Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): debug window #852

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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