singleActions.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import {
  2. getSetPublicAction,
  3. getEnabledSwitchActions,
  4. } from '@/utils/common/tableActions'
  5. export default {
  6. created () {
  7. this.singleActions = [
  8. {
  9. label: this.$t('aice.mounted_apps.auto_cache.enable'),
  10. permission: 'llm_instant_models_perform_enable_auto_cache',
  11. action: (obj) => {
  12. this.createDialog('InstantAppAutoCacheDialog', {
  13. data: [obj],
  14. columns: this.columns,
  15. onManager: this.onManager,
  16. refresh: this.refresh,
  17. })
  18. },
  19. meta: (obj) => {
  20. const ret = { validate: true, tooltip: null }
  21. if (!obj.enabled) {
  22. ret.validate = false
  23. return ret
  24. }
  25. return ret
  26. },
  27. },
  28. {
  29. label: this.$t('cloudenv.text_311'),
  30. actions: obj => {
  31. return [
  32. getSetPublicAction(this, {
  33. name: this.$t('aice.mounted_apps'),
  34. scope: 'project',
  35. resource: 'llm_instant_models',
  36. }, {
  37. permission: 'llm_instant_models_perform_public,llm_instant_models_perform_private',
  38. }),
  39. // {
  40. // label: this.$t('table.action.modify'),
  41. // action: obj => {
  42. // this.createDialog('LlmImageUpdateDialog', {
  43. // vm: this,
  44. // data: [obj],
  45. // columns: this.columns,
  46. // title: this.$t('table.action.update'),
  47. // name: this.$t('aice.mounted_apps'),
  48. // onManager: this.onManager,
  49. // })
  50. // },
  51. // meta: obj => {
  52. // const ret = {
  53. // validate: obj.can_update,
  54. // }
  55. // return ret
  56. // },
  57. // },
  58. ...getEnabledSwitchActions(this, obj, ['llm_instant_models_perform_enable', 'llm_instant_models_perform_disable'], {
  59. metas: [
  60. () => {
  61. const ret = {
  62. validate: !obj.enabled,
  63. }
  64. return ret
  65. },
  66. () => {
  67. const ret = {
  68. validate: obj.enabled,
  69. }
  70. return ret
  71. },
  72. ],
  73. resourceName: this.$t('aice.mounted_apps'),
  74. }),
  75. // 同步状态
  76. {
  77. label: this.$t('aice.perform_sync_status'),
  78. action: (obj) => {
  79. this.onManager('batchPerformAction', {
  80. steadyStatus: ['active'],
  81. id: [obj.id],
  82. managerArgs: {
  83. action: 'syncstatus',
  84. },
  85. })
  86. },
  87. },
  88. // 更改项目
  89. {
  90. label: this.$t('compute.perform_change_owner', [this.$t('dictionary.project')]),
  91. permission: 'llm_instant_models_perform_public',
  92. action: (obj) => {
  93. this.createDialog('ChangeOwenrDialog', {
  94. data: [obj],
  95. columns: this.columns,
  96. onManager: this.onManager,
  97. refresh: this.refresh,
  98. resource: 'llm_instant_models',
  99. })
  100. },
  101. },
  102. {
  103. label: this.$t('table.action.delete'),
  104. action: obj => {
  105. this.createDialog('DeleteResDialog', {
  106. vm: this,
  107. data: [obj],
  108. columns: this.columns,
  109. title: this.$t('table.action.delete'),
  110. name: this.$t('aice.mounted_apps'),
  111. onManager: this.onManager,
  112. })
  113. },
  114. meta: obj => this.$getDeleteResult(obj),
  115. },
  116. ]
  117. },
  118. },
  119. ]
  120. },
  121. }