filebrowser/frontend/src/views/Layout.vue

80 lines
2.0 KiB
Vue
Raw Normal View History

2018-02-01 12:17:04 +00:00
<template>
<div>
<div v-if="progress" class="progress">
<div v-bind:style="{ width: this.progress + '%' }"></div>
2018-02-01 12:17:04 +00:00
</div>
2023-08-19 18:32:29 +00:00
<header-bar showMenu showLogo>
<search />
<template #actions>
<action icon="grid_view" :label="$t('buttons.switchView')" @action="switchView" />
</template>
</header-bar>
2018-02-01 12:17:04 +00:00
<sidebar></sidebar>
<main>
<router-view></router-view>
2020-10-01 14:45:24 +00:00
<shell v-if="isExecEnabled && isLogged && user.perm.execute" />
2018-02-01 12:17:04 +00:00
</main>
<prompts></prompts>
<upload-files></upload-files>
2018-02-01 12:17:04 +00:00
</div>
</template>
<script>
2021-03-21 11:51:58 +00:00
import { mapState, mapGetters } from "vuex";
import Sidebar from "@/components/Sidebar";
import Prompts from "@/components/prompts/Prompts";
import Shell from "@/components/Shell";
import UploadFiles from "../components/prompts/UploadFiles";
2021-03-21 11:51:58 +00:00
import { enableExec } from "@/utils/constants";
2023-08-19 18:32:29 +00:00
import HeaderBar from "@/components/header/HeaderBar";
import Search from "@/components/Search";
import Action from "@/components/header/Action";
2018-02-01 12:17:04 +00:00
export default {
2021-03-21 11:51:58 +00:00
name: "layout",
2018-02-01 12:17:04 +00:00
components: {
2023-08-19 18:32:29 +00:00
Action,
HeaderBar,
Search,
2018-02-01 12:17:04 +00:00
Sidebar,
Prompts,
2021-03-21 11:51:58 +00:00
Shell,
UploadFiles,
},
computed: {
2021-03-21 11:51:58 +00:00
...mapGetters(["isLogged", "progress"]),
...mapState(["user"]),
isExecEnabled: () => enableExec,
2018-02-01 12:17:04 +00:00
},
watch: {
2021-03-21 11:51:58 +00:00
$route: function () {
this.$store.commit("resetSelected");
this.$store.commit("multiple", false);
if (this.$store.state.show !== "success")
this.$store.commit("closeHovers");
},
},
2023-08-19 18:32:29 +00:00
methods: {
switchView: async function () {
this.$store.commit("closeHovers");
const modes = {
list: "mosaic",
mosaic: "mosaic gallery",
"mosaic gallery": "list",
};
const data = {
id: this.user.id,
viewMode: modes[this.user.viewMode] || "list",
};
//users.update(data, ["viewMode"]).catch(this.$showError);
this.$store.commit("updateUser", data);
//this.setItemWeight();
//this.fillWindow();
},
}
2021-03-21 11:51:58 +00:00
};
2018-02-01 12:17:04 +00:00
</script>