singleActions.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('k8s.text_298'),
  7. permission: 'k8s_nodes_perform_uncordon',
  8. action: obj => {
  9. new this.$Manager('k8s_nodes', 'v1').performAction({
  10. id: obj.id,
  11. action: 'uncordon',
  12. data: { cluster: obj.cluster },
  13. }).then(() => {
  14. this.refresh()
  15. })
  16. },
  17. meta: obj => {
  18. return {
  19. validate: obj.unschedulable,
  20. }
  21. },
  22. },
  23. {
  24. label: i18n.t('k8s.text_299'),
  25. permission: 'k8s_nodes_perform_cordon',
  26. action: obj => {
  27. new this.$Manager('k8s_nodes', 'v1').performAction({
  28. id: obj.id,
  29. action: 'cordon',
  30. data: { cluster: obj.cluster },
  31. }).then(() => {
  32. this.refresh()
  33. })
  34. },
  35. meta: obj => {
  36. return {
  37. validate: !obj.unschedulable,
  38. }
  39. },
  40. },
  41. {
  42. label: i18n.t('k8s.text_215'),
  43. permission: 'k8s_nodes_update',
  44. action: async obj => {
  45. const manager = new this.$Manager('k8s_nodes', 'v1')
  46. async function fetchData () {
  47. const { data } = await manager.getSpecific({ id: obj.id, spec: 'rawdata' })
  48. return data
  49. }
  50. const configText = await fetchData()
  51. this.createDialog('K8SEditYamlDialog', {
  52. data: [obj],
  53. manager,
  54. refresh: this.refresh,
  55. configText,
  56. })
  57. },
  58. },
  59. ]
  60. },
  61. }