perf: Account backup report

This commit is contained in:
feng
2024-12-04 16:29:00 +08:00
committed by feng626
parent 390224613a
commit bbfb237f23
3 changed files with 33 additions and 25 deletions

View File

@@ -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 <span>{this.object.is_periodic ? val : '-'}</span>
}
},
'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 <span>{recipientServerB}</span>
}
}
},
'date_created', 'date_updated', 'is_active', 'comment'
]
}
},

View File

@@ -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 <span>{row.plan}</span>
}
},
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'
}
]
},

View File

@@ -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'])
})