singleActions.js 1.3 KB

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