summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzyh <[email protected]>2022-08-15 13:51:38 +0800
committerzyh <[email protected]>2022-08-15 13:51:38 +0800
commit8a66ec7464c511a36ce0ce99045de48e44fd6ddc (patch)
tree9b1328c73f1c7d1c5b3f22ab2e37519714dfba65
parent5aeab2338d2dcbab0589fe7608336cbd6e09cf18 (diff)
NEZ-2119 fix:修改输入框时国际化错误rel-22.07.05
-rw-r--r--nezha-fronted/src/components/common/searchInput.vue11
-rw-r--r--nezha-fronted/src/components/common/searchSelectInfo.js330
-rw-r--r--nezha-fronted/src/components/common/searchSelectInfo.vue286
3 files changed, 338 insertions, 289 deletions
diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue
index f315b868c..b591a328e 100644
--- a/nezha-fronted/src/components/common/searchInput.vue
+++ b/nezha-fronted/src/components/common/searchInput.vue
@@ -266,15 +266,16 @@
</template>
<script>
-import searchSelectInfo from './searchSelectInfo' // 搜索框组件--下拉框内容
+import searchSelectMixin from './searchSelectInfo' // 搜索框组件--下拉框内容
export default {
name: 'searchInput',
+ mixins: [searchSelectMixin],
data () {
return {
selectDom: { top: '', left: '', tempTop: '', show: true }, // 选择弹框的位置
clearSearchShow: false,
select_conditionsName: '',
- selectInfoList: searchSelectInfo,
+ selectInfoList: [],
select_title: '',
other: '',
localStorage_display: true,
@@ -290,7 +291,7 @@ export default {
groupSelect: [],
projectSelect: [],
severitySelect: [],
- alertTypesSelect: searchSelectInfo.searchMetrics,
+ alertTypesSelect: [],
moduleSelect: [],
modelSelect: [],
gnameList: [],
@@ -330,6 +331,10 @@ export default {
assetTypeTree: []
}
},
+ created () {
+ this.selectInfoList = this.searchSelectInfo
+ this.alertTypesSelect = this.searchSelectInfo.searchMetrics
+ },
watch: {
defaultValue: {
immediate: true,
diff --git a/nezha-fronted/src/components/common/searchSelectInfo.js b/nezha-fronted/src/components/common/searchSelectInfo.js
new file mode 100644
index 000000000..6c45c760d
--- /dev/null
+++ b/nezha-fronted/src/components/common/searchSelectInfo.js
@@ -0,0 +1,330 @@
+import i18n from './i18n'
+export default {
+ data () {
+ return {
+ searchSelectInfo: { // value: 传给后台的值;label:显示给用户看的值
+ severity: [ // 告警级别
+ {
+ value: 'P1',
+ label: i18n.t('alert.config.P1')
+ },
+ {
+ value: 'P2',
+ label: i18n.t('alert.config.P2')
+ },
+ {
+ value: 'P3',
+ label: i18n.t('alert.config.P3')
+ }
+ ],
+ promType: [ // promServer类型
+ {
+ value: 1,
+ label: i18n.t('overall.global')
+ },
+ {
+ value: 2,
+ label: 'Per-Datacenter'
+ }
+ ],
+ alertType: [ // 告警类型
+ {
+ value: 1,
+ label: i18n.t('project.project.projectName')
+ },
+ {
+ value: 2,
+ label: i18n.t('overall.module')
+ },
+ {
+ value: 3,
+ label: i18n.t('alert.config.typeOption.asset')
+ }
+ ],
+ assetState: [ // 资产入库/出库状态
+ {
+ value: 1,
+ label: i18n.t('asset.inStock')
+ }, {
+ value: 2,
+ label: i18n.t('asset.notInStock')
+ }, {
+ value: 3,
+ label: i18n.t('asset.suspended')
+ }
+ ],
+ endpointState: [
+ {
+ value: 1,
+ label: i18n.t('config.agent.up')
+ }, {
+ value: 0,
+ label: i18n.t('asset.down')
+ }, {
+ value: 2,
+ label: i18n.t('asset.suspended')
+ }
+ ],
+ promState: [
+ {
+ value: 1,
+ label: i18n.t('config.agent.up')
+ }, {
+ value: '0,-1',
+ label: i18n.t('asset.down')
+ }
+ ],
+ ipamState: [
+ {
+ value: 1,
+ label: i18n.t('overall.ipam.available')
+ }, {
+ value: 2,
+ label: i18n.t('overall.ipam.transient')
+ }, {
+ value: 3,
+ label: i18n.t('overall.ipam.used')
+ }
+
+ ],
+ pingStatus: [
+ {
+ value: '0',
+ label: i18n.t('license.inactive')
+ },
+ {
+ value: '1',
+ label: i18n.t('overall.active')
+ }
+ ],
+ credentialType: [
+ {
+ value: 2,
+ label: 'V2'
+ }, {
+ value: 3,
+ label: 'V3'
+ }
+ ],
+ operation: [
+ {
+ value: 'add',
+ label: i18n.t('buttons.add')
+ },
+ {
+ value: 'update',
+ label: i18n.t('profile.update')
+ },
+ {
+ value: 'query',
+ label: i18n.t('overall.query')
+ },
+ {
+ value: 'import',
+ label: i18n.t('overall.importExcel')
+ },
+ {
+ value: 'export',
+ label: i18n.t('overall.exportExcel')
+ },
+ {
+ value: 'delete',
+ label: i18n.t('overall.delete')
+ },
+ {
+ value: 'reset',
+ label: i18n.t('overall.reset')
+ },
+ {
+ value: 'unknown',
+ label: i18n.t('config.operationlog.operations.unknown')
+ },
+ {
+ value: 'login',
+ label: i18n.t('login.login')
+ },
+ {
+ value: 'logout',
+ label: i18n.t('overall.signOut')
+ }
+ ],
+ alertMessageState: [
+ {
+ value: '1',
+ label: i18n.t('alert.list.pending')
+ },
+ {
+ value: '2',
+ label: i18n.t('alert.list.expired')
+ }
+ ],
+ protocol: [
+ {
+ value: 'SSH',
+ label: i18n.t('config.terminallog.SSH')
+ },
+ {
+ value: 'TELNET',
+ label: i18n.t('asset.telnetProtocol')
+ }
+ ],
+ state: [
+ {
+ value: 'success',
+ label: i18n.t('overall.result.success')
+ },
+ {
+ value: 'fail',
+ label: i18n.t('overall.result.failed')
+ }
+ ],
+ dcState: [
+ {
+ value: 'ON',
+ label: i18n.t('overall.enabled')
+ },
+ {
+ value: 'OFF',
+ label: i18n.t('overall.disabled')
+ }
+ ],
+ recordState: [
+ {
+ value: 1,
+ label: i18n.t('overall.enabled')
+ },
+ {
+ value: 0,
+ label: i18n.t('overall.disabled')
+ }
+ ],
+ starrd: [
+ {
+ value: 1,
+ label: i18n.t('overall.starred')
+ },
+ {
+ value: 0,
+ label: i18n.t('overall.unstarred')
+ }
+ ],
+ recordType: [
+ {
+ value: 1,
+ label: i18n.t('overall.metric')
+ },
+ {
+ value: 2,
+ label: i18n.t('overall.logs')
+ }
+ ],
+ buildIn: [
+ {
+ value: 1,
+ label: i18n.t('overall.buildIn')
+ },
+ {
+ value: 0,
+ label: i18n.t('overall.unbuildIn')
+ }
+ ],
+ ack: [
+ {
+ value: '1',
+ label: i18n.t('tip.yes')
+ },
+ {
+ value: '0',
+ label: i18n.t('tip.no')
+ }
+ ],
+ varType: [
+ { value: '1', label: i18n.t('asset.asset') },
+ { value: '2', label: i18n.t('asset.endpoint') }
+ ],
+ chartType: [
+ {
+ value: 'line',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.line.label')
+ },
+ {
+ value: 'stackArea',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.stackArea.label')
+ },
+ {
+ value: 'bar',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.bar.label')
+ },
+ {
+ value: 'singleStat',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.singleStat.label')
+ },
+ {
+ value: 'pie',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.pie.label')
+ },
+ {
+ value: 'table',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.table.label')
+ },
+ {
+ value: 'alertList',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.alertList.label')
+ },
+ {
+ value: 'text',
+ label: i18n.t('dashboard.panel.chartForm.typeVal.text.label')
+ },
+ {
+ value: 'url',
+ label: i18n.t('dashboard.panel.chartForm.url')
+ },
+ {
+ value: 'group',
+ label: i18n.t('dashboard.panel.chartForm.group')
+ }
+ ],
+ terminalStatus: [
+ {
+ value: 0,
+ label: i18n.t('config.terminallog.statusItem.connecting')
+ }, {
+ value: 1,
+ label: i18n.t('config.terminallog.statusItem.connectionFailed')
+ }, {
+ value: 2,
+ label: i18n.t('config.terminallog.statusItem.over')
+ }, {
+ value: 3,
+ label: i18n.t('config.terminallog.statusItem.kickedOut')
+ }, {
+ value: 4,
+ label: i18n.t('config.terminallog.statusItem.unknownError')
+ }
+ ],
+ searchMetrics: [
+ {
+ id: 1,
+ name: i18n.t('overall.metric'),
+ searchType: 'alertTypes'
+ },
+ {
+ id: 2,
+ name: i18n.t('overall.logs'),
+ searchType: 'alertTypes'
+ },
+ {
+ id: 3,
+ name: i18n.t('overall.SNMPTrap'),
+ searchType: 'alertTypes'
+ }
+ ],
+ ipamType: [
+ { label: 'IPV4', value: 4 },
+ { label: 'IPV6', value: 6 }
+ ]
+ }
+
+ }
+ }
+}
diff --git a/nezha-fronted/src/components/common/searchSelectInfo.vue b/nezha-fronted/src/components/common/searchSelectInfo.vue
deleted file mode 100644
index 5c58a5fae..000000000
--- a/nezha-fronted/src/components/common/searchSelectInfo.vue
+++ /dev/null
@@ -1,286 +0,0 @@
-<script>
-import i18n from './i18n'
-const searchSelectInfo = { // value: 传给后台的值;label:显示给用户看的值
- severity: [ // 告警级别
- {
- value: 'P1',
- label: i18n.t('alert.config.P1')
- },
- {
- value: 'P2',
- label: i18n.t('alert.config.P2')
- },
- {
- value: 'P3',
- label: i18n.t('alert.config.P3')
- }
- ],
- promType: [ // promServer类型
- {
- value: 1,
- label: i18n.t('overall.global')
- },
- {
- value: 2,
- label: 'Per-Datacenter'
- }
- ],
- alertType: [ // 告警类型
- {
- value: 1,
- label: i18n.t('project.project.projectName')
- },
- {
- value: 2,
- label: i18n.t('overall.module')
- },
- {
- value: 3,
- label: i18n.t('alert.config.typeOption.asset')
- }
- ],
- assetState: [ // 资产入库/出库状态
- {
- value: 1,
- label: i18n.t('asset.inStock')
- }, {
- value: 2,
- label: i18n.t('asset.notInStock')
- }, {
- value: 3,
- label: i18n.t('asset.suspended')
- }
- ],
- endpointState: [
- {
- value: 1,
- label: i18n.t('config.agent.up')
- }, {
- value: 0,
- label: i18n.t('asset.down')
- }, {
- value: 2,
- label: i18n.t('asset.suspended')
- }
- ],
- promState: [
- {
- value: 1,
- label: i18n.t('config.agent.up')
- }, {
- value: '0,-1',
- label: i18n.t('asset.down')
- }
- ],
- ipamState: [
- {
- value: 1,
- label: i18n.t('overall.ipam.available')
- }, {
- value: 2,
- label: i18n.t('overall.ipam.transient')
- }, {
- value: 3,
- label: i18n.t('overall.ipam.used')
- }
-
- ],
- pingStatus: [
- {
- value: '0',
- label: i18n.t('license.inactive')
- },
- {
- value: '1',
- label: i18n.t('overall.active')
- }
- ],
- credentialType: [
- {
- value: 2,
- label: 'V2'
- }, {
- value: 3,
- label: 'V3'
- }
- ],
- operation: [
- {
- value: 'add',
- label: i18n.t('buttons.add')
- },
- {
- value: 'update',
- label: i18n.t('profile.update')
- },
- {
- value: 'query',
- label: i18n.t('overall.query')
- },
- {
- value: 'import',
- label: i18n.t('overall.importExcel')
- },
- {
- value: 'export',
- label: i18n.t('overall.exportExcel')
- },
- {
- value: 'delete',
- label: i18n.t('overall.delete')
- },
- {
- value: 'reset',
- label: i18n.t('overall.reset')
- },
- {
- value: 'unknown',
- label: i18n.t('config.operationlog.operations.unknown')
- },
- {
- value: 'login',
- label: i18n.t('login.login')
- },
- {
- value: 'logout',
- label: i18n.t('overall.signOut')
- }
- ],
- alertMessageState: [
- {
- value: '1',
- label: i18n.t('alert.list.pending')
- },
- {
- value: '2',
- label: i18n.t('alert.list.expired')
- }
- ],
- protocol: [
- {
- value: 'SSH',
- label: i18n.t('config.terminallog.SSH')
- },
- {
- value: 'TELNET',
- label: i18n.t('asset.telnetProtocol')
- }
- ],
- state: [
- {
- value: 'success',
- label: i18n.t('overall.result.success')
- },
- {
- value: 'fail',
- label: i18n.t('overall.result.failed')
- }
- ],
- dcState: [
- {
- value: 'ON',
- label: i18n.t('overall.enabled')
- },
- {
- value: 'OFF',
- label: i18n.t('overall.disabled')
- }
- ],
- ack: [
- {
- value: '1',
- label: i18n.t('tip.yes')
- },
- {
- value: '0',
- label: i18n.t('tip.no')
- }
- ],
- varType: [
- { value: '1', label: i18n.t('asset.asset') },
- { value: '2', label: i18n.t('asset.endpoint') }
- ],
- chartType: [
- {
- value: 'line',
- label: i18n.t('dashboard.panel.chartForm.typeVal.line.label')
- },
- {
- value: 'stackArea',
- label: i18n.t('dashboard.panel.chartForm.typeVal.stackArea.label')
- },
- {
- value: 'bar',
- label: i18n.t('dashboard.panel.chartForm.typeVal.bar.label')
- },
- {
- value: 'singleStat',
- label: i18n.t('dashboard.panel.chartForm.typeVal.singleStat.label')
- },
- {
- value: 'pie',
- label: i18n.t('dashboard.panel.chartForm.typeVal.pie.label')
- },
- {
- value: 'table',
- label: i18n.t('dashboard.panel.chartForm.typeVal.table.label')
- },
- {
- value: 'alertList',
- label: i18n.t('dashboard.panel.chartForm.typeVal.alertList.label')
- },
- {
- value: 'text',
- label: i18n.t('dashboard.panel.chartForm.typeVal.text.label')
- },
- {
- value: 'url',
- label: i18n.t('dashboard.panel.chartForm.url')
- },
- {
- value: 'group',
- label: i18n.t('dashboard.panel.chartForm.group')
- }
- ],
- terminalStatus: [
- {
- value: 0,
- label: i18n.t('config.terminallog.statusItem.connecting')
- }, {
- value: 1,
- label: i18n.t('config.terminallog.statusItem.connectionFailed')
- }, {
- value: 2,
- label: i18n.t('config.terminallog.statusItem.over')
- }, {
- value: 3,
- label: i18n.t('config.terminallog.statusItem.kickedOut')
- }, {
- value: 4,
- label: i18n.t('config.terminallog.statusItem.unknownError')
- }
- ],
- searchMetrics: [
- {
- id: 1,
- name: i18n.t('overall.metric'),
- searchType: 'alertTypes'
- },
- {
- id: 2,
- name: i18n.t('overall.logs'),
- searchType: 'alertTypes'
- },
- {
- id: 3,
- name: i18n.t('overall.SNMPTrap'),
- searchType: 'alertTypes'
- }
- ],
- ipamType: [
- { label: 'IPV4', value: 4 },
- { label: 'IPV6', value: 6 }
- ]
-}
-export default searchSelectInfo
-</script>