Better handling of connection errors
This commit is contained in:
parent
f1ec968f38
commit
f20d40460e
3 changed files with 28 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<navigation></navigation>
|
<navigation></navigation>
|
||||||
|
<flash class="m-6"/>
|
||||||
<div v-if="loadingServerData">
|
<div v-if="loadingServerData">
|
||||||
<div class="mt-6 h-16">
|
<div class="mt-6 h-16">
|
||||||
<div class="spinner spinner-xl spinner-thick blue"></div>
|
<div class="spinner spinner-xl spinner-thick blue"></div>
|
||||||
|
@ -56,6 +57,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="fixed pin-r pin-b m-6 max-w-sm" v-show="connectionError">
|
||||||
|
<div class="alert error">
|
||||||
|
There was an error while attempting to connect to the Daemon websocket. Error reported was: "{{connectionError.message}}"
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -69,9 +75,11 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
import PowerButtons from './components/PowerButtons';
|
import PowerButtons from './components/PowerButtons';
|
||||||
|
import Flash from '../Flash';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
Flash,
|
||||||
PowerButtons, ProgressBar, Navigation,
|
PowerButtons, ProgressBar, Navigation,
|
||||||
TerminalIcon, FolderIcon, UsersIcon, CalendarIcon, DatabaseIcon, GlobeIcon, SettingsIcon
|
TerminalIcon, FolderIcon, UsersIcon, CalendarIcon, DatabaseIcon, GlobeIcon, SettingsIcon
|
||||||
},
|
},
|
||||||
|
@ -81,16 +89,16 @@
|
||||||
...mapState('socket', ['connected', 'connectionError']),
|
...mapState('socket', ['connected', 'connectionError']),
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted: function () {
|
|
||||||
this.loadServer();
|
|
||||||
},
|
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
loadingServerData: true,
|
loadingServerData: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted: function () {
|
||||||
|
this.loadServer();
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Load the core server information needed for these pages to be functional.
|
* Load the core server information needed for these pages to be functional.
|
||||||
|
|
|
@ -45,9 +45,15 @@
|
||||||
*/
|
*/
|
||||||
connected: function (state) {
|
connected: function (state) {
|
||||||
if (state) {
|
if (state) {
|
||||||
|
this.terminal.open(this.$refs.terminal);
|
||||||
|
this.terminal.fit();
|
||||||
|
this.terminal.clear();
|
||||||
|
|
||||||
this.$socket.emit('send server log');
|
this.$socket.emit('send server log');
|
||||||
|
} else {
|
||||||
|
this.terminal.dispose();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +70,7 @@
|
||||||
data.line.split(/\n/g).forEach(line => {
|
data.line.split(/\n/g).forEach(line => {
|
||||||
this.terminal.writeln(line + '\u001b[0m');
|
this.terminal.writeln(line + '\u001b[0m');
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,10 +79,6 @@
|
||||||
* socket is not connected this will occur automatically when it connects.
|
* socket is not connected this will occur automatically when it connects.
|
||||||
*/
|
*/
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.terminal.open(this.$refs.terminal);
|
|
||||||
this.terminal.fit();
|
|
||||||
this.terminal.clear();
|
|
||||||
|
|
||||||
if (this.connected) {
|
if (this.connected) {
|
||||||
this.$socket.emit('send server log');
|
this.$socket.emit('send server log');
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
connected: false,
|
connected: false,
|
||||||
connectionError: null,
|
connectionError: false,
|
||||||
status: Status.STATUS_OFF,
|
status: Status.STATUS_OFF,
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -12,9 +12,16 @@ export default {
|
||||||
mutations: {
|
mutations: {
|
||||||
SOCKET_CONNECT: (state) => {
|
SOCKET_CONNECT: (state) => {
|
||||||
state.connected = true;
|
state.connected = true;
|
||||||
|
state.connectionError = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
SOCKET_ERROR: (state, err) => {
|
SOCKET_ERROR: (state, err) => {
|
||||||
|
state.connected = false;
|
||||||
|
state.connectionError = err;
|
||||||
|
},
|
||||||
|
|
||||||
|
SOCKET_CONNECT_ERROR: (state, err) => {
|
||||||
|
state.connected = false;
|
||||||
state.connectionError = err;
|
state.connectionError = err;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue