Change socket implementation for servers

This commit is contained in:
Dane Everitt 2018-08-18 20:13:40 -07:00
parent e0fda5865d
commit dc52e238ac
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 242 additions and 17 deletions

View file

@ -70,18 +70,19 @@
import Navigation from '../core/Navigation';
import ProgressBar from './components/ProgressBar';
import { mapState } from 'vuex';
import VueSocketio from 'vue-socket.io-extended';
import io from 'socket.io-client';
import Vue from 'vue';
import { Socketio } from './../../mixins/socketio';
import PowerButtons from './components/PowerButtons';
import Flash from '../Flash';
export default {
name: 'server',
mixins: [Socketio],
components: {
Flash,
PowerButtons, ProgressBar, Navigation,
TerminalIcon, FolderIcon, UsersIcon, CalendarIcon, DatabaseIcon, GlobeIcon, SettingsIcon
TerminalIcon, FolderIcon, UsersIcon, CalendarIcon, DatabaseIcon, GlobeIcon, SettingsIcon,
},
computed: {
@ -95,10 +96,20 @@
};
},
sockets: {
'console': function () {
console.log('server CONSOLE');
},
},
mounted: function () {
this.loadServer();
},
beforeDestroy: function () {
this.removeSocket();
},
methods: {
/**
* Load the core server information needed for these pages to be functional.
@ -115,7 +126,7 @@
query: `token=${this.credentials.key}`,
});
Vue.use(VueSocketio, socket, { store: this.$store });
this.$socket().connect(socket);
this.loadingServerData = false;
})
.catch(console.error);