This commit is contained in:
Jaroslav Rakhmatoullin 2024-05-03 20:01:43 +02:00 committed by GitHub
commit d7f477a4fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 1 deletions

View File

@ -35,6 +35,7 @@
"selectMultiple": "Select multiple",
"share": "Share",
"shell": "Toggle shell",
"gotoParent": "Open parent dir",
"submit": "Submit",
"switchView": "Switch view",
"toggleSidebar": "Toggle sidebar",

View File

@ -47,6 +47,12 @@
/>
</template>
<action
v-if="headerButtons.gotoParent || true"
icon="arrow_upward"
:label="t('buttons.gotoParent')"
@action="gotoParent"
/>
<action
v-if="headerButtons.shell"
icon="code"
@ -85,6 +91,14 @@
<span v-if="fileStore.selectedCount > 0"
>{{ fileStore.selectedCount }} selected</span
>
<action
v-if="headerButtons.gotoParent || true"
icon="arrow_upward"
:label="t('buttons.gotoParent')"
@action="gotoParent"
/>
<action
v-if="headerButtons.share"
icon="share"
@ -301,9 +315,10 @@ import {
ref,
watch,
} from "vue";
import { useRoute } from "vue-router";
import { useRoute, useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
import { storeToRefs } from "pinia";
import { useRouterStore } from "@/stores/router";
const showLimit = ref<number>(50);
const columnWidth = ref<number>(280);
@ -321,6 +336,7 @@ const layoutStore = useLayoutStore();
const { req } = storeToRefs(fileStore);
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
@ -404,6 +420,7 @@ const viewIcon = computed(() => {
const headerButtons = computed(() => {
return {
gotoParent: true,
upload: authStore.user?.perm.create,
download: authStore.user?.perm.download,
shell: authStore.user?.perm.execute && enableExec,
@ -890,6 +907,15 @@ const download = () => {
});
};
const gotoParent = () => {
console.log(route.fullPath)
const url = (route.fullPath || "")
const parts = url.replace(/\/$/, '').split('/');
parts.pop();
const parentUrl = parts.join('/');
router.push({ path: parentUrl });
};
const switchView = async () => {
layoutStore.closeHovers();