diff --git a/package.json b/package.json index 7457f36e..4aed6df7 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@amcharts/amcharts4": "^4.10.20", "@amcharts/amcharts4-geodata": "^4.1.20", + "@highlightjs/vue-plugin": "^2.0.1", "axios": "^0.21.1", "babel-plugin-lodash": "^3.3.4", "core-js": "^3.6.5", @@ -22,11 +23,13 @@ "moment-timezone": "^0.5.33", "node-sass": "^4.14.1", "postcss-px2rem-exclude": "0.0.6", + "prismjs": "^1.24.1", "sass-loader": "^8.0.2", "sass-resources-loader": "^2.2.1", "vue": "^3.0.0", "vue-grid-layout": "^3.0.0-beta1", "vue-i18n": "^9.1.6", + "vue-prism-editor": "^2.0.0-alpha.2", "vue-router": "^4.0.8", "vuex": "^4.0.1" }, diff --git a/src/assets/css/rightBoxCommon.scss b/src/assets/css/rightBoxCommon.scss index 63976f59..9dcb74fd 100644 --- a/src/assets/css/rightBoxCommon.scss +++ b/src/assets/css/rightBoxCommon.scss @@ -1,3 +1,6 @@ +.el-drawer__body { + height: 100%; +} .right-box, .right-sub-box { display: flex; flex-direction: column; diff --git a/src/components/rightBox/settings/GalaxyProxyBox.vue b/src/components/rightBox/settings/GalaxyProxyBox.vue new file mode 100644 index 00000000..e84f61db --- /dev/null +++ b/src/components/rightBox/settings/GalaxyProxyBox.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/src/components/table/CnDataList.vue b/src/components/table/CnDataList.vue index f0e81afb..cdc192b0 100644 --- a/src/components/table/CnDataList.vue +++ b/src/components/table/CnDataList.vue @@ -14,7 +14,7 @@ diff --git a/src/main.js b/src/main.js index 0ddf75fc..0ee0064a 100644 --- a/src/main.js +++ b/src/main.js @@ -7,6 +7,8 @@ import commonMixin from '@/mixins/common' import { cancelWithChange, clickOutside, noData } from '@/utils/tools' import { ClickOutside } from 'element-plus/lib/directives' import i18n from '@/i18n' +import hljsVuePlugin from '@highlightjs/vue-plugin' +import 'highlight.js/styles/color-brewer.css' import '@/assets/css/main.scss' // 样式入口 // import VueGridLayout from 'vue-grid-layout' import ElementPlus from 'element-plus' @@ -30,6 +32,7 @@ app.use(router) app.use(store) app.use(ElementPlus) app.use(i18n) +app.use(hljsVuePlugin) // app.use(VueGridLayout) app.directive('has', hasPermission) // 注册指令 diff --git a/src/mixins/dataList.js b/src/mixins/dataList.js index 20a7bcfc..ed261072 100644 --- a/src/mixins/dataList.js +++ b/src/mixins/dataList.js @@ -66,11 +66,9 @@ export default { if (params) { this.searchLabel = { ...this.searchLabel, ...params } } - // console.log(...this.pageObj) this.searchLabel = { ...this.searchLabel, ...this.pageObj } this.tools.loading = true - // console.log(typeof this.searchLabel) - console.log(delete this.searchLabel.total) + delete this.searchLabel.total get(this.url, this.searchLabel).then(response => { this.tools.loading = false if (response.code === 200) { diff --git a/src/mixins/rightBox.js b/src/mixins/rightBox.js index 509470c1..9adc76bc 100644 --- a/src/mixins/rightBox.js +++ b/src/mixins/rightBox.js @@ -1,3 +1,5 @@ +import { post, put } from '@/utils/http' + export default { props: { object: { @@ -17,6 +19,39 @@ export default { esc (refresh) { this.unblockOperation() this.$emit('close', refresh) + }, + save () { + if (this.blockOperation.save) { return } + this.blockOperation.save = true + + this.$refs.userForm.validate((valid) => { + if (valid) { + if (this.editObject.id) { + put(this.url, this.editObject).then(res => { + this.blockOperation.save = false + if (res.code === 200) { + this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.esc(true) + } else { + this.$message.error(res.msg) + } + }) + } else { + post(this.url, this.editObject).then(res => { + this.blockOperation.save = false + if (res.code === 200) { + this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.esc(true) + } else { + this.$message.error(res.msg) + } + }) + } + } else { + this.blockOperation.save = false + return false + } + }) } }, watch: { diff --git a/src/mixins/table.js b/src/mixins/table.js index d15f9462..65ab4822 100644 --- a/src/mixins/table.js +++ b/src/mixins/table.js @@ -40,18 +40,6 @@ export default { methods: { tableOperation ([command, row, param]) { switch (command) { - case 'recordTab': { - this.$emit('showBottomBox', 'recordTab', row) - break - } - case 'endpointQuery': { - this.$emit('showBottomBox', 'endpointQuery', row) - break - } - case 'fastSilence': { - this.$emit('addSilence', row, param) - break - } default: this.$emit(command, row) break diff --git a/src/router/index.js b/src/router/index.js index a4e61a47..eb35f671 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -33,6 +33,10 @@ const routes = [ { path: '/entityExplorer', component: () => import('@/views/entities/EntityExplorer') + }, + { + path: '/galaxyProxy', + component: () => import('@/views/settings/GalaxyProxy') } ] } diff --git a/src/utils/api.js b/src/utils/api.js index b19c7dd4..1fa3f5ad 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -12,6 +12,10 @@ export const api = { permission: '/sys/user/permissions', i18n: '/sys/i18n/lang', dict: '/sys/dict', + user: '/sys/user', + role: '/sys/role', + galaxyProxy: '/galaxy/setting', + operationLog: '/sys/log', // 业务 panel: '/visual/panel', chart: '/visual/chart', diff --git a/src/utils/constants.js b/src/utils/constants.js index d0bd2aa4..3d943433 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -29,7 +29,8 @@ export const fromRoute = { trafficSummary: 'trafficSummary', networkAppPerformance: 'networkAppPerformance', dnsServiceInsights: 'dnsServiceInsights', - user: 'user' + user: 'user', + galaxyProxy: 'galaxyProxy' } /* panel类别和路由之间的映射 */ diff --git a/src/utils/tools.js b/src/utils/tools.js index 90f54db3..6300b357 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -1,4 +1,4 @@ -import { ElMessageBox } from 'element-plus' +import { ElMessageBox, ElMessage } from 'element-plus' import i18n from '@/i18n' import _ from 'lodash' import { storageKey, iso36112 } from '@/utils/constants' @@ -462,3 +462,16 @@ function JSONParse (data) { return firstParse } } + +export function copyValue (item) { + const str = item + const domUrl = document.createElement('input') + domUrl.value = JSON.stringify(str) + domUrl.id = 'creatDom' + document.body.appendChild(domUrl) + domUrl.select() // 选择对象 + document.execCommand('Copy') // 执行浏览器复制命令 + const creatDom = document.getElementById('creatDom') + creatDom.parentNode.removeChild(creatDom) + ElMessage.success(i18n.global.t('tip.copySuccess')) +} diff --git a/src/views/settings/GalaxyProxy.vue b/src/views/settings/GalaxyProxy.vue new file mode 100644 index 00000000..a2bb353e --- /dev/null +++ b/src/views/settings/GalaxyProxy.vue @@ -0,0 +1,79 @@ + + + + + \ No newline at end of file diff --git a/src/views/settings/OperationLog.vue b/src/views/settings/OperationLog.vue index e027577c..f37ade67 100644 --- a/src/views/settings/OperationLog.vue +++ b/src/views/settings/OperationLog.vue @@ -7,8 +7,7 @@ :layout="['searchInput', 'elementSet','searchInput']" v-model:custom-table-title="tools.customTableTitle" :from="fromRoute.operationLog" - @search="search" - :search-msg="searchMsg"> + @search="search">