| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <template>
- <page-list
- :columns="columns"
- :group-actions="groupActions"
- :list="list"
- :single-actions="singleActions" />
- </template>
- <script>
- import SingleActionsMixin from '../mixins/singleActions'
- import ColumnsMixin from '../mixins/columns'
- import WindowsMixin from '@/mixins/windows'
- import ListMixin from '@/mixins/list'
- import expectStatus from '@/constants/expectStatus'
- import { getNameFilter, getStatusFilter } from '@/utils/common/tableFilter'
- import { HYPERVISORS_MAP } from '@/constants'
- export default {
- name: 'RDSAccountList',
- mixins: [WindowsMixin, ColumnsMixin, SingleActionsMixin, ListMixin],
- props: {
- params: {
- type: Object,
- },
- data: {
- type: Object,
- },
- id: {
- type: String,
- },
- },
- data () {
- return {
- list: this.$list.createList(this, {
- id: this.id,
- resource: 'dbinstanceaccounts',
- getParams: this.params,
- steadyStatus: Object.values(expectStatus.rdsAccount).flat(),
- filterOptions: {
- name: getNameFilter(),
- status: getStatusFilter('rdsAccount'),
- },
- }),
- groupActions: [
- {
- label: this.$t('db.text_41'),
- permission: 'rds_dbinstanceaccounts_create',
- action: () => {
- this.createDialog('RDSAccountCreateDialog', {
- list: this.list,
- title: this.$t('db.text_197'),
- rdsItem: this.data,
- })
- },
- meta: () => {
- const { engine, provider, brand } = this.data
- const { isRunning } = this.commonMeta
- const _meta = () => {
- if (!isRunning) {
- return {
- validate: false,
- tooltip: this.$t('db.text_198'),
- }
- }
- if (engine === 'SQLServer' && provider === 'Huawei') {
- return {
- validate: false,
- tooltip: this.$t('db.text_199'),
- }
- }
- if (engine === 'PostgreSQL' && provider === 'Huawei') {
- return {
- validate: false,
- tooltip: this.$t('db.text_200'),
- }
- }
- if (brand === HYPERVISORS_MAP.aws.brand || brand === HYPERVISORS_MAP.azure.brand) {
- return {
- validate: false,
- tooltip: this.$t('db.text_384', [brand]),
- }
- }
- return {
- validate: true,
- tooltip: '',
- }
- }
- return {
- buttonType: 'primary',
- ..._meta(),
- }
- },
- },
- ],
- }
- },
- created () {
- this.list.fetchData()
- this.initSidePageTab('detail')
- },
- methods: {
- handleOpenSidepage (row) {
- this.sidePageTriggerHandle(this, 'RDSAccountSidePage', {
- id: row.id,
- resource: 'dbinstanceaccounts',
- }, {
- list: this.list,
- rdsItem: this.data,
- })
- },
- },
- }
- </script>
|