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_215'),
  7. permission: 'k8s_pods_update',
  8. action: async obj => {
  9. const manager = new this.$Manager('pods', '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. })
  21. },
  22. },
  23. {
  24. label: i18n.t('k8s.text_201'),
  25. permission: 'k8s_pods_delete',
  26. action: (obj) => {
  27. const requestParams = {
  28. cluster: obj.clusterID,
  29. }
  30. if (obj.namespace) {
  31. requestParams.namespace = obj.namespace
  32. }
  33. this.createDialog('DeleteResDialog', {
  34. data: [obj],
  35. columns: this.columns,
  36. title: i18n.t('k8s.text_201'),
  37. name: i18n.t('k8s.text_9'),
  38. onManager: this.onManager,
  39. requestParams,
  40. success: () => {
  41. this.destroySidePages()
  42. },
  43. })
  44. },
  45. },
  46. ]
  47. },
  48. }