Skip to content

Commit

Permalink
feat(ui): add node debug info tab (#462)
Browse files Browse the repository at this point in the history
* feat: add node debug info tab

* refactor: use v-textarea, add copy, use mdi icons

* Update src/components/nodes-table/ExpandedNode.vue

refactor: use built-in icon

Co-authored-by: Daniel Lando <daniel.sorridi@gmail.com>

* refactor: revert inclusion of mdi icons

Co-authored-by: Andreas Hochsteger <andreas.hochsteger@oeamtc.at>
Co-authored-by: Daniel Lando <daniel.sorridi@gmail.com>
  • Loading branch information
3 people authored Feb 5, 2021
1 parent 94a32ea commit 56e1c62
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/components/nodes-table/ExpandedNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<v-tab key="node">Node</v-tab>
<v-tab v-if="showHass" key="homeassistant">Home Assistant</v-tab>
<v-tab key="groups">Groups</v-tab>
<v-tab key="debug">Debug Info</v-tab>

<!-- TABS -->
<v-tabs-items
style="background: transparent; padding-bottom: 10px;"
Expand All @@ -29,6 +31,19 @@
<v-tab-item key="groups">
<association-groups :node="node" :nodes="nodes" :socket="socket" />
</v-tab-item>

<!-- TAB DEBUG INFO -->
<v-tab-item key="debug">
<v-textarea
class="mx-2"
rows="10"
append-icon="content_copy"
v-model="nodeJson"
readonly
ref="nodeJsonContent"
@click:append="copyText"
></v-textarea>
</v-tab-item>
</v-tabs-items>
</v-tabs>
</td>
Expand Down Expand Up @@ -57,6 +72,9 @@ export default {
},
computed: {
...mapGetters(['gateway']),
nodeJson () {
return JSON.stringify(this.node, null, 2)
},
showHass () {
console.log(Object.keys(this.node.hassDevices))
return (
Expand All @@ -70,6 +88,15 @@ export default {
return {
currentTab: 0
}
},
methods: {
copyText () {
const textToCopy = this.$refs.nodeJsonContent.$el.querySelector(
'textarea'
)
textToCopy.select()
document.execCommand('copy')
}
}
}
</script>
Expand Down

0 comments on commit 56e1c62

Please sign in to comment.