space settings base page

This commit is contained in:
vabene1111
2024-08-20 13:50:58 +02:00
parent 4ba769a49e
commit 02ffb727d5
34 changed files with 124 additions and 143 deletions

View File

@@ -1,19 +1,61 @@
<template>
<v-form>
<p class="text-h6">{{ $t('Cosmetic') }}</p>
<p class="text-h6">{{ useUserPreferenceStore().activeSpace.name }}</p>
<v-divider class="mb-3"></v-divider>
<v-row v-if="space.name != undefined">
<v-col cols="12" md="4">
<v-card>
<v-card-title><i class="fa-solid fa-book"></i> {{ $t('Recipes') }}</v-card-title>
<v-card-text>{{ $n(space.recipeCount) }} / {{ space.maxRecipes == 0 ? '∞' : $n(space.maxRecipes) }}</v-card-text>
<v-progress-linear color="success" height="10" :model-value="(space.recipeCount / space.maxRecipes) * 100"></v-progress-linear>
</v-card>
</v-col>
<v-col cols="12" md="4">
<v-card>
<v-btn class="mt-3" color="success" @click="useUserPreferenceStore().updateUserSettings()" prepend-icon="$save">{{$t('Save')}}</v-btn>
<v-card-title><i class="fa-solid fa-users"></i> {{ $t('Users') }}</v-card-title>
<v-card-text>{{ $n(space.userCount) }} / {{ space.maxUsers == 0 ? '∞' : $n(space.maxUsers) }}</v-card-text>
<v-progress-linear color="success" height="10" :model-value="(space.userCount / space.maxUsers) * 100"></v-progress-linear>
</v-card>
</v-col>
<v-col cols="12" md="4">
<v-card>
<v-card-title><i class="fa-solid fa-file"></i> {{ $t('Files') }}</v-card-title>
<v-card-text v-if="space.maxFileStorageMb > -1">{{ $n(Math.round(space.fileSizeMb)) }} / {{ space.maxFileStorageMb == 0 ? '' : $n(space.maxFileStorageMb) }} MB</v-card-text>
<v-card-text v-if="space.maxFileStorageMb == -1">{{ $t('file_upload_disabled') }}</v-card-text>
<v-progress-linear v-if="space.maxFileStorageMb > -1" color="success" height="10" :model-value="(space.fileSizeMb / space.maxFileStorageMb) * 100" ></v-progress-linear>
</v-card>
</v-col>
</v-row>
<v-divider class="mt-3 mb-3"></v-divider>
<v-text-field></v-text-field>
<v-text-field></v-text-field>
<v-text-field></v-text-field>
<v-btn class="mt-3" color="success" @click="" prepend-icon="$save">{{ $t('Save') }}</v-btn>
</v-form>
</template>
<script setup lang="ts">
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
import {onMounted, ref} from "vue";
import {ApiApi, Space} from "@/openapi";
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
const space = ref({} as Space)
onMounted(() => {
let api = new ApiApi()
api.apiSpaceCurrentRetrieve().then(r => {
space.value = r
}).catch(err => {
useMessageStore().addError(ErrorMessageType.FETCH_ERROR, err)
})
})
</script>
<style scoped>

View File

@@ -6,9 +6,11 @@
</v-row>
<v-row>
<v-col cols="3" v-for="us in userSpaces">
<v-col cols="6" v-for="s in spaces">
<v-card>
<v-card-title>{{us.space}}</v-card-title>
<v-img height="200px" :src="recipeDefaultImage" :alt="$t('Image')"> </v-img>
<v-card-title>{{ s.name }} <v-chip variant="tonal" density="compact" color="error" v-if="s.id == useUserPreferenceStore().activeSpace.id">{{$t('active')}}</v-chip></v-card-title>
<v-card-subtitle>{{ $t('created_by') }} {{ s.createdBy.displayName }} </v-card-subtitle>
</v-card>
</v-col>
</v-row>
@@ -18,16 +20,18 @@
<script setup lang="ts">
import {onMounted, ref} from "vue";
import {ApiApi, UserSpace} from "@/openapi";
import {ApiApi, Space} from "@/openapi";
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
import recipeDefaultImage from '../../assets/recipe_no_image.svg'
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
const userSpaces = ref([] as UserSpace[])
const spaces = ref([] as Space[])
onMounted(() => {
const api = new ApiApi()
api.apiUserSpaceList().then(r => {
userSpaces.value = r.results
api.apiSpaceList().then(r => {
spaces.value = r
}).catch(err => {
useMessageStore().addError(ErrorMessageType.FETCH_ERROR, err)
})