Push the user into the newly created directory once made
This commit is contained in:
parent
66320972be
commit
25621f4c1c
2 changed files with 34 additions and 29 deletions
|
@ -1,32 +1,32 @@
|
||||||
<template>
|
<template>
|
||||||
<Modal :show="visible" v-on:close="onModalClose" :showCloseIcon="false" :dismissable="!isLoading">
|
<Modal :show="visible" v-on:close="onModalClose" :showCloseIcon="false" :dismissable="!isLoading">
|
||||||
<div class="flex items-end">
|
<div>
|
||||||
<div class="flex-1">
|
<label class="input-label">
|
||||||
<label class="input-label">
|
Directory Name
|
||||||
Folder Name
|
</label>
|
||||||
</label>
|
<input
|
||||||
<input
|
type="text" class="input" name="folder_name"
|
||||||
type="text" class="input" name="folder_name"
|
ref="folderNameField"
|
||||||
ref="folderNameField"
|
v-model="folderName"
|
||||||
v-model="folderName"
|
v-validate.disabled="'required'"
|
||||||
v-validate.disabled="'required'"
|
v-validate="'alpha_dash'"
|
||||||
v-validate="'alpha_dash'"
|
data-vv-as="Folder Name"
|
||||||
data-vv-as="Folder Name"
|
v-on:keyup.enter="submit"
|
||||||
v-on:keyup.enter="submit"
|
/>
|
||||||
/>
|
<p class="input-help">A new directory with this name will be created in the current directory.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-4">
|
<div class="mt-8 text-right">
|
||||||
<button type="submit"
|
<button class="btn btn-secondary btn-sm" v-on:click="onModalClose">Cancel</button>
|
||||||
class="btn btn-primary btn-sm"
|
<button type="submit"
|
||||||
v-on:click.prevent="submit"
|
class="ml-2 btn btn-primary btn-sm"
|
||||||
:disabled="errors.any() || isLoading"
|
v-on:click.prevent="submit"
|
||||||
>
|
:disabled="errors.any() || isLoading"
|
||||||
<span class="spinner white" v-bind:class="{ hidden: !isLoading }"> </span>
|
>
|
||||||
<span :class="{ hidden: isLoading }">
|
<span class="spinner white" v-bind:class="{ hidden: !isLoading }"> </span>
|
||||||
Create
|
<span :class="{ hidden: isLoading }">
|
||||||
</span>
|
Create Directory
|
||||||
</button>
|
</span>
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="input-help error">
|
<p class="input-help error">
|
||||||
{{ errors.first('folder_name') }}
|
{{ errors.first('folder_name') }}
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
createFolder(this.server.uuid, this.credentials, `${this.fm.currentDirectory}/${this.folderName.replace(/^\//, '')}`)
|
createFolder(this.server.uuid, this.credentials, `${this.fm.currentDirectory}/${this.folderName.replace(/^\//, '')}`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$emit('close');
|
this.$emit('created', this.folderName.replace(/^\//, ''));
|
||||||
this.onModalClose();
|
this.onModalClose();
|
||||||
})
|
})
|
||||||
.catch(console.error.bind(this))
|
.catch(console.error.bind(this))
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<a href="#" class="block btn btn-primary btn-sm">New File</a>
|
<a href="#" class="block btn btn-primary btn-sm">New File</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<CreateFolderModal v-on:close="listDirectory"/>
|
<CreateFolderModal v-on:created="directoryCreated"/>
|
||||||
<RenameModal/>
|
<RenameModal/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
|
import { join } from 'path';
|
||||||
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";
|
||||||
|
@ -183,6 +184,10 @@
|
||||||
fileRowDeleted: function (file: DirectoryContentObject) {
|
fileRowDeleted: function (file: DirectoryContentObject) {
|
||||||
this.files = this.files.filter(data => data !== file);
|
this.files = this.files.filter(data => data !== file);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
directoryCreated: function (directory: string) {
|
||||||
|
this.$router.push({ name: 'server-files', params: { path: join(this.currentDirectory, directory) }});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue