| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <page-list
- :list="list"
- :columns="columns"
- :group-actions="groupActions"
- :single-actions="singleActions"
- :export-data-options="exportDataOptions" />
- </template>
- <script>
- import WindowsMixin from '@/mixins/windows'
- import ListMixin from '@/mixins/list'
- import ColumnsMixin from '../mixins/columns'
- import SingleActionsMixin from '../mixins/singleActions'
- export default {
- name: 'PciList',
- mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
- data () {
- return {
- list: this.$list.createList(this, {
- id: 'pciList',
- resource: 'isolated_device_models',
- getParams: this.getParam,
- filterOptions: {
- dev_type: {
- label: this.$t('compute.pci.dev_type'),
- filter: true,
- formatter: val => {
- return `dev_type.contains("${val}")`
- },
- },
- model: {
- label: this.$t('compute.pci.model'),
- filter: true,
- formatter: val => {
- return `model.contains("${val}")`
- },
- },
- vendor_id: {
- label: this.$t('compute.pci.vendor_id'),
- filter: true,
- formatter: val => {
- return `vendor_id.contains("${val}")`
- },
- },
- device_id: {
- label: this.$t('compute.pci.device_id'),
- filter: true,
- formatter: val => {
- return `device_id.contains("${val}")`
- },
- },
- },
- }),
- exportDataOptions: {
- items: [
- { label: 'ID', key: 'id' },
- { label: this.$t('compute.pci.dev_type'), key: 'dev_type' },
- { label: this.$t('compute.pci.model'), key: 'model' },
- { label: this.$t('compute.pci.vendor_id'), key: 'vendor_id' },
- { label: this.$t('compute.pci.device_id'), key: 'device_id' },
- ],
- },
- columns: [],
- groupActions: [
- {
- label: this.$t('common.create'),
- permission: 'isolated_device_models_create',
- action: () => {
- this.createDialog('PciCreateDialog', {
- refresh: this.refresh,
- })
- },
- meta: () => ({
- buttonType: 'primary',
- }),
- },
- {
- label: this.$t('table.action.delete'),
- permission: 'isolated_device_models_delete',
- action: () => {
- this.createDialog('DeleteResDialog', {
- vm: this,
- data: this.list.selectedItems,
- columns: this.columns,
- title: this.$t('table.action.delete'),
- name: this.$t('compute.pci.passthrough_device_type'),
- onManager: this.onManager,
- })
- },
- meta: () => {
- const ret = { validate: this.list.selected.length }
- if (this.list.selectedItems.some(item => !item.can_delete)) {
- ret.validate = false
- return ret
- }
- return ret
- },
- },
- ],
- }
- },
- created () {
- this.initSidePageTab('pci-detail')
- this.list.fetchData()
- },
- methods: {
- getParam () {
- const ret = {
- with_meta: true,
- details: true,
- }
- return ret
- },
- handleOpenSidepage (row, tab) {
- this.sidePageTriggerHandle(this, 'PciSidePage', {
- id: row.id,
- resource: 'isolated_device_models',
- getParams: this.getParam,
- }, {
- list: this.list,
- tab,
- })
- },
- },
- }
- </script>
- <style>
- </style>
|