singleActions.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { getSetPublicAction, getDomainChangeOwnerAction } from '@/utils/common/tableActions'
  2. import i18n from '@/locales'
  3. export default {
  4. created () {
  5. this.singleActions = [
  6. {
  7. label: this.$t('scope.text_528'),
  8. action: (obj) => {
  9. this.onManager('performAction', {
  10. id: obj.id,
  11. managerArgs: {
  12. action: 'sync',
  13. },
  14. })
  15. this.$message.success(this.$t('scope.text_529'))
  16. },
  17. },
  18. {
  19. label: this.$t('common.edit'),
  20. action: (obj) => {
  21. this.createDialog('ChartCreateDialog', {
  22. onManager: this.onManager,
  23. data: [obj],
  24. formType: 'update',
  25. refresh: this.refresh,
  26. })
  27. },
  28. },
  29. {
  30. label: i18n.t('common.more'),
  31. actions: (obj) => {
  32. return [
  33. getSetPublicAction(this, {
  34. name: i18n.t('helm.text_6'),
  35. scope: 'domain',
  36. resource: 'repos',
  37. apiVersion: 'v1',
  38. }, {
  39. permission: 'k8s_repos_perform_public',
  40. }),
  41. getDomainChangeOwnerAction(this, {
  42. name: this.$t('dictionary.host'),
  43. resource: 'repos',
  44. apiVersion: 'v1',
  45. }, {
  46. permission: 'k8s_repos_perform_change_owner',
  47. meta: obj => {
  48. const ownerDomain = this.$store.getters.isAdminMode || obj.domain_id === this.$store.getters.userInfo.projectDomainId
  49. return {
  50. validate: ownerDomain,
  51. }
  52. },
  53. }),
  54. {
  55. label: i18n.t('helm.text_69'),
  56. permission: 'k8s_repos_delete',
  57. action: (obj) => {
  58. const requestParams = {
  59. cluster: obj.clusterID,
  60. }
  61. if (obj.namespace) {
  62. requestParams.namespace = obj.namespace
  63. }
  64. this.createDialog('DeleteResDialog', {
  65. vm: this,
  66. data: [obj],
  67. columns: this.columns,
  68. title: i18n.t('helm.text_69'),
  69. name: i18n.t('helm.text_6'),
  70. onManager: this.onManager,
  71. idKey: 'name',
  72. requestParams,
  73. })
  74. },
  75. meta: (obj) => {
  76. let validate = true
  77. let tooltip = ''
  78. if (+obj.release_count > 0) {
  79. validate = false
  80. tooltip = i18n.t('helm.text_97')
  81. }
  82. return {
  83. validate,
  84. tooltip,
  85. }
  86. },
  87. },
  88. ]
  89. },
  90. },
  91. ]
  92. },
  93. }