singleActions.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('k8s.text_63'),
  7. permission: 'k8s_daemonsets_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_215'),
  22. permission: 'k8s_daemonsets_update',
  23. action: async obj => {
  24. const manager = new this.$Manager('daemonsets', 'v1')
  25. async function fetchData () {
  26. const { data } = await manager.getSpecific({ id: obj.id, spec: 'rawdata' })
  27. return data
  28. }
  29. const configText = await fetchData()
  30. this.createDialog('K8SEditYamlDialog', {
  31. data: [obj],
  32. manager,
  33. refresh: this.refresh,
  34. configText,
  35. success: () => {
  36. if (this.getResponseData) this.getResponseData()
  37. },
  38. })
  39. },
  40. },
  41. {
  42. label: i18n.t('k8s.text_201'),
  43. permission: 'k8s_daemonsets_delete',
  44. action: obj => {
  45. const requestParams = {
  46. cluster: obj.clusterID,
  47. }
  48. if (obj.namespace) {
  49. requestParams.namespace = obj.namespace
  50. }
  51. this.createDialog('DeleteResDialog', {
  52. data: [obj],
  53. name: i18n.t('k8s.text_4'),
  54. columns: this.columns,
  55. title: i18n.t('k8s.text_201'),
  56. onManager: this.onManager,
  57. requestParams,
  58. success: () => {
  59. if (this.getResponseData) this.getResponseData()
  60. this.destroySidePages()
  61. },
  62. })
  63. },
  64. },
  65. ]
  66. },
  67. }