Skip to content

Commit

Permalink
feat(ui): debug window (#852)
Browse files Browse the repository at this point in the history
* feat(ui): debug window

* fix: typo

* fix: hide menubar
  • Loading branch information
robertsLando authored Mar 9, 2021
1 parent 1bd5c43 commit 42b2826
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-app :dark="dark">
<div v-if="$route.meta.requiresAuth && auth !== undefined">
<div v-if="$route.meta.requiresAuth && auth !== undefined && !hideTopbar">
<v-navigation-drawer
clipped-left
:mini-variant="mini"
Expand Down Expand Up @@ -239,6 +239,7 @@ export default {
drawer: false,
mini: false,
topbar: [],
hideTopbar: false,
title: '',
snackbar: false,
snackbarText: '',
Expand Down Expand Up @@ -515,6 +516,12 @@ export default {
this.toggleDrawer()
}
const hash = window.location.hash.substr(1)
if (hash === 'no-topbar') {
this.hideTopbar = true
}
this.dark = this.settings.load('dark', false)
this.changeThemeColor()
Expand Down
28 changes: 27 additions & 1 deletion src/components/Debug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
>Stop</v-btn
>
<v-btn color="blue darken-1" text @click="debug = []">Clear</v-btn>

<v-btn
v-if="!hideTopbar"
color="yellow darken-1"
text
@click="newWindow"
>Open in window</v-btn
>
</v-col>

<v-col cols="12">
Expand Down Expand Up @@ -42,19 +50,37 @@ export default {
data () {
return {
debug: [],
debugActive: false
debugActive: true,
hideTopbar: false
}
},
methods: {
...mapMutations(['showSnackbar']),
toggleDebug (v) {
this.debugActive = v
this.showSnackbar('Debug ' + (v ? 'activated' : 'disabled'))
},
newWindow () {
const newwindow = window.open(
window.location.href + '#no-topbar',
'DEBUG',
'height=800,width=600,status=no,toolbar:no,scrollbars:no,menubar:no' // check https://www.w3schools.com/jsref/met_win_open.asp for all available specs
)
if (window.focus) {
newwindow.focus()
}
}
},
mounted () {
// init socket events
const self = this
const hash = window.location.hash.substr(1)
if (hash === 'no-topbar') {
this.hideTopbar = true
}
this.socket.on(socketEvents.debug, data => {
if (self.debugActive) {
data = ansiUp.ansi_to_html(data)
Expand Down

0 comments on commit 42b2826

Please sign in to comment.