From 354fbd9fbe23aa8f9b9458e87ff4e10f1a9a0390 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Fri, 24 Apr 2020 09:52:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[Update]=20=E8=B5=84=E4=BA=A7=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E5=88=97=E8=A1=A8=E9=A1=B5=E6=B7=BB=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.js | 3 +++ src/views/perms/AssetPermissionList.vue | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index bbbf2bdb5..5804115f9 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -349,6 +349,9 @@ const cn = { 'RefreshPermissionCache': '刷新授权缓存', 'ReFreshSuccess': '刷新成功', 'ReFreshFail': '刷新失败', + 'IsValid': '有效', + 'IP': 'IP', + 'Hostname': '主机名', 'All': '全部', 'Connect': '连接', 'UpDownload': '上传下载', diff --git a/src/views/perms/AssetPermissionList.vue b/src/views/perms/AssetPermissionList.vue index 1fb269318..b46a23f4f 100644 --- a/src/views/perms/AssetPermissionList.vue +++ b/src/views/perms/AssetPermissionList.vue @@ -16,6 +16,17 @@ export default { url: '/api/v1/perms/asset-permissions/', hasSelection: false, hasTree: true, + tagSearch: [ + { label: this.$tc('Name'), key: 'name' }, + { label: this.$t('perms.IsValid'), key: 'is_valid' }, + { label: this.$tc('username'), key: 'username' }, + { label: this.$t('perms.UserGroups'), key: 'user_group' }, + { label: this.$t('perms.IP'), key: 'ip' }, + { label: this.$t('perms.Hostname'), key: 'hostname' }, + { label: this.$t('perms.Node'), key: 'node' }, + { label: this.$t('perms.SystemUser'), key: 'system_user' }, + { label: '继承(先占位)', key: 'all=0' } + ], treeSetting: { showMenu: false, showRefresh: true, From 4ac43ca708ccdb911f49143ec346e8701e0b639c Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 26 Apr 2020 11:00:25 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=20action=20fo?= =?UTF-8?q?rmatter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ListTable/formatters/ActionsFormatter.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ListTable/formatters/ActionsFormatter.vue b/src/components/ListTable/formatters/ActionsFormatter.vue index 8b93af967..133e1559e 100644 --- a/src/components/ListTable/formatters/ActionsFormatter.vue +++ b/src/components/ListTable/formatters/ActionsFormatter.vue @@ -95,6 +95,7 @@ export default { computed: { cleanedActions() { let actions = [...this.defaultActions, ...this.extraActions] + actions = _.cloneDeep(actions) actions = actions.map((v) => { v.has = this.cleanBoolean(v, 'has') v.can = this.cleanBoolean(v, 'can') From 252ff3d9c0265cfc4c00210ae04ba1dc862ae172 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 26 Apr 2020 11:31:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/sessions/Storage.vue | 78 ++++++++-------------------------- 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/src/views/sessions/Storage.vue b/src/views/sessions/Storage.vue index c3ed50b69..a4171504b 100644 --- a/src/views/sessions/Storage.vue +++ b/src/views/sessions/Storage.vue @@ -16,7 +16,6 @@ import { TabPage } from '@/layout/components' import { ListTable } from '@/components' import { TestCommandStorage, TestReplayStorage } from '@/api/sessions' -import { CustomActionsFormatter } from '@/components/ListTable/formatters' export default { name: 'Storage', @@ -90,7 +89,7 @@ export default { }, replayTableConfig: { url: '/api/v1/terminal/replay-storages/', - columns: ['name', 'type', 'comment', 'cusActions'], + columns: ['name', 'type', 'comment', 'actions'], columnsMeta: { name: { formatter: function(row) { @@ -105,36 +104,16 @@ export default { comment: { sortable: 'custom' }, - cusActions: { + actions: { prop: 'id', - formatter: CustomActionsFormatter, actions: { - actions: [ - { - name: 'update', - title: this.$tc('Update'), - type: 'primary', - can: function(row, cellValue,) { - return row.name !== 'null' && row.name !== 'default' - }, - callback: function({ row, col, cellValue, reload }) { - } - }, - { - name: 'delete', - title: this.$tc('Delete'), - type: 'danger', - can: function(row, cellValue) { - return row.name !== 'null' && row.name !== 'default' - }, - callback: function({ row, col, cellValue, reload }) { - const id = row.id - const url = `${this.url}${id}/` - this.$axios.delete(url).then(data => { - reload() - }) - } - }, + canUpdate: function(row, cellValue) { + return (row.name !== 'default' && row.name !== 'null') + }, + canDelete: function(row, cellValue) { + return (row.name !== 'default' && row.name !== 'null') + }, + extraActions: [ { name: 'test', title: this.$t('sessions.test'), @@ -179,7 +158,7 @@ export default { commandTableConfig: { title: 'command', url: '/api/v1/terminal/command-storages/', - columns: ['name', 'type', 'comment', 'cusActions'], + columns: ['name', 'type', 'comment', 'actions'], columnsMeta: { comment: { sortable: 'custom' @@ -194,36 +173,15 @@ export default { return row.type } }, - cusActions: { - prop: 'id', - formatter: CustomActionsFormatter, + actions: { actions: { - actions: [ - { - name: 'update', - title: this.$tc('Update'), - type: 'primary', - can: function(row, cellValue,) { - return row.name !== 'null' && row.name !== 'default' - }, - callback: function({ row, col, cellValue, reload }) { - } - }, - { - name: 'delete', - title: this.$tc('Delete'), - type: 'danger', - can: function(row, cellValue) { - return row.name !== 'null' && row.name !== 'default' - }, - callback: function({ row, col, cellValue, reload }) { - const id = row.id - const url = `${this.url}${id}/` - this.$axios.delete(url).then(data => { - reload() - }) - } - }, + canUpdate: function(row, cellValue) { + return (row.name !== 'default' && row.name !== 'null') + }, + canDelete: function(row, cellValue) { + return (row.name !== 'default' && row.name !== 'null') + }, + extraActions: [ { name: 'test', title: this.$t('sessions.test'), From a21fecf24abe59d283dda261be835f02ad893f57 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Sun, 26 Apr 2020 14:33:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[Update]=20=E6=8E=88=E6=9D=83=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=B8=ADtab=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=A8=E4=BD=9C,=E4=BB=A5=E5=89=8D?= =?UTF-8?q?=E5=88=87=E6=8D=A2tab=EF=BC=8C=E6=8E=A7=E5=88=B6=E5=8F=B3?= =?UTF-8?q?=E4=B8=8A=E8=A7=92=E7=9A=84=E5=88=A0=E9=99=A4=E5=92=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=9A=84=E6=98=BE=E7=A4=BA=E5=92=8C=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formatters/DeleteActionFormatter.vue | 29 +++++++++++++++++++ src/components/ListTable/formatters/index.js | 7 +++-- src/components/index.js | 1 + src/views/perms/AssetPermissionAsset.vue | 17 +++++++++-- src/views/perms/AssetPermissionDetail.vue | 10 +++++-- src/views/perms/AssetPermissionList.vue | 10 +++++-- src/views/perms/AssetPermissionUser.vue | 17 +++++++++-- .../DatabaseAppPermissionDatabaseApp.vue | 14 +++++++-- .../perms/DatabaseAppPermissionDetail.vue | 9 +++++- src/views/perms/DatabaseAppPermissionUser.vue | 15 ++++++++-- src/views/perms/RemoteAppPermissionDetail.vue | 9 +++++- 11 files changed, 121 insertions(+), 17 deletions(-) create mode 100644 src/components/ListTable/formatters/DeleteActionFormatter.vue diff --git a/src/components/ListTable/formatters/DeleteActionFormatter.vue b/src/components/ListTable/formatters/DeleteActionFormatter.vue new file mode 100644 index 000000000..8c6943997 --- /dev/null +++ b/src/components/ListTable/formatters/DeleteActionFormatter.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/components/ListTable/formatters/index.js b/src/components/ListTable/formatters/index.js index a2235da5b..66ca66727 100644 --- a/src/components/ListTable/formatters/index.js +++ b/src/components/ListTable/formatters/index.js @@ -8,6 +8,7 @@ import RouterFormatter from './RouterFormatter' import OutputExpandFormatter from './OutputExpandFormatter' import ExpandAssetPermissionFormatter from './ExpandAssetPermissionFormatter' import CustomActionsFormatter from './CustomActionsFormatter' +import DeleteActionFormatter from './DeleteActionFormatter' export default { DetailFormatter, @@ -19,7 +20,8 @@ export default { RouterFormatter, OutputExpandFormatter, ExpandAssetPermissionFormatter, - CustomActionsFormatter + CustomActionsFormatter, + DeleteActionFormatter } export { @@ -32,5 +34,6 @@ export { RouterFormatter, OutputExpandFormatter, ExpandAssetPermissionFormatter, - CustomActionsFormatter + CustomActionsFormatter, + DeleteActionFormatter } diff --git a/src/components/index.js b/src/components/index.js index 07976b9d0..21bb26775 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -16,3 +16,4 @@ export { default as ActiveCard } from './ActiveCard' export { default as Select2 } from './Select2' export { default as SvgIcon } from './SvgIcon' export { default as TreeTable } from './TreeTable' + diff --git a/src/views/perms/AssetPermissionAsset.vue b/src/views/perms/AssetPermissionAsset.vue index 9d2e1d01a..3e760df7a 100644 --- a/src/views/perms/AssetPermissionAsset.vue +++ b/src/views/perms/AssetPermissionAsset.vue @@ -14,6 +14,7 @@