Added hotkeys
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2021-06-13 17:52:45 +02:00
parent e10e00f222
commit e49dfa52c7
4 changed files with 27 additions and 0 deletions

15
package-lock.json generated
View File

@ -11665,6 +11665,21 @@
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true "dev": true
}, },
"v-hotkey": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/v-hotkey/-/v-hotkey-0.9.0.tgz",
"integrity": "sha512-PVbU9cw5oyoOr6y5q0nN9xmndzpCsLDhXRgVP80WRMvM1Eqkai3ViuJs/D+qFhRht6u5LyM10eBEZ5hq+3qLTg==",
"requires": {
"core-js": "^2.6.5"
},
"dependencies": {
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
}
}
},
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",

View File

@ -12,6 +12,7 @@
"bootstrap": "^4.5.2", "bootstrap": "^4.5.2",
"bootstrap-vue": "^2.16.0", "bootstrap-vue": "^2.16.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"v-hotkey": "^0.9.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
"vuex": "^3.4.0" "vuex": "^3.4.0"

View File

@ -3,6 +3,7 @@
<b-card <b-card
:title="cardTitle" :title="cardTitle"
class="m-2" class="m-2"
v-hotkey.prevent="keymap"
> >
<b-card-text> <b-card-text>
Could not read device data! Could not read device data!
@ -31,6 +32,13 @@ export default {
computed: { computed: {
cardTitle() { cardTitle() {
return `Device: ${this.device_id}` return `Device: ${this.device_id}`
},
keymap() {
return {
"up": this.bringOnline,
"down": this.bringOffline,
"right": this.doManualAlert
}
} }
}, },
methods: { methods: {

View File

@ -7,9 +7,12 @@ import axios from 'axios'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
import VueHotkey from 'v-hotkey'
import 'bootstrap/dist/css/bootstrap.css' import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css' import 'bootstrap-vue/dist/bootstrap-vue.css'
Vue.use(VueHotkey)
Vue.use(BootstrapVue) Vue.use(BootstrapVue)
Vue.use(IconsPlugin) Vue.use(IconsPlugin)