Format all the files
This commit is contained in:
parent
5bff8d99cc
commit
b6773b56c1
|
@ -9,7 +9,7 @@ import {ServerDatabase} from "@/api/server/types";
|
||||||
*/
|
*/
|
||||||
export function createDatabase(server: string, database: string, remote: string): Promise<ServerDatabase> {
|
export function createDatabase(server: string, database: string, remote: string): Promise<ServerDatabase> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
http.post(route('api.client.servers.databases', { server }), {database, remote})
|
http.post(route('api.client.servers.databases', {server}), {database, remote})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const copy: any = response.data.attributes;
|
const copy: any = response.data.attributes;
|
||||||
copy.password = copy.relationships.password.attributes.password;
|
copy.password = copy.relationships.password.attributes.password;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import http from '../http';
|
import http from '../http';
|
||||||
import { filter, isObject } from 'lodash';
|
import {filter, isObject} from 'lodash';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
|
import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
|
||||||
import {DirectoryContents} from "./types";
|
import {DirectoryContents} from "./types";
|
||||||
|
@ -7,9 +7,9 @@ import {DirectoryContents} from "./types";
|
||||||
/**
|
/**
|
||||||
* Get the contents of a specific directory for a given server.
|
* Get the contents of a specific directory for a given server.
|
||||||
*/
|
*/
|
||||||
export function getDirectoryContents (server: string, directory: string): Promise<DirectoryContents> {
|
export function getDirectoryContents(server: string, directory: string): Promise<DirectoryContents> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
http.get(route('server.files', { server, directory }))
|
http.get(route('server.files', {server, directory}))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
return resolve({
|
return resolve({
|
||||||
files: filter(response.data.contents, function (o) {
|
files: filter(response.data.contents, function (o) {
|
||||||
|
|
|
@ -10,7 +10,8 @@ window._ = require('lodash');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.$ = window.jQuery = require('jquery');
|
window.$ = window.jQuery = require('jquery');
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
}
|
||||||
|
|
||||||
window.axios = axios;
|
window.axios = axios;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
if (response.data.send_to_login) {
|
if (response.data.send_to_login) {
|
||||||
this.$flash.success('Your password has been reset, please login to continue.');
|
this.$flash.success('Your password has been reset, please login to continue.');
|
||||||
return this.$router.push({ name: 'login' });
|
return this.$router.push({name: 'login'});
|
||||||
}
|
}
|
||||||
|
|
||||||
return window.location = response.data.redirect_to;
|
return window.location = response.data.redirect_to;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { replace } from 'feather-icons';
|
import {replace} from 'feather-icons';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'Icon',
|
name: 'Icon',
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
components: {Icon},
|
components: {Icon},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
modalName: { type: String, default: 'modal' },
|
modalName: {type: String, default: 'modal'},
|
||||||
show: { type: Boolean, default: false },
|
show: {type: Boolean, default: false},
|
||||||
closeOnEsc: { type: Boolean, default: true },
|
closeOnEsc: {type: Boolean, default: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { isObject } from 'lodash';
|
import {isObject} from 'lodash';
|
||||||
import {AxiosError} from "axios";
|
import {AxiosError} from "axios";
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<input type="hidden" name="_token" v-bind:value="X_CSRF_TOKEN" />
|
<input type="hidden" name="_token" v-bind:value="X_CSRF_TOKEN"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
<button class="btn btn-green uppercase text-xs px-4 py-2"
|
<button class="btn btn-green uppercase text-xs px-4 py-2"
|
||||||
v-if="status === statuses.STATUS_OFF"
|
v-if="status === statuses.STATUS_OFF"
|
||||||
v-on:click.prevent="sendPowerAction('start')"
|
v-on:click.prevent="sendPowerAction('start')"
|
||||||
>Start</button>
|
>Start
|
||||||
|
</button>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<button class="btn btn-red 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('restart')">Restart</button>
|
||||||
|
|
|
@ -57,6 +57,6 @@
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'FileContextMenu',
|
name: 'FileContextMenu',
|
||||||
components: { Icon },
|
components: {Icon},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { formatDate } from "@/helpers";
|
import {formatDate} from "@/helpers";
|
||||||
import Icon from "@/components/core/Icon.vue";
|
import Icon from "@/components/core/Icon.vue";
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'FolderRow',
|
name: 'FolderRow',
|
||||||
components: { Icon },
|
components: {Icon},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
directory: {type: Object, required: true},
|
directory: {type: Object, required: true},
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
/**
|
/**
|
||||||
* Return a formatted directory path that is used to switch to a nested directory.
|
* Return a formatted directory path that is used to switch to a nested directory.
|
||||||
*/
|
*/
|
||||||
getClickablePath (directory: string): string {
|
getClickablePath(directory: string): string {
|
||||||
return `${this.currentDirectory.replace(/\/$/, '')}/${directory}`;
|
return `${this.currentDirectory.replace(/\/$/, '')}/${directory}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
<div class="animated-fade-in">
|
<div class="animated-fade-in">
|
||||||
<div class="filemanager-breadcrumbs">
|
<div class="filemanager-breadcrumbs">
|
||||||
/<span class="px-1">home</span><!--
|
/<span class="px-1">home</span><!--
|
||||||
-->/<router-link :to="{ name: 'server-files' }" class="px-1">container</router-link><!--
|
-->/
|
||||||
|
<router-link :to="{ name: 'server-files' }" class="px-1">container</router-link><!--
|
||||||
--><span v-for="crumb in breadcrumbs" class="inline-block">
|
--><span v-for="crumb in breadcrumbs" class="inline-block">
|
||||||
<span v-if="crumb.path">
|
<span v-if="crumb.path">
|
||||||
/<router-link :to="{ name: 'server-files', params: { path: crumb.path } }" class="px-1">{{crumb.directoryName}}</router-link>
|
/<router-link :to="{ name: 'server-files', params: { path: crumb.path } }" class="px-1">{{crumb.directoryName}}</router-link>
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
<FolderRow :directory="directory"/>
|
<FolderRow :directory="directory"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="file in files">
|
<div v-for="file in files">
|
||||||
<FileRow :file="file" :editable="editableFiles" />
|
<FileRow :file="file" :editable="editableFiles"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,121 +52,121 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import { map } from 'lodash';
|
import {map} from 'lodash';
|
||||||
import getDirectoryContents from "@/api/server/getDirectoryContents";
|
import getDirectoryContents from "@/api/server/getDirectoryContents";
|
||||||
import FileRow from "@/components/server/components/filemanager/FileRow.vue";
|
import FileRow from "@/components/server/components/filemanager/FileRow.vue";
|
||||||
import FolderRow from "@/components/server/components/filemanager/FolderRow.vue";
|
import FolderRow from "@/components/server/components/filemanager/FolderRow.vue";
|
||||||
|
|
||||||
type DataStructure = {
|
type DataStructure = {
|
||||||
loading: boolean,
|
loading: boolean,
|
||||||
errorMessage: string | null,
|
errorMessage: string | null,
|
||||||
currentDirectory: string,
|
currentDirectory: string,
|
||||||
files: Array<any>,
|
files: Array<any>,
|
||||||
directories: Array<any>,
|
directories: Array<any>,
|
||||||
editableFiles: Array<string>,
|
editableFiles: Array<string>,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'FileManager',
|
name: 'FileManager',
|
||||||
components: { FileRow, FolderRow },
|
components: {FileRow, FolderRow},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('server', ['server', 'credentials']),
|
...mapState('server', ['server', 'credentials']),
|
||||||
...mapState('socket', ['connected']),
|
...mapState('socket', ['connected']),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the breadcrumbs that display on the filemanager based on the directory that the
|
* Configure the breadcrumbs that display on the filemanager based on the directory that the
|
||||||
* user is currently in.
|
* user is currently in.
|
||||||
*/
|
*/
|
||||||
breadcrumbs: function () {
|
breadcrumbs: function () {
|
||||||
const directories = this.currentDirectory.replace(/^\/|\/$/, '').split('/');
|
const directories = this.currentDirectory.replace(/^\/|\/$/, '').split('/');
|
||||||
if (directories.length < 1 || !directories[0]) {
|
if (directories.length < 1 || !directories[0]) {
|
||||||
return [];
|
return [];
|
||||||
}
|
|
||||||
|
|
||||||
return map(directories, function (value: string, key: number) {
|
|
||||||
if (key === directories.length - 1) {
|
|
||||||
return { directoryName: value };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return map(directories, function (value: string, key: number) {
|
||||||
directoryName: value,
|
if (key === directories.length - 1) {
|
||||||
path: directories.slice(0, key + 1).join('/'),
|
return {directoryName: value};
|
||||||
};
|
}
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: {
|
return {
|
||||||
/**
|
directoryName: value,
|
||||||
* When the route changes reload the directory.
|
path: directories.slice(0, key + 1).join('/'),
|
||||||
*/
|
};
|
||||||
'$route': function (to) {
|
});
|
||||||
this.currentDirectory = to.params.path || '/';
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
watch: {
|
||||||
* Watch the current directory setting and when it changes update the file listing.
|
/**
|
||||||
*/
|
* When the route changes reload the directory.
|
||||||
currentDirectory: function () {
|
*/
|
||||||
|
'$route': function (to) {
|
||||||
|
this.currentDirectory = to.params.path || '/';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Watch the current directory setting and when it changes update the file listing.
|
||||||
|
*/
|
||||||
|
currentDirectory: function () {
|
||||||
|
this.listDirectory();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When we reconnect to the Daemon make sure we grab a listing of all of the files
|
||||||
|
* so that the error message disappears and we then load in a fresh listing.
|
||||||
|
*/
|
||||||
|
connected: function () {
|
||||||
|
// @ts-ignore
|
||||||
|
if (this.connected) {
|
||||||
|
this.listDirectory();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
data: function (): DataStructure {
|
||||||
|
return {
|
||||||
|
currentDirectory: this.$route.params.path || '/',
|
||||||
|
loading: true,
|
||||||
|
errorMessage: null,
|
||||||
|
directories: [],
|
||||||
|
editableFiles: [],
|
||||||
|
files: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted: function () {
|
||||||
this.listDirectory();
|
this.listDirectory();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
methods: {
|
||||||
* When we reconnect to the Daemon make sure we grab a listing of all of the files
|
/**
|
||||||
* so that the error message disappears and we then load in a fresh listing.
|
* List the contents of a directory.
|
||||||
*/
|
*/
|
||||||
connected: function () {
|
listDirectory: function () {
|
||||||
// @ts-ignore
|
this.loading = true;
|
||||||
if (this.connected) {
|
|
||||||
this.listDirectory();
|
const directory = encodeURI(this.currentDirectory.replace(/^\/|\/$/, ''));
|
||||||
}
|
getDirectoryContents(this.$route.params.id, directory)
|
||||||
|
.then((response) => {
|
||||||
|
this.files = response.files;
|
||||||
|
this.directories = response.directories;
|
||||||
|
this.editableFiles = response.editable;
|
||||||
|
this.errorMessage = null;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
if (typeof err === 'string') {
|
||||||
|
this.errorMessage = err;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error('An error was encountered while processing this request.', {err});
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
|
|
||||||
data: function (): DataStructure {
|
|
||||||
return {
|
|
||||||
currentDirectory: this.$route.params.path || '/',
|
|
||||||
loading: true,
|
|
||||||
errorMessage: null,
|
|
||||||
directories: [],
|
|
||||||
editableFiles: [],
|
|
||||||
files: [],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted: function () {
|
|
||||||
this.listDirectory();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
/**
|
|
||||||
* List the contents of a directory.
|
|
||||||
*/
|
|
||||||
listDirectory: function () {
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
const directory = encodeURI(this.currentDirectory.replace(/^\/|\/$/, ''));
|
|
||||||
getDirectoryContents(this.$route.params.id, directory)
|
|
||||||
.then((response) => {
|
|
||||||
this.files = response.files;
|
|
||||||
this.directories = response.directories;
|
|
||||||
this.editableFiles = response.editable;
|
|
||||||
this.errorMessage = null;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
if (typeof err === 'string') {
|
|
||||||
this.errorMessage = err;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.error('An error was encountered while processing this request.', { err });
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { format } from 'date-fns';
|
import {format} from 'date-fns';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the human readable filesize for a given number of bytes. This
|
* Return the human readable filesize for a given number of bytes. This
|
||||||
* uses 1024 as the base, so the response is denoted accordingly.
|
* uses 1024 as the base, so the response is denoted accordingly.
|
||||||
*/
|
*/
|
||||||
export function readableSize (bytes: number): string {
|
export function readableSize(bytes: number): string {
|
||||||
if (Math.abs(bytes) < 1024) {
|
if (Math.abs(bytes) < 1024) {
|
||||||
return `${bytes} Bytes`;
|
return `${bytes} Bytes`;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,6 @@ export function readableSize (bytes: number): string {
|
||||||
/**
|
/**
|
||||||
* Format the given date as a human readable string.
|
* Format the given date as a human readable string.
|
||||||
*/
|
*/
|
||||||
export function formatDate (date: string): string {
|
export function formatDate(date: string): string {
|
||||||
return format(date, 'MMM D, YYYY [at] HH:MM');
|
return format(date, 'MMM D, YYYY [at] HH:MM');
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
type ServerAllocation = {
|
type ServerAllocation = {
|
||||||
ip: string,
|
ip: string,
|
||||||
port: number,
|
port: number,
|
||||||
|
@ -75,7 +74,7 @@ export default class Server {
|
||||||
/**
|
/**
|
||||||
* Construct a new server model instance.
|
* Construct a new server model instance.
|
||||||
*/
|
*/
|
||||||
constructor (data: ServerData) {
|
constructor(data: ServerData) {
|
||||||
this.identifier = data.identifier;
|
this.identifier = data.identifier;
|
||||||
this.uuid = data.uuid;
|
this.uuid = data.uuid;
|
||||||
this.name = data.name;
|
this.name = data.name;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {AxiosInstance} from "axios";
|
||||||
import {Vue as VueType} from "vue/types/vue";
|
import {Vue as VueType} from "vue/types/vue";
|
||||||
import {ApplicationState} from "./store/types";
|
import {ApplicationState} from "./store/types";
|
||||||
import {Route} from "vue-router";
|
import {Route} from "vue-router";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import {Ziggy} from './helpers/ziggy';
|
import {Ziggy} from './helpers/ziggy';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import VueRouter, {Route} from 'vue-router';
|
import VueRouter, {Route} from 'vue-router';
|
||||||
import store from './store/index';
|
import store from './store/index';
|
||||||
import User from './models/user';
|
import User from './models/user';
|
||||||
|
|
||||||
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
|
|
||||||
|
|
||||||
// Base Vuejs Templates
|
// Base Vuejs Templates
|
||||||
import Login from './components/auth/Login.vue';
|
import Login from './components/auth/Login.vue';
|
||||||
import Dashboard from './components/dashboard/Dashboard.vue';
|
import Dashboard from './components/dashboard/Dashboard.vue';
|
||||||
|
@ -17,13 +14,15 @@ import ConsolePage from "@/components/server/subpages/Console.vue";
|
||||||
import FileManagerPage from "@/components/server/subpages/FileManager.vue";
|
import FileManagerPage from "@/components/server/subpages/FileManager.vue";
|
||||||
import DatabasesPage from "@/components/server/subpages/Databases.vue";
|
import DatabasesPage from "@/components/server/subpages/Databases.vue";
|
||||||
|
|
||||||
|
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/auth', component: Login,
|
path: '/auth', component: Login,
|
||||||
children: [
|
children: [
|
||||||
{ name: 'login', path: 'login', component: LoginForm },
|
{name: 'login', path: 'login', component: LoginForm},
|
||||||
{ name: 'forgot-password', path: 'password', component: ForgotPassword },
|
{name: 'forgot-password', path: 'password', component: ForgotPassword},
|
||||||
{ name: 'checkpoint', path: 'checkpoint', component: TwoFactorForm },
|
{name: 'checkpoint', path: 'checkpoint', component: TwoFactorForm},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.axios.post(route('auth.login'), {user, password})
|
window.axios.post(route('auth.login'), {user, password})
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('logout');
|
commit('logout');
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ export default {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.axios.put(route('api.client.account.update-email'), {email, password})
|
window.axios.put(route('api.client.account.update-email'), {email, password})
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
||||||
// in JSON format) throw an error and don't try to continue with the login.
|
// in JSON format) throw an error and don't try to continue with the login.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Server, {ServerData} from '../../models/server';
|
import Server, {ServerData} from '../../models/server';
|
||||||
import {ActionContext} from "vuex";
|
import {ActionContext} from "vuex";
|
||||||
import {DashboardState} from "../types";
|
import {DashboardState} from "../types";
|
||||||
|
|
||||||
const route = require('./../../../../../vendor/tightenco/ziggy/src/js/route').default;
|
const route = require('./../../../../../vendor/tightenco/ziggy/src/js/route').default;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -22,9 +23,9 @@ export default {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.axios.get(route('api.client.index'), {
|
window.axios.get(route('api.client.index'), {
|
||||||
params: { query: state.searchTerm },
|
params: {query: state.searchTerm},
|
||||||
})
|
})
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
||||||
// in JSON format) throw an error and don't try to continue with the request processing.
|
// in JSON format) throw an error and don't try to continue with the request processing.
|
||||||
|
|
|
@ -11,8 +11,7 @@ export default {
|
||||||
credentials: {node: '', key: ''},
|
credentials: {node: '', key: ''},
|
||||||
console: [],
|
console: [],
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {},
|
||||||
},
|
|
||||||
actions: {
|
actions: {
|
||||||
/**
|
/**
|
||||||
* Fetches the active server from the API and stores it in vuex.
|
* Fetches the active server from the API and stores it in vuex.
|
||||||
|
@ -20,8 +19,8 @@ export default {
|
||||||
getServer: ({commit}: ActionContext<ServerState, any>, {server}: { server: string }): Promise<void> => {
|
getServer: ({commit}: ActionContext<ServerState, any>, {server}: { server: string }): Promise<void> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.axios.get(route('api.client.servers.view', { server }))
|
window.axios.get(route('api.client.servers.view', {server}))
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
||||||
// in JSON format) throw an error and don't try to continue with the login.
|
// in JSON format) throw an error and don't try to continue with the login.
|
||||||
|
@ -47,7 +46,7 @@ export default {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.axios.get(route('server.credentials', {server}))
|
window.axios.get(route('server.credentials', {server}))
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
// If there is a 302 redirect or some other odd behavior (basically, response that isnt
|
||||||
// in JSON format) throw an error and don't try to continue with the login.
|
// in JSON format) throw an error and don't try to continue with the login.
|
||||||
|
|
|
@ -14,12 +14,12 @@ export default {
|
||||||
state.connectionError = false;
|
state.connectionError = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
SOCKET_ERROR: (state: SocketState, err : Error) => {
|
SOCKET_ERROR: (state: SocketState, err: Error) => {
|
||||||
state.connected = false;
|
state.connected = false;
|
||||||
state.connectionError = err;
|
state.connectionError = err;
|
||||||
},
|
},
|
||||||
|
|
||||||
SOCKET_CONNECT_ERROR: (state: SocketState, err : Error) => {
|
SOCKET_CONNECT_ERROR: (state: SocketState, err: Error) => {
|
||||||
state.connected = false;
|
state.connected = false;
|
||||||
state.connectionError = err;
|
state.connectionError = err;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {ServerData} from "../models/server";
|
import Server, {ServerData} from "../models/server";
|
||||||
import Server from "../models/server";
|
|
||||||
import User from "../models/user";
|
import User from "../models/user";
|
||||||
|
|
||||||
export type ApplicationState = {
|
export type ApplicationState = {
|
||||||
|
|
Loading…
Reference in New Issue