From fa8867124ebf8c322731c95f51f9ae746f429cc7 Mon Sep 17 00:00:00 2001 From: maslow Date: Mon, 9 Aug 2021 16:23:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=92=88=E5=AF=B9=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=20devops=20db=20=E9=9B=86=E5=90=88=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=EF=BC=9B=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E4=BD=93=E9=AA=8C=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/devops-admin/src/api/constants.js | 24 ++++++++++++ .../src/views/database/collections.vue | 24 ++++++++---- .../src/views/database/policies.vue | 13 ++++--- .../src/views/database/policy.vue | 39 ++++++++++++++----- .../views/deploy/components/deploy-panel.vue | 5 ++- .../src/views/deploy/requests.vue | 8 ++-- .../devops-admin/src/views/deploy/targets.vue | 11 +++--- .../src/views/development/function.vue | 9 ++--- .../src/views/development/functions.vue | 13 ++++--- .../src/views/development/triggers.vue | 14 +++---- .../devops-admin/src/views/system/admin.vue | 8 ++-- .../devops-admin/src/views/system/role.vue | 13 +++---- 12 files changed, 119 insertions(+), 62 deletions(-) create mode 100644 packages/devops-admin/src/api/constants.js diff --git a/packages/devops-admin/src/api/constants.js b/packages/devops-admin/src/api/constants.js new file mode 100644 index 0000000000..a44c7fcc7e --- /dev/null +++ b/packages/devops-admin/src/api/constants.js @@ -0,0 +1,24 @@ +const coll_prefix = 'devops_' + +const Constants = { + function_collection: '__deployed__functions', + trigger_collection: '__deployed__triggers', + policy_collection: '__deployed__policies', + coll_prefix: coll_prefix, + cn: { + admins: coll_prefix + 'admins', + permissions: coll_prefix + 'permissions', + roles: coll_prefix + 'roles', + policies: coll_prefix + 'policies', + functions: coll_prefix + 'functions', + function_history: coll_prefix + 'function_history', + triggers: coll_prefix + 'triggers', + deploy_targets: coll_prefix + 'deploy_targets', + deploy_requests: coll_prefix + 'deploy_requests' + } +} + +Object.freeze(Constants) +Object.freeze(Object.cn) + +export { Constants } diff --git a/packages/devops-admin/src/views/database/collections.vue b/packages/devops-admin/src/views/database/collections.vue index d722ec1de8..523aa470d8 100644 --- a/packages/devops-admin/src/views/database/collections.vue +++ b/packages/devops-admin/src/views/database/collections.vue @@ -3,7 +3,7 @@
集合名称: - +
- + 记录列表 索引管理 @@ -22,11 +22,11 @@
- - 搜索记录 - 添加记录 + + 搜索记录 + 添加记录
- +
_id: {{ item._id }} @@ -50,7 +50,7 @@ 更新 - + @@ -356,4 +356,14 @@ export default { color: blue; } } + + .el-main { + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; + // .db-editor { + // border: 1px solid lightgray + // } + } diff --git a/packages/devops-admin/src/views/database/policies.vue b/packages/devops-admin/src/views/database/policies.vue index 212247a8ac..77b5028cb2 100644 --- a/packages/devops-admin/src/views/database/policies.vue +++ b/packages/devops-admin/src/views/database/policies.vue @@ -139,6 +139,7 @@ import Pagination from '@/components/Pagination' // secondary package based on el-pagination import { db } from '../../api/cloud' import DeployPanel from '../deploy/components/deploy-panel.vue' +import { Constants } from '../../api/constants' // 默认化创建表单的值 function getDefaultFormValue() { @@ -204,7 +205,7 @@ export default { }, methods: { async getFunctions() { - const r = await db.collection('__functions') + const r = await db.collection(Constants.cn.functions) .where({ status: 1 }) .get() @@ -228,7 +229,7 @@ export default { } // 执行数据查询 - const res = await db.collection('__policies') + const res = await db.collection(Constants.cn.policies) .where(query) .limit(limit) .skip((page - 1) * limit) @@ -238,7 +239,7 @@ export default { this.list = res.data // 获取数据总数 - const { total } = await db.collection('__policies') + const { total } = await db.collection(Constants.cn.policies) .where(query) .limit(limit) .skip((page - 1) * limit) @@ -268,7 +269,7 @@ export default { if (!valid) { return } // 执行创建请求 - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .add(this.form) if (!r.id) { @@ -315,7 +316,7 @@ export default { } // 执行更新请求 - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .where({ _id: this.form._id }) .update(data) @@ -343,7 +344,7 @@ export default { await this.$confirm('确认要删除此数据?', '删除确认') // 执行删除请求 - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .where({ _id: row._id }) .remove() diff --git a/packages/devops-admin/src/views/database/policy.vue b/packages/devops-admin/src/views/database/policy.vue index b468b36a7f..b5b420d7cf 100644 --- a/packages/devops-admin/src/views/database/policy.vue +++ b/packages/devops-admin/src/views/database/policy.vue @@ -17,7 +17,7 @@
选择集合
- + {{ item }} @@ -29,7 +29,7 @@ 保存 删除
- +
@@ -76,6 +76,7 @@ import JsonEditor from '@/components/JsonEditor/rule' import { db } from '../../api/cloud' import $ from 'lodash' import { publishPolicy } from '../../api/publish' +import { Constants } from '../../api/constants' const defaultValue = '{}' const defaultForm = { @@ -125,7 +126,7 @@ export default { methods: { async getPolicies() { this.loading = true - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .get() if (!r.ok) { @@ -154,7 +155,7 @@ export default { this.loading = true const rule_data = this.value const key = `rules.${this.collection_name}` - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .where({ _id: this.policy_id }) @@ -187,7 +188,7 @@ export default { this.loading = true const key = `rules.${this.form.collection}` - const { total } = await db.collection('__policies') + const { total } = await db.collection(Constants.cn.policies) .where({ _id: this.form.policy_id, [key]: db.command.exists(true) @@ -198,7 +199,7 @@ export default { this.$message('该集合规则已存在!') return } - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .where({ _id: this.form.policy_id, [key]: db.command.exists(false) @@ -244,7 +245,7 @@ export default { this.loading = true const key = `rules.${this.collection_name}` - const r = await db.collection('__policies') + const r = await db.collection(Constants.cn.policies) .where({ _id: this.policy_id, [key]: db.command.exists(true) @@ -314,7 +315,9 @@ export default { display: flex; .collection-list { - width: 200px; + width: 250px; + + padding-bottom: 10px; border-radius: 5px; box-sizing: border-box; @@ -323,8 +326,20 @@ export default { color: gray; margin-bottom: 10px; } - .collection-radio { + + .radio-group { width: 100%; + height: 640px; + overflow-y: scroll; + overflow-x: hidden; + } + + .radio-group::-webkit-scrollbar { + display: none; + } + + .collection-radio { + width: 80%; margin-bottom: 10px; margin-left: 0px; } @@ -340,12 +355,16 @@ export default { display: flex; width: 400px; justify-content: flex-start; - margin-bottom: 5px; + margin-bottom: 10px; .btn { margin-left: 15px; } } + + .editor { + border: 1px solid lightgray + } } } diff --git a/packages/devops-admin/src/views/deploy/components/deploy-panel.vue b/packages/devops-admin/src/views/deploy/components/deploy-panel.vue index 174221f6b6..83ecae580b 100644 --- a/packages/devops-admin/src/views/deploy/components/deploy-panel.vue +++ b/packages/devops-admin/src/views/deploy/components/deploy-panel.vue @@ -59,6 +59,7 @@