Merge branch 'dev-3.5' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.6

# Conflicts:
#	nezha-fronted/src/entrance/exportHtml/exportHtml.html
This commit is contained in:
zhangyu
2023-04-13 10:26:20 +08:00
6 changed files with 39 additions and 6 deletions

View File

@@ -41,11 +41,11 @@ dev_build:
# 编译 上传模板
- npm run build:html
- mc alias set nz $MINIO_HOST $MINIO_USER $MINIO_PWD
- mc cp dist/index.html nz/depends/template/snapshot_template.html
- mkdir -p /builds/nezha/nezha-fronted/nezha-fronted/snapshot_template && cp dist/index.html /builds/nezha/nezha-fronted/nezha-fronted/snapshot_template/snapshot_template.html
- npm run build
- cd /builds/nezha/nezha-fronted/nezha-fronted/dist
- mc cp nz/depends/template/snapshot_template.html ./snapshot_template.html
- cp /builds/nezha/nezha-fronted/nezha-fronted/snapshot_template/snapshot_template.html ./snapshot_template.html
- rm -rf nz-gui*.zip
- export FILE_NAME=nz-gui-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA.zip
# 生成 git log 日志文件
@@ -90,11 +90,11 @@ rel_build:
- npm run build:html
- mc alias set nz $MINIO_HOST $MINIO_USER $MINIO_PWD
- mc cp dist/index.html nz/depends/template/snapshot_template.html
- mkdir -p /builds/nezha/nezha-fronted/nezha-fronted/snapshot_template && cp dist/index.html /builds/nezha/nezha-fronted/nezha-fronted/snapshot_template/snapshot_template.html
- npm run build
- cd /builds/nezha/nezha-fronted/nezha-fronted/dist
- mc cp nz/depends/template/snapshot_template.html ./snapshot_template.html
- cp /builds/nezha/nezha-fronted/nezha-fronted/snapshot_template/snapshot_template.html ./snapshot_template.html
- zip -m nz-gui*.zip ./snapshot_template.html
- mv nz-gui*.zip nz-gui-$CI_COMMIT_SHORT_SHA.zip
- md5sum nz-gui-$CI_COMMIT_SHORT_SHA.zip > nz-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt

View File

@@ -211,7 +211,30 @@ export default {
this.showBasicInfo = !this.showBasicInfo
},
init () {
if (window.dataJson) { return }
if (window.dataJson) {
this.severityDataWeight = JSON.parse(localStorage.getItem('nz-severityData'))
const weekDays = this.getWeeksTime()
const res = this.chartDetail.alertMessageTrend
if (!res.result) {
return
}
const alertDaysData = res.result ? res.result[0].values : []
const newWeekDays = JSON.parse(JSON.stringify(weekDays))
alertDaysData.forEach(item => {
item.values.forEach(time => {
const findItem = newWeekDays.find(days => days.time == time[0])
if (findItem) {
findItem[item.metric.priority] = time[1]
}
})
})
setTimeout(() => {
this.alertDaysData = newWeekDays
console.log(this.alertDaysData)
this.trendLoading = false
})
return
}
this.loading = true
const weekDays = this.getWeeksTime()
if (this.trendTimer) {

View File

@@ -43,6 +43,9 @@ export default {
} else {
this.dateFormatStr = 'YYYY-MM-DD'
}
if (window.dataJson) {
this.severityDataWeight = JSON.parse(localStorage.getItem('nz-severityData'))
}
},
methods: {
showPriority (daysData) {

View File

@@ -165,6 +165,7 @@ export default {
this.chartUnitType = this.dataJson.unit || 1
this.$refs.chartUnit.unit = this.dataJson.unit || 1
this.expressionChange()
window.addEventListener('resize', this.logsCollapseChange)
},
methods: {
logsCollapseChange (activeNames, a, b) {
@@ -563,6 +564,9 @@ export default {
this.expressionChange()
}
}
},
beforeDestroy () {
window.removeEventListener('resize', this.logsCollapseChange)
}
}
</script>

View File

@@ -92,6 +92,9 @@ export default {
document.body.style.minWidth = 'unset'
}
document.body.style.minWidth = 'unset'
const arr = [{ id: 1, name: 'P1', color: '#eb1010', weight: 1, remark: 'Critical, alert that can cause business paralysis' }, { id: 2, name: 'P2', color: '#f89984', weight: 2, remark: 'Major, alert that requires urgent attention, but does not affect the business yet' }, { id: 3, name: 'P3', color: '#f7ba78', weight: 3, remark: 'Minor, alert that need to be dealt with, but not urgent' }]
localStorage.setItem('nz-severityData', JSON.stringify(arr))
localStorage.setItem('nz-severityDataWeight', JSON.stringify(arr))
},
mounted () {
if (this.$refs.dashboardScrollbar) {

File diff suppressed because one or more lines are too long