Format all the files

This commit is contained in:
Dane Everitt 2019-02-09 21:15:45 -08:00
parent 5bff8d99cc
commit b6773b56c1
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
22 changed files with 158 additions and 159 deletions

View file

@ -9,7 +9,7 @@ import {ServerDatabase} from "@/api/server/types";
*/
export function createDatabase(server: string, database: string, remote: string): Promise<ServerDatabase> {
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 => {
const copy: any = response.data.attributes;
copy.password = copy.relationships.password.attributes.password;

View file

@ -1,5 +1,5 @@
import http from '../http';
import { filter, isObject } from 'lodash';
import {filter, isObject} from 'lodash';
// @ts-ignore
import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
import {DirectoryContents} from "./types";
@ -7,9 +7,9 @@ import {DirectoryContents} from "./types";
/**
* 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) => {
http.get(route('server.files', { server, directory }))
http.get(route('server.files', {server, directory}))
.then((response) => {
return resolve({
files: filter(response.data.contents, function (o) {

View file

@ -10,7 +10,8 @@ window._ = require('lodash');
try {
window.$ = window.jQuery = require('jquery');
} catch (e) {}
} catch (e) {
}
window.axios = axios;

View file

@ -103,7 +103,7 @@
if (response.data.send_to_login) {
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;

View file

@ -4,7 +4,7 @@
<script lang="ts">
import Vue from 'vue';
import { replace } from 'feather-icons';
import {replace} from 'feather-icons';
export default Vue.extend({
name: 'Icon',

View file

@ -24,9 +24,9 @@
components: {Icon},
props: {
modalName: { type: String, default: 'modal' },
show: { type: Boolean, default: false },
closeOnEsc: { type: Boolean, default: true },
modalName: {type: String, default: 'modal'},
show: {type: Boolean, default: false},
closeOnEsc: {type: Boolean, default: true},
},
mounted: function () {

View file

@ -40,7 +40,7 @@
<script lang="ts">
import Vue from 'vue';
import { isObject } from 'lodash';
import {isObject} from 'lodash';
import {AxiosError} from "axios";
export default Vue.extend({

View file

@ -1,5 +1,5 @@
<template>
<input type="hidden" name="_token" v-bind:value="X_CSRF_TOKEN" />
<input type="hidden" name="_token" v-bind:value="X_CSRF_TOKEN"/>
</template>
<script lang="ts">

View file

@ -5,7 +5,8 @@
<button class="btn btn-green uppercase text-xs px-4 py-2"
v-if="status === statuses.STATUS_OFF"
v-on:click.prevent="sendPowerAction('start')"
>Start</button>
>Start
</button>
<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-secondary uppercase text-xs px-4 py-2" v-on:click.prevent="sendPowerAction('restart')">Restart</button>

View file

@ -57,6 +57,6 @@
export default Vue.extend({
name: 'FileContextMenu',
components: { Icon },
components: {Icon},
});
</script>

View file

@ -16,12 +16,12 @@
<script lang="ts">
import Vue from 'vue';
import { formatDate } from "@/helpers";
import {formatDate} from "@/helpers";
import Icon from "@/components/core/Icon.vue";
export default Vue.extend({
name: 'FolderRow',
components: { Icon },
components: {Icon},
props: {
directory: {type: Object, required: true},
@ -37,7 +37,7 @@
/**
* 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}`;
},

View file

@ -2,7 +2,8 @@
<div class="animated-fade-in">
<div class="filemanager-breadcrumbs">
/<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-if="crumb.path">
/<router-link :to="{ name: 'server-files', params: { path: crumb.path } }" class="px-1">{{crumb.directoryName}}</router-link>
@ -34,7 +35,7 @@
<FolderRow :directory="directory"/>
</div>
<div v-for="file in files">
<FileRow :file="file" :editable="editableFiles" />
<FileRow :file="file" :editable="editableFiles"/>
</div>
</div>
</div>
@ -51,25 +52,25 @@
</template>
<script lang="ts">
import Vue from 'vue';
import {mapState} from "vuex";
import { map } from 'lodash';
import getDirectoryContents from "@/api/server/getDirectoryContents";
import FileRow from "@/components/server/components/filemanager/FileRow.vue";
import FolderRow from "@/components/server/components/filemanager/FolderRow.vue";
import Vue from 'vue';
import {mapState} from "vuex";
import {map} from 'lodash';
import getDirectoryContents from "@/api/server/getDirectoryContents";
import FileRow from "@/components/server/components/filemanager/FileRow.vue";
import FolderRow from "@/components/server/components/filemanager/FolderRow.vue";
type DataStructure = {
type DataStructure = {
loading: boolean,
errorMessage: string | null,
currentDirectory: string,
files: Array<any>,
directories: Array<any>,
editableFiles: Array<string>,
}
}
export default Vue.extend({
export default Vue.extend({
name: 'FileManager',
components: { FileRow, FolderRow },
components: {FileRow, FolderRow},
computed: {
...mapState('server', ['server', 'credentials']),
...mapState('socket', ['connected']),
@ -86,7 +87,7 @@ export default Vue.extend({
return map(directories, function (value: string, key: number) {
if (key === directories.length - 1) {
return { directoryName: value };
return {directoryName: value};
}
return {
@ -160,12 +161,12 @@ export default Vue.extend({
return;
}
console.error('An error was encountered while processing this request.', { err });
console.error('An error was encountered while processing this request.', {err});
})
.then(() => {
this.loading = false;
});
},
},
});
});
</script>

View file

@ -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
* 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) {
return `${bytes} Bytes`;
}
@ -23,6 +23,6 @@ export function readableSize (bytes: number): 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');
}

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,3 @@
type ServerAllocation = {
ip: string,
port: number,
@ -75,7 +74,7 @@ export default class Server {
/**
* Construct a new server model instance.
*/
constructor (data: ServerData) {
constructor(data: ServerData) {
this.identifier = data.identifier;
this.uuid = data.uuid;
this.name = data.name;

View file

@ -5,7 +5,6 @@ import {AxiosInstance} from "axios";
import {Vue as VueType} from "vue/types/vue";
import {ApplicationState} from "./store/types";
import {Route} from "vue-router";
// @ts-ignore
import {Ziggy} from './helpers/ziggy';

View file

@ -1,9 +1,6 @@
import VueRouter, {Route} from 'vue-router';
import store from './store/index';
import User from './models/user';
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
// Base Vuejs Templates
import Login from './components/auth/Login.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 DatabasesPage from "@/components/server/subpages/Databases.vue";
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
const routes = [
{
path: '/auth', component: Login,
children: [
{ name: 'login', path: 'login', component: LoginForm },
{ name: 'forgot-password', path: 'password', component: ForgotPassword },
{ name: 'checkpoint', path: 'checkpoint', component: TwoFactorForm },
{name: 'login', path: 'login', component: LoginForm},
{name: 'forgot-password', path: 'password', component: ForgotPassword},
{name: 'checkpoint', path: 'checkpoint', component: TwoFactorForm},
]
},

View file

@ -1,6 +1,7 @@
import Server, {ServerData} from '../../models/server';
import {ActionContext} from "vuex";
import {DashboardState} from "../types";
const route = require('./../../../../../vendor/tightenco/ziggy/src/js/route').default;
export default {
@ -22,7 +23,7 @@ export default {
return new Promise((resolve, reject) => {
// @ts-ignore
window.axios.get(route('api.client.index'), {
params: { query: state.searchTerm },
params: {query: state.searchTerm},
})
// @ts-ignore
.then(response => {

View file

@ -11,8 +11,7 @@ export default {
credentials: {node: '', key: ''},
console: [],
},
getters: {
},
getters: {},
actions: {
/**
* Fetches the active server from the API and stores it in vuex.
@ -20,7 +19,7 @@ export default {
getServer: ({commit}: ActionContext<ServerState, any>, {server}: { server: string }): Promise<void> => {
return new Promise((resolve, reject) => {
// @ts-ignore
window.axios.get(route('api.client.servers.view', { server }))
window.axios.get(route('api.client.servers.view', {server}))
// @ts-ignore
.then(response => {
// If there is a 302 redirect or some other odd behavior (basically, response that isnt

View file

@ -14,12 +14,12 @@ export default {
state.connectionError = false;
},
SOCKET_ERROR: (state: SocketState, err : Error) => {
SOCKET_ERROR: (state: SocketState, err: Error) => {
state.connected = false;
state.connectionError = err;
},
SOCKET_CONNECT_ERROR: (state: SocketState, err : Error) => {
SOCKET_CONNECT_ERROR: (state: SocketState, err: Error) => {
state.connected = false;
state.connectionError = err;
},

View file

@ -1,5 +1,4 @@
import {ServerData} from "../models/server";
import Server from "../models/server";
import Server, {ServerData} from "../models/server";
import User from "../models/user";
export type ApplicationState = {