perf: Push account record

This commit is contained in:
feng
2025-01-26 16:39:32 +08:00
committed by feng626
parent caf34a96e6
commit 0a96331218
7 changed files with 167 additions and 9 deletions

View File

@@ -24,17 +24,20 @@ export default {
props: {
object: {
type: Object,
required: true,
required: false,
default: () => ({})
}
},
data() {
const vm = this
const url = this.object.id === undefined
? '/api/v1/accounts/change-secret-records/'
: `/api/v1/accounts/change-secret-records/?execution_id=${this.object.id}`
return {
secretUrl: '',
showViewSecretDialog: false,
tableConfig: {
url: `/api/v1/accounts/change-secret-records/?execution_id=${this.object.id}`,
url: url,
columns: [
'asset', 'account', 'date_finished', 'is_success', 'error', 'actions'
],
@@ -157,6 +160,10 @@ export default {
{
value: 'failed',
label: this.$t('Failed')
},
{
label: this.$t('Execution'),
value: 'execution_id'
}
]
}

View File

@@ -32,11 +32,6 @@ export default {
title: this.$t('Basic'),
name: 'AccountChangeSecretExecutionInfo',
hidden: () => !this.$hasPerm('accounts.view_changesecretexecution')
},
{
title: this.$t('TaskList'),
name: 'AccountChangeSecretRecord',
hidden: () => !this.$hasPerm('accounts.view_changesecretrecord')
}
],
getTitle: this.getExecutionTitle

View File

@@ -35,7 +35,7 @@ export default {
},
columnsMeta: {
automation: {
label: this.$t('TaskID'),
label: this.$t('ExecutionID'),
formatter: function(row) {
return <span>{row.automation}</span>
}

View File

@@ -33,6 +33,14 @@ export default {
component: () => import(
'@/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue'
)
},
{
title: this.$t('RecordList'),
name: 'AccountPushRecord',
hidden: () => !this.$hasPerm('accounts.view_changesecretrecord'),
component: () => import(
'@/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue'
)
}
]
}

View File

@@ -0,0 +1,140 @@
<template>
<div>
<RecordViewSecret
v-if="showViewSecretDialog"
:url="secretUrl"
:visible.sync="showViewSecretDialog"
/>
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
</div>
</template>
<script>
import GenericListTable from '@/layout/components/GenericListTable/index.vue'
import { DetailFormatter } from '@/components/Table/TableFormatters'
import RecordViewSecret from '@/components/Apps/ChangeSecret/RecordViewSecret.vue'
export default {
name: 'AccountPushRecord',
components: {
RecordViewSecret,
GenericListTable
},
props: {
object: {
type: Object,
required: false,
default: () => ({})
}
},
data() {
const url = this.object.id === undefined
? '/api/v1/accounts/push-account-records/'
: `/api/v1/accounts/push-account-records/?execution_id=${this.object.id}`
return {
secretUrl: '',
showViewSecretDialog: false,
tableConfig: {
url: url,
columns: [
'asset', 'account', 'date_finished', 'is_success', 'error'
],
columnsMeta: {
asset: {
label: this.$t('Asset'),
formatter: DetailFormatter,
formatterArgs: {
can: this.$hasPerm('assets.view_asset'),
getTitle({ row }) {
return row.asset.name
},
getRoute({ row }) {
return {
name: 'AssetDetail',
params: { id: row.asset.id }
}
}
}
},
account: {
label: this.$t('Username'),
formatter: DetailFormatter,
formatterArgs: {
can: this.$hasPerm('accounts.view_account'),
getTitle({ row }) {
return row.account.username
},
getRoute({ row }) {
return {
name: 'AssetAccountDetail',
params: { id: row.account.id }
}
}
}
},
is_success: {
label: this.$t('Success'),
formatter: (row) => {
if (row.status === 'pending') {
return <i Class='fa fa fa-spinner fa-spin'/>
}
if (row.is_success) {
return <i Class='fa fa-check text-primary'/>
}
return <i Class='fa fa-times text-danger'/>
}
}
}
},
headerActions: {
hasSearch: true,
hasRefresh: true,
hasLeftActions: true,
hasRightActions: true,
hasExport: false,
hasImport: false,
hasCreate: false,
hasBulkDelete: false,
hasBulkUpdate: false,
searchConfig: {
exclude: ['id', 'status', 'execution'],
options: [
{
label: this.$t('Asset'),
value: 'asset_name'
},
{
label: this.$t('Accounts'),
value: 'account_username'
},
{
value: 'status',
label: this.$t('Status'),
type: 'choice',
children: [
{
default: true,
value: 'success',
label: this.$t('Success')
},
{
value: 'failed',
label: this.$t('Failed')
}
]
},
{
label: this.$t('Execution'),
value: 'execution_id'
}
]
}
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -35,7 +35,7 @@ export default {
},
columnsMeta: {
automation: {
label: this.$t('TaskID'),
label: this.$t('ExecutionID'),
formatter: function(row) {
return <span>{row.automation}</span>
}

View File

@@ -26,6 +26,14 @@ export default {
name: 'AccountPushExecutionList',
hidden: !this.$hasPerm('accounts.view_pushaccountexecution'),
component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue')
},
{
title: this.$t('RecordList'),
name: 'AccountPushRecord',
hidden: () => !this.$hasPerm('accounts.view_pushsecretrecord'),
component: () => import(
'@/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue'
)
}
]
}