index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$route.path.includes('app-package') ? $t('dictionary.app_package') : $t('compute.text_97')"
  5. icon="res-image"
  6. :res-name="detailData.name"
  7. :current-tab="params.windowData.currentTab"
  8. :tabs="detailTabs"
  9. :loaded="loaded"
  10. @tab-change="handleTabChange">
  11. <template v-if="isStandalone" v-slot:actions>
  12. <actions
  13. :options="singleActions"
  14. :row="detailData"
  15. button-type="link"
  16. button-size="small"
  17. :before-show-menu="beforeShowMenu" />
  18. </template>
  19. <component
  20. :is="params.windowData.currentTab"
  21. :res-id="data.id"
  22. :id="listId"
  23. :data="detailData"
  24. :resource="resource"
  25. :on-manager="onManager"
  26. :columns="columns"
  27. :getParams="getParams"
  28. taskResource="image-tasks"
  29. @refresh="refresh" />
  30. </base-side-page>
  31. </template>
  32. <script>
  33. import SidePageMixin from '@/mixins/sidePage'
  34. import WindowsMixin from '@/mixins/windows'
  35. import Actions from '@/components/PageList/Actions'
  36. import ChildrenImageList from '../../host-image/sidepage/ChildrenImage'
  37. import SingleActionsMixin from '../mixins/singleActions'
  38. import ColumnsMixin from '../mixins/columns'
  39. import SystemImageDetail from './Detail'
  40. import CacheList from './Cache'
  41. import CachedImageEventDrawer from './CachedImageEventList'
  42. export default {
  43. name: 'SystemImageSidePage',
  44. components: {
  45. SystemImageDetail,
  46. CacheList,
  47. ChildrenImageList,
  48. CachedImageEventDrawer,
  49. Actions,
  50. },
  51. mixins: [SidePageMixin, WindowsMixin, SingleActionsMixin, ColumnsMixin],
  52. computed: {
  53. isStandalone () {
  54. if (this.data && this.data.data && [true, 'true'].includes(this.data.data.is_guest_image)) {
  55. return false
  56. }
  57. return true
  58. },
  59. detailTabs () {
  60. if (this.$store.getters.isAdminMode && this.isStandalone) {
  61. return [
  62. { label: this.$t('compute.text_238'), key: 'system-image-detail' },
  63. { label: this.$t('compute.text_692'), key: 'cache-list' },
  64. { label: this.$t('table.title.task'), key: 'task-drawer' },
  65. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  66. { label: this.$t('dictionary.cachedimage') + this.$t('compute.text_240'), key: 'cached-image-event-drawer' },
  67. ]
  68. }
  69. return [
  70. { label: this.$t('compute.text_238'), key: 'system-image-detail' },
  71. { label: this.$t('table.title.task'), key: 'task-drawer' },
  72. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  73. ]
  74. },
  75. listId () {
  76. switch (this.params.windowData.currentTab) {
  77. case 'event-drawer':
  78. return 'EventListForSystemImageSidePage'
  79. case 'cached-image-event-drawer':
  80. return 'EventListForCachedSystemImageSidePage'
  81. default:
  82. return ''
  83. }
  84. },
  85. getParams () {
  86. if (this.params.windowData.currentTab === 'event-drawer') {
  87. return { obj_type: 'image' }
  88. }
  89. if (this.params.windowData.currentTab === 'cached-image-event-drawer') {
  90. return { obj_type: 'cachedimage' }
  91. }
  92. return {}
  93. },
  94. },
  95. methods: {
  96. beforeShowMenu () {
  97. return this.$store.dispatch('scopedPolicy/get', {
  98. category: ['image_hidden_menus'],
  99. })
  100. },
  101. },
  102. }
  103. </script>