singleActions.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('k8s.text_63'),
  7. permission: 'k8s_statefulsets_update',
  8. action: obj => {
  9. this.createDialog('K8SSetImageDialog', {
  10. data: [obj],
  11. columns: this.columns,
  12. onManager: this.onManager,
  13. refresh: this.refresh,
  14. success: () => {
  15. if (this.getResponseData) this.getResponseData()
  16. },
  17. })
  18. },
  19. },
  20. {
  21. label: i18n.t('k8s.text_68'),
  22. permission: 'k8s_statefulsets_update',
  23. action: obj => {
  24. this.createDialog('K8SSetLimitDialog', {
  25. data: [obj],
  26. columns: this.columns,
  27. onManager: this.onManager,
  28. refresh: this.refresh,
  29. success: () => {
  30. if (this.getResponseData) this.getResponseData()
  31. },
  32. })
  33. },
  34. },
  35. {
  36. label: i18n.t('k8s.text_196'),
  37. actions: obj => [
  38. {
  39. label: i18n.t('k8s.text_215'),
  40. permission: 'k8s_statefulsets_update',
  41. action: async () => {
  42. const manager = new this.$Manager('statefulsets', 'v1')
  43. async function fetchData () {
  44. const { data } = await manager.getSpecific({ id: obj.id, spec: 'rawdata' })
  45. return data
  46. }
  47. const configText = await fetchData()
  48. this.createDialog('K8SEditYamlDialog', {
  49. data: [obj],
  50. manager,
  51. refresh: this.refresh,
  52. configText,
  53. success: () => {
  54. if (this.getResponseData) this.getResponseData()
  55. },
  56. })
  57. },
  58. },
  59. {
  60. label: i18n.t('k8s.text_201'),
  61. permission: 'k8s_statefulsets_delete',
  62. action: () => {
  63. const requestParams = {
  64. cluster: obj.clusterID,
  65. }
  66. if (obj.namespace) {
  67. requestParams.namespace = obj.namespace
  68. }
  69. this.createDialog('DeleteResDialog', {
  70. vm: this,
  71. data: [obj],
  72. columns: this.columns,
  73. title: i18n.t('k8s.text_201'),
  74. name: i18n.t('k8s.text_5'),
  75. onManager: this.onManager,
  76. requestParams,
  77. success: () => {
  78. if (this.getResponseData) this.getResponseData()
  79. },
  80. })
  81. },
  82. },
  83. ],
  84. },
  85. ]
  86. },
  87. }