From 1eeb2ef6001ec5f53384d9d03e47cf195e0cfe82 Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Fri, 9 Apr 2021 13:01:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E5=96=84agent=20download?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/language/cn.js | 12 +- .../src/components/common/language/en.js | 19 +- .../src/components/common/mixin/table.js | 2 +- .../common/rightBox/promServerBox.vue | 41 ++++- .../src/components/page/config/dc.vue | 130 -------------- .../src/components/page/config/promServer.vue | 166 +++++++++++++++++- .../components/page/dashboard/chartBox.vue | 2 - .../page/dashboard/explore/explore.vue | 2 +- 8 files changed, 219 insertions(+), 155 deletions(-) diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 84917d151..37bae8ee1 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -487,7 +487,8 @@ const cn = { noImportFile: '没有可导入的文件', noAccess: '无访问权限', confirmDuplicate: '确认复制吗?', - confirmCancel: '您所做的修改将不会被保存?' + confirmCancel: '您所做的修改将不会被保存?', + copySuccess: '复制成功' }, asset: { asset: '资产', @@ -705,7 +706,14 @@ const cn = { editProm: '修改Prometheus服务', type: '类别', checkTime: '检查时间', - dataCenter: '数据中心' + dataCenter: '数据中心', + agent: { + title: '下载Agent', + download: '下载', + osType: 'OS 类型', + autoScript: '自动安装脚本', + type: 'Agent类型' + } }, terminallog: { terminallog: '终端日志', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 0700845bb..ea111738c 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -490,7 +490,8 @@ const en = { noImportFile: 'No import file found', noAccess: 'No access', confirmDuplicate: 'Are you sure to duplicate this chart?', - confirmCancel: 'Changes you made are not saved?' + confirmCancel: 'Changes you made are not saved?', + copySuccess: 'Copy success' }, asset: { asset: 'Asset', @@ -709,7 +710,14 @@ const en = { editProm: 'Edit prometheus server', // "修改Prometheus Server" type: 'Type', // "类别" checkTime: 'Check time', - dataCenter: 'Data center' + dataCenter: 'Data center', + agent: { + title: 'Download agent', + download: 'Download', + osType: 'OS type', + autoScript: 'Auto install script', + type: 'Agent type' + } }, dc: { dc: 'Data center', @@ -736,13 +744,6 @@ const en = { longitude: 'Longitude', latitude: 'Latitude', lnglat: 'Coordinate', - agent:{ - title:"Download agent", - download:"Download", - osType:"OS type", - autoScript:"Auto install script", - type:"Agent type" - } }, model: { model: 'Asset model', diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index eaacb6287..664b7594b 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -28,7 +28,7 @@ export default { scrollbarWrap: null, delFlag: false, - operationWidth: "165" // 操作列宽 + operationWidth: '165' // 操作列宽 } }, methods: { diff --git a/nezha-fronted/src/components/common/rightBox/promServerBox.vue b/nezha-fronted/src/components/common/rightBox/promServerBox.vue index 3dafea6f4..4c8768540 100644 --- a/nezha-fronted/src/components/common/rightBox/promServerBox.vue +++ b/nezha-fronted/src/components/common/rightBox/promServerBox.vue @@ -39,15 +39,25 @@ - + + + + + + + + + + + + {{item.label}} + + + + + + + @@ -96,6 +106,19 @@ export default { } }, methods: { + refreshToken: function () { + if(!this.editPromServer.token||this.editPromServer.token == ''){ + this.$message.error("The token is empty") + return; + } + this.$post('agent/token/refresh' , this.editPromServer).then(response=>{ + if(response.code == 200){ + this.editPromServer.token = response.data.token; + }else{ + this.$message.error(response.msg) + } + }) + }, /* 关闭弹框 */ esc (refresh) { this.$emit('close', refresh) diff --git a/nezha-fronted/src/components/page/config/dc.vue b/nezha-fronted/src/components/page/config/dc.vue index f72c108eb..666f2102c 100644 --- a/nezha-fronted/src/components/page/config/dc.vue +++ b/nezha-fronted/src/components/page/config/dc.vue @@ -135,50 +135,7 @@ - -
- -
{{$t('config.dc.agent.download')}}
-
- - - - {{item.label}} - - - -
{{$t('config.dc.agent.autoScript')}}
-
- - - - {{item.name}} - - - - - - - {{item.label}} - - - -
-
- -
curl -o- -H "Authorization:{{token}}" http://{{ipAddr}}/agent/{{agentParam.dc}}/{{agentParam.type}}/install.sh | bash
-
- -
-
- -
wget -qO- --header="Authorization:{{token}}" http://{{ipAddr}}/agent/{{agentParam.dc}}/{{agentParam.type}}/install.sh | bash
-
- -
-
-
+ diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue index 2362f782f..a040b5d61 100644 --- a/nezha-fronted/src/components/page/dashboard/chartBox.vue +++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue @@ -247,7 +247,6 @@ - @@ -270,7 +269,6 @@ - diff --git a/nezha-fronted/src/components/page/dashboard/explore/explore.vue b/nezha-fronted/src/components/page/dashboard/explore/explore.vue index 376111176..9f730c2aa 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/explore.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/explore.vue @@ -583,7 +583,7 @@ export default { panel: '', sync: 0, groupId: '', - remark: '', + remark: '' } this.expressions.forEach((exp) => { chart.elements.push({ expression: exp, legend: '', type: 'expert', id: '' })