diff --git a/frontend/src/components/Search.vue b/frontend/src/components/Search.vue
index 6b498218..fc8f976f 100644
--- a/frontend/src/components/Search.vue
+++ b/frontend/src/components/Search.vue
@@ -90,10 +90,10 @@ export default {
};
},
watch: {
- show(val, old) {
- this.active = val === "search";
+ currentPrompt(val, old) {
+ this.active = val?.prompt === "search";
- if (old === "search" && !this.active) {
+ if (old?.prompt === "search" && !this.active) {
if (this.reload) {
this.setReload(true);
}
@@ -116,8 +116,8 @@ export default {
},
},
computed: {
- ...mapState(["user", "show"]),
- ...mapGetters(["isListing"]),
+ ...mapState(["user"]),
+ ...mapGetters(["isListing", "currentPrompt"]),
boxes() {
return boxes;
},
diff --git a/frontend/src/components/Sidebar.vue b/frontend/src/components/Sidebar.vue
index 4394f55a..9a4c667d 100644
--- a/frontend/src/components/Sidebar.vue
+++ b/frontend/src/components/Sidebar.vue
@@ -133,9 +133,9 @@ export default {
},
computed: {
...mapState(["user"]),
- ...mapGetters(["isLogged"]),
+ ...mapGetters(["isLogged", "currentPrompt"]),
active() {
- return this.$store.state.show === "sidebar";
+ return this.currentPrompt?.prompt === "sidebar";
},
signup: () => signup,
version: () => version,
diff --git a/frontend/src/components/header/HeaderBar.vue b/frontend/src/components/header/HeaderBar.vue
index 65c144a9..a0aab314 100644
--- a/frontend/src/components/header/HeaderBar.vue
+++ b/frontend/src/components/header/HeaderBar.vue
@@ -11,7 +11,7 @@
-
+
@@ -25,7 +25,7 @@
@@ -35,6 +35,7 @@
import { logoURL } from "@/utils/constants";
import Action from "@/components/header/Action.vue";
+import { mapGetters } from "vuex";
export default {
name: "header-bar",
@@ -52,6 +53,9 @@ export default {
this.$store.commit("showHover", "sidebar");
},
},
+ computed: {
+ ...mapGetters(["currentPromptName"]),
+ },
};
diff --git a/frontend/src/components/prompts/Copy.vue b/frontend/src/components/prompts/Copy.vue
index 4f556e5d..46166108 100644
--- a/frontend/src/components/prompts/Copy.vue
+++ b/frontend/src/components/prompts/Copy.vue
@@ -6,26 +6,43 @@
{{ $t("prompts.copyMessage") }}
-
(dest = val)">
+
(dest = val)">
+
-
-
-
+
+
+
+
+
+
+
+
@@ -46,7 +63,7 @@ export default {
dest: null,
};
},
- computed: mapState(["req", "selected"]),
+ computed: mapState(["req", "selected", "user"]),
methods: {
copy: async function (event) {
event.preventDefault();
diff --git a/frontend/src/components/prompts/Delete.vue b/frontend/src/components/prompts/Delete.vue
index 0540b1d8..8e319846 100644
--- a/frontend/src/components/prompts/Delete.vue
+++ b/frontend/src/components/prompts/Delete.vue
@@ -37,8 +37,8 @@ import buttons from "@/utils/buttons";
export default {
name: "delete",
computed: {
- ...mapGetters(["isListing", "selectedCount"]),
- ...mapState(["req", "selected", "showConfirm"]),
+ ...mapGetters(["isListing", "selectedCount", "currentPrompt"]),
+ ...mapState(["req", "selected"]),
},
methods: {
...mapMutations(["closeHovers"]),
@@ -50,7 +50,7 @@ export default {
await api.remove(this.$route.path);
buttons.success("delete");
- this.showConfirm();
+ this.currentPrompt?.confirm();
this.closeHovers();
return;
}
diff --git a/frontend/src/components/prompts/Download.vue b/frontend/src/components/prompts/Download.vue
index 8c5a570d..1c6e63b1 100644
--- a/frontend/src/components/prompts/Download.vue
+++ b/frontend/src/components/prompts/Download.vue
@@ -11,7 +11,7 @@
v-for="(ext, format) in formats"
:key="format"
class="button button--block"
- @click="showConfirm(format)"
+ @click="currentPrompt.confirm(format)"
v-focus
>
{{ ext }}
@@ -21,7 +21,7 @@
diff --git a/frontend/src/components/prompts/FileList.vue b/frontend/src/components/prompts/FileList.vue
index 7a5c9f56..653752a0 100644
--- a/frontend/src/components/prompts/FileList.vue
+++ b/frontend/src/components/prompts/FileList.vue
@@ -133,6 +133,17 @@ export default {
this.selected = event.currentTarget.dataset.url;
this.$emit("update:selected", this.selected);
},
+ createDir: async function () {
+ this.$store.commit("showHover", {
+ prompt: "newDir",
+ action: null,
+ confirm: null,
+ props: {
+ redirect: false,
+ base: this.current === this.$route.path ? null : this.current,
+ },
+ });
+ },
},
};
diff --git a/frontend/src/components/prompts/Move.vue b/frontend/src/components/prompts/Move.vue
index 1e0cf868..bbc19d36 100644
--- a/frontend/src/components/prompts/Move.vue
+++ b/frontend/src/components/prompts/Move.vue
@@ -5,27 +5,44 @@
- (dest = val)">
+ (dest = val)">
+
-
-
-
+
+
+
+
+
+
+
+
@@ -46,7 +63,7 @@ export default {
dest: null,
};
},
- computed: mapState(["req", "selected"]),
+ computed: mapState(["req", "selected", "user"]),
methods: {
move: async function (event) {
event.preventDefault();
diff --git a/frontend/src/components/prompts/NewDir.vue b/frontend/src/components/prompts/NewDir.vue
index bdcae64a..653ae953 100644
--- a/frontend/src/components/prompts/NewDir.vue
+++ b/frontend/src/components/prompts/NewDir.vue
@@ -43,6 +43,16 @@ import url from "@/utils/url";
export default {
name: "new-dir",
+ props: {
+ redirect: {
+ type: Boolean,
+ default: true,
+ },
+ base: {
+ type: [String, null],
+ default: null,
+ },
+ },
data: function () {
return {
name: "",
@@ -57,7 +67,11 @@ export default {
if (this.new === "") return;
// Build the path of the new directory.
- let uri = this.isFiles ? this.$route.path + "/" : "/";
+ let uri;
+
+ if (this.base) uri = this.base;
+ else if (this.isFiles) uri = this.$route.path + "/";
+ else uri = "/";
if (!this.isListing) {
uri = url.removeLastDir(uri) + "/";
@@ -65,10 +79,14 @@ export default {
uri += encodeURIComponent(this.name) + "/";
uri = uri.replace("//", "/");
-
try {
await api.post(uri);
- this.$router.push({ path: uri });
+ if (this.redirect) {
+ this.$router.push({ path: uri });
+ } else if (!this.base) {
+ const res = await api.fetch(url.removeLastDir(uri) + "/");
+ this.$store.commit("updateRequest", res);
+ }
} catch (e) {
this.$showError(e);
}
diff --git a/frontend/src/components/prompts/Prompts.vue b/frontend/src/components/prompts/Prompts.vue
index 4a96f471..3305be9a 100644
--- a/frontend/src/components/prompts/Prompts.vue
+++ b/frontend/src/components/prompts/Prompts.vue
@@ -1,6 +1,12 @@
@@ -20,7 +26,8 @@ import ReplaceRename from "./ReplaceRename.vue";
import Share from "./Share.vue";
import Upload from "./Upload.vue";
import ShareDelete from "./ShareDelete.vue";
-import { mapState } from "vuex";
+import Sidebar from "../Sidebar.vue";
+import { mapGetters, mapState } from "vuex";
import buttons from "@/utils/buttons";
export default {
@@ -40,6 +47,7 @@ export default {
ReplaceRename,
Upload,
ShareDelete,
+ Sidebar
},
data: function () {
return {
@@ -52,7 +60,7 @@ export default {
},
created() {
window.addEventListener("keydown", (event) => {
- if (this.show == null) return;
+ if (this.currentPrompt == null) return;
let prompt = this.$refs.currentComponent;
@@ -64,7 +72,7 @@ export default {
// Enter
if (event.keyCode == 13) {
- switch (this.show) {
+ switch (this.currentPrompt.prompt) {
case "delete":
prompt.submit();
break;
@@ -82,31 +90,13 @@ export default {
});
},
computed: {
- ...mapState(["show", "plugins"]),
- currentComponent: function () {
- const matched =
- [
- "info",
- "help",
- "delete",
- "rename",
- "move",
- "copy",
- "newFile",
- "newDir",
- "download",
- "replace",
- "replace-rename",
- "share",
- "upload",
- "share-delete",
- ].indexOf(this.show) >= 0;
-
- return (matched && this.show) || null;
- },
+ ...mapState(["plugins"]),
+ ...mapGetters(["currentPrompt", "currentPromptName"]),
showOverlay: function () {
return (
- this.show !== null && this.show !== "search" && this.show !== "more"
+ this.currentPrompt !== null &&
+ this.currentPrompt.prompt !== "search" &&
+ this.currentPrompt.prompt !== "more"
);
},
},
diff --git a/frontend/src/components/prompts/Replace.vue b/frontend/src/components/prompts/Replace.vue
index a525bbbc..bece1772 100644
--- a/frontend/src/components/prompts/Replace.vue
+++ b/frontend/src/components/prompts/Replace.vue
@@ -19,7 +19,7 @@