From e13b4dce43bdc8655c76d07d846a0eec74e74781 Mon Sep 17 00:00:00 2001 From: Gabriel De Almeida Date: Fri, 12 Mar 2021 14:22:13 -0500 Subject: [PATCH] Fixed the error where the browser path became /app/ due to navigating up a folder too quickly and repeatedly. --- ui/src/components/BreadCrumbs.vue | 6 +++--- ui/src/components/FileBrowser.vue | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ui/src/components/BreadCrumbs.vue b/ui/src/components/BreadCrumbs.vue index 60d5d6c..1b67ea2 100644 --- a/ui/src/components/BreadCrumbs.vue +++ b/ui/src/components/BreadCrumbs.vue @@ -42,13 +42,13 @@ export default { ? ["Home", ...path.slice(0, path.length - 1)] : ["Home"]; return path; - } + }, }, methods: { link(idx) { - const crumbs = this.crumbs; + const crumbsArr = this.crumbs; let path = ""; - if (idx > 0) path = crumbs.slice(1, idx + 1).join("/") + "/"; + if (idx > 0) path = crumbsArr.slice(1, idx + 1).join("/") + "/"; return "/app/browser/" + path; }, diff --git a/ui/src/components/FileBrowser.vue b/ui/src/components/FileBrowser.vue index 2aeeb70..0c75aa2 100644 --- a/ui/src/components/FileBrowser.vue +++ b/ui/src/components/FileBrowser.vue @@ -437,12 +437,10 @@ tbody { - - .. + + + .. + @@ -535,6 +533,7 @@ tbody { import axios from "axios"; import FileEntry from "./FileEntry.vue"; import BreadCrumbs from "./BreadCrumbs.vue"; + export default { data: () => ({ s3: null, @@ -551,6 +550,12 @@ export default { dragAndDropDisplay: false, }), computed: { + upperDirectory() { + const pathArr = this.path.split("/"); + pathArr.splice(-2, 1); + const path = pathArr.length > 1 ? pathArr.join('/'): ""; + return "/app/browser/" + path; + }, createFolderEnabled() { return ( this.createFolderInput.trim().length > 0 && @@ -676,7 +681,6 @@ export default { async back() { this.createFolderInputShow = false; await this.$store.dispatch("openDropdown", null); - await this.$store.dispatch("files/back"); }, async buttonUpload() { const fileInputElement = this.$refs.fileInput;