singleActions.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('compute.text_1047', [i18n.t('dictionary.server')]),
  7. permission: 'server_create',
  8. action: obj => {
  9. this.$router.push({
  10. path: '/servertemplate/create-server',
  11. query: {
  12. id: obj.id,
  13. },
  14. })
  15. },
  16. meta: obj => {
  17. const isReady = obj.status === 'ready'
  18. return {
  19. validate: isReady,
  20. tooltip: !isReady && i18n.t('compute.text_1048'),
  21. }
  22. },
  23. },
  24. {
  25. label: i18n.t('compute.perform_delete'),
  26. permission: 'servertemplates_delete',
  27. action: obj => {
  28. this.createDialog('DeleteResDialog', {
  29. vm: this,
  30. data: [obj],
  31. columns: this.columns,
  32. title: i18n.t('compute.perform_delete'),
  33. onManager: this.onManager,
  34. name: this.$t('dictionary.servertemplate'),
  35. })
  36. },
  37. meta: obj => this.$getDeleteResult(obj),
  38. },
  39. ]
  40. },
  41. }