index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('compute.backup_storage')"
  5. icon="res-backup-storage"
  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>
  12. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  13. </template>
  14. <component
  15. v-bind="hostListActions"
  16. :is="params.windowData.currentTab"
  17. :data="detailData"
  18. :on-manager="onManager"
  19. :refresh="refresh"
  20. @refresh="refresh"
  21. :list="params.list"
  22. :getParams="getParams"
  23. :columns="columns"
  24. :res-id="data.id"
  25. :id="listId" />
  26. </base-side-page>
  27. </template>
  28. <script>
  29. import HostList from '@Compute/views/host/components/List'
  30. import Actions from '@/components/PageList/Actions'
  31. import SidePageMixin from '@/mixins/sidePage'
  32. import WindowsMixin from '@/mixins/windows'
  33. import BackupStorageDetail from './Detail'
  34. import ColumnsMixin from '../mixins/columns'
  35. import SingleActionsMixin from '../mixins/singleActions'
  36. export default {
  37. name: 'BackupStorageSidePage',
  38. components: {
  39. BackupStorageDetail,
  40. Actions,
  41. HostList,
  42. },
  43. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  44. data () {
  45. return {
  46. detailTabs: [
  47. { label: this.$t('compute.text_238'), key: 'backup-storage-detail' },
  48. { label: this.$t('storage.text_50'), key: 'host-list' },
  49. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  50. ],
  51. }
  52. },
  53. computed: {
  54. getParams () {
  55. return {
  56. backupstorage: this.data.id,
  57. details: true,
  58. }
  59. },
  60. hostListActions () {
  61. const me = this
  62. return {
  63. // this = hostList
  64. frontGroupActions: function () {
  65. return [
  66. {
  67. label: this.$t('storage.text_66'),
  68. permission: 'hostbackupstorages_create',
  69. action: () => {
  70. this.createDialog('HostAttachBackupStorageDialog', {
  71. data: [me.detailData],
  72. columns: me.columns,
  73. title: this.$t('storage.text_66'),
  74. onManager: this.onManager,
  75. refresh: this.refresh,
  76. })
  77. },
  78. },
  79. {
  80. label: this.$t('storage.text_90'),
  81. permission: 'hostbackupstorages_delete',
  82. action: () => {
  83. this.createDialog('HostDetachBackupStorageDialog', {
  84. title: this.$t('storage.text_90'),
  85. data: this.list.selectedItems,
  86. columns: this.columns,
  87. list: this.list,
  88. resId: me.getParams.backupstorage,
  89. })
  90. },
  91. meta: () => {
  92. return {
  93. validate: this.list.selectedItems.length > 0,
  94. }
  95. },
  96. },
  97. ]
  98. },
  99. frontSingleActions: function () {
  100. return [
  101. {
  102. label: this.$t('storage.text_90'),
  103. permission: 'hostbackupstorages_delete',
  104. action: (row) => {
  105. this.createDialog('HostDetachBackupStorageDialog', {
  106. title: this.$t('storage.text_90'),
  107. data: [row],
  108. columns: this.columns,
  109. list: this.list,
  110. resId: me.getParams.backupstorage,
  111. })
  112. },
  113. },
  114. ]
  115. },
  116. }
  117. },
  118. listId () {
  119. switch (this.params.windowData.currentTab) {
  120. case 'host-list':
  121. return 'HostListForBlockStorageSidePage'
  122. case 'event-drawer':
  123. return 'EventListForBackupStorageSidePage'
  124. default:
  125. return ''
  126. }
  127. },
  128. },
  129. }
  130. </script>