singleActions.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('k8s.text_215'),
  7. permission: 'k8s_configmaps_update',
  8. action: async obj => {
  9. const manager = new this.$Manager('configmaps', 'v1')
  10. async function fetchData () {
  11. const { data } = await manager.getSpecific({ id: obj.id, spec: 'rawdata' })
  12. return data
  13. }
  14. const configText = await fetchData()
  15. this.createDialog('K8SEditYamlDialog', {
  16. data: [obj],
  17. manager,
  18. refresh: this.refresh,
  19. configText,
  20. success: () => {
  21. if (this.getResponseData) this.getResponseData()
  22. },
  23. })
  24. },
  25. },
  26. {
  27. label: i18n.t('k8s.text_201'),
  28. permission: 'k8s_configmaps_delete',
  29. action: (obj) => {
  30. const requestParams = {
  31. cluster: obj.clusterID,
  32. }
  33. if (obj.namespace) {
  34. requestParams.namespace = obj.namespace
  35. }
  36. this.createDialog('DeleteResDialog', {
  37. data: [obj],
  38. columns: this.columns,
  39. title: i18n.t('k8s.text_201'),
  40. name: i18n.t('k8s.text_17'),
  41. onManager: this.onManager,
  42. requestParams,
  43. success: () => {
  44. if (this.getResponseData) this.getResponseData()
  45. this.destroySidePages()
  46. },
  47. })
  48. },
  49. },
  50. ]
  51. },
  52. }