From bbfb237f23d7c846aca6344feeab031e95ef986d Mon Sep 17 00:00:00 2001
From: feng <1304903146@qq.com>
Date: Wed, 4 Dec 2024 16:29:00 +0800
Subject: [PATCH] perf: Account backup report
---
.../AccountBackupDetail/AccountBackupInfo.vue | 6 +--
.../AccountBackupExecutionList.vue | 37 +++++++++++--------
.../AccountBackup/AccountBackupList.vue | 15 +++++---
3 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/src/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupInfo.vue b/src/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupInfo.vue
index ec9b8e07e..0aec1fa4d 100644
--- a/src/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupInfo.vue
+++ b/src/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupInfo.vue
@@ -53,7 +53,7 @@ export default {
],
url: `/api/v1/accounts/account-backup-plans/${this.object.id}/`,
detailFields: [
- 'id', 'name',
+ 'id', 'name', 'backup_type',
{
key: this.$t('Crontab'),
value: this.object.crontab,
@@ -68,7 +68,6 @@ export default {
return {this.object.is_periodic ? val : '-'}
}
},
- 'date_created', 'date_updated', 'comment',
{
key: this.$t('Recipient') + ' A',
value: this.object.recipients_part_one,
@@ -100,7 +99,8 @@ export default {
const recipientServerB = this.isEmail ? '-' : val.map(item => item.name).join(', ')
return {recipientServerB}
}
- }
+ },
+ 'date_created', 'date_updated', 'is_active', 'comment'
]
}
},
diff --git a/src/views/accounts/AccountBackup/AccountBackupExecution/AccountBackupExecutionList.vue b/src/views/accounts/AccountBackup/AccountBackupExecution/AccountBackupExecutionList.vue
index 693e23387..fae3ead87 100644
--- a/src/views/accounts/AccountBackup/AccountBackupExecution/AccountBackupExecutionList.vue
+++ b/src/views/accounts/AccountBackup/AccountBackupExecution/AccountBackupExecutionList.vue
@@ -24,38 +24,32 @@ export default {
tableConfig: {
url: '/api/v1/accounts/account-backup-plan-executions/',
columns: [
- 'automation', 'account_backup_name', 'timedelta', 'trigger', 'date_start',
- 'is_success', 'reason', 'actions'
+ 'automation', 'trigger',
+ 'date_start', 'date_finished', 'duration', 'actions'
],
columnsShow: {
default: [
- 'automation', 'account_backup_name', 'timedelta', 'date_start',
- 'is_success', 'reason', 'actions'
+ 'automation', 'trigger',
+ 'date_start', 'date_finished', 'duration', 'actions'
]
},
columnsMeta: {
automation: {
- label: this.$t('TaskID'),
- formatter: function(row) {
- return {row.plan}
- }
- },
- account_backup_name: {
label: this.$t('DisplayName'),
formatter: DetailFormatter,
formatterArgs: {
getTitle: ({ row }) => row.snapshot.name,
getRoute: ({ row }) => ({
name: 'AccountBackupDetail',
- params: { id: row.plan }
+ params: { id: row.automation }
})
},
- id: ({ row }) => row.plan
+ id: ({ row }) => row.automation
},
- timedelta: {
+ duration: {
label: this.$t('TimeDelta'),
formatter: function(row) {
- return row.timedelta.toFixed(2) + 's'
+ return row.duration + 's'
}
},
actions: {
@@ -67,6 +61,7 @@ export default {
{
name: 'log',
type: 'primary',
+ can: this.$hasPerm('accounts.view_backupaccountexecution'),
title: this.$t('Log'),
callback: function({ row }) {
openTaskPage(row['id'])
@@ -76,9 +71,19 @@ export default {
name: 'detail',
title: this.$t('Detail'),
type: 'info',
+ can: this.$hasPerm('accounts.view_backupaccountexecution'),
callback: function({ row }) {
return this.$router.push({ name: 'AccountBackupExecutionDetail', params: { id: row.id }})
}
+ },
+ {
+ name: 'report',
+ title: this.$t('Report'),
+ type: 'success',
+ can: this.$hasPerm('accounts.view_backupaccountexecution'),
+ callback: function({ row }) {
+ window.open(`/api/v1/accounts/account-backup-plan-executions/${row.id}/report/`)
+ }
}
]
}
@@ -90,11 +95,11 @@ export default {
options: [
{
label: this.$t('TaskID'),
- value: 'plan_id'
+ value: 'automation_id'
},
{
label: this.$t('DisplayName'),
- value: 'plan__name'
+ value: 'automation__name'
}
]
},
diff --git a/src/views/accounts/AccountBackup/AccountBackupList.vue b/src/views/accounts/AccountBackup/AccountBackupList.vue
index 9c7b1f57b..d152305a2 100644
--- a/src/views/accounts/AccountBackup/AccountBackupList.vue
+++ b/src/views/accounts/AccountBackup/AccountBackupList.vue
@@ -22,14 +22,14 @@ export default {
resource: 'accountbackupautomation'
},
columns: [
- 'name', 'org_name', 'is_periodic',
- 'periodic_display', 'executed_amount', 'actions'
+ 'name', 'backup_type', 'org_name', 'is_periodic',
+ 'periodic_display', 'executed_amount', 'is_active', 'actions'
],
columnsShow: {
min: ['name', 'actions'],
default: [
- 'name', 'org_name', 'periodic_display',
- 'executed_amount', 'actions'
+ 'name', 'backup_type', 'org_name', 'periodic_display',
+ 'executed_amount', 'is_active', 'actions'
]
},
columnsMeta: {
@@ -56,7 +56,7 @@ export default {
name: 'AccountBackupList',
query: {
tab: 'AccountBackupExecutionList',
- plan_id: row.id
+ automation_id: row.id
}
}
}
@@ -79,7 +79,10 @@ export default {
callback: function({ row }) {
this.$axios.post(
`/api/v1/accounts/account-backup-plan-executions/`,
- { plan: row.id }
+ {
+ automation: row.id,
+ type: row.type.value
+ }
).then(res => {
openTaskPage(res['task'])
})