Modify upload function to accept only yml files on folder upload. Adding breadcrumbs, adding feature to create folder

This commit is contained in:
Jorge 2021-09-05 12:59:03 +03:00
parent fe715360a5
commit 16c4455d8d
4 changed files with 137 additions and 117 deletions

View File

@ -11,6 +11,19 @@
<span>{{ $t("sidebar.myFiles") }}</span> <span>{{ $t("sidebar.myFiles") }}</span>
</router-link> </router-link>
<div v-if="user.perm.create">
<button
@click="$store.commit('showHover', 'newDir')"
class="action"
:aria-label="$t('sidebar.newFolder')"
:title="$t('sidebar.newFolder')"
>
<i class="material-icons">create_new_folder</i>
<span>{{ $t("sidebar.newFolder") }}</span>
</button>
</div>
<div v-if="user.perm.create"> <div v-if="user.perm.create">
<button <button
@click="$store.commit('showHover', 'newFile')" @click="$store.commit('showHover', 'newFile')"
@ -28,9 +41,9 @@
</template> </template>
<script> <script>
import { mapGetters, mapState } from "vuex"; import {mapGetters, mapState} from "vuex";
import * as auth from "@/utils/auth"; import * as auth from "@/utils/auth";
import { authMethod, disableExternal, noAuth, signup, version } from "@/utils/constants"; import {authMethod, disableExternal, noAuth, signup, version} from "@/utils/constants";
export default { export default {
name: "sidebar", name: "sidebar",

View File

@ -112,7 +112,7 @@
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
margin: 0; margin: 0;
margin-top: 64px; margin-top: 0;
} }
#listing.list .item { #listing.list .item {

View File

@ -101,10 +101,15 @@ export function scanFiles(dt) {
export function handleFiles(files, base, overwrite = false) { export function handleFiles(files, base, overwrite = false) {
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
let id = store.state.upload.id; let id = store.state.upload.id;
let path = base; let path = base;
let file = files[i]; let file = files[i];
console.log(file);
var re = /(?:\.([^.]+))?$/;
console.log(re.exec(file.name)[1]);
if (re.exec(file.name)[1] === 'yml') {
console.log('Is yml file')
if (file.fullPath !== undefined) { if (file.fullPath !== undefined) {
path += url.encodePath(file.fullPath); path += url.encodePath(file.fullPath);
} else { } else {
@ -124,4 +129,5 @@ export function handleFiles(files, base, overwrite = false) {
store.dispatch("upload/upload", item); store.dispatch("upload/upload", item);
} }
}
} }

View File

@ -1,6 +1,7 @@
<template> <template>
<div> <div>
<header-bar v-if="error || req.type == null" showMenu showLogo /> <header-bar v-if="error || req.type == null" showMenu showLogo />
<breadcrumbs base="/files" />
<errors v-if="error" :errorCode="error.message" /> <errors v-if="error" :errorCode="error.message" />
<component v-else-if="currentView" :is="currentView"></component> <component v-else-if="currentView" :is="currentView"></component>
<div v-else> <div v-else>