diff --git a/@xen-orchestra/web-core/lib/layouts/CoreLayout.vue b/@xen-orchestra/web-core/lib/layouts/CoreLayout.vue index 8393c0da76b..2dceca94c63 100644 --- a/@xen-orchestra/web-core/lib/layouts/CoreLayout.vue +++ b/@xen-orchestra/web-core/lib/layouts/CoreLayout.vue @@ -1,6 +1,6 @@ @@ -13,12 +13,14 @@ import { useHostStore } from '@/stores/xo-rest-api/host.store' import type { XoHost } from '@/types/xo/host.type' import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue' import VtsObjectNotFoundHero from '@core/components/state-hero/VtsObjectNotFoundHero.vue' +import { useUiStore } from '@core/stores/ui.store' import { computed } from 'vue' import { useRoute } from 'vue-router/auto' const route = useRoute<'/host/[id]'>() const { isReady, get } = useHostStore().subscribe() +const uiStore = useUiStore() const host = computed(() => get(route.params.id as XoHost['id'])) diff --git a/@xen-orchestra/web/src/pages/host/[id]/console.vue b/@xen-orchestra/web/src/pages/host/[id]/console.vue index 33f63f3027d..17da8a14942 100644 --- a/@xen-orchestra/web/src/pages/host/[id]/console.vue +++ b/@xen-orchestra/web/src/pages/host/[id]/console.vue @@ -3,7 +3,11 @@ @@ -17,15 +21,29 @@ import VtsClipboardConsole from '@core/components/console/VtsClipboardConsole.vu import VtsLayoutConsole from '@core/components/console/VtsLayoutConsole.vue' import VtsRemoteConsole from '@core/components/console/VtsRemoteConsole.vue' import VtsDivider from '@core/components/divider/VtsDivider.vue' +import { useUiStore } from '@core/stores/ui.store' import { computed } from 'vue' +import { useRouter } from 'vue-router' const props = defineProps<{ host: XoHost }>() +const router = useRouter() +const uiStore = useUiStore() + const url = computed( () => new URL(`/api/consoles/${props.host.controlDomain}`, window.location.origin.replace(/^http/, 'ws')) ) const isHostConsoleAvailable = computed(() => props.host.power_state === 'Running') + +const openInNewTab = () => { + const routeData = router.resolve({ query: { ui: '0' } }) + window.open(routeData.href, '_blank') +} + +const toggleFullScreen = () => { + uiStore.hasUi = !uiStore.hasUi +} diff --git a/@xen-orchestra/web/src/pages/vm/[id].vue b/@xen-orchestra/web/src/pages/vm/[id].vue index cf44be29dcb..d1619dafc35 100644 --- a/@xen-orchestra/web/src/pages/vm/[id].vue +++ b/@xen-orchestra/web/src/pages/vm/[id].vue @@ -2,7 +2,7 @@ - + @@ -13,12 +13,14 @@ import { useVmStore } from '@/stores/xo-rest-api/vm.store' import type { XoVm } from '@/types/xo/vm.type' import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue' import VtsObjectNotFoundHero from '@core/components/state-hero/VtsObjectNotFoundHero.vue' +import { useUiStore } from '@core/stores/ui.store' import { computed } from 'vue' import { useRoute } from 'vue-router/auto' const route = useRoute<'/vm/[id]'>() const { isReady, get: getVm } = useVmStore().subscribe() +const uiStore = useUiStore() const vm = computed(() => getVm(route.params.id as XoVm['id'])) diff --git a/@xen-orchestra/web/src/pages/vm/[id]/console.vue b/@xen-orchestra/web/src/pages/vm/[id]/console.vue index bc685cca2fa..5877fade7ad 100644 --- a/@xen-orchestra/web/src/pages/vm/[id]/console.vue +++ b/@xen-orchestra/web/src/pages/vm/[id]/console.vue @@ -3,7 +3,11 @@ @@ -17,13 +21,27 @@ import VtsClipboardConsole from '@core/components/console/VtsClipboardConsole.vu import VtsLayoutConsole from '@core/components/console/VtsLayoutConsole.vue' import VtsRemoteConsole from '@core/components/console/VtsRemoteConsole.vue' import VtsDivider from '@core/components/divider/VtsDivider.vue' +import { useUiStore } from '@core/stores/ui.store' import { computed } from 'vue' +import { useRouter } from 'vue-router' const props = defineProps<{ vm: XoVm }>() +const router = useRouter() +const uiStore = useUiStore() + const url = computed(() => new URL(`/api/consoles/${props.vm.id}`, window.location.origin.replace(/^http/, 'ws'))) const isVmConsoleAvailable = computed(() => props.vm.power_state === 'Running' && props.vm.other.disable_pv_vnc !== '1') + +const openInNewTab = () => { + const routeData = router.resolve({ query: { ui: '0' } }) + window.open(routeData.href, '_blank') +} + +const toggleFullScreen = () => { + uiStore.hasUi = !uiStore.hasUi +}