From 03173b64b942cfc35f9384c1f4839538ce147d51 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Fri, 13 Dec 2019 17:08:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20project=E3=80=81config=E3=80=81aler?= =?UTF-8?q?t=E7=95=8C=E9=9D=A2=E5=92=8C=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.project、config、alert界面 2.和后端的交互,但部分接口/原型未定,包括: --1.Alert-config link查看、编辑框暂时直接回显id --2.用户保存操作后端报错 --3.endpoint弹框页面未定,暂按现版本原型实现 --- nezha-fronted/src/assets/css/main.css | 2 +- .../src/components/common/header.vue | 76 ++++- .../src/components/common/language/en.js | 44 ++- .../src/components/page/alert/config.vue | 188 +++++++++++-- .../src/components/page/alert/list.vue | 10 +- .../src/components/page/config/account.vue | 20 +- .../src/components/page/config/promServer.vue | 133 +++++---- .../src/components/page/project/project.vue | 262 +++++++++++++++--- nezha-fronted/src/http.js | 9 +- nezha-fronted/src/store/index.js | 2 +- 10 files changed, 592 insertions(+), 154 deletions(-) diff --git a/nezha-fronted/src/assets/css/main.css b/nezha-fronted/src/assets/css/main.css index e12fbfa45..d555c8f08 100644 --- a/nezha-fronted/src/assets/css/main.css +++ b/nezha-fronted/src/assets/css/main.css @@ -361,7 +361,7 @@ html { /* end--endpoint->子弹框asset搜索框前缀和后缀*/ /* begin--自定义可编辑的el-select下拉框样式*/ .config-dropdown { - width: 550px; + width: 520px; } .config-dropdown-btn { display: inline-block; diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 7876e0637..6ecc14344 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -1,12 +1,28 @@ @@ -39,10 +55,10 @@ - +
{{$t('alert.alertList')}}
- +
{{$t('alert.alertConfig')}}
@@ -50,10 +66,10 @@ - +
{{$t('config.account.account')}}
- +
{{$t('config.promServer.promServerList')}}
@@ -101,7 +117,32 @@ export default { return { language: localStorage.getItem("language"), assetData: [], - projectData: [] + projectData: [], + createMenu: [ + { + label: this.$t('project.project.createProject'), + url: 'project', + type: 1 + }, + { + label: this.$t('project.module.createModule'), + url: 'project', + type: 2 + }, + { + label: this.$t('project.endpoint.createEndpoint'), + url: 'project', + type: 3 + }, + { + label: this.$t('asset.createAsset'), + url: 'asset' + }, + { + label: this.$t('alert.config.createAlertConfig'), + url: 'alertConfig' + } + ] } }, methods: { @@ -112,6 +153,9 @@ export default { t: +new Date() } }); + }, + createBox(item) { + }, jumpToAsset(data, id) { this.$store.state.assetData.moduleData = data; @@ -151,7 +195,7 @@ export default { this.getProjectData(); }, computed: { - projectListReload() { + projectListReloadWatch() { return this.$store.state.projectListReload; } }, @@ -159,7 +203,7 @@ export default { projectListReloadWatch(n, o) { if (n) { this.getProjectData(); - this.$store.commit('projectListReload', false); + this.$store.commit('projectListReloadChange', false); } } } @@ -266,6 +310,20 @@ export default { .header-name-jiantou { position: static !important; } +.el-menu-demo>li:first-of-type { + position: fixed; + left: 40%; + top: 0; +} +.menu-create { + line-height: 15px; + text-align: center; + padding-top: 15px; +} +.menu-create .el-icon-plus { + font-size: 12px; + line-height: 12px; +} .menu-edit { line-height: 36px; float: right; diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 67790d7c0..a45b1626a 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -15,9 +15,16 @@ const en = { search: 'Search', add: "Add", option: "Option", - clearAll: "Clear All" + clearAll: "Clear All", + }, + tip: { + confirmDelete: "Confirm Delete?", + yes: "Yes", + no: "No", + deleteSuccess: "Successfully Deleted" }, asset:{ + createAsset: "Create Asset", tableTitle: { id: 'ID', assetType: '资产类型', @@ -65,7 +72,8 @@ const en = { //侧滑框 promId: "Prometheus Server ID", createProm: "Create Prometheus Server", - editProm: "Edit Prometheus Server" + editProm: "Edit Prometheus Server", + type: "Type" }, }, alert: { @@ -86,9 +94,9 @@ const en = { charts: "Charts", //表内容 - projectalert: "Project Alert", - modulealert: "Module Alert", - devicealert: "Device Alert", + projectAlert: "Project Alert", + moduleAlert: "Module Alert", + deviceAlert: "Device Alert", pending: "Pending", expired: "Expired" }, @@ -96,11 +104,20 @@ const en = { name: "Name", receiver: "Receiver", expr: "Expr", - for: "For", + for: "For (s)", + link: 'Link', option: "Option", alertConfig: "Alert Config", - createalertConfig: "Create Alert Config", - editalertConfig: "Edit Alert Config", + createAlertConfig: "Create Alert Config", + editAlertConfig: "Edit Alert Config", + medium: "Medium", + high: "High", + low: "Low", + typeOption: { + project: 'Project', + module: 'Module', + asset: 'Asset' + } } }, project: { @@ -108,13 +125,15 @@ const en = { project: "Project", projectName: "Project Name", editProject: "Edit Project", - description: "Description" + description: "Description", + createProject: "Create Project" }, module: { module: "Module", moduleName: "Module Name", editModule: "Edit Module", description: "Description", + createModule: "Create Module", tip: { defaultEndpointSet: "Default Endpoint Set", relation: "Endpoints associated with Module will reference Port/Path/Param/Params by default" @@ -132,7 +151,12 @@ const en = { asset: "Asset", lastUpdate: "Last Update", }, - metrics: "Metrics" + metrics: { + metrics: "Metrics", + name: 'name', + type: 'Type', + description: 'Desc' + } }, ...enLocale } diff --git a/nezha-fronted/src/components/page/alert/config.vue b/nezha-fronted/src/components/page/alert/config.vue index c5f0c8f83..c6cdb1fcc 100644 --- a/nezha-fronted/src/components/page/alert/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -59,8 +59,17 @@ + +  {{severityData[1].value}} + {{severityData[0].value}} +  {{severityData[2].value}} + + + + + {{scope.row[item.prop].name}} {{scope.row[item.prop]}} @@ -85,7 +94,7 @@ {{$t('overall.save')}} {{$t('overall.edit')}} -
+
@@ -100,6 +109,7 @@
+
{{$t('alert.config.name')}}
@@ -115,6 +125,52 @@
{{alertRule.alertName}}
+ +
+
{{$t('alert.list.type')}}
+
+ + + + +
{{item.value}}
+
+
+ +
+
{{$t('alert.config.link')}}
+
+ +
{{alertRule.linkObject.name}}
+ +
+
+
{{$t('alert.config.expr')}}
@@ -128,6 +184,7 @@
{{alertRule.expr}}
+
{{$t('alert.config.for')}}
@@ -137,23 +194,36 @@ placeholder="" v-model="alertRule.last" size="small" - > + > + +
{{alertRule.last}}s
+
{{$t('alert.severity')}}
- -
{{alertRule.severity}}
+ + + {{item.value}} + + + + + +
{{alertRule.severity}}
+
{{$t('alert.summary')}}
@@ -167,6 +237,7 @@
{{alertRule.summary}}
+
{{$t('alert.description')}}
@@ -180,6 +251,7 @@
{{alertRule.description}}
+
{{$t('config.account.receiver')}}
@@ -191,7 +263,7 @@ :label="item.name" :value="item"> {{item.name}} - +
-
{{$t('overall.cancel')}}
{{alertRule.id == '' ? $t('overall.create') : $t('overall.save')}}
+
{{$t('overall.cancel')}}
{{alertRule.id == '' ? $t('overall.create') : $t('overall.save')}}
@@ -228,7 +300,7 @@ diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue index 63e5bf1bf..14f01417a 100644 --- a/nezha-fronted/src/components/page/project/project.vue +++ b/nezha-fronted/src/components/page/project/project.vue @@ -558,27 +558,16 @@
{{$t("project.project.projectName")}}
- + +
{{$t("project.project.description")}}
- + +
@@ -609,7 +598,7 @@
{{$t('overall.save')}}
-
+
@@ -628,36 +617,28 @@
{{$t("project.project.project")}}
- + + + +
{{$t("project.module.moduleName")}}
- + +
{{$t("project.module.description")}}
- + +
@@ -674,22 +655,16 @@
{{$t("project.endpoint.port")}}
- + +
{{$t("project.endpoint.path")}}
- + +
@@ -714,7 +689,7 @@
-
{{$t('overall.cancel')}}
{{currentModule.id == '' ? $t('overall.create') : $t('overall.save')}}
+
{{$t('overall.cancel')}}
{{currentModule.id == '' && moduleRightBox.isCreate ? $t('overall.create') : $t('overall.save')}}
@@ -731,9 +706,12 @@ export default { tableShow: 1, // 1.endpoint; 2.metrics projectRightBox: { show: false, - title: '' + title: '', + isCreate: false }, project: {id: '', name: '', remark: ''}, + newProject: {id: '', name: '', remark: ''}, + newModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, rightBox: { //弹出框相关 show: false, isEdit: false, //false查看,true编辑 @@ -779,19 +757,20 @@ export default { }, moduleRightBox: { show: false, - title: '' + title: '', + isCreate: false }, currentModule: { //左侧列表当前选中的module id: '', name: '', projectId: '' }, - selectedModule: { //侧滑框中选中的module + selectedModule: { //endpoint侧滑框中选中的module id: '', name: '', projectId: '' }, - selectedAsset: { //侧滑框中选中的asset + selectedAsset: { //endpoint侧滑框中选中的asset id: '', host: '', sn: '' @@ -890,13 +869,21 @@ export default { }); }, // 获取module、endpoint弹框中project下拉框数据 - getProjectData: function() { + getProjectData: function(name) { this.$get('project').then(response => { if (response.code === 200) { this.projectData = response.data.list; - console.info(this.project); - this.project = this.projectData[0]; - console.info(this.project); + if (name) { + for (let i = 0; i < this.projectData.length; i++) { + if (this.projectData[i].name == name) { + this.project = this.projectData[i]; + this.$store.commit('setProject', this.project); + break; + } + } + } else { + this.project = this.projectData[0]; + } } }); }, @@ -937,7 +924,7 @@ export default { this.$get('module', {projectId: this.$store.state.projectData.id}).then(response => { if (response.code === 200) { this.moduleData = response.data.list; - for (var i = 0; i < response.data.list.length; i++) { + for (let i = 0; i < response.data.list.length; i++) { try { var tempObj = JSON.parse(response.data.list[i].param); } catch (err) { @@ -956,7 +943,6 @@ export default { this.endPointTableData = []; this.pageObj.total = 0; } - } }); }, @@ -1082,7 +1068,10 @@ export default { this.$message({duration: 3000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.$store.commit('projectRightBoxShow', false); this.getProjectData(); - this.getModuleData(); + setTimeout(() => { + this.getModuleData(); + }, 50); + if (this.projectData.length > 0) { this.$store.commit('setProject', this.projectData[0]); } @@ -1105,6 +1094,9 @@ export default { this.rightBox.isEdit = true; this.rightBox.title = this.$t("project.endpoint.createEndpoint"); this.rightBox.show = true; + }, + toAddProject: function() { + }, // 打开endpoint详情页 detail: function(u) { @@ -1127,24 +1119,48 @@ export default { }, // 保存project projectSave: function() { - this.$put('project', this.project).then(response => { - if (response.code === 200) { - this.$store.commit('setProject', this.project); - this.$store.commit('projectListReloadChange', true); - this.$store.commit('projectRightBoxShow', false); - } - }); + if (!this.projectRightBox.isCreate) { + this.$put('project', this.project).then(response => { + if (response.code === 200) { + this.$store.commit('setProject', this.project); + this.$store.commit('projectListReloadChange', true); + this.$store.commit('projectRightBoxShow', false); + } + }); + } else { + this.$post('project', this.newProject).then(response => { + if (response.code === 200) { + this.projectRightBox.isCreate = false; + this.getProjectData(this.newProject.name); + this.$store.commit('projectListReloadChange', true); + this.$store.commit('projectRightBoxShow', false); + this.getModuleData(); + this.newProject = {id:'', name:'', remark:''}; + } + }); + } }, // 保存module moduleSave: function() { - this.currentModule.param = this.paramToJson(); - this.currentModule.projectId = this.currentModule.project.id; - this.$put('module', this.currentModule).then(response => { - if (response.code === 200) { - this.esc(3); - this.getModuleData(); - } - }); + if (!this.moduleRightBox.isCreate) { + this.currentModule.param = this.paramToJson(); + this.currentModule.projectId = this.currentModule.project.id; + this.$put('module', this.currentModule).then(response => { + if (response.code === 200) { + this.esc(3); + this.getModuleData(); + } + }); + } else { + this.newModule.param = this.paramToJson(); + this.$post('module', this.newModule).then(response => { + if (response.code === 200) { + this.esc(3); + this.getModuleData(); + this.moduleRightBox.isCreate = false; + } + }); + } }, // 保存endpoint save: function() { @@ -1246,7 +1262,16 @@ export default { }, projectBoxShow() { return this.$store.state.projectBoxShow; - } + }, + toCreateProject() { + return this.$store.state.createProject; + }, + toCreateModule() { + return this.$store.state.createModule; + }, + toCreateEndpoint() { + return this.$store.state.createEndpoint; + }, }, watch: { sProject(n, o) { @@ -1258,6 +1283,32 @@ export default { }, projectBoxShow(n, o) { this.projectRightBox.show = n; + }, + toCreateProject(n ,o) { + if (n) { + this.$store.commit('toCreateProject', false); + this.projectRightBox.isCreate = true; + this.projectRightBox.title = this.$t('project.project.createProject'); + } + }, + toCreateModule(n ,o) { + if (n) { + this.$store.commit('toCreateModule', false); + this.moduleRightBox.show = true; + this.moduleRightBox.isCreate = true; + this.moduleRightBox.title = this.$t('project.module.createModule'); + this.newModule = {id: '', name: '', projectId: this.project.id, project: this.project, port: '', path: '', param: '', paramObj: []}; + this.paramObj = []; + } + }, + toCreateEndpoint(n, o) { + if (n) { + this.$store.commit('toCreateEndpoint', false); + this.cleanEndpoint(); + this.rightBox.show = true; + this.rightBox.isEdit = true; + this.rightBox.title = this.$t('project.endpoint.createEndpoint'); + } } } } diff --git a/nezha-fronted/src/store/index.js b/nezha-fronted/src/store/index.js index 4f4e9d26b..58c1d73ef 100644 --- a/nezha-fronted/src/store/index.js +++ b/nezha-fronted/src/store/index.js @@ -13,7 +13,11 @@ const store = new Vuex.Store({ name: '' }, projectBoxShow: false, - projectListReload: false + projectListReload: false, + createProject: false, + createModule: false, + createEndpoint: false, + createAlertConfig: false, }, getters: { }, @@ -27,7 +31,19 @@ const store = new Vuex.Store({ }, projectListReloadChange(state, reload) { state.projectListReload = reload; - } + }, + toCreateProject(state, status) { + state.createProject = status; + }, + toCreateModule(state, status) { + state.createModule = status; + }, + toCreateEndpoint(state, status) { + state.createEndpoint = status; + }, + toCreateAlertConfig(state, status) { + state.createAlertConfig = status; + }, }, actions: { } From 9ef4f00a74dee2f749399511aaa47ba18be2e4b8 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Mon, 16 Dec 2019 10:35:31 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E6=8C=89=E9=92=AEcreate=20project=E6=9C=89=E6=97=B6=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/header.vue | 1 + nezha-fronted/src/components/page/alert/config.vue | 3 ++- nezha-fronted/src/components/page/project/project.vue | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 5a568345f..bb66572bb 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -176,6 +176,7 @@ export default { } this.$store.commit('toCreateEndpoint', true); } else if (item.type == 5) { + this.$store.commit('projectRightBoxShow', false); this.$store.commit('toCreateAlertConfig', true); } }, 120); diff --git a/nezha-fronted/src/components/page/alert/config.vue b/nezha-fronted/src/components/page/alert/config.vue index 21f500ca6..510797014 100644 --- a/nezha-fronted/src/components/page/alert/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -452,7 +452,7 @@ export default { toAdd: function() { this.cleanAlertRule(); this.rightBox.isEdit = true; - this.rightBox.title = this.$t("alert.config.createalertConfig"); + this.rightBox.title = this.$t("alert.config.createAlertConfig"); this.rightBox.show = true; }, detail: function(u) { @@ -587,6 +587,7 @@ export default { }, watch: { sProject(n, o) { + this.$store.commit('toCreateAlertConfig', false); this.toAdd(); } } diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue index 14f01417a..3dd31c55b 100644 --- a/nezha-fronted/src/components/page/project/project.vue +++ b/nezha-fronted/src/components/page/project/project.vue @@ -1246,7 +1246,7 @@ export default { this.assetSearch.dropdownShow = false; } }, - mounted: function() { + created: function() { window.addEventListener('click', () => { this.esc(1); this.$store.commit('projectRightBoxShow', false); From ce2e0d5d995d54480b14d1872ade05d4cd426881 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Mon, 16 Dec 2019 17:14:58 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/assets/css/main.css | 2 +- .../src/components/common/language/en.js | 2 + .../src/components/common/searchInput.vue | 1292 +++++++++++++++++ .../src/components/page/alert/config.vue | 40 +- .../src/components/page/project/project.vue | 2 + nezha-fronted/src/main.js | 3 + 6 files changed, 1338 insertions(+), 3 deletions(-) create mode 100644 nezha-fronted/src/components/common/searchInput.vue diff --git a/nezha-fronted/src/assets/css/main.css b/nezha-fronted/src/assets/css/main.css index d555c8f08..bf1f3331f 100644 --- a/nezha-fronted/src/assets/css/main.css +++ b/nezha-fronted/src/assets/css/main.css @@ -119,7 +119,7 @@ html { float: right; } .top-tools .top-tool-search { - width: 220px; + width: 320px; } .top-tools .el-button-group { float: left; diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index a45b1626a..6b30b3cb6 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -16,6 +16,8 @@ const en = { add: "Add", option: "Option", clearAll: "Clear All", + name: 'Name', + searchTip: 'Press Enter or click to search' }, tip: { confirmDelete: "Confirm Delete?", diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue new file mode 100644 index 000000000..8f3e87f29 --- /dev/null +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -0,0 +1,1292 @@ + + + + + diff --git a/nezha-fronted/src/components/page/alert/config.vue b/nezha-fronted/src/components/page/alert/config.vue index 510797014..71125a8c5 100644 --- a/nezha-fronted/src/components/page/alert/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -2,6 +2,23 @@ .account { height: 100%; } + .right-box::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2); + border-radius: 0; + background: rgba(0,0,0,0.1); + } + .right-box::-webkit-scrollbar-thumb { + border-radius: 5px; + -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2); + background: rgba(0,0,0,0.2); + } + .right-box::-webkit-scrollbar { + width: 4px; + height: 4px; + } + .right-box { + overflow: auto; + } .account-list-option { cursor: pointer; display: inline-block; @@ -35,12 +52,14 @@ {{$t('overall.add')}} - + >--> + +
+
@@ -692,6 +693,7 @@
{{$t('overall.cancel')}}
{{currentModule.id == '' && moduleRightBox.isCreate ? $t('overall.create') : $t('overall.save')}}
+
diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js index 5bb4de70e..e53517303 100644 --- a/nezha-fronted/src/main.js +++ b/nezha-fronted/src/main.js @@ -15,7 +15,10 @@ import axios from 'axios'; import {post, get, put, del} from './http.js' import Pagination from "./components/common/pagination"; //引入全局分页组件 +import searchInput from "./components/common/searchInput"; + Vue.component("Pagination", Pagination); +Vue.component("searchInput", searchInput); Vue.prototype.$axios = axios Vue.prototype.$post = post; From bab11922cf4c243b99c5ca62168ec130bb8f20bb Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Tue, 17 Dec 2019 17:17:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.alert下两个页面的搜索功能 2.config-promserver部分搜索功能 --- .../src/components/common/language/en.js | 2 + .../src/components/common/searchInput.vue | 539 +++++++++--------- .../components/common/searchSelectInfo.vue | 44 ++ .../src/components/page/alert/config.vue | 56 +- .../src/components/page/alert/list.vue | 78 ++- .../src/components/page/config/promServer.vue | 71 ++- nezha-fronted/src/main.js | 10 +- 7 files changed, 477 insertions(+), 323 deletions(-) create mode 100644 nezha-fronted/src/components/common/searchSelectInfo.vue diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 6b30b3cb6..28c62df9b 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -17,6 +17,8 @@ const en = { option: "Option", clearAll: "Clear All", name: 'Name', + }, + search: { searchTip: 'Press Enter or click to search' }, tip: { diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index 8f3e87f29..5638832d1 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -7,7 +7,7 @@
{{other.recentSearch}} - +
    @@ -21,7 +21,7 @@
{{other.clearReSearch}} - {{other.noRecentSearch}} + {{other.noRecentSearch}}
@@ -32,20 +32,25 @@
{{val.name}}
-
- {{val.val}} +
+ {{val.valString ? val.valString : val.val}}
- +
  • {{item.label}}
-
+
    -
  • {{item.name}}
  • +
  • {{item.label}}
  • +
+
+
+
    +
  • {{item.name}}
@@ -93,16 +98,16 @@
    -
  • +
  • {{val.name}}
  • -
  • +
@@ -113,28 +118,29 @@ diff --git a/nezha-fronted/src/components/page/alert/config.vue b/nezha-fronted/src/components/page/alert/config.vue index 71125a8c5..2032a0428 100644 --- a/nezha-fronted/src/components/page/alert/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -48,18 +48,11 @@
- - - {{$t('overall.add')}} - - - - + + + {{$t('overall.add')}} + +
{ + this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo); + this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize); + this.$get('alert/rule', this.searchLabel).then(response => { if (response.code == 200) { this.tableData = response.data.list; this.pageObj.total = response.data.total; @@ -610,6 +619,15 @@ export default { pageSize(val) { this.pageObj.pageSize = val; this.getTableData(); + }, + search: function(searchObj) { + this.searchLabel = {}; + for (let item in searchObj) { + if (searchObj[item]) { + this.$set(this.searchLabel, item, searchObj[item]); + } + } + this.getTableData(); } }, mounted() { diff --git a/nezha-fronted/src/components/page/alert/list.vue b/nezha-fronted/src/components/page/alert/list.vue index 9a0d98558..1403e8ef6 100644 --- a/nezha-fronted/src/components/page/alert/list.vue +++ b/nezha-fronted/src/components/page/alert/list.vue @@ -169,16 +169,7 @@
- - - {{$t('overall.add')}} - - +