2018-05-27 22:37:03 +00:00
|
|
|
<template>
|
2018-06-03 06:36:20 +00:00
|
|
|
<div>
|
|
|
|
<navigation></navigation>
|
2018-08-07 04:33:43 +00:00
|
|
|
<flash class="m-6"/>
|
2018-07-19 05:48:19 +00:00
|
|
|
<div v-if="loadingServerData">
|
|
|
|
<div class="mt-6 h-16">
|
|
|
|
<div class="spinner spinner-xl spinner-thick blue"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-04 04:30:06 +00:00
|
|
|
<div v-else>
|
|
|
|
<div class="m-6 flex flex-no-shrink rounded animate fadein">
|
|
|
|
<div class="sidebar border-grey-lighter flex-no-shrink w-1/3 max-w-xs">
|
|
|
|
<div class="mr-6">
|
|
|
|
<div class="p-6 text-center bg-white border rounded">
|
|
|
|
<h3 class="mb-2 text-blue font-medium">{{server.name}}</h3>
|
|
|
|
<span class="text-grey-dark text-sm">{{server.node}}</span>
|
|
|
|
<power-buttons class="mt-6 pt-6 text-center border-t border-grey-lighter"/>
|
|
|
|
</div>
|
2018-07-16 02:47:31 +00:00
|
|
|
</div>
|
2018-08-04 04:30:06 +00:00
|
|
|
<div class="mt-6 sidenav mr-6 bg-white border rounded">
|
2018-09-12 05:24:48 +00:00
|
|
|
<router-link :to="{ name: 'server', params: { id: $route.params.id } }">
|
2018-08-04 04:30:06 +00:00
|
|
|
<terminal-icon class="h-4"></terminal-icon> Console
|
|
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'server-files' }">
|
|
|
|
<folder-icon class="h-4"></folder-icon> Files
|
|
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'server-subusers' }">
|
|
|
|
<users-icon class="h-4"></users-icon> Subusers
|
|
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'server-schedules' }">
|
|
|
|
<calendar-icon class="h-4"></calendar-icon> Schedules
|
|
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'server-databases' }">
|
|
|
|
<database-icon class="h-4"></database-icon> Databases
|
|
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'server-allocations' }">
|
|
|
|
<globe-icon class="h-4"></globe-icon> Allocations
|
|
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'server-settings' }">
|
|
|
|
<settings-icon class="h-4"></settings-icon> Settings
|
|
|
|
</router-link>
|
2018-06-03 06:36:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-04 04:30:06 +00:00
|
|
|
<div class="h-full w-full">
|
2018-08-04 05:32:01 +00:00
|
|
|
<!--
|
2018-08-04 04:30:06 +00:00
|
|
|
<div class="mb-6 bg-white border rounded" v-if="$router.currentRoute.name !== 'server'">
|
|
|
|
<div class="flex">
|
|
|
|
<progress-bar title="Memory" percent="33" class="flex-1 p-4 pb-6"></progress-bar>
|
|
|
|
<progress-bar title="CPU" percent="80" class="flex-1 p-4 pb-6"></progress-bar>
|
|
|
|
<progress-bar title="Disk" percent="97" class="flex-1 p-4 pb-6"></progress-bar>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-04 05:32:01 +00:00
|
|
|
-->
|
2018-09-12 05:24:48 +00:00
|
|
|
<router-view :key="server.identifier"></router-view>
|
2018-05-27 22:37:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-07-19 05:48:19 +00:00
|
|
|
</div>
|
2018-08-07 04:33:43 +00:00
|
|
|
<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>
|
2018-05-27 22:37:03 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-07-19 05:48:19 +00:00
|
|
|
import { TerminalIcon, FolderIcon, UsersIcon, CalendarIcon, DatabaseIcon, GlobeIcon, SettingsIcon } from 'vue-feather-icons'
|
2018-06-03 06:36:20 +00:00
|
|
|
import Navigation from '../core/Navigation';
|
2018-07-16 02:47:31 +00:00
|
|
|
import ProgressBar from './components/ProgressBar';
|
2018-08-02 06:37:14 +00:00
|
|
|
import { mapState } from 'vuex';
|
2018-07-21 06:45:07 +00:00
|
|
|
import io from 'socket.io-client';
|
2018-12-17 02:57:34 +00:00
|
|
|
import { Socketio } from '../../mixins/socketio/index';
|
2018-08-02 06:37:14 +00:00
|
|
|
|
|
|
|
import PowerButtons from './components/PowerButtons';
|
2018-08-07 04:33:43 +00:00
|
|
|
import Flash from '../Flash';
|
2018-07-21 06:45:07 +00:00
|
|
|
|
2018-05-27 22:37:03 +00:00
|
|
|
export default {
|
2018-08-19 03:13:40 +00:00
|
|
|
name: 'server',
|
|
|
|
mixins: [Socketio],
|
2018-06-11 19:06:12 +00:00
|
|
|
components: {
|
2018-08-19 04:13:05 +00:00
|
|
|
Flash, PowerButtons, ProgressBar, Navigation,
|
2018-08-19 03:13:40 +00:00
|
|
|
TerminalIcon, FolderIcon, UsersIcon, CalendarIcon, DatabaseIcon, GlobeIcon, SettingsIcon,
|
2018-07-19 05:48:19 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2018-07-21 06:45:07 +00:00
|
|
|
...mapState('server', ['server', 'credentials']),
|
2018-08-02 06:37:14 +00:00
|
|
|
...mapState('socket', ['connected', 'connectionError']),
|
2018-07-19 05:48:19 +00:00
|
|
|
},
|
|
|
|
|
2018-09-12 05:24:48 +00:00
|
|
|
// Watch for route changes that occur with different server parameters. This occurs when a user
|
|
|
|
// uses the search bar. Because of the way vue-router works, it won't re-mount the server component
|
|
|
|
// so we will end up seeing the wrong server data if we don't perform this watch.
|
|
|
|
watch: {
|
|
|
|
'$route': function (toRoute, fromRoute) {
|
|
|
|
if (toRoute.params.id !== fromRoute.params.id) {
|
|
|
|
this.loadingServerData = true;
|
|
|
|
this.loadServer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-07-19 05:48:19 +00:00
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
loadingServerData: true,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2018-08-07 04:33:43 +00:00
|
|
|
mounted: function () {
|
|
|
|
this.loadServer();
|
|
|
|
},
|
|
|
|
|
2018-08-19 03:13:40 +00:00
|
|
|
beforeDestroy: function () {
|
|
|
|
this.removeSocket();
|
|
|
|
},
|
|
|
|
|
2018-07-19 05:48:19 +00:00
|
|
|
methods: {
|
2018-07-21 06:45:07 +00:00
|
|
|
/**
|
|
|
|
* Load the core server information needed for these pages to be functional.
|
|
|
|
*/
|
2018-07-19 05:48:19 +00:00
|
|
|
loadServer: function () {
|
2018-07-21 06:45:07 +00:00
|
|
|
Promise.all([
|
|
|
|
this.$store.dispatch('server/getServer', {server: this.$route.params.id}),
|
|
|
|
this.$store.dispatch('server/getCredentials', {server: this.$route.params.id})
|
|
|
|
])
|
2018-07-19 05:48:19 +00:00
|
|
|
.then(() => {
|
2018-08-02 06:37:14 +00:00
|
|
|
// Configure the socket.io implementation. This is a really ghetto way of handling things
|
|
|
|
// but all of these plugins assume you have some constant connection, which we don't.
|
|
|
|
const socket = io(`${this.credentials.node}/v1/ws/${this.server.uuid}`, {
|
|
|
|
query: `token=${this.credentials.key}`,
|
|
|
|
});
|
|
|
|
|
2018-08-19 03:13:40 +00:00
|
|
|
this.$socket().connect(socket);
|
2018-07-19 05:48:19 +00:00
|
|
|
this.loadingServerData = false;
|
|
|
|
})
|
2018-08-19 04:13:05 +00:00
|
|
|
.catch(err => {
|
|
|
|
console.error({ err });
|
|
|
|
});
|
2018-07-21 06:45:07 +00:00
|
|
|
},
|
|
|
|
},
|
2018-05-27 22:37:03 +00:00
|
|
|
}
|
|
|
|
</script>
|