diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue
index 5914d8b76..21bc81efd 100644
--- a/src/components/Apps/AccountListTable/AccountList.vue
+++ b/src/components/Apps/AccountListTable/AccountList.vue
@@ -162,6 +162,7 @@ export default {
account: {},
secretUrl: '',
quickFilters: accountQuickFilters,
+ tabDeactivated: false,
tableConfig: {
url: this.url,
permissions: {
@@ -205,15 +206,7 @@ export default {
},
asset: {
formatter: row => {
- const to = {
- name: 'AssetDetail',
- params: { id: row.asset.id }
- }
- if (vm.$hasPerm('assets.view_asset')) {
- return {row.asset.name}
- } else {
- return {row.asset.name}
- }
+ return {row.asset.name}
}
},
platform: {
@@ -254,9 +247,9 @@ export default {
formatter: ActionsFormatter,
formatterArgs: {
hasUpdate: false, // can set function(row, value)
- hasDelete: false, // can set function(row, value)
+ hasDelete: true, // can set function(row, value)
hasClone: false,
- canClone: true,
+ canDelete: () => vm.$hasPerm('accounts.delete_account'),
moreActionsTitle: this.$t('More'),
extraActions: accountOtherActions(this)
}
@@ -319,7 +312,7 @@ export default {
name: 'TestSelected',
title: this.$t('TestSelected'),
type: 'primary',
- icon: 'fa-link',
+ icon: 'verify',
can: ({ selectedRows }) => {
return selectedRows.length > 0 &&
['clickhouse', 'redis', 'website', 'chatgpt'].indexOf(selectedRows[0].asset.type.value) === -1 &&
@@ -399,12 +392,12 @@ export default {
},
activated() {
// 由于组件嵌套较深,有可能导致 Error in activated hook: "TypeError: Cannot read properties of undefined (reading 'getList')" 的问题
- setTimeout(() => {
- this.refresh()
- }, 300)
+ if (this.tabDeactivated) {
+ setTimeout(() => this.refresh(), 300)
+ }
},
deactivated() {
- this.deactive = true
+ this.tabDeactivated = true
},
methods: {
setActions() {
@@ -417,31 +410,6 @@ export default {
actionColumn.formatterArgs.extraActions.push(item)
}
}
- if (this.hasDeleteAction) {
- this.tableConfig.columnsMeta.actions.formatterArgs.extraActions.push(
- {
- name: 'Delete',
- title: this.$t('Delete'),
- can: this.$hasPerm('accounts.delete_account'),
- type: 'primary',
- callback: ({ row }) => {
- const msg = this.$t('AccountDeleteConfirmMsg')
- this.$confirm(msg, this.$tc('Info'), {
- type: 'warning',
- confirmButtonClass: 'el-button--danger',
- beforeClose: async(action, instance, done) => {
- if (action !== 'confirm') return done()
- this.$axios.delete(`/api/v1/accounts/accounts/${row.id}/`).then(() => {
- done()
- this.$refs.ListTable.reloadTable()
- this.$message.success(this.$tc('DeleteSuccessMsg'))
- })
- }
- })
- }
- }
- )
- }
},
onUpdateAuthDone(account) {
Object.assign(this.account, account)
diff --git a/src/components/Apps/AccountListTable/const.js b/src/components/Apps/AccountListTable/const.js
index 6011cea84..192178af8 100644
--- a/src/components/Apps/AccountListTable/const.js
+++ b/src/components/Apps/AccountListTable/const.js
@@ -30,6 +30,7 @@ export const accountOtherActions = (vm) => [
title: vm.$t('View'),
can: vm.$hasPerm('accounts.view_accountsecret'),
type: 'primary',
+ order: 1,
callback: ({ row }) => {
// debugger
vm.secretUrl = `/api/v1/accounts/account-secrets/${row.id}/`
@@ -58,9 +59,28 @@ export const accountOtherActions = (vm) => [
})
}
},
+ {
+ name: 'Clone',
+ title: vm.$t('Duplicate'),
+ can: vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
+ callback: ({ row }) => {
+ const data = {
+ ...vm.asset,
+ ...row.asset
+ }
+ vm.account = row
+ vm.iAsset = data
+ vm.showAddDialog = false
+ vm.accountCreateUpdateTitle = vm.$t('DuplicateAccount')
+ setTimeout(() => {
+ vm.showAddDialog = true
+ })
+ }
+ },
{
name: 'Test',
title: vm.$t('验证密文'),
+ divided: true,
can: ({ row }) =>
!vm.$store.getters.currentOrgIsRoot &&
vm.$hasPerm('accounts.verify_account') &&
@@ -104,10 +124,11 @@ export const accountOtherActions = (vm) => [
},
{
name: 'CopyToOther',
- title: '复制到其他资产',
+ title: vm.$t('CopyToOther'),
type: 'primary',
divided: true,
callback: ({ row }) => {
+ vm.accountCreateUpdateTitle = vm.$t('CopyToOther')
vm.$route.query.flag = 'copy'
vm.iAsset = vm.asset
vm.account = row
@@ -116,19 +137,15 @@ export const accountOtherActions = (vm) => [
},
{
name: 'MoveToOther',
- title: '移动到其他资产',
+ title: vm.$t('MoveToOther'),
type: 'primary',
callback: ({ row }) => {
+ vm.accountCreateUpdateTitle = vm.$t('MoveToOther')
vm.$route.query.flag = 'move'
vm.iAsset = vm.asset
vm.account = row
vm.showAddDialog = true
}
- },
- {
- name: 'Clone',
- title: vm.$t('Duplicate'),
- divided: true
}
]
@@ -186,7 +203,7 @@ export const accountQuickFilters = [
{
label: '弱密码',
filter: {
- risk: 'week_password'
+ risk: 'weak_password'
}
},
{
diff --git a/src/components/Table/ListTable/index.vue b/src/components/Table/ListTable/index.vue
index 71d1a66ac..a9fa76b65 100644
--- a/src/components/Table/ListTable/index.vue
+++ b/src/components/Table/ListTable/index.vue
@@ -100,7 +100,7 @@ export default {
extraQuery: extraQuery,
actionInit: this.headerActions.has === false,
initQuery: {},
- filterExpand: localStorage.getItem('filterExpand') === '1'
+ filterExpand: localStorage.getItem('filterExpand') !== '0'
}
},
computed: {
diff --git a/src/components/Table/TableFormatters/SecretViewerFormatter.vue b/src/components/Table/TableFormatters/SecretViewerFormatter.vue
index cba49a342..0a1a40d0d 100644
--- a/src/components/Table/TableFormatters/SecretViewerFormatter.vue
+++ b/src/components/Table/TableFormatters/SecretViewerFormatter.vue
@@ -1,6 +1,6 @@
-
+
+
+
diff --git a/src/icons/svg/disable.svg b/src/icons/svg/disable.svg
new file mode 100644
index 000000000..98837fdb4
--- /dev/null
+++ b/src/icons/svg/disable.svg
@@ -0,0 +1,5 @@
+
diff --git a/src/icons/svg/scan.svg b/src/icons/svg/scan.svg
index 4f7c157be..b4823da84 100644
--- a/src/icons/svg/scan.svg
+++ b/src/icons/svg/scan.svg
@@ -1,9 +1,6 @@
-
\ No newline at end of file
+
diff --git a/src/icons/svg/verify.svg b/src/icons/svg/verify.svg
new file mode 100644
index 000000000..9aa5e5e4b
--- /dev/null
+++ b/src/icons/svg/verify.svg
@@ -0,0 +1,6 @@
+
diff --git a/src/layout/components/TabPage/index.vue b/src/layout/components/TabPage/index.vue
index 9905f9fd0..563ea4c33 100644
--- a/src/layout/components/TabPage/index.vue
+++ b/src/layout/components/TabPage/index.vue
@@ -174,9 +174,17 @@ export default {
margin-bottom: 5px;
.el-tabs__item {
- i.pre-icon {
+ .pre-icon {
+ width: 16px;
+ display: inline-block;
opacity: 0.6;
}
+
+ &.is-active {
+ .pre-icon {
+ opacity: 1;
+ }
+ }
}
.el-tabs__nav-next {
diff --git a/src/views/assets/Asset/AssetList/components/const.js b/src/views/assets/Asset/AssetList/components/const.js
index 2dc0f38f5..a1af507ef 100644
--- a/src/views/assets/Asset/AssetList/components/const.js
+++ b/src/views/assets/Asset/AssetList/components/const.js
@@ -1,10 +1,5 @@
import {
- ActionsFormatter,
- ArrayFormatter,
- ChoicesFormatter,
- DetailFormatter,
- PlatformFormatter,
- ProtocolsFormatter
+ ActionsFormatter, ArrayFormatter, ChoicesFormatter, DetailFormatter, PlatformFormatter, ProtocolsFormatter
} from '@/components/Table/TableFormatters'
import HostInfoFormatter from '@/components/Table/TableFormatters/HostInfoFormatter.vue'
import AmountFormatter from '@/components/Table/TableFormatters/AmountFormatter.vue'
@@ -33,6 +28,7 @@ export function getDefaultConfig(vm) {
name: 'TestSelected',
title: vm.$t('TestSelected'),
type: 'primary',
+ icon: 'verify',
can: ({ selectedRows }) =>
vm.$hasPerm('assets.test_assetconnectivity') &&
!vm.$store.getters.currentOrgIsRoot &&
@@ -56,7 +52,7 @@ export function getDefaultConfig(vm) {
name: 'DeactiveSelected',
title: vm.$t('DisableSelected'),
type: 'primary',
- icon: 'fa fa-ban',
+ icon: 'disable',
can: ({ selectedRows }) => {
return selectedRows.length > 0 && vm.$hasPerm('assets.change_asset')
},
@@ -76,7 +72,7 @@ export function getDefaultConfig(vm) {
name: 'ActiveSelected',
title: vm.$t('ActivateSelected'),
type: 'primary',
- icon: 'fa fa-check-circle-o',
+ icon: 'activate',
can: ({ selectedRows }) => {
return selectedRows.length > 0 && vm.$hasPerm('assets.change_asset')
},