From 28dc90badc2355c49c7294a8fe83fa8559b3808e Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Wed, 26 Jun 2024 12:06:25 +0200 Subject: [PATCH] fix(ui): hide open in new window inside popup window --- src/lib/utils.js | 4 ++++ src/views/Debug.vue | 4 ++-- src/views/Zniffer.vue | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/utils.js b/src/lib/utils.js index 9cbf646af83..0e7bc255bd0 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -311,6 +311,10 @@ export function openInWindow(title, height = 800, width = 600) { } } +export function isPopupWindow() { + return window.opener !== null && window.opener !== window; + } + export function getProtocolIcon(protocol) { if (typeof protocol === 'boolean') { protocol = protocol ? Protocols.ZWaveLongRange : Protocols.ZWave diff --git a/src/views/Debug.vue b/src/views/Debug.vue index 9ba27dffb17..3e63a8468ab 100644 --- a/src/views/Debug.vue +++ b/src/views/Debug.vue @@ -91,7 +91,7 @@ import { socketEvents } from '@server/lib/SocketEvents' import { AnsiUp } from 'ansi_up' import { mapState, mapActions } from 'pinia' import useBaseStore from '../stores/base.js' -import { openInWindow } from '../lib/utils' +import { isPopupWindow, openInWindow } from '../lib/utils' const ansiUp = new AnsiUp() @@ -152,7 +152,7 @@ export default { color: 'primary', tooltip: 'Open in window', action: this.newWindow, - disabled: false, + disabled: isPopupWindow(), }, ] }, diff --git a/src/views/Zniffer.vue b/src/views/Zniffer.vue index f2e809e9e50..dc7b78ba11b 100644 --- a/src/views/Zniffer.vue +++ b/src/views/Zniffer.vue @@ -300,7 +300,7 @@ Settings - +