space settings and message

This commit is contained in:
vabene1111
2024-09-21 13:36:36 +02:00
parent 55bd417105
commit ce869950c3
36 changed files with 313 additions and 16 deletions

View File

@@ -131,7 +131,7 @@ async function createObject(object: any, select$: Multiselect) {
</script>
<style src="@vueform/multiselect/themes/default.css"></style>
<style scoped>
<style>
.material-multiselect {
--ms-line-height: 2.5;
--ms-bg: rgba(235, 235, 235, 0.75);
@@ -141,4 +141,8 @@ async function createObject(object: any, select$: Multiselect) {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.multiselect-tag {
background-color: #b98766 !important;
}
</style>

View File

@@ -22,22 +22,80 @@
<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">{{ $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-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>
<user-file-field v-model="space.image" :label="$t('Image')"></user-file-field>
<v-alert color="primary" variant="tonal" v-if="useUserPreferenceStore().serverSettings.hosted">
<v-alert-title>
<v-row>
<v-col>
<v-avatar image="../../assets/logo_color.svg" class="me-2"></v-avatar>
{{ $t('ThankYou') }}!
</v-col>
<v-col>
<v-btn color="primary" class="float-right" href="https://tandoor.dev/manage" target="_blank">{{ $t('ManageSubscription') }}</v-btn>
</v-col>
</v-row>
</v-alert-title>
<p class="mt-2">{{ $t('ThanksTextHosted') }}</p>
</v-alert>
<v-alert color="primary" variant="tonal" v-if="!useUserPreferenceStore().serverSettings.hosted">
<v-alert-title>
<v-row>
<v-col>
<v-avatar image="../../assets/logo_color.svg" class="me-2"></v-avatar>
{{ $t('ThankYou') }}!
</v-col>
<v-col>
<v-btn color="primary" class="float-right" href="https://github.com/sponsors/vabene1111" target="_blank"><i class="fa-brands fa-github"></i> GitHub Sponsors
</v-btn>
</v-col>
</v-row>
</v-alert-title>
<p class="mt-2">{{ $t('ThanksTextSelfhosted') }}</p>
</v-alert>
<p class="text-h6 mt-2">{{ $t('Settings') }}</p>
<v-divider class="mb-2"></v-divider>
<user-file-field v-model="space.image" :label="$t('Image')" :hint="$t('CustomImageHelp')" persistent-hint></user-file-field>
<user-file-field v-model="space.navLogo" :label="$t('Logo')" :hint="$t('CustomNavLogoHelp')" persistent-hint></user-file-field>
<v-textarea v-model="space.message" :label="$t('Message')"></v-textarea>
<model-select v-model="space.foodInherit" model="FoodInheritField" mode="tags"></model-select>
<v-btn color="success" @click="updateSpace()" prepend-icon="$save">{{ $t('Save') }}</v-btn>
<p class="text-h6 mt-2">{{ $t('Logo') }}</p>
<v-divider></v-divider>
<p class="text-subtitle-2">{{ $t('CustomLogoHelp') }}</p>
<user-file-field v-model="space.logoColor32" :label="$t('Logo') + ' 32x32px'"></user-file-field>
<user-file-field v-model="space.logoColor128"></user-file-field>
<user-file-field v-model="space.logoColor128" :label="$t('Logo') + ' 128x128px'"></user-file-field>
<user-file-field v-model="space.logoColor144" :label="$t('Logo') + ' 144x144px'"></user-file-field>
<user-file-field v-model="space.logoColor180" :label="$t('Logo') + ' 180x180px'"></user-file-field>
<user-file-field v-model="space.logoColor192" :label="$t('Logo') + ' 192x192px'"></user-file-field>
<user-file-field v-model="space.logoColor512" :label="$t('Logo') + ' 512x512px'"></user-file-field>
<user-file-field v-model="space.logoColorSvg" :label="$t('Logo') + ' SVG'"></user-file-field>
<v-text-field :hint="$t('CustomNavLogoHelp')" persistent-hint></v-text-field>
<v-text-field :hint="$t('CustomNavLogoHelp')" persistent-hint></v-text-field>
<v-btn class="mt-3" color="success" @click="updateSpace()" prepend-icon="$save">{{ $t('Save') }}</v-btn>
<v-btn color="success" @click="updateSpace()" prepend-icon="$save">{{ $t('Save') }}</v-btn>
</v-form>
</template>
@@ -47,8 +105,9 @@
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
import {onMounted, ref} from "vue";
import {ApiApi, Space} from "@/openapi";
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
import {ErrorMessageType, PreparedMessage, useMessageStore} from "@/stores/MessageStore";
import UserFileField from "@/components/inputs/UserFileField.vue";
import ModelSelect from "@/components/inputs/ModelSelect.vue";
const space = ref({} as Space)
@@ -61,10 +120,12 @@ onMounted(() => {
})
})
function updateSpace(){
function updateSpace() {
let api = new ApiApi()
api.apiSpacePartialUpdate({id: space.value.id, patchedSpace: space.value}).then(r => {
space.value = r
useUserPreferenceStore().activeSpace = Object.assign({}, space.value)
useMessageStore().addPreparedMessage(PreparedMessage.UPDATE_SUCCESS, space.value)
}).catch(err => {
useMessageStore().addError(ErrorMessageType.UPDATE_ERROR, err)
})

View File

@@ -1,16 +1,20 @@
<template>
<v-row>
<v-col cols="12"></v-col>
<v-col>
<p class="text-h6">{{ $t('YourSpaces') }}</p>
<v-divider></v-divider>
</v-col>
</v-row>
<v-row>
<v-col cols="6" v-for="s in spaces">
<v-card @click="useUserPreferenceStore().switchSpace(s)">
<v-img height="200px" cover :src="(s.image !== undefined) ? s.image?.preview : 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-img height="200px" cover :src="(s.image !== undefined) ? s.image?.preview : 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>