From ab03712220043d7206354b7b90a15c3f57246bd4 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 8 Jun 2020 20:05:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86asset=20user=20table=E6=8A=BD?= =?UTF-8?q?=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AssetUserTable/index.vue | 38 ++- src/components/AutoDataTable/index.vue | 16 +- src/components/DataTable/index.vue | 11 + src/components/ListTable/index.vue | 41 ++- src/components/TreeTable/index.vue | 7 +- src/i18n/langs/cn.json | 4 +- src/i18n/langs/en.json | 1 + src/layout/components/Footer/index.vue | 2 +- .../components/GenericTreeListPage/index.vue | 3 + src/layout/components/NavHeader/Help.vue | 4 +- src/styles/index.scss | 8 + src/views/xpack/Vault/VaultList.vue | 263 +++--------------- src/views/xpack/router.js | 2 +- 13 files changed, 137 insertions(+), 263 deletions(-) diff --git a/src/components/AssetUserTable/index.vue b/src/components/AssetUserTable/index.vue index 5cb6420c0..7207820b1 100644 --- a/src/components/AssetUserTable/index.vue +++ b/src/components/AssetUserTable/index.vue @@ -15,13 +15,25 @@ -
-
MFA
-
+ + +
MFA
+
+ -
- {{ this.$t('common.Confirm') }} -
+ {{ $t('common.MFARequireForSecurity') }} + + + {{ this.$t('common.Confirm') }} + + + + + + + + + @@ -59,6 +71,10 @@ export default { type: String, required: true }, + hasLeftActions: { + type: Boolean, + default: false + }, otherActions: { type: Array, default: null @@ -164,14 +180,20 @@ export default { ] }, headerActions: { - hasRightActions: false, - hasLeftActions: false, + hasLeftActions: this.hasLeftActions, + hasBulkDelete: false, hasSearch: true } } }, computed: { }, + watch: { + url(iNew) { + this.$set(this.tableConfig, 'url', iNew) + console.log('Url change', this.tableConfig) + } + }, mounted() { if (this.otherActions) { const actionColumn = this.tableConfig.columns[this.tableConfig.columns.length - 1] diff --git a/src/components/AutoDataTable/index.vue b/src/components/AutoDataTable/index.vue index 48602b050..56e2acf95 100644 --- a/src/components/AutoDataTable/index.vue +++ b/src/components/AutoDataTable/index.vue @@ -21,9 +21,20 @@ export default { loading: true, method: 'get', iConfig: {}, + autoConfig: {}, meta: {} } }, + computed: { + }, + watch: { + config: { + handler(iNew) { + this.$log.debug('AutoDataTable Config change found: ', iNew) + }, + deep: true + } + }, mounted() { this.optionUrlMetaAndGenCols() }, @@ -118,7 +129,7 @@ export default { return col }, generateColumns() { - const config = Object.assign({}, this.config) + // const config = Object.assign({}, this.config) const columns = [] for (let col of this.config.columns) { if (typeof col === 'object') { @@ -128,7 +139,8 @@ export default { columns.push(col) } } - this.iConfig = Object.assign(config, { columns: columns }) + this.autoConfig.columns = columns + this.iConfig = Object.assign(this.config, this.autoConfig) } } } diff --git a/src/components/DataTable/index.vue b/src/components/DataTable/index.vue index 4d2e52d08..900565458 100644 --- a/src/components/DataTable/index.vue +++ b/src/components/DataTable/index.vue @@ -27,6 +27,7 @@ export default { draw: 1 } }, + extraQuery: {}, defaultAlign: 'left', dataPath: 'results', totalPath: 'count', @@ -85,12 +86,22 @@ export default { computed: { tableConfig() { const config = Object.assign(this.defaultConfig, this.config) + this.$log.debug('Datatable found config change') return config }, iListeners() { return Object.assign({}, this.$listeners, this.tableConfig.listeners) } }, + watch: { + config: { + handler() { + this.$log.debug('DataTable: found config change', this.tableConfig.url) + // this.getList() + }, + deep: true + } + }, methods: { getList() { this.$refs.table.clearSelection() diff --git a/src/components/ListTable/index.vue b/src/components/ListTable/index.vue index 21b93aaf2..286f5fad8 100644 --- a/src/components/ListTable/index.vue +++ b/src/components/ListTable/index.vue @@ -2,7 +2,7 @@
- +
@@ -36,35 +36,50 @@ export default { return { selectedRows: [], init: false, - iTableConfig: { - extraQuery: { - date_from: '', - date_to: '' - }, - ...this.tableConfig - } + extraQuery: {} } }, computed: { dataTable() { + console.log(this.$refs.dataTable.$refs) return this.$refs.dataTable.$refs.dataTable + }, + iTableConfig() { + const config = Object.assign(this.tableConfig, { extraQuery: this.extraQuery }) + this.$log.debug('ListTable: iTableConfig change', config) + return config } }, + watch: { + extraQuery: { + handler() { + this.$log.debug('ListTable: found extraQuery change') + }, + deep: true + } + }, + mounted() { + }, methods: { handleSelectionChange(val) { this.selectedRows = val }, + getDataTable() { + return this.$refs.dataTable.$refs.dataTable + }, reloadTable() { - this.dataTable.getList() + this.getDataTable().getList() }, search(attrs) { return this.dataTable.search(attrs, true) }, handleDateChange(attrs) { - this.iTableConfig.extraQuery = { - date_from: attrs[0].toISOString(), - date_to: attrs[1].toISOString() - } + this.$set(this.extraQuery, 'date_from', attrs[0].toISOString()) + this.$set(this.extraQuery, 'date_to', attrs[1].toISOString()) + // this.extraQuery = { + // date_from: attrs[0].toISOString(), + // date_to: attrs[1].toISOString() + // } return this.dataTable.searchDate({ date_from: attrs[0].toISOString(), date_to: attrs[1].toISOString() diff --git a/src/components/TreeTable/index.vue b/src/components/TreeTable/index.vue index 4fd9646ca..4fc93e9fb 100644 --- a/src/components/TreeTable/index.vue +++ b/src/components/TreeTable/index.vue @@ -21,7 +21,9 @@
- + + +
@@ -60,15 +62,14 @@ export default { iTableConfig: this.tableConfig, iShowTree: this.showTree, componentKey: 0 - } }, watch: { - }, methods: { handleUrlChange(_url) { this.$set(this.iTableConfig, 'url', _url) + this.$emit('urlChange', _url) this.forceRerender() }, forceRerender() { diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 79c7b5f79..804b68037 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -148,6 +148,7 @@ "common": { "CrontabHelpTips": "eg:每周日 03:05 执行 <5 3 * * 0>
提示: 使用5位 Linux crontab 表达式 <分 时 日 月 星期> (在线工具
注意: 如果同时设置了定期执行和周期执行,优先使用定期执行", "BadRequestErrorMsg": "请求错误,请检查填写内容", + "MFARequireForSecurity": "为了安全请输入MFA", "DateLast24Hours": "最近一天", "DateLastWeek": "最近一周", "DateLastMonth": "最近一月", @@ -845,7 +846,8 @@ "restoreDialogTitle": "你确认吗", "technologyConsult": "技术咨询", "Vault": { - "Vault": "密码匣子" + "Vault": "密码匣子", + "Create": "创建密码" }, "Cloud": { "CloudCenter": "云管中心", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 4347cbe74..635e24344 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -148,6 +148,7 @@ "CrontabHelpTips": "eg: Every Sunday 03:05 run <5 3 * * 0>
Tips:Using 5 digits linux crontab expressions (Online tools)
Note:If both Regularly perform and Cycle perform are set,give priority to Regularly perform", "BadRequestErrorMsg" : "Bad request, please check again", "DateLast24Hours": "Last 24 hours", + "MFARequireForSecurity": "MFA required for security", "TestSuccessMsg": "Test Success", "DateLastWeek": "Last week", "DateLastMonth": "Last month", diff --git a/src/layout/components/Footer/index.vue b/src/layout/components/Footer/index.vue index 9050be98b..4b2c8b026 100644 --- a/src/layout/components/Footer/index.vue +++ b/src/layout/components/Footer/index.vue @@ -1,7 +1,7 @@ diff --git a/src/styles/index.scss b/src/styles/index.scss index ed84c8892..28cf15555 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -135,3 +135,11 @@ h4 { .el-dialog__body { padding-top: 10px; } + +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; + font-size: 13px +} diff --git a/src/views/xpack/Vault/VaultList.vue b/src/views/xpack/Vault/VaultList.vue index b79199a9a..8e6dda0de 100644 --- a/src/views/xpack/Vault/VaultList.vue +++ b/src/views/xpack/Vault/VaultList.vue @@ -1,261 +1,60 @@ diff --git a/src/views/xpack/router.js b/src/views/xpack/router.js index a97683cee..f8c4d96a3 100644 --- a/src/views/xpack/router.js +++ b/src/views/xpack/router.js @@ -8,7 +8,7 @@ export default { component: Layout, redirect: '/applications/remote-apps/', name: 'Xpack', - meta: { title: 'Xpack', icon: 'sitemap', licenseRequired: true }, + meta: { title: 'X-Pack', icon: 'sitemap', licenseRequired: true }, children: [ { path: 'change-auth-plan',