From 95bc5cc90229c61c6dd709a52ea3f1dd433f689b Mon Sep 17 00:00:00 2001 From: ssongliu Date: Mon, 13 Mar 2023 10:16:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=95=B0=E6=8D=AE=E7=BC=93=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/terminal.go | 10 -- .../container/container/monitor/index.vue | 149 +----------------- .../container/container/terminal/index.vue | 8 +- 3 files changed, 15 insertions(+), 152 deletions(-) diff --git a/backend/app/api/v1/terminal.go b/backend/app/api/v1/terminal.go index 379efcfaf..0be0d0589 100644 --- a/backend/app/api/v1/terminal.go +++ b/backend/app/api/v1/terminal.go @@ -9,7 +9,6 @@ import ( "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" "github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/global" - "github.com/1Panel-dev/1Panel/backend/utils/cmd" "github.com/1Panel-dev/1Panel/backend/utils/copier" "github.com/1Panel-dev/1Panel/backend/utils/ssh" "github.com/1Panel-dev/1Panel/backend/utils/terminal" @@ -157,15 +156,6 @@ func (b *BaseApi) ContainerWsSsh(c *gin.Context) { } defer wsConn.Close() - cmds := fmt.Sprintf("docker exec %s %s", containerID, command) - if len(user) != 0 { - cmds = fmt.Sprintf("docker exec -u %s %s %s", user, containerID, command) - } - stdout, err := cmd.Exec(cmds) - if wshandleError(wsConn, errors.WithMessage(err, stdout)) { - return - } - commands := fmt.Sprintf("docker exec -it %s %s", containerID, command) if len(user) != 0 { commands = fmt.Sprintf("docker exec -it -u %s %s %s", user, containerID, command) diff --git a/frontend/src/views/container/container/monitor/index.vue b/frontend/src/views/container/container/monitor/index.vue index 3e38b4a77..dd17f8107 100644 --- a/frontend/src/views/container/container/monitor/index.vue +++ b/frontend/src/views/container/container/monitor/index.vue @@ -1,5 +1,11 @@ @@ -78,12 +80,6 @@ const dialogData = ref({ containerID: '', }); -// function changeChartSize() { -// echarts.getInstanceByDom(document.getElementById('cpuChart') as HTMLElement)?.resize(); -// echarts.getInstanceByDom(document.getElementById('memoryChart') as HTMLElement)?.resize(); -// echarts.getInstanceByDom(document.getElementById('ioChart') as HTMLElement)?.resize(); -// echarts.getInstanceByDom(document.getElementById('networkChart') as HTMLElement)?.resize(); -// } const acceptParams = async (params: DialogProps): Promise => { monitorVisiable.value = true; dialogData.value.containerID = params.containerID; @@ -98,7 +94,6 @@ const acceptParams = async (params: DialogProps): Promise => { timeInterval.value = 5; isInit.value = true; loadData(); - // window.addEventListener('resize', changeChartSize); timer = setInterval(async () => { if (monitorVisiable.value) { isInit.value = false; @@ -220,140 +215,12 @@ const loadData = async () => { ], formatStr: 'KB/s', }; - // let cpuYDatas = { - // name: 'CPU', - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: cpuDatas.value, - // showSymbol: false, - // }; - // freshChart('cpuChart', ['CPU'], timeDatas.value, [cpuYDatas], 'CPU', '%'); - - // let memoryYDatas = { - // name: i18n.global.t('monitor.memory'), - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: memDatas.value, - // showSymbol: false, - // }; - // let cacheYDatas = { - // name: i18n.global.t('container.cache'), - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: cacheDatas.value, - // showSymbol: false, - // }; - // freshChart( - // 'memoryChart', - // [i18n.global.t('monitor.memory'), i18n.global.t('monitor.cache')], - // timeDatas.value, - // [memoryYDatas, cacheYDatas], - // i18n.global.t('monitor.memory'), - // ' MB', - // ); - - // let ioReadYDatas = { - // name: i18n.global.t('monitor.read'), - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: ioReadDatas.value, - // showSymbol: false, - // }; - // let ioWriteYDatas = { - // name: i18n.global.t('monitor.write'), - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: ioWriteDatas.value, - // showSymbol: false, - // }; - // freshChart( - // 'ioChart', - // [i18n.global.t('monitor.read'), i18n.global.t('monitor.write')], - // timeDatas.value, - // [ioReadYDatas, ioWriteYDatas], - // i18n.global.t('monitor.disk') + ' IO', - // 'MB', - // ); - - // let netTxYDatas = { - // name: i18n.global.t('monitor.up'), - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: netTxDatas.value, - // showSymbol: false, - // }; - // let netRxYDatas = { - // name: i18n.global.t('monitor.down'), - // type: 'line', - // areaStyle: { - // color: '#ebdee3', - // }, - // data: netRxDatas.value, - // showSymbol: false, - // }; - // freshChart( - // 'networkChart', - // [i18n.global.t('monitor.up'), i18n.global.t('monitor.down')], - // timeDatas.value, - // [netTxYDatas, netRxYDatas], - // i18n.global.t('monitor.network'), - // 'KB/s', - // ); }; - -// function freshChart(chartName: string, legendDatas: any, xDatas: any, yDatas: any, yTitle: string, formatStr: string) { -// if (isInit.value) { -// echarts.init(document.getElementById(chartName) as HTMLElement); -// } -// let itemChart = echarts.getInstanceByDom(document.getElementById(chartName) as HTMLElement); -// const option = { -// title: [ -// { -// left: 'center', -// text: yTitle, -// }, -// ], -// zlevel: 1, -// z: 1, -// tooltip: { -// trigger: 'axis', -// formatter: function (datas: any) { -// let res = datas[0].name + '
'; -// for (const item of datas) { -// res += item.marker + ' ' + item.seriesName + ':' + item.data + formatStr + '
'; -// } -// return res; -// }, -// }, -// grid: { left: '7%', right: '7%', bottom: '20%' }, -// legend: { -// data: legendDatas, -// right: 10, -// }, -// xAxis: { data: xDatas, boundaryGap: false }, -// yAxis: { name: '( ' + formatStr + ' )' }, -// series: yDatas, -// }; -// itemChart?.setOption(option, true); -// } - const handleClose = async () => { monitorVisiable.value = false; clearInterval(Number(timer)); timer = null; - // window.removeEventListener('resize', changeChartSize); + chartsOption.value = { cpuChart: null, memoryChart: null, ioChart: null, networkChart: null }; }; defineExpose({ diff --git a/frontend/src/views/container/container/terminal/index.vue b/frontend/src/views/container/container/terminal/index.vue index 8ad63a3f1..daca454d8 100644 --- a/frontend/src/views/container/container/terminal/index.vue +++ b/frontend/src/views/container/container/terminal/index.vue @@ -1,5 +1,11 @@