diff --git a/nezha-fronted/src/components/common/filterSearch/filterSearch.vue b/nezha-fronted/src/components/common/filterSearch/filterSearch.vue
index c98be7b00..7d93e7241 100644
--- a/nezha-fronted/src/components/common/filterSearch/filterSearch.vue
+++ b/nezha-fronted/src/components/common/filterSearch/filterSearch.vue
@@ -118,7 +118,7 @@ export default {
this.metaList.push(meta)
this.$emit('metaList')
} else {
- let self = this
+ const self = this
const newCondition = Object.assign({}, self.meta)
newCondition.nameIsEditing = true
this.metaList.push(newCondition)
diff --git a/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue b/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue
index b2945836d..2003fe2d0 100644
--- a/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue
+++ b/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue
@@ -406,6 +406,9 @@ export default {
}
params[trendKey] = this.obj.id
this.$get('/stat/alertMessage/trend', params).then((res) => {
+ if (!res.data) {
+ return
+ }
const alertDaysData = res.data.result ? res.data.result[0].values : []
const newWeekDays = JSON.parse(JSON.stringify(weekDays))
alertDaysData.forEach(item => {
@@ -552,7 +555,7 @@ export default {
arr.unshift(obj)
}
return arr
- },
+ }
}
}
diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js
index f79981f8a..c1cb48fd0 100644
--- a/nezha-fronted/src/components/common/js/constants.js
+++ b/nezha-fronted/src/components/common/js/constants.js
@@ -202,6 +202,7 @@ export const alertMessage = {
{ value: 'P3', label: i18n.t('alert.config.P3') }
],
states: [
+ { value: '', label: i18n.t('overall.all') },
{ value: '1', label: i18n.t('overall.active') },
{ value: '2', label: i18n.t('overall.silence') },
{ value: '3', label: i18n.t('alert.list.expired') }
@@ -395,7 +396,7 @@ export const chartType = {
bar: 'bar',
table: 'table',
stat: 'stat',
- guage: 'guage',
+ gauge: 'gauge',
pie: 'pie',
treemap: 'treemap',
log: 'log',
diff --git a/nezha-fronted/src/components/common/js/validate.js b/nezha-fronted/src/components/common/js/validate.js
index 6369d3593..753387373 100644
--- a/nezha-fronted/src/components/common/js/validate.js
+++ b/nezha-fronted/src/components/common/js/validate.js
@@ -77,7 +77,7 @@ export function nzNumber (rule, value, callback) {
export function noSpecialChar (rule, value, callback) {
// eslint-disable-next-line no-control-regex
- const charReg = /^\w[\u0000-\uFFFF]*$/
+ const charReg = /^\S[\u0000-\uFFFF]*$/
/// ^\S[\u0000-\uFFFF]*$/
setTimeout(() => {
if (!value) {
diff --git a/nezha-fronted/src/components/common/login.vue b/nezha-fronted/src/components/common/login.vue
index 34e0407d5..7588803e6 100644
--- a/nezha-fronted/src/components/common/login.vue
+++ b/nezha-fronted/src/components/common/login.vue
@@ -31,7 +31,7 @@
-
+
{
- const fileName = 'Login' + '-' + this.getTimeString() + '.xml'
+ let fileName = this.licenseList.id + '-' + this.getTimeString() + '.xml'
+ const resFileName = res.headers['content-disposition'].split('=')[1]
+ if (resFileName) {
+ fileName = resFileName
+ }
if (window.navigator.msSaveOrOpenBlob) {
// 兼容ie11
- const blobObject = new Blob([res])
+ const blobObject = new Blob([res.data])
window.navigator.msSaveOrOpenBlob(blobObject, fileName)
} else {
- const url = URL.createObjectURL(new Blob([res]))
+ const url = URL.createObjectURL(new Blob([res.data]))
const a = document.createElement('a')
document.body.appendChild(a) // 此处增加了将创建的添加到body当中
a.href = url
diff --git a/nezha-fronted/src/components/common/mixin/alertLabelMixin.js b/nezha-fronted/src/components/common/mixin/alertLabelMixin.js
new file mode 100644
index 000000000..fa35bbac2
--- /dev/null
+++ b/nezha-fronted/src/components/common/mixin/alertLabelMixin.js
@@ -0,0 +1,52 @@
+export default {
+ data () {
+ return {
+ alertLabelShow: false,
+ alertLabelId: '',
+ alertLabelObj: {},
+ alertLabelType: ''
+ }
+ },
+ methods: {
+ // label 鼠标划入
+ labelHover (item, type, loading, isUseType = true, e) {
+ if (this.labelToolTipDis(type)) {
+ return
+ }
+ if (isUseType) {
+ if (e) {
+ const dom = e.currentTarget
+ const position = dom.getBoundingClientRect()
+ this.$set(item[type], 'position', position)
+ this.alertLabelId = item[type].id
+ this.alertLabelObj = item[type]
+ this.alertLabelType = type
+ }
+ this.$set(item[type], 'loading', loading)
+ } else {
+ if (e) {
+ const dom = e.currentTarget
+ const position = dom.getBoundingClientRect()
+ this.$set(item, 'position', position)
+ this.alertLabelId = item.id
+ this.alertLabelObj = item
+ this.alertLabelType = type
+ }
+ this.$set(item, 'loading', loading)
+ }
+ this.alertLabelShow = loading
+ },
+ // label tooltip是否显示
+ labelToolTipDis (labelType) {
+ switch (labelType) {
+ case 'asset':
+ case 'module':
+ case 'endpoint':
+ case 'project':
+ case 'dc':
+ return false
+ default: return true
+ }
+ }
+ }
+}
diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js
index 10ce505f2..fb961aa2d 100644
--- a/nezha-fronted/src/components/common/mixin/dataList.js
+++ b/nezha-fronted/src/components/common/mixin/dataList.js
@@ -23,7 +23,7 @@ export default {
pages: 1,
total: 0
},
- orderBy: '',
+ orderBy: 'id',
/* 工具参数 */
tools: {
loading: true, // 是否显示table加载动画
@@ -105,6 +105,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
+ item.left = 0
+ item.top = 0
+ item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -132,7 +135,7 @@ export default {
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
- if (!this.scrollbarWrap && this.$refs.dataTable.$refs.dataTable) {
+ if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)
@@ -214,7 +217,9 @@ export default {
},
dragend () {
this.$nextTick(() => {
- this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
+ if (this.$refs.dataTable) {
+ this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
+ }
})
},
search (searchObj) {
@@ -332,6 +337,9 @@ export default {
},
created () {
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
+ if (this.$route.query.orderBy && !this.isSubList) {
+ this.orderBy = this.$route.query.orderBy
+ }
let searchKeys = {}
if (path === 'dc') {
searchKeys = {
@@ -969,14 +977,18 @@ export default {
if (pageSize && pageSize !== 'undefined') {
this.pageObj.pageSize = pageSize
}
+ if (!this.$refs.dataTable && !this.$refs.dataDetail) {
+ return
+ }
+ const tableTitle = this.$refs.dataTable ? this.$refs.dataTable.tableTitle : this.$refs.dataDetail.tableTitle
let localStorageTableTitle = localStorage.getItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId)
- localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : this.$refs.dataTable.tableTitle
- this.tools.customTableTitle = this.$refs.dataTable.tableTitle.map((item, index) => { // 修复切换中英文的问题
+ localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : tableTitle
+ this.tools.customTableTitle = tableTitle.map((item, index) => { // 修复切换中英文的问题
item.show = localStorageTableTitle[index].show
return item
})
- if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) {
- const arr = localStorageTableTitle.splice(this.$refs.dataTable.tableTitle.length, localStorageTableTitle.length)
+ if (localStorageTableTitle && (localStorageTableTitle.length > tableTitle.length)) {
+ const arr = localStorageTableTitle.splice(tableTitle.length, localStorageTableTitle.length)
arr.forEach(item => {
item.minWidth = item.label.length * 16 + 20
})
@@ -985,7 +997,9 @@ export default {
if (!this.fromBottom) {
this.getTableData()
this.$nextTick(() => {
- this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
+ if (this.$refs.dataTable) {
+ this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
+ }
})
}
},
diff --git a/nezha-fronted/src/components/common/mixin/detailViewMixin.js b/nezha-fronted/src/components/common/mixin/detailViewMixin.js
index 8862b68b5..df2cc285b 100644
--- a/nezha-fronted/src/components/common/mixin/detailViewMixin.js
+++ b/nezha-fronted/src/components/common/mixin/detailViewMixin.js
@@ -2,7 +2,7 @@ export default {
props: {},
data () {
return {
- detailType: 'list',
+ detailType: localStorage.getItem('detail-view-' + this.tableId) || 'list',
detailViewRightObj: '',
detailViewLoading: false,
detailTimer: ''
@@ -16,10 +16,10 @@ export default {
if (this.detailType === flag) {
return
}
- this.$refs.dataList.bottomBox.showSubList = false
- if (this.orderBy) {
- this.detailViewRightObj = ''
- }
+ // this.$refs.dataList.bottomBox.showSubList = false
+ // if (this.orderBy) {
+ // this.detailViewRightObj = ''
+ // }
this.detailType = flag
let dataList = ''
localStorage.setItem('detail-view-' + this.tableId, this.detailType)
@@ -66,7 +66,7 @@ export default {
this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs.dataList.$refs.searchInput.searchLabelList.filter(item => searchLabel.label !== item.label)
}
})
- if (this.orderBy && this.$refs.dataTable.$refs.dataTable) {
+ if (this.orderBy) {
const index = this.orderBy.indexOf('-')
let orderBy = ''
let orderType = ''
@@ -78,7 +78,9 @@ export default {
orderBy = this.orderBy
orderType = 'ascending'
}
- this.$refs.dataTable.$refs.dataTable.sort(orderBy, orderType)
+ if (this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
+ this.$refs.dataTable.$refs.dataTable.sort(orderBy, orderType)
+ }
}
}, 100)
},
diff --git a/nezha-fronted/src/components/common/mixin/subDataList.js b/nezha-fronted/src/components/common/mixin/subDataList.js
index 57be8db76..22641b1b8 100644
--- a/nezha-fronted/src/components/common/mixin/subDataList.js
+++ b/nezha-fronted/src/components/common/mixin/subDataList.js
@@ -5,11 +5,12 @@ export default {
type: Array
},
targetTab: String,
- from: String
+ from: String,
},
data () {
return {
- subTableHeight: this.$tableHeight.openSubList.subList
+ subTableHeight: this.$tableHeight.openSubList.subList,
+ isSubList: true
}
},
methods: {
diff --git a/nezha-fronted/src/components/common/mixin/system/systemMixin.js b/nezha-fronted/src/components/common/mixin/system/systemMixin.js
index b61375c77..326896696 100644
--- a/nezha-fronted/src/components/common/mixin/system/systemMixin.js
+++ b/nezha-fronted/src/components/common/mixin/system/systemMixin.js
@@ -77,6 +77,7 @@ export default {
localStorage.setItem('nz-sys-timezone', param.timezone)
localStorage.setItem('timezoneOffset', moment.tz(param.timezone).format('Z'))
localStorage.setItem('nz-default-dateFormat', param.date_format)
+ this.$store.commit('setTimeFormatMain', param.date_format)
}
this.dateFormatTimer()
setTimeout(() => {
diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js
index 5be856c43..b0216a1f7 100644
--- a/nezha-fronted/src/components/common/mixin/table.js
+++ b/nezha-fronted/src/components/common/mixin/table.js
@@ -26,7 +26,7 @@ export default {
data () {
return {
operationWidth: '165', // 操作列宽
- orderBy: {},
+ orderBy: null,
severityDataWeight: this.$store.getters.severityDataWeight
}
},
@@ -131,10 +131,11 @@ export default {
if (n) {
const index = n.indexOf('-')
if (index !== -1) {
- this.orderBy[n.slice(index + 1)] = 'descending'
+ this.orderBy = { prop: n.slice(index + 1), order: 'descending' }
} else {
- this.orderBy[n] = 'descending'
+ this.orderBy = { prop: n, order: 'ascending' }
}
+ // this.orderBy = JSON.parse(JSON.stringify(this.orderBy))
}
}
},
@@ -162,32 +163,9 @@ export default {
params[this.trendKey] = item.id
setTimeout(() => {
this.$get('/stat/alertMessage/trend', params).then((res) => {
- // res = {
- // msg: 'success',
- // code: 200,
- // data: {
- // result: [
- // {
- // values: [
- // {
- // metric: { priority: 'P1' },
- // values: []
- // }, {
- // metric: { priority: 'P2' },
- // values: [
- // [1645142400000, 0], [1645228800000, 3], [1645315200000, 20], [1645401600000, 0], [1645488000000, 0], [1645574400000, 3], [1645660800000, 20]
- // ]
- // }, {
- // metric: { priority: 'P3' },
- // values: [
- // [1645142400000, 1], [1645228800000, 3], [1645315200000, 20], [1645401600000, 0], [1645488000000, 0], [1645574400000, 3], [1645660800000, 20]
- // ]
- // }]
- // }],
- // resultType: 'matrix'
- // },
- // time: '2022-02-24 08:41:35'
- // }
+ if (!res.data) {
+ return
+ }
const alertDaysData = res.data.result ? res.data.result[0].values : []
const newWeekDays = JSON.parse(JSON.stringify(weekDays))
alertDaysData.forEach(item => {
diff --git a/nezha-fronted/src/components/common/popBox/guide.vue b/nezha-fronted/src/components/common/popBox/guide.vue
index 3e7616c07..b52f2e85c 100644
--- a/nezha-fronted/src/components/common/popBox/guide.vue
+++ b/nezha-fronted/src/components/common/popBox/guide.vue
@@ -101,7 +101,7 @@ export default {
},
{
route: '/monitor/project',
- title: this.$t('guide.monitor'),
+ title: this.$t('overall.monitor'),
icon: 'nz-icon nz-icon-menu-project',
tip: this.$t('guide.monitorTip'),
permissionCode: 'project_view'
diff --git a/nezha-fronted/src/components/common/project/popData/assetTable.vue b/nezha-fronted/src/components/common/project/popData/assetTable.vue
index 8ba22d364..143a29d77 100644
--- a/nezha-fronted/src/components/common/project/popData/assetTable.vue
+++ b/nezha-fronted/src/components/common/project/popData/assetTable.vue
@@ -170,6 +170,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
+ item.left = 0
+ item.top = 0
+ item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
diff --git a/nezha-fronted/src/components/common/project/popData/endpointTable.vue b/nezha-fronted/src/components/common/project/popData/endpointTable.vue
index afc5bfc0a..6d2692ef4 100644
--- a/nezha-fronted/src/components/common/project/popData/endpointTable.vue
+++ b/nezha-fronted/src/components/common/project/popData/endpointTable.vue
@@ -176,6 +176,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
+ item.left = 0
+ item.top = 0
+ item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue
index d9d46af89..da74ed855 100644
--- a/nezha-fronted/src/components/common/project/topologyL5.vue
+++ b/nezha-fronted/src/components/common/project/topologyL5.vue
@@ -798,6 +798,9 @@ export default {
resolve(this.topoPrevDataS)
}
this.$get('monitor/project/topo', { projectId: this.obj.id }).then(res => {
+ if (!res.data) {
+ return
+ }
let data = res.data.topo
if (!res.data.topo || !res.data.topo.pens.length) {
this.showNoData = true
@@ -1772,6 +1775,9 @@ export default {
this.imgageLoading = true
this.$get('monitor/project/topo/icon').then((imageAllId) => {
const promiseArr = []
+ if (!imageAllId || !imageAllId.data) {
+ return
+ }
imgidList.forEach((item, index) => {
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`))
diff --git a/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue b/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue
index 61b6b63b1..d9fb16ed1 100644
--- a/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/administration/roleBox.vue
@@ -23,7 +23,7 @@
-->
-