index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('compute.text_100')"
  5. icon="res-disk"
  6. :res-name="detailData.name"
  7. :current-tab="params.windowData.currentTab"
  8. :tabs="detailTabs"
  9. :loaded="loaded"
  10. @tab-change="handleTabChange">
  11. <template v-slot:actions v-if="showActions">
  12. <actions
  13. :options="singleActions"
  14. :row="detailData"
  15. :before-show-menu="beforeShowMenu"
  16. button-type="link"
  17. button-size="small" />
  18. </template>
  19. <component
  20. :is="params.windowData.currentTab"
  21. :res-id="data.id"
  22. :id="listId"
  23. :data="detailData"
  24. :getParams="getParams"
  25. :on-manager="onManager"
  26. :columns="columns"
  27. taskResource="compute-tasks" />
  28. </base-side-page>
  29. </template>
  30. <script>
  31. import SidePageMixin from '@/mixins/sidePage'
  32. import WindowsMixin from '@/mixins/windows'
  33. import Actions from '@/components/PageList/Actions'
  34. import SingleActionsMixin from '../mixins/singleActions'
  35. import ColumnsMixin from '../mixins/columns'
  36. import DiskDetail from './Detail'
  37. import SnapshotList from './snapshot'
  38. export default {
  39. name: 'DiskSidePage',
  40. components: {
  41. DiskDetail,
  42. SnapshotList,
  43. Actions,
  44. },
  45. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  46. data () {
  47. return {
  48. detailTabs: [
  49. { label: this.$t('compute.text_238'), key: 'disk-detail' },
  50. { label: this.$t('compute.text_462'), key: 'snapshot-list' },
  51. { label: this.$t('table.title.task'), key: 'task-drawer' },
  52. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  53. ],
  54. }
  55. },
  56. computed: {
  57. getParams () {
  58. return null
  59. },
  60. listId () {
  61. switch (this.params.windowData.currentTab) {
  62. case 'event-drawer':
  63. return 'EventListForDiskSidePage'
  64. default:
  65. return ''
  66. }
  67. },
  68. showActions () {
  69. return !this.$isScopedPolicyMenuHidden('disk_hidden_columns.perform_action')
  70. },
  71. hiddenColumns () {
  72. return this.params.hiddenColumns || []
  73. },
  74. },
  75. methods: {
  76. beforeShowMenu () {
  77. return this.$store.dispatch('scopedPolicy/get', {
  78. category: ['disk_hidden_menus'],
  79. })
  80. },
  81. },
  82. }
  83. </script>