| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <page-list
- :list="list"
- show-tag-columns
- show-tag-filter
- :columns="templateListColumns || columns"
- :single-actions="singleActions"
- :group-actions="groupActions"
- :showSearchbox="showSearchbox"
- :showGroupActions="showGroupActions"
- :export-data-options="exportDataOptions"
- :show-single-actions="!isTemplate"
- :show-page="!isTemplate" />
- </template>
- <script>
- import * as R from 'ramda'
- import ListMixin from '@/mixins/list'
- import ResTemplateListMixin from '@/mixins/resTemplateList'
- import WindowsMixin from '@/mixins/windows'
- import expectStatus from '@/constants/expectStatus'
- import {
- getDomainFilter,
- getStatusFilter,
- getDescriptionFilter,
- getCreatedAtFilter,
- getBrandFilter,
- getTenantFilter,
- getAccountFilter,
- getCloudProviderFilter,
- } from '@/utils/common/tableFilter'
- import GlobalSearchMixin from '@/mixins/globalSearch'
- import SingleActionsMixin from '../mixins/singleActions'
- import ColumnsMixin from '../mixins/columns'
- export default {
- name: 'DnsZoneList',
- mixins: [WindowsMixin, ListMixin, GlobalSearchMixin, ColumnsMixin, SingleActionsMixin, ResTemplateListMixin],
- props: {
- id: String,
- getParams: {
- type: [Function, Object],
- },
- cloudEnv: String,
- },
- data () {
- return {
- list: this.$list.createList(this, {
- ctx: this,
- id: this.id,
- resource: 'dns_zones',
- getParams: this.getParam,
- isTemplate: this.isTemplate,
- templateLimit: this.templateLimit,
- steadyStatus: {
- status: Object.values(expectStatus.dnszone).flat(),
- },
- filterOptions: {
- id: {
- label: this.$t('table.title.id'),
- },
- name: {
- label: this.$t('network.text_21'),
- filter: true,
- formatter: val => {
- return `name.contains("${val}")`
- },
- },
- description: getDescriptionFilter(),
- status: getStatusFilter('dnszone'),
- brand: getBrandFilter(),
- account: getAccountFilter(),
- manager: getCloudProviderFilter(),
- zone_type: {
- label: this.$t('network.text_717'),
- dropdown: true,
- multiple: true,
- items: [
- { label: 'PublicZone', key: 'PublicZone' },
- { label: 'PrivateZone', key: 'PrivateZone' },
- ],
- filter: true,
- formatter: val => {
- return `zone_type.contains("${val}")`
- },
- },
- project_domains: getDomainFilter(),
- tenant: getTenantFilter(),
- created_at: getCreatedAtFilter(),
- },
- responseData: this.responseData,
- hiddenColumns: ['created_at'],
- }),
- groupActions: [
- {
- label: this.$t('network.text_26'),
- permission: 'dns_zones_create',
- action: () => {
- this.$router.push({
- name: 'DnsZoneCreate',
- params: {
- cloudEnv: this.cloudEnv,
- },
- })
- },
- meta: () => {
- return {
- buttonType: 'primary',
- }
- },
- },
- {
- label: this.$t('compute.text_275'),
- actions: () => {
- return [
- {
- label: this.$t('compute.text_283'),
- permission: 'dns_zones_perform_set_user_metadata',
- action: () => {
- this.createDialog('SetTagDialog', {
- data: this.list.selectedItems,
- columns: this.columns,
- onManager: this.onManager,
- params: {
- resources: 'dns_zones',
- },
- mode: 'add',
- })
- },
- },
- {
- label: this.$t('network.text_131'),
- permission: 'dns_zones_delete',
- action: () => {
- this.createDialog('DeleteResDialog', {
- vm: this,
- title: this.$t('network.text_131'),
- name: this.$t('dictionary.dns_zone'),
- data: this.list.selectedItems,
- columns: this.columns,
- onManager: this.onManager,
- alert: this.$t('network.text_762'),
- })
- },
- meta: () => {
- return {
- validate: this.list.allowDelete(),
- }
- },
- },
- ]
- },
- meta: () => {
- const ret = {
- validate: true,
- tooltip: null,
- }
- ret.validate = this.list.selectedItems.length > 0
- if (!ret.validate) return ret
- return ret
- },
- },
- ],
- }
- },
- computed: {
- exportDataOptions () {
- return {
- downloadType: 'local',
- title: this.$t('dictionary.dns_zone'),
- items: [
- ...this.columns,
- { field: 'manager', title: this.$t('dictionary.cloudprovider') },
- ],
- }
- },
- },
- watch: {
- cloudEnv (val) {
- this.$nextTick(() => {
- this.list.fetchData(0)
- })
- },
- },
- created () {
- this.initSidePageTab('dns-zone-detail')
- this.list.fetchData()
- this.$bus.$on('DnsZoneListSingleRefresh', (...arg) => {
- this.list.refresh(...arg)
- }, false)
- },
- methods: {
- getParam () {
- const ret = {
- ...(R.is(Function, this.getParams) ? this.getParams() : this.getParams),
- detail: true,
- }
- if (this.cloudEnv) ret.cloud_env = this.cloudEnv
- return ret
- },
- handleOpenSidepage (row, tab) {
- this.sidePageTriggerHandle(this, 'DnsZoneSidePage', {
- id: row.id,
- resource: 'dns_zones',
- }, {
- list: this.list,
- tab,
- })
- },
- },
- }
- </script>
|