singleActions.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { mapGetters } from 'vuex'
  2. // import { Base64 } from 'js-base64'
  3. // import qs from 'qs'
  4. import protocolCheck from 'custom-protocol-detection'
  5. import { typeClouds } from '@/utils/common/hypervisor'
  6. import Actions from '../constants/actions'
  7. export default {
  8. computed: {
  9. ...mapGetters(['isAdminMode', 'isDomainMode', 'userInfo', 'auth', 'common']),
  10. enableMFA () {
  11. return this.userInfo.enable_mfa && this.auth.auth.system_totp_on
  12. },
  13. enableWaterMark () {
  14. const { globalConfig = {} } = this.common
  15. const { enable_watermark = true } = globalConfig
  16. return enable_watermark
  17. },
  18. },
  19. created () {
  20. this.webconsoleManager = new this.$Manager('webconsole', 'v1')
  21. this.singleActions = Actions.getSingleActions.call(this)
  22. },
  23. destroyed () {
  24. this.webconsoleManager = null
  25. },
  26. methods: {
  27. openWebConsole (obj, data, protocol) {
  28. this.$openWebConsole(data)
  29. },
  30. open (obj, url) {
  31. if (obj.hypervisor === typeClouds.hypervisorMap.esxi.key) {
  32. protocolCheck(url, () => {
  33. this.createDialog('VmrcDownload', {
  34. data: [obj],
  35. columns: this.columns,
  36. onManager: this.onManager,
  37. })
  38. }, () => {
  39. window.location.href = url
  40. })
  41. } else {
  42. window.open(url)
  43. }
  44. },
  45. },
  46. }