diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 559a81218..6a3aa2aee 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -1447,7 +1447,10 @@ export default { const arr = [] arr.push(this.$get(`/asset/asset/${assetId}`)) arr.push(this.$get(`/asset/asset/feature/${assetId}`)) - this.$refs['editChart' + chartInfo.id][0].showLoad() + console.log(this.$refs['editChart' + chartInfo.id][0]) + if (this.$refs['editChart' + chartInfo.id][0]) { + this.$refs['editChart' + chartInfo.id][0].showLoad() + } // this.$get('/asset/info?id=' + assetId).then(response => { // if (response.code == 200) { diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index 8791c5e59..31bef095c 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -465,6 +465,26 @@ export default { if (chartItem.type === 'endpointInfo') { seriesItem.theData.type = 'line' } + if ((chartItem.type === 'line' || chartItem.type === 'stackArea' || chartItem.type === 'bar') && chartItem.param && chartItem.param.threshold) { + seriesItem.theData.markLine = { + silent: true, + symbol: ['circle', 'circle'], + label: { + distance: this.computeDistance(chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(chartItem.param.threshold)), + formatter (params) { + return chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(params.value) + } + }, + lineStyle: { + color: '#d64f40', + width: 2, + type: 'dotted' + }, + data: [{ + yAxis: Number(chartItem.param.threshold) + }] + } + } // 图表中每条线的名字,后半部分 let host = ''// up, if (queryItem.metric.__name__) { diff --git a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue index 11d560be4..b73628fb6 100644 --- a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue +++ b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue @@ -1253,19 +1253,19 @@ export default { const ePosition = window.ePosition const boxWidth = document.getElementsByClassName('page')[0].offsetWidth const boxHeight = document.getElementsByClassName('page')[0].offsetHeight - this.tooltipPosition.left = ePosition.layerX + 20 - this.tooltipPosition.top = ePosition.layerY + this.tooltipPosition.left = ePosition.offsetX + 20 + this.tooltipPosition.top = ePosition.offsetY this.$nextTick(() => { if (this.$refs.topoTooltip) { - if ((boxWidth / 2) > ePosition.layerX) { - this.tooltipPosition.left = ePosition.layerX + 20 + if ((boxWidth / 2) > ePosition.offsetX) { + this.tooltipPosition.left = ePosition.offsetX + 20 } else { - this.tooltipPosition.left = ePosition.layerX - 20 - this.$refs.topoTooltip.offsetWidth + this.tooltipPosition.left = ePosition.offsetX - 20 - this.$refs.topoTooltip.offsetWidth } - if (boxHeight > (ePosition.layerY + this.$refs.topoTooltip.offsetHeight)) { - this.tooltipPosition.top = ePosition.layerY + if (boxHeight > (ePosition.offsetY + this.$refs.topoTooltip.offsetHeight)) { + this.tooltipPosition.top = ePosition.offsetY } else { - this.tooltipPosition.top = ePosition.layerY - this.$refs.topoTooltip.offsetHeight + this.tooltipPosition.top = ePosition.offsetY - this.$refs.topoTooltip.offsetHeight } } if (this.isScreen) { @@ -1408,6 +1408,10 @@ export default { if (this.$refs.topTool) { this.$refs.topTool.scaleNum = parseInt(data * 100) } + const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() + if (getTopology(this.topologyIndex)) { + getTopology(this.topologyIndex).canvasPos = domRect + } break } case 'locked': { @@ -1924,6 +1928,7 @@ export default { } const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() getTopology(this.topologyIndex).canvasPos = domRect + getTopology(this.topologyIndex).resize() }, 100) }, @@ -2015,7 +2020,6 @@ export default { item.animatePlay = item.data.animatePlay item.data.animateType = item.animateType if (item.type === 0 && JSON.stringify(item.data.imageId)) { - item.image = '' item.animateFrames = [] item.animateReady = null delete item.img diff --git a/nezha-fronted/src/components/common/alert/nzTooltip.vue b/nezha-fronted/src/components/common/alert/nzTooltip.vue new file mode 100644 index 000000000..54623b3a1 --- /dev/null +++ b/nezha-fronted/src/components/common/alert/nzTooltip.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/nezha-fronted/src/components/common/i18n.js b/nezha-fronted/src/components/common/i18n.js index c018835e2..1165394f8 100644 --- a/nezha-fronted/src/components/common/i18n.js +++ b/nezha-fronted/src/components/common/i18n.js @@ -1,11 +1,13 @@ import Vue from 'vue' import locale from 'element-ui/lib/locale' import VueI18n from 'vue-i18n' +import { get } from '@/http' +import messages from './language' Vue.use(VueI18n) // 从localStorage获取语言选择。 const i18n = new VueI18n({ - locale: localStorage.getItem('nz-language') || 'en' // 初始未选择默认 en 英文 - // messages + locale: localStorage.getItem('nz-language') || 'en', // 初始未选择默认 en 英文 + messages }) locale.i18n((key, value) => i18n.t(key, value)) // 兼容element diff --git a/nezha-fronted/src/components/common/language/index.js b/nezha-fronted/src/components/common/language/index.js index dfbf6e068..d367c582e 100644 --- a/nezha-fronted/src/components/common/language/index.js +++ b/nezha-fronted/src/components/common/language/index.js @@ -1,6 +1,6 @@ -import en from './en' -import cn from './cn' +import newen from './newen' +import newcn from './newcn' export default { - en: en, - cn: cn + en: newen, + cn: newcn } diff --git a/nezha-fronted/src/components/common/language/newcn.js b/nezha-fronted/src/components/common/language/newcn.js new file mode 100644 index 000000000..05751a780 --- /dev/null +++ b/nezha-fronted/src/components/common/language/newcn.js @@ -0,0 +1,70 @@ +import zhLocale from 'element-ui/lib/locale/lang/zh-CN' // 引入element语言包 +const newcn = { + setup: { + step0: '欢迎', + step1: '数据库', + step2: 'Redis', + step3: '系统', + host: 'Host', + port: '端口', + language: '语言', + welcome: { + header: '欢迎使用哪吒安装向导!', + guid: '向导将为您做什么?', + guid_1: '创建基本的配置', + guid_2: '尝试在数据库和Redis设置中查找问题', + toContinue: '继续', + creatFile: '出于安全原因,您需要通过创建文件来验证安装', + createFileTip: '这可以通过执行以下命令来完成', + next: '完成后单击“下一步”按钮.' + }, + database: { + configTitle: '配置数据库连接', + configTip: '请手动创建数据库,并设置连接到此数据库的配置参数,完成后按“下一步”按钮' + }, + redis: { + configTitle: '配置Redis连接', + configTip: '请设置连接到此redis的配置参数,完成后按“下一步”按钮' + }, + system: { + configTitle: '系统配置', + configTip: '请输入管理员的用户名和密码,并设置Nezha WEB模块的安装信息,如IP:port', + federation: '联邦', + federationEnable: '可用', + federationDisable: '不可用' + }, + name: '数据库名称', + username: '用户名', + pin: '密码', + alertPath: '网站URL', + alertPrefix: '警报前缀', + haMode: 'HA 模式', + haVip: '虚拟的 IP', + next: '下一步', + back: '返回', + finish: '完成', + invalidDb: '数据库配置可能存在一些错误', + invalidRedis: 'Redis的配置可能有一些错误', + invalidPin: 'Redis的密码可能错误', + requirePin: 'Redis可能需要密码', + wait: '配置已保存,请耐心等待生效', + reloadTimeout: '重新启动服务器花了太多时间,安装可能有一些问题', + hadConfig: '已经有人开始配置系统', + invalidCode: '身份验证无效,请按照{page}中的描述继续', + welcomePage: '欢迎页面', + inited: '系统已经被初始化' + }, + login: { + username: '登录名', + pin: '密码', + login: '登录', + verify: '验证', + verifyDialogTitle: '双因子认证设置', + verifyTitle: '双因子认证', + verifyContent: '在您的移动设备上输入来自双因子应用程序的代码。 如果您丢失了设备,您可以输入您的恢复代码之一。', + verifyPlaceholder: '验证码', + bindFail: '绑定失败' + }, + ...zhLocale +} +export default newcn diff --git a/nezha-fronted/src/components/common/language/newen.js b/nezha-fronted/src/components/common/language/newen.js new file mode 100644 index 000000000..ee37c67d4 --- /dev/null +++ b/nezha-fronted/src/components/common/language/newen.js @@ -0,0 +1,79 @@ +import enLocale from 'element-ui/lib/locale/lang/en' // 引入element语言包 +const newen = { +// 命名原则 +// 创建使用New +// 表示创建状态用Created,如创建时间Created Time +// 告警使用Alert,而不是Alarm +// 账号用Account,username、password等都属于account的一部分 +// A user is the person who uses the account, the account is an inanimate object that is merely registered to an e-mail address. + setup: { + step0: 'Welcome', + step1: 'Database', + step2: 'Redis', + step3: 'System', + host: 'Host', + port: 'Port', + language: 'Language', + welcome: { + header: 'Welcome to Nezha setup wizard!', + guid: 'What will the wizard do for you?', + guid_1: 'Create a basic configuration', + guid_2: 'Tries to find problems within your Database and Redis setup', + toContinue: 'To continue', + creatFile: 'For security reasons you need to authenticate for the installation by creating the file', + createFileTip: 'This can be done by executing the following command', + next: "Click the 'Next' button when you've finished." + }, + database: { + configTitle: 'Configure DB connection', + configTip: "Please create database manually,and set the configuration parameters for connection to this database,Press 'Next' button when done" + }, + redis: { + configTitle: 'Configure Redis connection', + configTip: "Please set the configuration parameters for connection to this redis,Press 'Next' button when done" + }, + system: { + configTitle: 'System configuration', + configTip: 'Please enter username and password for administrator ,and set the Nezha WEB module install information,like IP:port', + federation: 'Federation', + federationEnable: 'Enable', + federationDisable: 'Disable' + + }, + name: 'Database name', + username: 'Username', + pin: 'Password', + alertPath: 'Site URL', + alertPrefix: 'Alert prefix', + haMode: 'HA mode', + haVip: 'Virtual IP', + next: 'Next', + back: 'Back', + finish: 'Finish', + invalidDb: 'There may be some errors in the configuration of the database', + invalidRedis: 'There may be some errors in the configuration of the Redis', + invalidPin: "Redis's password may be wrong", + requirePin: 'The password may be required by the Redis', + wait: 'The configuration has been saved, please wait patiently for it to take effect', + reloadTimeout: 'It took too much time to restart the server, there may be some problems when you install', + hadConfig: 'Someone has started to configure the system', + invalidCode: "The authentication is invalid ,please follow the description in {page} 'To continue'", + welcomePage: 'Welcome page', + inited: 'The system has been initialized' + }, + login: { + username: 'Username', + pin: 'Password', + login: 'Login', + upload: 'Upload license', + verify: 'Verify code', + verifyDialogTitle: 'Two Factor Authentication Set Up', + verifyTitle: 'Two-Factor Authentication', + verifyContent: 'Enter the code from the two -factor app on your mobile device. If you\' ve lost your device, you may enter one of your recovery codes.', + verifyPlaceholder: 'verify code', + bindFail: 'Binding failure' + }, + ...enLocale +} + +export default newen diff --git a/nezha-fronted/src/components/common/login.vue b/nezha-fronted/src/components/common/login.vue index 20d57784f..e85ffe84d 100644 --- a/nezha-fronted/src/components/common/login.vue +++ b/nezha-fronted/src/components/common/login.vue @@ -127,7 +127,7 @@ export default { license: { warnInfo: '', token: '', - valid: false + valid: true }, uploadFileList: [], uploadFile: { file: '', path: '', uuid: '' }, @@ -148,7 +148,7 @@ export default { methods: { ...mapActions(['loginSuccess']), login () { - if (this.loading || !this.license.valid) { + if (this.loading || !this.license.valid || !this.license.token) { return } if (this.validateLogin() && (this.$route.path == '/' || this.$route.path == '/login')) { @@ -214,6 +214,9 @@ export default { localStorage.setItem('nz-username', this.loginData.username) localStorage.setItem('nz-prometheus-federation-enabled', res.data.prometheusFederationEnabled) localStorage.setItem('nz-language', this.lang) + res.data.user = { + lang: this.lang + } this.loginSuccess(res) } else { this.authToken = res.data.authToken diff --git a/nezha-fronted/src/components/common/pagination.vue b/nezha-fronted/src/components/common/pagination.vue index 8356a46c0..7ee78e7c7 100644 --- a/nezha-fronted/src/components/common/pagination.vue +++ b/nezha-fronted/src/components/common/pagination.vue @@ -1,21 +1,21 @@ @@ -101,6 +101,7 @@ export default { wraps.forEach(wrap => { if (wrap) { wrap.scrollTop = 0 + wrap.scrollLeft = 0 } }) }) diff --git a/nezha-fronted/src/components/common/project/popData/alertTable.vue b/nezha-fronted/src/components/common/project/popData/alertTable.vue index 71604e665..51fd15fcb 100644 --- a/nezha-fronted/src/components/common/project/popData/alertTable.vue +++ b/nezha-fronted/src/components/common/project/popData/alertTable.vue @@ -13,7 +13,7 @@ v-loading="tools.loading" > diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 8da2db9e9..5c7f06025 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -1448,6 +1448,10 @@ export default { if (this.$refs.topTool) { this.$refs.topTool.scaleNum = parseInt(data * 100) } + const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() + if (getTopology(this.topologyIndex)) { + getTopology(this.topologyIndex).canvasPos = domRect + } break } case 'locked': { @@ -2052,7 +2056,6 @@ export default { item.animatePlay = item.data.animatePlay item.data.animateType = item.animateType if (item.type === 0 && JSON.stringify(item.data.imageId)) { - item.image = '' item.animateFrames = [] item.animateReady = null delete item.img diff --git a/nezha-fronted/src/components/common/rightBox/assetMetaBox.vue b/nezha-fronted/src/components/common/rightBox/assetMetaBox.vue index 1dc4fb1c0..d5d9a82a7 100644 --- a/nezha-fronted/src/components/common/rightBox/assetMetaBox.vue +++ b/nezha-fronted/src/components/common/rightBox/assetMetaBox.vue @@ -102,7 +102,7 @@ {{$t('config.assetLabel.interval')}}: @@ -110,7 +110,7 @@
{{$t('config.assetLabel.decimals')}}: - +
diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index deabbf850..af195fc7b 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -14,7 +14,8 @@
  • {{item.name}}: - {{item.val+' '}} + {{item.val+' '}} + {{' '}}
  • diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index 9603037b0..b4ea4f7ed 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -110,8 +110,8 @@ fixed="right">
    {{$t('overall.option')}}
    - - + +
    diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 1d31fd720..85591894b 100644 --- a/nezha-fronted/src/components/common/table/settings/endpointTable.vue +++ b/nezha-fronted/src/components/common/table/settings/endpointTable.vue @@ -95,64 +95,61 @@ +