singleActions.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { mapGetters } from 'vuex'
  2. import i18n from '@/locales'
  3. export default {
  4. created () {
  5. this.singleActions = [
  6. // {
  7. // label: i18n.t('cloudenv.text_463'),
  8. // action: (obj) => {
  9. // this.createDialog('CdnHostnameCreateDialog', {
  10. // onManager: this.onManager,
  11. // type: 'edit',
  12. // data: [obj],
  13. // title: i18n.t('cloudenv.text_463'),
  14. // })
  15. // },
  16. // },
  17. {
  18. label: i18n.t('network.text_131'),
  19. action: (obj) => {
  20. this.createDialog('DeleteResDialog', {
  21. vm: this,
  22. title: i18n.t('network.text_131'),
  23. name: this.$t('network.cdn_custom_hostname'),
  24. data: [obj],
  25. columns: this.columns,
  26. ok: async (ids) => {
  27. await new this.$Manager(`cdn_domains/${this.cdnId}/delete-custom-hostname`).batchPost({
  28. data: { id: obj.id },
  29. })
  30. this.list.refresh()
  31. },
  32. })
  33. },
  34. },
  35. ]
  36. },
  37. computed: {
  38. ...mapGetters(['isAdminMode', 'isDomainMode', 'userInfo']),
  39. },
  40. methods: {
  41. isOwner (obj) {
  42. if (this.isAdminMode) return true
  43. if (this.isDomainMode) return obj.domain_id === this.userInfo.projectDomainId
  44. return false
  45. },
  46. },
  47. }