Move settings navigation to account menu and add file creation templates
This commit is contained in:
1 parent
042392f611
commit
54761e4ef2
24 files changed
+591
-165
No files matched your search
@@ -2,32 +2,28 @@
|
||||
<div class="dashboard settings-page">
|
||||
<header-bar showMenu showLogo />
|
||||
<div class="settings-page-heading">
|
||||
<h1>{{ t("sidebar.settings") }}</h1>
|
||||
</div>
|
||||
<div class="settings-tabs" :aria-label="t('sidebar.settings')">
|
||||
<router-link to="/settings/profile"
|
||||
><AppIcon name="tune" />{{ t("settings.profileSettings") }}</router-link
|
||||
>
|
||||
<router-link v-if="authStore.user?.perm.share" to="/settings/shares"
|
||||
><AppIcon name="link" />{{ t("settings.shareManagement") }}</router-link
|
||||
>
|
||||
<router-link v-if="authStore.user?.perm.admin" to="/settings/global"
|
||||
><AppIcon name="dns" />{{ t("settings.globalSettings") }}</router-link
|
||||
>
|
||||
<router-link v-if="authStore.user?.perm.admin" to="/settings/users"
|
||||
><AppIcon name="group" />{{ t("settings.userManagement") }}</router-link
|
||||
>
|
||||
<h1>{{ heading }}</h1>
|
||||
</div>
|
||||
<p v-if="layout.loading" role="status">{{ t("files.loading") }}</p>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
import HeaderBar from "@/components/header/HeaderBar.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
const authStore = useAuthStore();
|
||||
const route = useRoute();
|
||||
const heading = computed(() =>
|
||||
t(
|
||||
route.name === "GlobalSettings"
|
||||
? "explorer.adminSettings"
|
||||
: route.name === "Shares"
|
||||
? "settings.shareManagement"
|
||||
: "sidebar.settings"
|
||||
)
|
||||
);
|
||||
const layout = useLayoutStore();
|
||||
</script>
|
||||
@@ -9,10 +9,7 @@
|
||||
:aria-expanded="isContextMenuVisible"
|
||||
@click.stop="openActions"
|
||||
>
|
||||
{{ t("explorer.actions")
|
||||
}}<span v-if="fileStore.selectedCount">
|
||||
({{ fileStore.selectedCount }})</span
|
||||
>
|
||||
{{ t("explorer.actions") }}
|
||||
</button>
|
||||
</header-bar>
|
||||
|
||||
@@ -221,18 +218,7 @@
|
||||
:counter="fileStore.selectedCount"
|
||||
/>
|
||||
<div class="context-menu-separator" v-if="fileStore.selectedCount" />
|
||||
<action
|
||||
v-if="authStore.user?.perm.create"
|
||||
icon="create_new_folder"
|
||||
:label="t('sidebar.newFolder')"
|
||||
show="newDir"
|
||||
/>
|
||||
<action
|
||||
v-if="authStore.user?.perm.create"
|
||||
icon="note_add"
|
||||
:label="t('sidebar.newFile')"
|
||||
show="newFile"
|
||||
/>
|
||||
<CreateMenu v-if="authStore.user?.perm.create" />
|
||||
<action
|
||||
v-if="headerButtons.upload"
|
||||
icon="upload"
|
||||
@@ -296,6 +282,7 @@ import HeaderBar from "@/components/header/HeaderBar.vue";
|
||||
import Action from "@/components/header/Action.vue";
|
||||
import Search from "@/components/Search.vue";
|
||||
import Item from "@/components/files/ListingItem.vue";
|
||||
import CreateMenu from "@/components/files/CreateMenu.vue";
|
||||
import ContextMenu from "@/components/ContextMenu.vue";
|
||||
import {
|
||||
computed,
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
@submit.prevent="save"
|
||||
>
|
||||
<div class="settings-grid">
|
||||
<button
|
||||
type="button"
|
||||
class="card settings-section settings-wide admin-users-tile"
|
||||
@click="layoutStore.showHover('users-management')"
|
||||
>
|
||||
<AppIcon name="users" /><span
|
||||
><strong>{{ t("settings.userManagement") }}</strong
|
||||
><small>{{ t("explorer.usersHint") }}</small></span
|
||||
><AppIcon name="chevron_right" />
|
||||
</button>
|
||||
<section class="card settings-section">
|
||||
<h2><AppIcon name="archive" />{{ t("settings.downloadsTitle") }}</h2>
|
||||
<label class="settings-field"
|
||||
@@ -119,17 +129,7 @@
|
||||
</form>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
const archiveFormats = {
|
||||
zip: "ZIP",
|
||||
tar: "TAR",
|
||||
targz: "TAR.GZ",
|
||||
tarbz2: "TAR.BZ2",
|
||||
tarxz: "TAR.XZ",
|
||||
tarlz4: "TAR.LZ4",
|
||||
tarsz: "TAR.SZ",
|
||||
tarbr: "TAR.BR",
|
||||
tarzst: "TAR.ZST",
|
||||
};
|
||||
import { useRoute } from "vue-router";
|
||||
import { settings as api } from "@/api";
|
||||
import { StatusError } from "@/api/utils";
|
||||
import Rules from "@/components/settings/Rules.vue";
|
||||
@@ -160,6 +160,25 @@ const $showSuccess = inject<IToastSuccess>("$showSuccess")!;
|
||||
const { t } = useI18n();
|
||||
|
||||
const layoutStore = useLayoutStore();
|
||||
const route = useRoute();
|
||||
onMounted(() => {
|
||||
if (route.query.users)
|
||||
layoutStore.showHover({
|
||||
prompt: "users-management",
|
||||
props: { userId: Number(route.query.users) },
|
||||
});
|
||||
});
|
||||
const archiveFormats = {
|
||||
zip: "ZIP",
|
||||
tar: "TAR",
|
||||
targz: "TAR.GZ",
|
||||
tarbz2: "TAR.BZ2",
|
||||
tarxz: "TAR.XZ",
|
||||
tarlz4: "TAR.LZ4",
|
||||
tarsz: "TAR.SZ",
|
||||
tarbr: "TAR.BR",
|
||||
tarzst: "TAR.ZST",
|
||||
};
|
||||
|
||||
const formattedChunkSize = computed({
|
||||
get() {
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
<rules v-model:rules="user.rules" />
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<router-link to="/settings/users" class="button button--flat">{{
|
||||
$t("buttons.cancel")
|
||||
}}</router-link
|
||||
<button type="button" class="button button--flat" @click="emit('cancel')">
|
||||
{{ $t("buttons.cancel") }}</button
|
||||
><button class="button" :disabled="saving">
|
||||
{{ $t("buttons.save") }}
|
||||
</button>
|
||||
@@ -31,13 +30,15 @@
|
||||
</form>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, inject } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { ref, watch, inject } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { users as api } from "@/api";
|
||||
import { StatusError } from "@/api/utils";
|
||||
import Errors from "@/views/Errors.vue";
|
||||
import Rules from "@/components/settings/Rules.vue";
|
||||
const route = useRoute();
|
||||
const props = defineProps<{ userId: number }>();
|
||||
const emit = defineEmits<{ cancel: []; saved: [] }>();
|
||||
const { t } = useI18n();
|
||||
const user = ref<IUser>();
|
||||
const error = ref<StatusError>();
|
||||
const saving = ref(false);
|
||||
@@ -51,19 +52,26 @@ const permissions = [
|
||||
"share",
|
||||
"download",
|
||||
] as const;
|
||||
onMounted(async () => {
|
||||
try {
|
||||
user.value = await api.get(Number(route.params.id));
|
||||
} catch (e) {
|
||||
error.value = e as StatusError;
|
||||
}
|
||||
});
|
||||
watch(
|
||||
() => props.userId,
|
||||
async (id) => {
|
||||
user.value = undefined;
|
||||
error.value = undefined;
|
||||
try {
|
||||
user.value = await api.get(id);
|
||||
} catch (e) {
|
||||
error.value = e as StatusError;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
async function save() {
|
||||
if (!user.value || saving.value) return;
|
||||
saving.value = true;
|
||||
try {
|
||||
await api.update(user.value, ["scope", "perm", "rules"]);
|
||||
showSuccess("Saved");
|
||||
showSuccess(t("settings.settingsUpdated"));
|
||||
emit("saved");
|
||||
} catch (e) {
|
||||
showError(e as Error);
|
||||
} finally {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<errors v-if="error" :errorCode="error.status" />
|
||||
<section v-else-if="!layoutStore.loading" class="card users-card">
|
||||
<p v-else-if="busy" role="status">{{ t("files.loading") }}</p>
|
||||
<section v-else class="card users-card">
|
||||
<div class="card-title">
|
||||
<h2>{{ t("settings.users") }}</h2>
|
||||
</div>
|
||||
@@ -23,13 +24,15 @@
|
||||
</td>
|
||||
<td class="user-scope">{{ user.scope }}</td>
|
||||
<td>
|
||||
<router-link
|
||||
<button
|
||||
type="button"
|
||||
class="user-edit"
|
||||
:to="'/settings/users/' + user.id"
|
||||
@click="emit('edit', user.id)"
|
||||
:title="t('buttons.update')"
|
||||
:aria-label="t('buttons.update')"
|
||||
><AppIcon name="edit"
|
||||
/></router-link>
|
||||
>
|
||||
<AppIcon name="edit" />
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -38,7 +41,6 @@
|
||||
</section>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
import { users as api } from "@/api";
|
||||
import Errors from "@/views/Errors.vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
@@ -48,11 +50,12 @@ import { StatusError } from "@/api/utils";
|
||||
const error = ref<StatusError | null>(null);
|
||||
const users = ref<IUser[]>([]);
|
||||
|
||||
const layoutStore = useLayoutStore();
|
||||
const busy = ref(false);
|
||||
const emit = defineEmits<{ edit: [id: number] }>();
|
||||
const { t } = useI18n();
|
||||
|
||||
onMounted(async () => {
|
||||
layoutStore.loading = true;
|
||||
busy.value = true;
|
||||
|
||||
try {
|
||||
users.value = await api.getAll();
|
||||
@@ -61,7 +64,7 @@ onMounted(async () => {
|
||||
error.value = err;
|
||||
}
|
||||
} finally {
|
||||
layoutStore.loading = false;
|
||||
busy.value = false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user