index.vue 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('k8s.text_226')"
  5. icon="res-k8s-cronjob"
  6. :res-name="detailData.name"
  7. :actions="params.actions"
  8. :current-tab="params.windowData.currentTab"
  9. :tabs="detailTabs"
  10. :loaded="loaded"
  11. @tab-change="handleTabChange">
  12. <template v-slot:actions>
  13. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  14. </template>
  15. <component :is="params.windowData.currentTab" :key="params.windowData.currentTab" :id="listId" :res-id="data.id" :data="detailData" :onManager="onManager" resource="cronjobs" :getParams="getParams" :showSearchbox="false" :showGroupActions="false" />
  16. </base-side-page>
  17. </template>
  18. <script>
  19. import ColumnsMixin from '../mixins/columns'
  20. import SingleActionsMixin from '../mixins/singleActions'
  21. import Detail from './Detail'
  22. import EventsSidepage from '@K8S/sections/EventsSidepage'
  23. import SourceInformationSidepage from '@K8S/sections/SourceInformationSidepage'
  24. import JobList from '@K8S/views/job/components/List'
  25. import SidePageMixin from '@/mixins/sidePage'
  26. import WindowsMixin from '@/mixins/windows'
  27. import Actions from '@/components/PageList/Actions'
  28. export default {
  29. name: 'K8SCronJobsSidePage',
  30. components: {
  31. Actions,
  32. Detail,
  33. EventsSidepage,
  34. SourceInformationSidepage,
  35. ActiveJobs: JobList,
  36. InactiveJobs: JobList,
  37. },
  38. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  39. data () {
  40. return {
  41. detailTabs: [
  42. { label: this.$t('k8s.text_217'), key: 'detail' },
  43. { label: this.$t('k8s.text_227'), key: 'active-jobs' },
  44. { label: this.$t('k8s.text_228'), key: 'inactive-jobs' },
  45. { label: this.$t('k8s.text_218'), key: 'events-sidepage' },
  46. { label: this.$t('k8s.text_219'), key: 'source-information-sidepage' },
  47. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  48. ],
  49. }
  50. },
  51. computed: {
  52. getParams () {
  53. const params = {
  54. owner_kind: this.detailData.kind,
  55. owner_name: this.detailData.name,
  56. namespace: this.detailData.namespace,
  57. cluster: this.detailData.clusterID,
  58. }
  59. if (this.params.windowData.currentTab === 'active-jobs') {
  60. params.active = true
  61. }
  62. if (this.params.windowData.currentTab === 'inactive-jobs') {
  63. params.active = false
  64. }
  65. return params
  66. },
  67. listId () {
  68. switch (this.params.windowData.currentTab) {
  69. case 'event-drawer':
  70. return 'EventListForK8SCronJobsSidePage'
  71. case 'active-jobs':
  72. return 'ActiveJobsForK8SCronJobsSidePage'
  73. case 'inactive-jobs':
  74. return 'InactiveJobsForK8SCronJobsSidePage'
  75. case 'events-sidepage':
  76. return 'EventsForK8SCronJobsSidePage'
  77. default:
  78. return ''
  79. }
  80. },
  81. },
  82. }
  83. </script>