From fbe346a3322090aa5a4ad1a1d39ec1baa6f7013e Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 14 May 2021 12:32:47 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix=EF=BC=9A=E5=A4=84=E7=90=86=20alertMessa?= =?UTF-8?q?ge=20=E6=9F=A5=E8=AF=A2=E5=9B=BE=E8=A1=A8=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/page/alert/alertMessage.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index d1f09a08e..0c66f2e32 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -227,10 +227,12 @@ export default { }) }, messageDetail (row) { - this.currentMsg = { ...row } - this.graphShow = true - this.$nextTick(() => { - this.queryChartDate() + this.$get('/alert/rule/' + row.alertRule.id).then(res => { + this.currentMsg = { ...row, alertRule: { ...res.data } } + this.graphShow = true + this.$nextTick(() => { + this.queryChartDate() + }) }) }, queryMessage (alertMessage) { @@ -410,13 +412,14 @@ export default { promQueryParamConvert (obj) { let r = '(' + obj.alertRule.expr + ')' let intoLabels = false + obj.labels = JSON.parse(obj.labels) if (Object.keys(obj.labels).length > 0) { r += (function () { let group = ' and ' + '(group({' let by = ' by (' for (const k in obj.labels) { - if (k != 'alertname' && k != 'severity') { + if (k != 'alertname' && k != 'severity' && k != 'severity_id') { intoLabels = true group += k group += '=' From 212cb25ad0c823d54c550a60ddc13aea50d0865f Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 14 May 2021 13:41:01 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9panel?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20chart=20=E6=97=A0=E6=B3=95=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/charts/line-chart-block.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index c089773b7..2bdf4eddb 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -184,7 +184,7 @@ - + From 801180443fae942ca89d49590fd38082f5b444b9 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 14 May 2021 15:24:32 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=20alertMessa?= =?UTF-8?q?ge=20=E5=9B=BE=E8=A1=A8=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BB=A5=E5=8F=8A=20=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=90=8E=20=E5=88=86=E9=A1=B5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=B8=A6=E4=BA=86=E6=97=B6=E9=97=B4=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/charts/chart-alert-list.vue | 2 +- .../src/components/charts/chart-detail.vue | 2 +- .../common/bottomBox/tabs/alertMessageTab.vue | 4 +-- .../common/bottomBox/tabs/endpointTab.vue | 4 +-- .../src/components/common/header.vue | 2 +- .../src/components/common/language/cn.js | 5 +-- .../src/components/common/language/en.js | 5 +-- .../common/project/L5/CanvasProps.vue | 8 ++++- .../common/project/popData/alertTable.vue | 4 +-- .../common/project/popData/assetTable.vue | 2 +- .../common/project/popData/endpointTable.vue | 2 +- .../common/rightBox/addEndpointBox.vue | 2 +- .../rightBox/asset/assetBatchEditBox.vue | 2 +- .../common/rightBox/chartTempBox.vue | 2 +- .../common/rightBox/editEndpointBox.vue | 2 +- .../common/rightBox/editEndpointBoxNew.vue | 26 +++++++-------- .../components/common/rightBox/moduleBox.vue | 2 +- .../common/table/alert/alertMessageTable.vue | 2 +- .../src/components/layout/container.vue | 2 +- .../src/components/layout/header.vue | 2 +- .../components/page/alert/alertMessage.vue | 32 +++++++++++++++---- .../src/components/page/dashboard/panel.vue | 2 +- 22 files changed, 72 insertions(+), 44 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-alert-list.vue b/nezha-fronted/src/components/charts/chart-alert-list.vue index 9dc39422c..1d6c21668 100644 --- a/nezha-fronted/src/components/charts/chart-alert-list.vue +++ b/nezha-fronted/src/components/charts/chart-alert-list.vue @@ -301,7 +301,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { diff --git a/nezha-fronted/src/components/charts/chart-detail.vue b/nezha-fronted/src/components/charts/chart-detail.vue index 51f0ed91a..4db3ad90a 100644 --- a/nezha-fronted/src/components/charts/chart-detail.vue +++ b/nezha-fronted/src/components/charts/chart-detail.vue @@ -357,7 +357,7 @@ export default { path: this.$t('project.endpoint.path'), param: this.$t('project.endpoint.param'), state: this.$t('alert.list.state'), - project: this.$t('project.project.project'), + project: this.$t('project.project.projectName'), module: this.$t('project.module.module') } } diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue index db493664b..8fe9dbaf2 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue @@ -198,7 +198,7 @@ export default { disabled: false }, { id: 20, - name: this.$t('project.project.project'), + name: this.$t('project.project.projectName'), type: 'project', label: 'project', disabled: false @@ -272,7 +272,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue index f3730dc9f..aa5dc9a9b 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue @@ -193,7 +193,7 @@ export default { prop: 'id', show: true }, { - label: this.$t('project.project.project'), + label: this.$t('project.project.projectName'), prop: 'project', show: true, width: '120' @@ -288,7 +288,7 @@ export default { readonly: true }, { id: 34, - name: this.$t('project.project.project'), + name: this.$t('project.project.projectName'), // name: this.$t('asset.asset'), type: 'input', label: 'projectName', diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index f33a5ab4f..93df622fe 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -253,7 +253,7 @@ export default { }, createMenu: [ // 新增按钮内容 { - label: this.$t('project.project.project'), + label: this.$t('project.project.projectName'), url: 'project', type: 1, permission: 'header_add_project' diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 2e4667cdc..2e2624c7d 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -106,7 +106,8 @@ const cn = { moreOption: '更多选项', copy: '复制', silence: '静默', - labels: '标签' + labels: '标签', + editType: '类型' }, setup: { step0: '欢迎', @@ -1163,7 +1164,7 @@ const cn = { }, project: { project: '名称', - projectName: '系统名称', + projectName: '系统', editProject: '编辑系统', description: '描述', createProject: '新增系统' diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 467a758c3..cf62d080b 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -111,7 +111,8 @@ const en = { labels: 'Labels', moreOption: 'More option', copy: 'Copy', - silence: 'Silence' + silence: 'Silence', + editType: 'Type' }, pageSize: '/page', setup: { @@ -1177,7 +1178,7 @@ const en = { }, project: { project: 'Name', // "系统" - projectName: 'Project name', // "系统名称" + projectName: 'Project', // "系统名称" editProject: 'Edit project', // "编辑系统" description: 'Description', // "描述" createProject: 'New project'// "新增系统" diff --git a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue index deda9f99d..a5546c0f8 100644 --- a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue +++ b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue @@ -1884,8 +1884,14 @@ export default { outline: none; } + /deep/ .el-input-number:focus { + .el-input-number__decrease, .el-input-number__increase { + visibility: visible; + outline: none; + } + } /deep/ .el-input-number:focus-within { - /deep/ .el-input-number__decrease, /deep/ .el-input-number__increase { + .el-input-number__decrease, .el-input-number__increase { visibility: visible; outline: none; } diff --git a/nezha-fronted/src/components/common/project/popData/alertTable.vue b/nezha-fronted/src/components/common/project/popData/alertTable.vue index 97b3c8921..d98450d04 100644 --- a/nezha-fronted/src/components/common/project/popData/alertTable.vue +++ b/nezha-fronted/src/components/common/project/popData/alertTable.vue @@ -203,7 +203,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { @@ -284,7 +284,7 @@ export default { disabled: false }, { id: 22, - name: this.$t('project.project.project'), + name: this.$t('project.project.projectName'), type: 'project', label: 'project', disabled: false diff --git a/nezha-fronted/src/components/common/project/popData/assetTable.vue b/nezha-fronted/src/components/common/project/popData/assetTable.vue index 76a3bb474..3d56a4748 100644 --- a/nezha-fronted/src/components/common/project/popData/assetTable.vue +++ b/nezha-fronted/src/components/common/project/popData/assetTable.vue @@ -130,7 +130,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { diff --git a/nezha-fronted/src/components/common/project/popData/endpointTable.vue b/nezha-fronted/src/components/common/project/popData/endpointTable.vue index 05bafcf18..1efc8b2f7 100644 --- a/nezha-fronted/src/components/common/project/popData/endpointTable.vue +++ b/nezha-fronted/src/components/common/project/popData/endpointTable.vue @@ -116,7 +116,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { diff --git a/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue b/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue index c340b111d..c0ced71d8 100644 --- a/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue +++ b/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue @@ -13,7 +13,7 @@
- + diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue index 59a2cc0f7..0cecb1faf 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue @@ -10,7 +10,7 @@
- + diff --git a/nezha-fronted/src/components/common/rightBox/chartTempBox.vue b/nezha-fronted/src/components/common/rightBox/chartTempBox.vue index f9cabbfc0..15a470dca 100644 --- a/nezha-fronted/src/components/common/rightBox/chartTempBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chartTempBox.vue @@ -373,7 +373,7 @@ export default { disabled: false }, { id: 34, - name: this.$t('project.project.project'), + name: this.$t('project.project.projectName'), // name: this.$t('asset.asset'), type: 'input', label: 'projectName', diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue index b130e98c0..f1fb4c5ff 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue @@ -17,7 +17,7 @@
- + diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue index 09d961bc0..143498d56 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue @@ -27,7 +27,7 @@ - + @@ -121,18 +121,18 @@
- - - - - + + + + + + + + + + + + diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index eab509f66..8e9a1e599 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -122,7 +122,7 @@ id="module-box-input-pattern" v-model="editModule.endpointNameTmpl" :fetch-suggestions="querySearch" - placeholder="请输入内容" + :placeholder="$t('overall.placeHolder')" > diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index 5c5794bff..4c1c46eaa 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -224,7 +224,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { diff --git a/nezha-fronted/src/components/layout/container.vue b/nezha-fronted/src/components/layout/container.vue index abd9c91a5..f32de9582 100644 --- a/nezha-fronted/src/components/layout/container.vue +++ b/nezha-fronted/src/components/layout/container.vue @@ -20,7 +20,7 @@ export default { height: calc(100% - 50px); background-color: #f6f6f6; width: 100%; - + padding-right: 10px; &>div { height: 100%; } diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue index 538e081a9..f6b4c4259 100644 --- a/nezha-fronted/src/components/layout/header.vue +++ b/nezha-fronted/src/components/layout/header.vue @@ -79,7 +79,7 @@ export default { // 顶部菜单相关 createMenu: [ // 新增按钮内容 { - label: this.$t('project.project.project'), + label: this.$t('project.project.projectName'), url: 'project', type: 1, permission: 'header_add_project' diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 0c66f2e32..834cf2640 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -89,7 +89,7 @@
{{$t("project.endpoint.dialogTitle")}}
- +
@@ -132,6 +132,7 @@ export default { sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'], legend: [], searchTime: [], + searchTimeDialog: [], searchTimeSelect: bus.getTimezontDateRange(), currentMsg: {}, chartUnit: 5, @@ -193,7 +194,7 @@ export default { return (key, value) => { if (key == 'type') { if (value == 1) { - value = this.$t('project.project.project') + value = this.$t('project.project.projectName') } else if (value == 2) { value = this.$t('module.module.module') } else if (value == 3) { @@ -247,7 +248,7 @@ export default { // const end = this.searchTime[1] ? this.searchTime[1] : getTime(0, 'h') const start = this.currentMsg.startAt const end = this.currentMsg.endAt - this.searchTime = [start, end] + this.searchTimeDialog = [start, end] const timeDiff = (new Date(end).getTime() - new Date(start).getTime()) / 1000 / (24 * 60 * 60) let step = '15s' if (timeDiff < 1) { @@ -323,7 +324,7 @@ export default { chartData.name += '}' const legend = { name: chartData.name, - alias: alias, + alias: chartData.name, isGray: false } this.legend.push(legend) @@ -344,7 +345,7 @@ export default { this.$refs.messageChart.endLoading() }) } catch (err) { - this.$message.error(err) + // this.$message.error(err) this.$refs.messageChart.endLoading() } }) @@ -584,7 +585,26 @@ export default { this.$refs.dataTable.$refs.dataTable.bodyWrapper.scrollTop = 0 } this.getTableData() - } + }, + computeDistance (str) { + let width = 0 + const html = document.createElement('span') + html.innerText = str + html.className = 'getTextWidth' + document.querySelector('body').appendChild(html) + width = document.querySelector('.getTextWidth').offsetWidth + document.querySelector('.getTextWidth').remove() + return Number('-' + (width + 5)) + }, + returnMarkArea () { + if (this.currentMsg) { + if (this.currentMsg.alertRule.operator == '>' || this.currentMsg.alertRule.operator == '>=') { + return [{ yAxis: this.currentMsg.alertRule.threshold }, {}] + } else { + return [{}, { yAxis: this.currentMsg.alertRule.threshold }] + } + } + }, } } diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index ce6f21a40..a7fbd966f 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -1,7 +1,7 @@ diff --git a/nezha-fronted/src/components/common/js/common.js b/nezha-fronted/src/components/common/js/common.js index e4e812903..d9a3f0842 100644 --- a/nezha-fronted/src/components/common/js/common.js +++ b/nezha-fronted/src/components/common/js/common.js @@ -10,7 +10,7 @@ export function resetZIndex (e) { } export function getUUID () { function S4 () { - return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + return (((1 + window.crypto.getRandomValues(new Uint32Array(10))[0]) * 0x10000) | 0).toString(16).substring(1) } return (S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4()) diff --git a/nezha-fronted/src/components/common/js/radomcolor/color.txt b/nezha-fronted/src/components/common/js/radomcolor/color.txt deleted file mode 100644 index c7e0b2172..000000000 --- a/nezha-fronted/src/components/common/js/radomcolor/color.txt +++ /dev/null @@ -1,177 +0,0 @@ - -#d8a6ea -#d8f799 -#7fe2d0 -#f7677b -#6e4eed -#adff3a -#f082f2 -#cc2095 -#ea60aa -#8cf2d7 -#51cc41 -#9c93d8 -#f4a1c5 -#a1f4b3 -#6de8a6 -#92a1e8 -#e5aa52 -#96c938 -#9dd7ea -#ccd1ff -#d65640 -#ffccd1 -#6ba5c4 -#6af7a0 -#ffa5fc -#bff977 -#98f99a -#c14c3f -#0f1ec4 -#88e02a -#d540dd -#24f27d -#4572ef -#fff8af -#5f56d8 -#5023ba -#021b60 -#80ed76 -#cbfca9 -#235ad1 -#ed87ae -#adf913 -#dbdb29 -#e23bc6 -#e2a33d -#949fe8 -#bad7fc -#4ce86e -#9ccbe5 -#6354ea -#98f2d7 -#fcc79c -#192e96 -#a567ce -#f72a56 -#f29e59 -#eb6eef -#e03188 -#6050bf -#beb9f7 -#9ec1ef -#4083b7 -#f73302 -#614dd1 -#f7b183 -#d6ef97 -#13f7e4 -#bbccf7 -#c17c3c -#db5c91 -#fcdfbf -#88d32c -#b33de5 -#5ef9b9 -#27e5b9 -#7f84d1 -#f98f7a -#d05ae2 -#44c4c2 -#e5d04b -#b23c2c -#2209b5 -#cdc2f9 -#be40e8 -#b3d1fc -#67e0d2 -#c5f9a4 -#89dbf9 -#f4b0d0 -#0e00aa -#88a8d8 -#e595a3 -#9ef99a -#ffdf2b -#e59787 -#68f9ac -#6620a3 -#6cd87a -#ade8ed -#e7f78a -#d66a22 -#a24cff -#959cdb -#c6ffb2 -#db4cff -#4dff47 -#ee24f2 -#41ce31 -#99efbd -#2b8407 -#3db2c6 -#cb42ed -#6d22a3 -#6357cc -#012e77 -#fc2dc5 -#b27b21 -#ef1ce5 -#f75b87 -#e87ab6 -#a8ffcc -#9ae2e1 -#b4f79b -#13d681 -#85d85f -#dd499d -#e88db0 -#35ce35 -#fff7af -#e57e91 -#2cc147 -#60f7e3 -#16af98 -#9b2ff9 -#dd0618 -#42c49d -#c137ce -#fcc3bf -#1219e2 -#04a53f -#69ea81 -#fcdbba -#e53986 -#5656e2 -#423cfc -#9ddd75 -#fc2500 -#f461a8 -#fc6fba -#b53649 -#71e8ac -#f26a8e -#bf8511 -#21f2a2 -#b1bded -#e5bd6e -#c004e5 -#6fdbd9 -#98f9c4 -#f9e936 -#d16932 -#fcb86a -#27e5d5 -#e2bc7f -#ca52f2 -#3bd68e -#74e3ed -#e0e80b -#bf5ced -#ff14b0 -#66c3e8 -#fcf88a -#6a2099 -#ea4ff2 -#c708e0 -#d35d6c \ No newline at end of file diff --git a/nezha-fronted/src/components/common/js/radomcolor/randomcolor.js b/nezha-fronted/src/components/common/js/radomcolor/randomcolor.js deleted file mode 100644 index 763543c44..000000000 --- a/nezha-fronted/src/components/common/js/radomcolor/randomcolor.js +++ /dev/null @@ -1,316 +0,0 @@ -function randomcolor () { - let e = null - const t = {} - r('monochrome', null, [ - [0, 0], - [100, 0] - ]), - r('red', [-26, 18], [ - [20, 100], - [30, 92], - [40, 89], - [50, 85], - [60, 78], - [70, 70], - [80, 60], - [90, 55], - [100, 50] - ]), - r('orange', [19, 46], [ - [20, 100], - [30, 93], - [40, 88], - [50, 86], - [60, 85], - [70, 70], - [100, 70] - ]), - r('yellow', [47, 62], [ - [25, 100], - [40, 94], - [50, 89], - [60, 86], - [70, 84], - [80, 82], - [90, 80], - [100, 75] - ]), - r('green', [63, 178], [ - [30, 100], - [40, 90], - [50, 85], - [60, 81], - [70, 74], - [80, 64], - [90, 50], - [100, 40] - ]), - r('blue', [179, 257], [ - [20, 100], - [30, 86], - [40, 80], - [50, 74], - [60, 60], - [70, 52], - [80, 44], - [90, 39], - [100, 35] - ]), - r('purple', [258, 282], [ - [20, 100], - [30, 87], - [40, 79], - [50, 70], - [60, 65], - [70, 59], - [80, 52], - [90, 45], - [100, 42] - ]), - r('pink', [283, 334], [ - [20, 100], - [30, 90], - [40, 86], - [60, 84], - [80, 80], - [90, 75], - [100, 73] - ]) - var n = function (r) { - if (void 0 !== (r = r || {}).seed && r.seed !== null && r.seed === parseInt(r.seed, 10)) { e = r.seed } else if (typeof r.seed === 'string') { - e = (function (e) { - for (var t = 0, n = 0; n !== e.length && !(t >= Number.MAX_SAFE_INTEGER); n++) { t += e.charCodeAt(n) } - return t - } - (r.seed)) - } else { - if (void 0 !== r.seed && r.seed !== null) { throw new TypeError('The seed value must be an integer or string') } - e = null - } - let c, - l - if (r.count !== null && void 0 !== r.count) { - const u = r.count - const d = [] - for (r.count = null; u > d.length;) { e && r.seed && (r.seed += 1), d.push(n(r)) } - return r.count = u, - d - } - return (function (e, t) { - switch (t.format) { - case 'hsvArray': - return e - case 'hslArray': - return a(e) - case 'hsl': - var n = a(e) - return 'hsl(' + n[0] + ', ' + n[1] + '%, ' + n[2] + '%)' - case 'hsla': - var s = a(e) - var o = t.alpha || Math.random() - return 'hsla(' + s[0] + ', ' + s[1] + '%, ' + s[2] + '%, ' + o + ')' - case 'rgbArray': - return i(e) - case 'rgb': - return 'rgb(' + i(e).join(', ') + ')' - case 'rgba': - var r = i(e) - o = t.alpha || Math.random() - return 'rgba(' + r.join(', ') + ', ' + o + ')' - default: - return (function (e) { - const t = i(e) - - function n (e) { - const t = e.toString(16) - return t.length == 1 ? '0' + t : t - } - return '#' + n(t[0]) + n(t[1]) + n(t[2]) - } - (e)) - } - } - ([c = (function (e) { - let n = o(function (e) { - if (typeof parseInt(e) === 'number') { - const n = parseInt(e) - if (n < 360 && n > 0) { return [n, n] } - } - if (typeof e === 'string') { - if (t[e]) { - const s = t[e] - if (s.hueRange) { return s.hueRange } - } else if (e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)) { - const o = (function (e) { - e = (e = e.replace(/^#/, '')).length === 3 ? e.replace(/(.)/g, '$1$1') : e - const t = parseInt(e.substr(0, 2), 16) / 255 - const n = parseInt(e.substr(2, 2), 16) / 255 - const s = parseInt(e.substr(4, 2), 16) / 255 - const o = Math.max(t, n, s) - const r = o - Math.min(t, n, s) - const i = o ? r / o : 0 - switch (o) { - case t: - return [(n - s) / r % 6 * 60 || 0, i, o] - case n: - return [60 * ((s - t) / r + 2) || 0, i, o] - case s: - return [60 * ((t - n) / r + 4) || 0, i, o] - } - } - (e))[0] - return [o, o] - } - } - return [0, 360] - } - (e.hue)) - n < 0 && (n = 360 + n) - return n - } - (r)), l = (function (e, t) { - if (t.hue === 'monochrome') { return 0 } - if (t.luminosity === 'random') { return o([0, 100]) } - const n = (function (e) { - return s(e).saturationRange - } - (e)) - let r = n[0] - let i = n[1] - switch (t.luminosity) { - case 'bright': - r = 55 - break - case 'dark': - r = i - 10 - break - case 'light': - i = 55 - } - return o([r, i]) - } - (c, r)), - (function (e, t, n) { - let r = (function (e, t) { - for (let n = s(e).lowerBounds, o = 0; o < n.length - 1; o++) { - const r = n[o][0] - const i = n[o][1] - const a = n[o + 1][0] - const c = n[o + 1][1] - if (t >= r && t <= a) { - const l = (c - i) / (a - r) - return l * t + (i - l * r) - } - } - return 0 - } - (e, t)) - let i = 100 - switch (n.luminosity) { - case 'dark': - i = r + 20 - break - case 'light': - r = (i + r) / 2 - break - case 'random': - r = 0, - i = 100 - } - return o([r, i]) - } - (c, l, r)) - ], r)) - } - - function s (e) { - for (const n in e >= 334 && e <= 360 && (e -= 360), t) { - const s = t[n] - if (s.hueRange && e >= s.hueRange[0] && e <= s.hueRange[1]) { return t[n] } - } - return 'Color not found' - } - - function o (t) { - if (e === null) { return Math.floor(t[0] + Math.random() * (t[1] + 1 - t[0])) } - const n = t[1] || 1 - const s = t[0] || 0 - const o = (e = (9301 * e + 49297) % 233280) / 233280 - return Math.floor(s + o * (n - s)) - } - - function r (e, n, s) { - const o = s[0][0] - const r = s[s.length - 1][0] - const i = s[s.length - 1][1] - const a = s[0][1] - t[e] = { - hueRange: n, - lowerBounds: s, - saturationRange: [o, r], - brightnessRange: [i, a] - } - } - - function i (e) { - let t = e[0] - t === 0 && (t = 1), - t === 360 && (t = 359), - t /= 360 - const n = e[1] / 100 - const s = e[2] / 100 - const o = Math.floor(6 * t) - const r = 6 * t - o - const i = s * (1 - n) - const a = s * (1 - r * n) - const c = s * (1 - (1 - r) * n) - let l = 256 - let u = 256 - let d = 256 - switch (o) { - case 0: - l = s, - u = c, - d = i - break - case 1: - l = a, - u = s, - d = i - break - case 2: - l = i, - u = s, - d = c - break - case 3: - l = i, - u = a, - d = s - break - case 4: - l = c, - u = i, - d = s - break - case 5: - l = s, - u = i, - d = a - } - return [Math.floor(255 * l), Math.floor(255 * u), Math.floor(255 * d)] - } - - function a (e) { - const t = e[0] - const n = e[1] / 100 - const s = e[2] / 100 - const o = (2 - n) * s - return [t, Math.round(n * s / (o < 1 ? o : 2 - o) * 1e4) / 100, o / 2 * 100] - } - return n() -} - -export { - randomcolor -} diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index 042c68293..e4fa7b5a3 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -26,7 +26,6 @@ export default { tableOperation ([command, row, param]) { switch (command) { case 'edit': { - console.info(1, command, row) this.$emit('edit', row) break } diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue index f6b4c4259..ed600e464 100644 --- a/nezha-fronted/src/components/layout/header.vue +++ b/nezha-fronted/src/components/layout/header.vue @@ -11,7 +11,7 @@ - {{item.name}} + {{item.name}} diff --git a/nezha-fronted/src/components/page/dashboard/explore/explore.vue b/nezha-fronted/src/components/page/dashboard/explore/explore.vue index 670cfdd89..cd10905f9 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/explore.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/explore.vue @@ -86,7 +86,7 @@
-

Query examples

+

Query examples

Simple time series selection diff --git a/nezha-fronted/src/libs/bus.js b/nezha-fronted/src/libs/bus.js index 4e66a1467..ee9d596f7 100644 --- a/nezha-fronted/src/libs/bus.js +++ b/nezha-fronted/src/libs/bus.js @@ -103,7 +103,6 @@ export default new Vue({ 'm+': time.getMinutes(), // 分 's+': time.getSeconds(), // 秒 'q+': Math.floor((time.getMonth() + 3) / 3), // 季度 - a: time.getHours() > 12 ? 'pm' : 'am', S: time.getMilliseconds(), // 毫秒 w: week } @@ -117,7 +116,6 @@ export default new Vue({ : ((`00${o[k]}`).substr((`${o[k]}`).length))) } }) - fm = fm.replace('h', time.getHours() > 12 ? time.getHours() - 12 : time.getHours()) return fm }, // 格式化tag为字符串表达式 From e2636bee950cda90e3f538a9efeb4865adff023d Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 14 May 2021 17:09:57 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9asset=20?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E6=8C=89=E9=92=AE=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?assetModel=20=E4=B8=8A=E6=BB=91=EF=BC=8C=E4=BF=AE=E6=94=B9modul?= =?UTF-8?q?e=20endpoint=E4=B8=8A=E6=BB=91=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/bottomBox/bottomBox.vue | 11 +++-- .../common/bottomBox/tabs/assetTab.vue | 5 +++ .../common/bottomBox/tabs/endpointTabNew.vue | 2 +- .../src/components/common/language/cn.js | 3 +- .../src/components/common/language/en.js | 3 +- .../common/popBox/topToolMoreOptions.vue | 4 +- .../rightBox/asset/assetBatchEditBox.vue | 2 +- .../common/table/settings/modelTable.vue | 19 ++++---- .../src/components/page/asset/asset.vue | 44 ++++++++++--------- .../page/dashboard/overview/chartConfig.vue | 2 +- .../page/dashboard/overview/overview2.scss | 3 ++ 11 files changed, 59 insertions(+), 39 deletions(-) diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index 9f85d5978..820c37c36 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -58,6 +58,8 @@ + +

@@ -157,14 +159,14 @@ export default { moduleTabTitle: [ // { prop: 'panel', name: 'Detail' }, { prop: 'endpoint', name: this.$t('asset.endpoint') }, - { prop: 'moduleAlertMessage', name: 'Alerts' } + { prop: 'moduleAlertMessage', name: 'Alert' } ] }, endpoint: { endpointTabTitle: [ // { prop: 'panel', name: 'Detail' }, { prop: 'endpointQuery', name: 'Query' }, - { prop: 'endpointAlertMessage', name: 'Alerts' } + { prop: 'endpointAlertMessage', name: 'Alert' } ] }, chartTemp: { @@ -174,9 +176,12 @@ export default { }, alertRule: { alertRule: [ - { prop: 'alertRuleAlertMessage', name: 'Alerts' } + { prop: 'alertRuleAlertMessage', name: 'Alert' } ] }, + model: [ + { prop: 'asset', name: this.$t('asset.assets'), active: true } + ], dc: { cabinet: [ { prop: 'cabinet', name: this.$t('config.dc.cabinets'), active: true }, diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue index b073c939f..e0e2a5796 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue @@ -52,6 +52,7 @@ import subDataListMixin from '@/components/common/mixin/subDataList' import nzBottomDataList from '@/components/common/bottomBox/nzBottomDataList' import assetTable from '@/components/common/table/asset/assetTable' import assetBox from '@/components/common/rightBox/asset/assetBox' +import {fromRoute} from "@/components/common/js/constants"; export default { name: 'assetTab', mixins: [dataListMixin, subDataListMixin], @@ -193,6 +194,10 @@ export default { deep: true, handler (n, o) { this.searchLabel.dcIds = n.id + if ( this.from === fromRoute.model) { + delete this.searchLabel.dcIds + this.searchLabel.modelIds = n.id + } this.getTableData() } } diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTabNew.vue index adc51e7c3..141e76f12 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTabNew.vue @@ -32,7 +32,7 @@ - +
diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 2e2624c7d..0a0863131 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -107,7 +107,8 @@ const cn = { copy: '复制', silence: '静默', labels: '标签', - editType: '类型' + editType: '类型', + searchCondition: '搜索条件' }, setup: { step0: '欢迎', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index cf62d080b..f703f8e9e 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -112,7 +112,8 @@ const en = { moreOption: 'More option', copy: 'Copy', silence: 'Silence', - editType: 'Type' + editType: 'Type', + searchCondition: 'Search condition' }, pageSize: '/page', setup: { diff --git a/nezha-fronted/src/components/common/popBox/topToolMoreOptions.vue b/nezha-fronted/src/components/common/popBox/topToolMoreOptions.vue index c8f0b9931..71580d5f8 100644 --- a/nezha-fronted/src/components/common/popBox/topToolMoreOptions.vue +++ b/nezha-fronted/src/components/common/popBox/topToolMoreOptions.vue @@ -158,7 +158,7 @@ export default { rollbackImport () { let url if (this.importUrl.indexOf('asset') > -1) { - url = '/asset/cancelImport' + url = '/asset/asset/cancelImport' } else if (this.importUrl.indexOf('endpoint') > -1) { url = '/monitor/endpoint/cancelImport' } else if (this.importUrl.indexOf('rule') > -1) { @@ -227,7 +227,7 @@ export default { let url = null if (this.importUrl.indexOf('asset') > -1) { - url = '/asset/template' + url = '/asset/asset/template' } else if (this.importUrl.indexOf('rule') > -1) { url = '/alert/rule/template' } else if (this.importUrl.indexOf('panel') > -1) { diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue index 0cecb1faf..36131bc1a 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBatchEditBox.vue @@ -3,7 +3,7 @@
{{$t('asset.batchEditAsset')}}
- +
diff --git a/nezha-fronted/src/components/common/table/settings/modelTable.vue b/nezha-fronted/src/components/common/table/settings/modelTable.vue index 6149597a8..70537fff6 100644 --- a/nezha-fronted/src/components/common/table/settings/modelTable.vue +++ b/nezha-fronted/src/components/common/table/settings/modelTable.vue @@ -60,13 +60,14 @@ fixed="right">
{{$t('overall.option')}}
- + +
- {{$t('overall.edit')}} + {{$t('overall.delete')}}
@@ -88,19 +89,19 @@ export default { prop: 'id', show: true, width: 80, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('config.model.name'), prop: 'name', show: true, - width: 160, - sortable:'custom' + width: 450, + sortable: 'custom' }, { label: this.$t('config.model.brand'), prop: 'brand', show: true, - width: 160 - ,sortable:'custom' + width: 160, + sortable: 'custom' }, { label: this.$t('config.model.remark'), prop: 'remark', @@ -110,7 +111,7 @@ export default { prop: 'assetNum', show: true, width: 200, - sortable:'custom' + sortable: 'custom' } ] } @@ -118,7 +119,7 @@ export default { methods: { }, - created() { + created () { }, computed: { diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 34f907ebb..96bfa1862 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -10,30 +10,34 @@ @search="search" >