diff --git a/.idea/nezha-fronted.iml b/.idea/nezha-fronted.iml index c956989b2..40870b393 100644 --- a/.idea/nezha-fronted.iml +++ b/.idea/nezha-fronted.iml @@ -1,7 +1,9 @@ - + + + diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue index efa4e4129..750f4d6cd 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue @@ -11,6 +11,11 @@ class="full-width-height" > + + @@ -84,8 +89,8 @@ export default { }, { id: 13, - name: this.$t('config.dc.remark'), - label: 'remark', + name: this.$t('config.dc.description'), + label: 'description', disabled: false } ] @@ -99,6 +104,15 @@ export default { // 切换tab changeTab (tab) { this.$emit('changeTab', tab) + }, + addChart () { + this.rightBox.show = true + }, + closeRightBox (refresh) { + this.rightBox.show = false + if (refresh) { + this.refresh() + } } }, watch: { diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index b4a3f8369..f5bf2c517 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -155,7 +155,7 @@ export const alertMessage = { { value: 'P3', label: i18n.t('alert.config.P3') } ], states: [ - { value: '1', label: i18n.t('alert.list.pending') }, + { value: '1', label: i18n.t('overall.active') }, { value: '2', label: i18n.t('overall.silence') }, { value: '3', label: i18n.t('alert.list.expired') } ] @@ -172,6 +172,55 @@ export const statisticsList = [ { value: 'different', label: i18n.t('dashboard.panel.chartForm.statisticsVal.different') } ] +export const chart = { + varType: [ + { value: '1', label: i18n.t('asset.asset') }, + { value: '2', label: i18n.t('asset.endpoint') } + ], + type: [ + { + value: 'line', + label: i18n.t('dashboard.panel.chartForm.typeVal.line.label') + }, + { + value: 'stackArea', + label: i18n.t('dashboard.panel.chartForm.typeVal.stackArea.label') + }, + { + value: 'bar', + label: i18n.t('dashboard.panel.chartForm.typeVal.bar.label') + }, + { + value: 'singleStat', + label: i18n.t('dashboard.panel.chartForm.typeVal.singleStat.label') + }, + { + value: 'pie', + label: i18n.t('dashboard.panel.chartForm.typeVal.pie.label') + }, + { + value: 'table', + label: i18n.t('dashboard.panel.chartForm.typeVal.table.label') + }, + { + value: 'alertList', + label: i18n.t('dashboard.panel.chartForm.typeVal.alertList.label') + }, + { + value: 'text', + label: i18n.t('dashboard.panel.chartForm.typeVal.text.label') + }, + { + value: 'url', + label: i18n.t('dashboard.panel.chartForm.typeVal.url.label') + }, + { + value: 'group', + label: i18n.t('dashboard.panel.chartForm.typeVal.group.label') + } + ] +} + export const intervalList = [ { value: -1, label: i18n.t('dashboard.panel.refreshInterval.never') }, { value: 30, label: '30s' }, diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 6cebee967..1a8fd3c3a 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -84,7 +84,7 @@ const en = { clickUpload: 'Click to upload', upload: 'upload', template: 'Template', - active: 'active', + active: 'Active', result: { total: 'Total', failed: 'Failed', @@ -694,7 +694,7 @@ const en = { selectArea: 'Select area', cabinetNum: 'Cabinet', assets: 'Assets', - remark: 'Remark', + remark: 'Description', cabinets: 'Cabinets', createDc: 'Nre data center', editDc: 'Edit data center', diff --git a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue index 586f1fbbd..6de7491d4 100644 --- a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue @@ -79,7 +79,7 @@ export default { if (valid) { this.editCabinet.idcId = this.currentDc.id if (this.editCabinet.id) { - this.$put('cabinet', this.editCabinet).then(res => { + this.$put('/dc/cabinet', this.editCabinet).then(res => { this.prevent_opt.save = false if (res.code === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) @@ -89,7 +89,7 @@ export default { } }) } else { - this.$post('cabinet', this.editCabinet).then(res => { + this.$post('/dc/cabinet', this.editCabinet).then(res => { this.prevent_opt.save = false if (res.code === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) diff --git a/nezha-fronted/src/components/common/rightBox/setting/cabinetBox.vue b/nezha-fronted/src/components/common/rightBox/setting/cabinetBox.vue index 5ffd65699..0b8d37307 100644 --- a/nezha-fronted/src/components/common/rightBox/setting/cabinetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/setting/cabinetBox.vue @@ -56,6 +56,8 @@ export default { } } }, + created() { + }, methods: { clickOutside () { this.esc(false) @@ -71,7 +73,7 @@ export default { if (valid) { this.editCabinet.idcId = this.currentDc.id if (this.editCabinet.id) { - this.$put('cabinet', this.editCabinet).then(res => { + this.$put('/dc/cabinet', this.editCabinet).then(res => { this.prevent_opt.save = false if (res.code === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) @@ -81,7 +83,7 @@ export default { } }) } else { - this.$post('cabinet', this.editCabinet).then(res => { + this.$post('/dc/cabinet', this.editCabinet).then(res => { this.prevent_opt.save = false if (res.code === 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index 2912e0ac1..49d392af2 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -49,7 +49,7 @@
  • {{item.label}}
  • -
    +
    • {{item.label}}
    • @@ -89,7 +89,37 @@
    • {{item.host}}
    -
    +
    + +
      +
    • {{item.name}}
    • +
    +
    +
      +
    • {{item.name}}
    • +
    +
    +
    + +
      +
    • {{item.name}}
    • +
    +
    +
      +
    • {{item.name}}
    • +
    +
    +
    + +
      +
    • {{item.name}}
    • +
    +
    +
      +
    • {{item.name}}
    • +
    +
    +
    • {{item.name}}
    • @@ -99,6 +129,16 @@
    • {{item.name}}
    +
    + +
      +
    • {{item.name}}
    • +
    +
    +
      +
    • {{item.name}}
    • +
    +
      @@ -222,7 +262,11 @@ export default { actionSelect: [], dcSelect: [], // 数据中心 assetSelect: [], // 资产 + assetStateSelect: [], + brandSelect: [], + groupSelect: [], projectSelect: [], + severitySelect: [], moduleSelect: [], modelSelect: [], gnameList: [], @@ -444,6 +488,22 @@ export default { val.val = selectItem.host val.valnum = selectItem.id val.valString = '' + } else if (val.type == 'assetState' && selectItem.searchType == 'assetState') { + val.val = selectItem.name + val.valnum = selectItem.id + val.valString = '' + } else if (val.type === 'brand' && selectItem.searchType === 'brand') { + val.val = selectItem.name + val.valnum = selectItem.id + val.valString = '' + } else if (val.type === 'group' && selectItem.searchType === 'group') { + val.val = selectItem.name + val.valnum = selectItem.id + val.valString = '' + } else if (val.type === 'severity' && selectItem.searchType === 'severity') { + val.val = selectItem.name + val.valnum = selectItem.id + val.valString = '' } } // this.select_list.push({type: 'dc', val: selectItem.name, valnum: selectItem.id}); @@ -520,6 +580,36 @@ export default { } }) }, + getAssetStateData () { + this.$get('asset/stateConf', { pageNo: 1, pageSize: -1 }).then(response => { + if (response.code === 200) { + this.assetStateSelect = response.data.list + this.assetStateSelect.forEach((item, index) => { + this.$set(item, 'searchType', 'assetState') + }) + } + }) + }, + getBrandData () { + this.$get('asset/brand', { pageNo: 1, pageSize: -1 }).then(response => { + if (response.code === 200) { + this.brandSelect = response.data.list + this.brandSelect.forEach((item, index) => { + this.$set(item, 'searchType', 'brand') + }) + } + }) + }, + getGroupData () { + this.$get('asset/field/group', { pageNo: 1, pageSize: -1 }).then(response => { + if (response.code === 200) { + this.groupSelect = response.data.list + this.groupSelect.forEach((item, index) => { + this.$set(item, 'searchType', 'group') + }) + } + }) + }, getModelData () { this.$get('model', { pageNo: 1, pageSize: -1 }).then(response => { if (response.code === 200) { @@ -531,7 +621,7 @@ export default { }) }, getProjectData () { - this.$get('project', { pageNo: 1, pageSize: -1 }).then(response => { + this.$get('monitor/project', { pageNo: 1, pageSize: -1 }).then(response => { if (response.code === 200) { this.projectSelect = response.data.list this.projectSelect.forEach((item, index) => { @@ -540,6 +630,16 @@ export default { } }) }, + getSeverityData () { + this.$get('alert/severity', { pageNo: 1, pageSize: -1 }).then(response => { + if (response.code === 200) { + this.severitySelect = response.data.list + this.severitySelect.forEach((item, index) => { + this.$set(item, 'searchType', 'severity') + }) + } + }) + }, getModuleData () { this.$get('module', { pageNo: 1, pageSize: -1 }).then(response => { if (response.code === 200) { @@ -593,7 +693,7 @@ export default { stringSelectInfo (column, selectItem, e) { this.stop_click(e) this.select_list.forEach(val => { - if (val.label == column.label) { + if (val.label === column.label) { val.val = selectItem.value val.valString = selectItem.label } @@ -759,20 +859,34 @@ export default { } else if (val.type == 'selectAction') { // 新增日志判断 objectInfo[val.label] = val.valnum } else if (val.type == 'dc') { - objectInfo.idcId = val.valnum + objectInfo.dcIds = val.valnum } else if (val.type == 'asset') { objectInfo.asset = val.val } else if (val.type == 'module') { objectInfo.moduleId = val.valnum - } else if (val.type == 'project') { - objectInfo.projectId = val.valnum - } else if (val.type == 'idc') { - objectInfo.dcId = val.valnum + } else if (val.type === 'project') { + objectInfo.projectIds = val.valnum + } else if (val.type === 'assetState') { + objectInfo.stateIds = val.valnum + } else if (val.type === 'brand') { + objectInfo.brandIds = val.valnum + } else if (val.type === 'group') { + objectInfo.groupIds = val.valnum + } else if (val.type === 'selectString') { + if (val.label === 'dcState') { + objectInfo.state = val.val + } else if (val.label === 'promType') { + objectInfo.type = val.val + } else if (val.label === 'promState') { + objectInfo.status = val.val + } else if (val.label === 'chartType') { + objectInfo.type = val.val + } } else { objectInfo[val.label] = val.val } } - // console.log('search obj', objectInfo) + console.log('search obj', objectInfo) }) this.getHeight() // 搜索完成后存储在本地历史记录中 @@ -1326,23 +1440,25 @@ export default { this.defaultValue != '' ? this.no_condition=this.defaultValue:''; */ this.restructure_historyDate() setTimeout(() => { - if (this.$route.path == '/Objects_Objects') { - this.schelistget() + if (this.$route.path === '/asset') { + this.getAssetStateData() } - if (this.$route.path == '/agent') { + if (this.$route.path === '/agent') { this.getDcData() } - if (this.$route.path == '/monitor/project' || this.$route.path == '/alertMessage' || this.$route.path == '/alertRule') { - this.getAssetData() + if (this.$route.path === '/model') { + this.getBrandData() } - if (this.$route.path == '/alertMessage') { + if (this.$route.path === '/assetLabel') { + this.getGroupData() + } + if (this.$route.path === '/monitor/module') { this.getProjectData() - this.getModuleData() } - if (this.$route.path == '/asset') { - this.getModelData() + if (this.$route.path === '/alertRule') { + this.getSeverityData() } - if (this.$route.path == '/exprTemp') { + if (this.$route.path === '/exprTemp') { this.getGnameList() } }, 1000) diff --git a/nezha-fronted/src/components/common/searchSelectInfo.vue b/nezha-fronted/src/components/common/searchSelectInfo.vue index 1fffa07d6..4e816e01a 100644 --- a/nezha-fronted/src/components/common/searchSelectInfo.vue +++ b/nezha-fronted/src/components/common/searchSelectInfo.vue @@ -51,7 +51,7 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用 label: i18n.t('asset.suspended') } ], - endpointState: [ // 资产入库/出库状态 + endpointState: [ { value: 1, label: 'UP' @@ -63,6 +63,15 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用 label: 'SUSPENDED' } ], + promState: [ + { + value: 1, + label: 'UP' + }, { + value: 0, + label: 'DOWN' + } + ], pingStatus: [ { value: '0', @@ -73,6 +82,15 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用 label: i18n.t('asset.pingActive') } ], + credentialType: [ + { + value: 2, + label: 'V2' + }, { + value: 3, + label: 'V3' + } + ], operation: [ { value: 'add', @@ -110,7 +128,6 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用 value: 'logout', label: i18n.t('config.operationlog.operations.logout') } - ], alertMessageState: [ { @@ -142,6 +159,62 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用 label: i18n.t('overall.result.failed') } ], + dcState: [ + { + value: 'enable', + label: 'Enable' + }, + { + value: 'disable', + label: 'Disable' + } + ], + varType: [ + { value: '1', label: i18n.t('asset.asset') }, + { value: '2', label: i18n.t('asset.endpoint') } + ], + chartType: [ + { + value: 'line', + label: i18n.t('dashboard.panel.chartForm.typeVal.line.label') + }, + { + value: 'stackArea', + label: i18n.t('dashboard.panel.chartForm.typeVal.stackArea.label') + }, + { + value: 'bar', + label: i18n.t('dashboard.panel.chartForm.typeVal.bar.label') + }, + { + value: 'singleStat', + label: i18n.t('dashboard.panel.chartForm.typeVal.singleStat.label') + }, + { + value: 'pie', + label: i18n.t('dashboard.panel.chartForm.typeVal.pie.label') + }, + { + value: 'table', + label: i18n.t('dashboard.panel.chartForm.typeVal.table.label') + }, + { + value: 'alertList', + label: i18n.t('dashboard.panel.chartForm.typeVal.alertList.label') + }, + { + value: 'text', + label: i18n.t('dashboard.panel.chartForm.typeVal.text.label') + }, + { + value: 'url', + label: i18n.t('dashboard.panel.chartForm.typeVal.url.label') + }, + { + value: 'group', + label: i18n.t('dashboard.panel.chartForm.typeVal.group.label') + } + ], terminalStatus: [ { value: 0, diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index 3312ae31b..697d6ee3c 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -106,9 +106,15 @@ fixed="right">
      {{$t('overall.option')}}
      - - - + + +
      + +
      + + {{$t('overall.delete')}} + +
      @@ -159,7 +165,7 @@ export default { width: 80, sortable: 'custom' }, { - label: this.$t('alert.alertName'), + label: this.$t('alert.rule'), prop: 'alertRule', show: true, width: 180, diff --git a/nezha-fronted/src/components/common/table/nzDataList.vue b/nezha-fronted/src/components/common/table/nzDataList.vue index f2b267dda..8eb01ae51 100644 --- a/nezha-fronted/src/components/common/table/nzDataList.vue +++ b/nezha-fronted/src/components/common/table/nzDataList.vue @@ -11,7 +11,7 @@