singleActions.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('compute.text_234'),
  7. action: (obj) => {
  8. this.onManager('performAction', {
  9. steadyStatus: ['succeeded', 'failed'],
  10. id: obj.id,
  11. managerArgs: {
  12. action: 'run',
  13. },
  14. })
  15. },
  16. meta: obj => {
  17. const { status } = obj
  18. const isRun = status === 'running'
  19. return {
  20. validate: !isRun,
  21. tooltip: isRun && i18n.t('compute.text_235'),
  22. }
  23. },
  24. },
  25. {
  26. label: i18n.t('compute.text_236'),
  27. action: (obj) => {
  28. this.createDialog('AnsiblePlayBookStopDialog', {
  29. title: i18n.t('compute.text_236'),
  30. data: [obj],
  31. onManager: this.onManager,
  32. columns: this.columns,
  33. })
  34. },
  35. meta: obj => {
  36. const { status } = obj
  37. const isRun = status === 'running'
  38. return {
  39. validate: isRun,
  40. tooltip: !isRun && i18n.t('compute.text_237'),
  41. }
  42. },
  43. },
  44. ]
  45. },
  46. }