Skip to content

Commit

Permalink
fix(ui): hide open in new window inside popup window
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jun 26, 2024
1 parent ab7634b commit 28dc90b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ export function openInWindow(title, height = 800, width = 600) {
}
}

export function isPopupWindow() {
return window.opener !== null && window.opener !== window;

Check failure on line 315 in src/lib/utils.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `;`
}

Check failure on line 316 in src/lib/utils.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `··`

export function getProtocolIcon(protocol) {
if (typeof protocol === 'boolean') {
protocol = protocol ? Protocols.ZWaveLongRange : Protocols.ZWave
Expand Down
4 changes: 2 additions & 2 deletions src/views/Debug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -152,7 +152,7 @@ export default {
color: 'primary',
tooltip: 'Open in window',
action: this.newWindow,
disabled: false,
disabled: isPopupWindow(),
},
]
},
Expand Down
6 changes: 4 additions & 2 deletions src/views/Zniffer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
<v-card-title> Settings </v-card-title>
<v-card-text>
<v-row>
<v-col cols="12">
<v-col v-if="!isPopup" cols="12">
<v-btn
text
small
Expand Down Expand Up @@ -354,6 +354,7 @@ import {
humanFriendlyNumber,
openInWindow,
getProtocolIcon,
isPopupWindow,
} from '../lib/utils'
export default {
Expand Down Expand Up @@ -421,7 +422,7 @@ export default {
endHeight() {
const lastIndex = this.start + this.perPage
return this.rowHeight * (this.totalFrames - lastIndex + 1)
},
}

Check failure on line 425 in src/views/Zniffer.vue

View workflow job for this annotation

GitHub Actions / test (18.x)

Insert `,`
},
watch: {
topPaneHeight() {
Expand Down Expand Up @@ -504,6 +505,7 @@ export default {
data() {
return {
znifferRegions,
isPopup: isPopupWindow(),
fab: false,
drawer: false,
frequency: null,
Expand Down

0 comments on commit 28dc90b

Please sign in to comment.