| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <page-list
- show-tag-columns
- show-tag-filter
- :columns="columns"
- :group-actions="groupActions"
- :list="list"
- :single-actions="singleActions"
- :export-data-options="exportDataOptions" />
- </template>
- <script>
- import ColumnsMixin from '../mixins/columns'
- import SingleActionsMixin from '../mixins/singleActions'
- import ListMixin from '@/mixins/list'
- import { getNameFilter, getFilter, getStatusFilter } from '@/utils/common/tableFilter'
- import WindowsMixin from '@/mixins/windows'
- import expectStatus from '@/constants/expectStatus'
- import { HYPERVISORS_MAP } from '@/constants'
- import i18n from '@/locales'
- const BACKUP_TYPE = {
- automated: i18n.t('db.text_33'),
- manual: i18n.t('db.text_34'),
- }
- export default {
- name: 'RDSBackupList',
- mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
- props: {
- id: String,
- params: {
- type: Object,
- },
- data: {
- type: Object,
- },
- },
- data () {
- return {
- list: this.$list.createList(this, {
- id: this.id,
- resource: 'dbinstancebackups',
- getParams: this.params,
- steadyStatus: Object.values(expectStatus.rdsBackup).flat(),
- filterOptions: {
- name: getNameFilter(),
- status: getStatusFilter('rdsBackup'),
- // dbinstance: getFilter({
- // field: 'dbinstance',
- // title: '实例名称',
- // }),
- dbinstance: {
- field: 'dbinstance',
- label: this.$t('db.text_35'),
- },
- engine: getFilter({
- field: 'engine',
- title: this.$t('db.text_57'),
- multiple: true,
- items: [
- { label: 'MySQL', key: 'MySQL' },
- { label: 'PostgreSQL', key: 'PostgreSQL' },
- { label: 'SQLServer', key: 'SQLServer' },
- ],
- }),
- backup_mode: getFilter({
- field: 'backup_mode',
- title: this.$t('db.text_36'),
- items: Object.keys(BACKUP_TYPE).map(key => {
- return { label: BACKUP_TYPE[key], key }
- }),
- }),
- },
- }),
- exportDataOptions: {
- items: [
- { label: 'ID', key: 'id' },
- { label: this.$t('db.text_60'), key: 'name' },
- { label: this.$t('db.text_35'), key: 'dbinstance' },
- { label: this.$t('db.text_36'), key: 'backup_mode' },
- { label: this.$t('db.text_57'), key: 'engine' },
- { label: this.$t('db.text_38'), key: 'backup_size_mb' },
- { label: this.$t('db.text_46'), key: 'status' },
- { label: this.$t('db.text_210'), key: 'start_time' },
- { label: this.$t('db.text_211'), key: 'end_time' },
- { label: this.$t('db.text_40'), key: 'region' },
- ],
- },
- groupActions: [
- {
- label: this.$t('db.text_41'),
- permission: 'rds_dbinstancebackups_create',
- action: () => {
- this.createDialog('RDSBackupCreate', {
- rdsItem: this.data,
- onManager: this.onManager,
- refresh: this.refresh,
- list: this.list,
- })
- },
- meta: () => {
- let validate = true
- let tooltip = ''
- if (this.data.status !== 'running') {
- validate = false
- tooltip = this.$t('db.text_212')
- }
- if (this.data.provider === 'Qcloud' && this.data.category === 'basic') {
- validate = false
- tooltip = this.$t('db.text_342')
- }
- if ((this.data.brand === HYPERVISORS_MAP.aws.brand || this.data.brand === HYPERVISORS_MAP.azure.brand) && validate) {
- validate = false
- tooltip = this.$t('db.text_384', [this.data.brand])
- }
- return {
- buttonType: 'primary',
- validate: validate,
- tooltip: tooltip,
- }
- },
- },
- {
- label: this.$t('db.text_213'),
- actions: () => {
- return [
- {
- label: this.$t('db.text_69'),
- permission: 'rds_dbinstancebackups_perform_syncstatus',
- action: () => {
- this.onManager('batchPerformAction', {
- steadyStatus: ['running', 'ready'],
- managerArgs: {
- action: 'syncstatus',
- },
- })
- },
- },
- {
- label: this.$t('db.text_42'),
- permission: 'rds_dbinstancebackups_delete',
- action: () => {
- this.createDialog('DeleteResDialog', {
- vm: this,
- name: this.$t('db.text_44'),
- title: this.$t('db.text_43'),
- data: this.list.selectedItems,
- columns: this.columns,
- onManager: this.onManager,
- refresh: this.refresh,
- })
- },
- meta: () => {
- if (this.data.brand === 'Aliyun') {
- return {
- validate: false,
- tooltip: this.$t('db.text_214'),
- }
- }
- return this.$getDeleteResult(this.list.selectedItems)
- },
- },
- ]
- },
- meta: () => {
- return {
- validate: this.list.selected.length,
- }
- },
- },
- ],
- }
- },
- created () {
- this.list.fetchData()
- this.initSidePageTab('rds-backup-detail')
- },
- methods: {
- handleOpenSidepage (row) {
- this.sidePageTriggerHandle(this, 'RDSBackupSidePage', {
- id: row.id,
- resource: 'dbinstancebackups',
- getParams: this.params,
- steadyStatus: Object.values(expectStatus.rdsBackup).flat(),
- }, {
- list: this.list,
- })
- },
- },
- }
- </script>
|