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>
</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">
<button
@click="$store.commit('showHover', 'newFile')"
@ -28,9 +41,9 @@
</template>
<script>
import { mapGetters, mapState } from "vuex";
import {mapGetters, mapState} from "vuex";
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 {
name: "sidebar",

View File

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

View File

@ -101,10 +101,15 @@ export function scanFiles(dt) {
export function handleFiles(files, base, overwrite = false) {
for (let i = 0; i < files.length; i++) {
let id = store.state.upload.id;
let path = base;
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) {
path += url.encodePath(file.fullPath);
} else {
@ -124,4 +129,5 @@ export function handleFiles(files, base, overwrite = false) {
store.dispatch("upload/upload", item);
}
}
}

View File

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