Fix power button actions

This commit is contained in:
Dane Everitt 2019-02-09 17:37:44 -08:00
parent 8385ec7feb
commit 5cb57af193
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 11 additions and 7 deletions

View file

@ -1,12 +1,15 @@
import Vue from 'vue';
import { mapState } from 'vuex';
import {mapState} from 'vuex';
import Status from '../../../helpers/statuses';
import {Socketio} from "@/mixins/socketio";
export default Vue.component('power-buttons', {
computed: {
...mapState('socket', ['connected', 'status']),
},
mixins: [Socketio],
data: function () {
return {
statuses: Status,
@ -15,7 +18,7 @@ export default Vue.component('power-buttons', {
methods: {
sendPowerAction: function (action: string) {
// this.$socket().instance().emit('set status', action)
this.$socket().instance().emit('set status', action)
},
},
@ -28,9 +31,9 @@ export default Vue.component('power-buttons', {
v-on:click.prevent="sendPowerAction('start')"
>Start</button>
<div v-else>
<button class="btn btn-red-500 uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('stop')">Stop</button>
<button class="btn btn-red uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('stop')">Stop</button>
<button class="btn btn-secondary uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('restart')">Restart</button>
<button class="btn btn-secondary uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('kill')">Kill</button>
<button class="btn btn-secondary btn-red uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('kill')">Kill</button>
</div>
</transition>
</div>