singleActions.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('k8s.text_201'),
  7. permission: 'k8s_rbacrolebindings_delete',
  8. action: (obj) => {
  9. this.createDialog('DeleteResDialog', {
  10. vm: this,
  11. data: [obj],
  12. columns: this.columns,
  13. title: i18n.t('k8s.text_328'),
  14. name: i18n.t('k8s.text_24'),
  15. onManager: this.onManager,
  16. ok: (ids, data) => {
  17. return new this.$Manager('rbacrolebindings', 'v1').batchDelete({
  18. ids,
  19. data: {
  20. cluster: data[0].clusterID,
  21. namespace: data[0].namespace,
  22. },
  23. }).then(() => {
  24. if (this.getResponseData) {
  25. this.getResponseData()
  26. } else {
  27. this.destroySidePages()
  28. this.refresh()
  29. }
  30. return true
  31. }).catch(error => {
  32. throw error
  33. })
  34. },
  35. })
  36. },
  37. },
  38. {
  39. label: i18n.t('k8s.text_215'),
  40. permission: 'k8s_rbacrolebindings_update',
  41. action: async obj => {
  42. const manager = new this.$Manager('rbacrolebindings', '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. },
  61. }