diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 84144a626..23608ee90 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -291,6 +291,13 @@ li{ min-width: 60px; padding: 0 10px; } +.nz-btn.nz-btn-size-mini-new{ + height: 22px; + line-height: 22px; + text-align: center; + min-width: 40px; + padding: 0 5px; +} .nz-btn.nz-btn-style-normal-new { /* 新版橙色按钮 */ background: $btn-normal-background-color-new; color: $btn-normal-txt-color-new; diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 9490e6d8e..875109f41 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -180,5 +180,8 @@ export const fromRoute = { endpointQuery: 'endpointQuery', terminalLog: 'terminalLog', operationLog: 'operationLog', - menus: 'menus' + menus: 'menus', + notify: 'notify', + link: 'link', + apiKey: 'apiKey' } diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 6327723b3..45928b4b7 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -946,7 +946,8 @@ const cn = { update: '更新', del: '删除', nameMaxLength: '长度应小于64', - uriRequired: '请填写正确的网址' + uriRequired: '请填写正确的网址', + create: '创建人' }, notification: { notification: 'Notification', @@ -958,7 +959,10 @@ const cn = { del: '删除', nameMaxLength: '长度应小于64', uriRequired: '必填项', - filePathReg: '请输入正确的文件路径' + filePathReg: '请输入正确的文件路径', + create: '新建通知方式', + invalid: '停用', + valid: '可用' }, reset: { reset: '重置', @@ -971,6 +975,13 @@ const cn = { promptTitle: '确认密码', yes: '是', no: '否' + }, + apiKey: { + apiKey: 'API key', + role: '角色', + create: '创建人', + creatAt: '创建时间', + expireAt: '过期时间' } }, assetType: { diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 945ec2b37..8b8a1c544 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -173,7 +173,8 @@ const en = { login: { username: 'Username', password: 'Password', - login: 'Login' + login: 'Login', + upload: 'Upload license' }, dashboard: { title: 'Dashboard', @@ -898,7 +899,7 @@ const en = { second: 'second', day: 'day', maxSeries: 'Query max series', - unsaved: 'Unsaved tip', + unsaved: 'Unsaved prompt', mapConfig: 'Map center', mapTitle: 'Configurate map', lat: 'latitude', @@ -950,19 +951,26 @@ const en = { update: 'Update', del: 'Delete', nameMaxLength: 'The length should be less than 64', - uriRequired: 'Please fill in the correct url' + uriRequired: 'Please fill in the correct url', + create: 'Creator' }, notification: { notification: 'Notification', name: 'Name', filePath: 'File path', operation: 'Operation', + account: 'Account', + state: 'State', + buildIn: 'Build in', add: 'Add', update: 'Update', del: 'Delete', nameMaxLength: 'The length should be less than 64', uriRequired: 'Required', - filePathReg: 'Please enter the correct file path' + filePathReg: 'Please enter the correct file path', + create: 'Create notification', + invalid: 'Invalid', + valid: 'Valid' }, reset: { reset: 'Reset', @@ -975,6 +983,13 @@ const en = { promptTitle: 'Confirm', yes: 'Yes', no: 'No' + }, + apiKey: { + apiKey: 'API key', + role: 'Role', + create: 'Creator', + creatAt: 'Create at', + expireAt: 'Expire at' } }, assetType: { diff --git a/nezha-fronted/src/components/common/login.vue b/nezha-fronted/src/components/common/login.vue index 966744dbc..4d2222b03 100644 --- a/nezha-fronted/src/components/common/login.vue +++ b/nezha-fronted/src/components/common/login.vue @@ -14,7 +14,7 @@
- +
@@ -25,6 +25,22 @@
+
+
{{license.warnInfo}}
+
INSTALLATION ID:{{license.token}}
+
+ + + +
+
Build on Prometheus @@ -43,6 +59,13 @@ export default { pin: '', remember: false }, + license: { + warnInfo: '', + token: '', + valid: false + }, + uploadFileList: [], + uploadFile: { file: '', path: '', uuid: '' }, loading: false, lang: localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en', // en/cn langListShow: false @@ -54,7 +77,7 @@ export default { if (this.loading) { return } - if (this.validateLogin() && (this.$route.path == '/' || this.$route.path == '/login')) { + if (this.license.valid && this.validateLogin() && (this.$route.path == '/' || this.$route.path == '/login')) { this.loading = true this.$post('sys/login', this.loginData).then(res => { if (res.code == 200) { @@ -85,6 +108,36 @@ export default { } else { return true } + }, + licenseStat: function () { + this.$get('/sys/license/state').then(response => { + if (response.code === 200) { + this.license.warnInfo = '' + this.license.valid = true + } else { + this.license.valid = false + this.license.warnInfo = response.msg + } + this.license.token = response.token + }) + }, + handleChange: function (file, fileList) { + if (fileList.length > 0) { + this.uploadFileList = [fileList[fileList.length - 1]] + } + this.uploadFile.file = this.uploadFileList[0] + this.upload() + }, + upload () { + const form = new FormData() + form.append('file', this.uploadFile.file.raw) + this.$post('/sys/license/upload', form, { 'Content-Type': 'multipart/form-data' }).then(res => { + if (res.code == 200) { + this.licenseStat() + } else { + this.$message.error(res.msg) + } + }) } }, watch: { @@ -105,6 +158,7 @@ export default { } } document.getElementById('usernameInput').focus() + this.licenseStat() } } @@ -247,4 +301,31 @@ export default { right: 0; transform: translateY(-50%); } +.login-license{ + margin-top: 40px; + text-align: center; + line-height: 30px; + .license-warn{ + color: #EF7458; + } + .license-info{ + white-space: nowrap; + } + .login-btn{ + height: 30px; + width: 120px; + } +} +.login-btn.nz-btn-disabled{ + background-image: none; + color: #e5e5e5; + background-color: #ffffff; + border-color: #e5e5e5 ; + cursor: default; +} + + diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index 5f2b1c0f7..202e1e7fd 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -57,7 +57,12 @@ export default { selectionChange (objs) { this.batchDeleteObjs = objs }, - getTableData () { + getTableData (params) { + if (params && Object.keys(params).length > 0) { + for (const key in params) { + this.$set(this.searchLabel, key, params[key]) + } + } this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index f7278ee4f..914089ca7 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -10,7 +10,10 @@ export default { type: String, default: '100%' }, - url: { + api: { + type: String + }, + tableId: { type: String } }, diff --git a/nezha-fronted/src/components/common/table/nzDataList.vue b/nezha-fronted/src/components/common/table/nzDataList.vue index e90e52e31..7c91dd04f 100644 --- a/nezha-fronted/src/components/common/table/nzDataList.vue +++ b/nezha-fronted/src/components/common/table/nzDataList.vue @@ -14,7 +14,7 @@
- diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue index 612e1162c..3be3b4109 100644 --- a/nezha-fronted/src/components/layout/header.vue +++ b/nezha-fronted/src/components/layout/header.vue @@ -492,6 +492,7 @@ export default { } else { if (getBreadCrumb(list[i].children, crumb)) { crumb.unshift(list[i]) + return true } } } diff --git a/nezha-fronted/src/components/page/config/snmp.vue b/nezha-fronted/src/components/page/config/snmp.vue index 7b6894c83..3b9fca12c 100644 --- a/nezha-fronted/src/components/page/config/snmp.vue +++ b/nezha-fronted/src/components/page/config/snmp.vue @@ -46,7 +46,7 @@ export default { } }, watch: { - route: { + $routePath: { immediate: true, handler (n, o) { if (n.indexOf('mib') != -1 && this.$route.params.tab) { diff --git a/nezha-fronted/src/components/page/config/system.vue b/nezha-fronted/src/components/page/config/system.vue index 7c3b6a93b..f75df1bf8 100644 --- a/nezha-fronted/src/components/page/config/system.vue +++ b/nezha-fronted/src/components/page/config/system.vue @@ -1,6 +1,6 @@