Merge branch 'dev-3.8' of git.mesalab.cn:nezha/nezha-fronted into dev-3.9
This commit is contained in:
@@ -250,11 +250,41 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 修复echarts bug(dataZoom设置为inside 未按住ctrl 页面无法滚动)
|
||||
// 监听按键按下事件
|
||||
document.addEventListener('keydown', this.keydown)
|
||||
// 监听按键松开事件
|
||||
document.addEventListener('keyup', this.keyup)
|
||||
}
|
||||
this.chartLoading = false
|
||||
this.isInit = false
|
||||
}, 200)
|
||||
},
|
||||
keydown (event) {
|
||||
// 监听按键按下事件
|
||||
// 判断是否按下了Ctrl键
|
||||
if (event.ctrlKey) {
|
||||
// 如果按下了Ctrl键,则启用Echarts的dataZoom功能
|
||||
getChart(this.chartId).setOption({
|
||||
dataZoom: [{
|
||||
disabled: false
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
keyup (event) {
|
||||
// 监听按键松开事件
|
||||
// 判断是否释放了Ctrl键
|
||||
if (!event.ctrlKey) {
|
||||
// 如果释放了Ctrl键,则禁用Echarts的dataZoom功能
|
||||
getChart(this.chartId).setOption({
|
||||
dataZoom: [{
|
||||
disabled: true
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
getMinMaxFromData (originalDatas, chartUnit = 2) {
|
||||
let minTime = null
|
||||
let maxTime = null
|
||||
@@ -724,6 +754,10 @@ export default {
|
||||
this.isStack = this.chartInfo.param.stack
|
||||
} catch (e) {}
|
||||
this.chartInfo.loaded && this.initChart(this.chartOption)
|
||||
},
|
||||
beforeDestroy () {
|
||||
document.removeEventListener('keydown', this.keydown)
|
||||
document.removeEventListener('keyup', this.keyup)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -50,6 +50,7 @@ export const chartTimeSeriesLineOption = {
|
||||
},
|
||||
dataZoom: [
|
||||
{
|
||||
disabled: true,
|
||||
type: 'inside',
|
||||
zoomOnMouseWheel: 'ctrl'
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ export default {
|
||||
})
|
||||
// && n.alertRule.dashboardId
|
||||
// n.alertRule && (n.alertRule.dashboardId = 101534)
|
||||
if (n.alertRule && n.alertRule.dashboardId) {
|
||||
if (n.alertRule && n.alertRule.dashboardId && n.alertRule.dashboardId != -1) {
|
||||
//
|
||||
this.cardNames.push({
|
||||
key: 'dashboard',
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<script>
|
||||
// import { host, port } from '@/components/common/js/validate'
|
||||
import editRigthBox from '../../mixin/editRigthBox'
|
||||
|
||||
import bus from '@/libs/bus'
|
||||
export default {
|
||||
name: 'userBox',
|
||||
components: {
|
||||
@@ -246,6 +246,15 @@ export default {
|
||||
if (res.code === 200) {
|
||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
this.esc(true)
|
||||
const userInfo = localStorage.getItem('nz-userInfo') ? JSON.parse(localStorage.getItem('nz-userInfo')) : ''
|
||||
if (userInfo.id == this.editUser.id) {
|
||||
const obj = this.$lodash.cloneDeep(this.editUser)
|
||||
delete obj.roles
|
||||
delete obj.pin
|
||||
delete obj.pinChange
|
||||
localStorage.setItem('nz-userInfo', JSON.stringify(obj))
|
||||
bus.$emit('login')
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
|
||||
@@ -427,7 +427,8 @@ export default {
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||
],
|
||||
clientPort: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' },
|
||||
{ validator: port, trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
cabRules: {
|
||||
|
||||
@@ -190,7 +190,7 @@ export default {
|
||||
}
|
||||
},
|
||||
copyValue (item) {
|
||||
const str = item
|
||||
const str = JSON.stringify(JSON.parse(item), null, 2)
|
||||
// const domUrl = document.createElement('input')
|
||||
// domUrl.value = JSON.stringify(str)
|
||||
// domUrl.id = 'creatDom'
|
||||
@@ -200,7 +200,7 @@ export default {
|
||||
// const creatDom = document.getElementById('creatDom')
|
||||
// creatDom.parentNode.removeChild(creatDom)
|
||||
// this.$message.success(this.$t('overall.copySuccess'))
|
||||
this.$copyText(JSON.stringify(str)).then(() => {
|
||||
this.$copyText(str).then(() => {
|
||||
this.$message.success({ message: this.$t('overall.copySuccess') })
|
||||
})
|
||||
}
|
||||
|
||||
@@ -202,8 +202,9 @@ export default {
|
||||
|
||||
initEvent () {
|
||||
bus.$on('login', () => {
|
||||
this.username = localStorage.getItem('nz-username')
|
||||
this.name = localStorage.getItem('nz-username')
|
||||
const userInfo = localStorage.getItem('nz-userInfo') ? JSON.parse(localStorage.getItem('nz-userInfo')) : {}
|
||||
this.username = userInfo.username
|
||||
this.name = userInfo.name
|
||||
// this.refreshLang()
|
||||
})
|
||||
// if (window.history && window.history.pushState) {
|
||||
@@ -218,7 +219,8 @@ export default {
|
||||
this.$store.commit('isShrink')
|
||||
},
|
||||
testUser () {
|
||||
if (this.username != localStorage.getItem('nz-username')) {
|
||||
const userInfo = localStorage.getItem('nz-userInfo') ? JSON.parse(localStorage.getItem('nz-userInfo')) : {}
|
||||
if (this.name != userInfo.name) {
|
||||
this.$router.go(0)
|
||||
}
|
||||
if (this.$store.getters.getLanguage && (this.$store.getters.getLanguage !== localStorage.getItem('nz-language'))) {
|
||||
@@ -233,8 +235,9 @@ export default {
|
||||
// for (let i = 97; i < 123; i++) {
|
||||
// this.fontData.push(String.fromCharCode(i))
|
||||
// }
|
||||
this.name = localStorage.getItem('nz-username')
|
||||
this.username = localStorage.getItem('nz-username')
|
||||
const userInfo = localStorage.getItem('nz-userInfo') ? JSON.parse(localStorage.getItem('nz-userInfo')) : {}
|
||||
this.name = userInfo.name
|
||||
this.username = userInfo.username
|
||||
this.language = localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en'
|
||||
this.$i18n.locale = this.language
|
||||
if (localStorage.getItem('nz-token')) {
|
||||
|
||||
Reference in New Issue
Block a user