File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
components/server/components Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 11import Vue from 'vue' ;
2- import { mapState } from 'vuex' ;
2+ import { mapState } from 'vuex' ;
33import Status from '../../../helpers/statuses' ;
4+ import { Socketio } from "@/mixins/socketio" ;
45
56export default Vue . component ( 'power-buttons' , {
67 computed : {
78 ...mapState ( 'socket' , [ 'connected' , 'status' ] ) ,
89 } ,
910
11+ mixins : [ Socketio ] ,
12+
1013 data : function ( ) {
1114 return {
1215 statuses : Status ,
@@ -15,7 +18,7 @@ export default Vue.component('power-buttons', {
1518
1619 methods : {
1720 sendPowerAction : function ( action : string ) {
18- // this.$socket().instance().emit('set status', action)
21+ this . $socket ( ) . instance ( ) . emit ( 'set status' , action )
1922 } ,
2023 } ,
2124
@@ -28,9 +31,9 @@ export default Vue.component('power-buttons', {
2831 v-on:click.prevent="sendPowerAction('start')"
2932 >Start</button>
3033 <div v-else>
31- <button class="btn btn-red-500 uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('stop')">Stop</button>
34+ <button class="btn btn-red uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('stop')">Stop</button>
3235 <button class="btn btn-secondary uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('restart')">Restart</button>
33- <button class="btn btn-secondary uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('kill')">Kill</button>
36+ <button class="btn btn-secondary btn-red uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('kill')">Kill</button>
3437 </div>
3538 </transition>
3639 </div>
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default new class SocketEmitter {
1515 /**
1616 * Add an event listener for socket events.
1717 */
18- addListener ( event : string | number , callback : ( data : any ) => void , vm : ComponentOptions < Vue > ) {
18+ addListener ( event : string | number , callback : ( ... data : any [ ] ) => void , vm : ComponentOptions < Vue > ) {
1919 if ( ! isFunction ( callback ) ) {
2020 return ;
2121 }
@@ -31,7 +31,7 @@ export default new class SocketEmitter {
3131 /**
3232 * Remove an event listener for socket events based on the context passed through.
3333 */
34- removeListener ( event : string | number , callback : ( data : any ) => void , vm : ComponentOptions < Vue > ) {
34+ removeListener ( event : string | number , callback : ( ... data : any [ ] ) => void , vm : ComponentOptions < Vue > ) {
3535 if ( ! isFunction ( callback ) || ! this . listeners . has ( event ) ) {
3636 return ;
3737 }
@@ -53,7 +53,8 @@ export default new class SocketEmitter {
5353 */
5454 emit ( event : string | number , ...args : any ) {
5555 ( this . listeners . get ( event ) || [ ] ) . forEach ( ( listener ) => {
56- listener . callback . call ( listener . vm , args ) ;
56+ // @ts -ignore
57+ listener . callback . call ( listener . vm , ...args ) ;
5758 } ) ;
5859 }
5960}
You can’t perform that action at this time.
0 commit comments