Merge remote-tracking branch 'origin/dev-3.1' into dev-3.1.1_theme

# Conflicts:
#	nezha-fronted/src/components/cli/webSSH.vue
#	nezha-fronted/src/components/common/alert/alertLabel2.vue
#	nezha-fronted/src/components/common/detailView/list/asset/assetDetail.vue
#	nezha-fronted/src/components/common/popBox/topToolMoreOptions.vue
#	nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue
#	nezha-fronted/src/components/common/rightBox/moduleBox.vue
#	nezha-fronted/src/components/page/config/system.vue
#	nezha-fronted/src/components/page/monitor/project/index.vue
This commit is contained in:
chenjinsong
2021-11-11 11:28:19 +08:00
10076 changed files with 1357 additions and 604 deletions

View File

@@ -646,105 +646,107 @@ export default {
this.topologyLoading = true
this.getTopologyData().then((data) => {
this.openTopologyData(data).then(() => {
// 获取对应的值 给节点 连线添加对应动画
this.lineName = data.lineName ? data.lineName : this.lineName
this.chartGetData = []
const axiosArr = []
const promiseArr = []
const self = this
const pensPromise = (pen, arr, index) => {
return new Promise(function (resolve, reject) {
Promise.all(arr).then((res) => {
self.chartGetData[index].res = self.computeData(res, pen.data.aggregation, pen)
self.setAnimation(pen, self.chartGetData[index].res)
resolve()
})
})
}
const panelTime = localStorage.getItem('panelTime') ? JSON.parse(localStorage.getItem('panelTime')) : ['', '']
const endTime = panelTime[1] || this.filterTime[1]
const startTime = panelTime[0] || this.filterTime[0]
const step = bus.getStep(startTime, endTime)
data.pens && data.pens.forEach((item, index) => {
this.chartGetData.push({ id: item.id, res: [] })
let arr = []
if (item.data.valueMappingShow) {
arr = item.data.expressArr.map((ele) => {
let query = ele
if (!query) {
return new Promise(resolve => {
resolve({ data: '', status: 'no query' })
})
}
query += '&nullType=' + 'connected'
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
})
}
axiosArr.push({ item, arr })
promiseArr.push(pensPromise(item, arr, index))
})
if (this.fromTopologyDialog && !this.isPreview) {
setTimeout(() => {
this.topologyLoading = false
getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).centerView()
getTopology(this.topologyIndex).resize()
this.editTopology()
}, 100)
} else {
Promise.all(promiseArr).then((res) => {
getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).lock(1)
this.objChange = false
let flag = false
const position = {
x: this.$refs['topology-canvas' + this.topologyIndexF].offsetWidth,
y: this.$refs['topology-canvas' + this.topologyIndexF].offsetHeight
}
this.oldScale = getTopology(this.topologyIndex).data.scale
getTopology(this.topologyIndex).data.pens.forEach(item => {
if (flag) {
return
}
if (item.rect.ex > position.x || item.rect.ey > position.y) {
if (this.fromOverView) {
getTopology(this.topologyIndex).fitView(20)
}
flag = true
}
})
getTopology(this.topologyIndex).resize()
getTopology(this.topologyIndex).centerView()
if (this.fromChartBox || this.fromChart) { // 是否来自panel 和 chartBox
getTopology(this.topologyIndex).fitView(20)
if (this.chartInfo && this.chartInfo.param && this.chartInfo.param.lock) { // 判断节点 以及画布 是否可以拖动
getTopology(this.topologyIndex).lock(2)
}
}
this.topologyLoading = false
this.penToolTipScale = getTopology(this.topologyIndex).data.scale
setTimeout(() => {
getTopology(this.topologyIndex).data.pens.forEach(item => {
if (item.animatePlay) {
item.stopAnimate()
setTimeout(() => {
item.startAnimate()
})
}
})
})
// if(this.fromPrev){
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
// }
// getTopology(this.topologyIndex).fitView();
this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data)
this.getNodesArr()
})
}
this.initPens(data)
})
})
},
initPens (data) {
// 获取对应的值 给节点 连线添加对应动画
this.lineName = data.lineName ? data.lineName : this.lineName
this.chartGetData = []
const axiosArr = []
const promiseArr = []
const self = this
const pensPromise = (pen, arr, index) => {
return new Promise(function (resolve, reject) {
Promise.all(arr).then((res) => {
self.chartGetData[index].res = self.computeData(res, pen.data.aggregation, pen)
self.setAnimation(pen, self.chartGetData[index].res)
resolve()
})
})
}
const panelTime = localStorage.getItem('panelTime') ? JSON.parse(localStorage.getItem('panelTime')) : ['', '']
const endTime = panelTime[1] || this.filterTime[1]
const startTime = panelTime[0] || this.filterTime[0]
const step = bus.getStep(startTime, endTime)
data.pens && data.pens.forEach((item, index) => {
this.chartGetData.push({ id: item.id, res: [] })
let arr = []
if (item.data.valueMappingShow) {
arr = item.data.expressArr.map((ele) => {
let query = ele
if (!query) {
return new Promise(resolve => {
resolve({ data: '', status: 'no query' })
})
}
query += '&nullType=' + 'connected'
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
})
}
axiosArr.push({ item, arr })
promiseArr.push(pensPromise(item, arr, index))
})
if (this.fromTopologyDialog && !this.isPreview) {
setTimeout(() => {
this.topologyLoading = false
getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).centerView()
getTopology(this.topologyIndex).resize()
this.editTopology()
}, 100)
} else {
Promise.all(promiseArr).then((res) => {
getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).lock(1)
this.objChange = false
let flag = false
const position = {
x: this.$refs['topology-canvas' + this.topologyIndexF].offsetWidth,
y: this.$refs['topology-canvas' + this.topologyIndexF].offsetHeight
}
this.oldScale = getTopology(this.topologyIndex).data.scale
getTopology(this.topologyIndex).data.pens.forEach(item => {
if (flag) {
return
}
if (item.rect.ex > position.x || item.rect.ey > position.y) {
if (this.fromOverView) {
getTopology(this.topologyIndex).fitView(20)
}
flag = true
}
})
getTopology(this.topologyIndex).resize()
getTopology(this.topologyIndex).centerView()
if (this.fromChartBox || this.fromChart) { // 是否来自panel 和 chartBox
getTopology(this.topologyIndex).fitView(20)
if (this.chartInfo && this.chartInfo.param && this.chartInfo.param.lock) { // 判断节点 以及画布 是否可以拖动
getTopology(this.topologyIndex).lock(2)
}
}
this.topologyLoading = false
this.penToolTipScale = getTopology(this.topologyIndex).data.scale
setTimeout(() => {
getTopology(this.topologyIndex).data.pens.forEach(item => {
if (item.animatePlay) {
item.stopAnimate()
setTimeout(() => {
item.startAnimate()
})
}
})
})
// if(this.fromPrev){
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
// }
// getTopology(this.topologyIndex).fitView();
this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data)
this.getNodesArr()
})
}
},
dateChange () {
// const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
// this.setSearchTime(nowTimeType.type, nowTimeType.value)
@@ -818,12 +820,22 @@ export default {
this.topologyInfo.name = ''
resolve(data)
} else {
this.topologyInfo = {
fontSize: data.data.fontSize,
align: data.data.align,
fontColor: data.data.fontColor,
opacity: data.data.opacity,
name: data.name
if (data.data) {
this.topologyInfo = {
fontSize: data.data.fontSize,
align: data.data.align,
fontColor: data.data.fontColor,
opacity: data.data.opacity,
name: data.name
}
} else {
this.topologyInfo = {
fontSize: 14,
align: 'left',
fontColor: '#000000',
opacity: 1,
name: ''
}
}
if (this.fromOverView || this.fromChartBox) { // 优化从首页来的加载速度
const arr = data.pens.filter(item => !item.type)
@@ -1007,7 +1019,7 @@ export default {
},
// Severity Label
returnSeverityLabel (key) {
return this.$CONSTANTS.alertMessage.severityData.find(s => { return s.value == key }).label
return this.$t(this.$CONSTANTS.alertMessage.severityData.find(s => { return s.value == key }).label)
},
getNodesArr () {
const arr = []
@@ -1184,6 +1196,7 @@ export default {
// 连线是否自动计算锚点
// data.manualCps=true;
data.animateColor = '#FA901C'
data.toArrowColor = '#000000'
data.data = {
animatePlay: false,
strokeStyle: data.strokeStyle,
@@ -1909,6 +1922,8 @@ export default {
index: 0,
list: [JSON.parse(JSON.stringify(getTopology(this.topologyIndex).data))]
}
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
getTopology(this.topologyIndex).canvasPos = domRect
}, 100)
},
@@ -1940,6 +1955,8 @@ export default {
saveTopology () {
this.previewData = ''
this.isPreview = false
this.editTopologyFlag = true
this.showNoData = false
const topologyData = getTopology(this.topologyIndex).pureData()
this.editTopologyFlag = false
topologyData.rule = false
@@ -2029,7 +2046,8 @@ export default {
getTopology(this.topologyIndex).lock(1)
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
getTopology(this.topologyIndex).canvasPos = domRect
this.reload()
this.initPens(topologyData)
// this.reload()
})
},
previewExit () { // 继续编辑