mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-10 00:28:22 -05:00
settings cleanup
This commit is contained in:
@@ -8,6 +8,10 @@
|
|||||||
:item-content-height="calendarItemHeight"
|
:item-content-height="calendarItemHeight"
|
||||||
:enable-drag-drop="true"
|
:enable-drag-drop="true"
|
||||||
@dropOnDate="dropCalendarItemOnDate"
|
@dropOnDate="dropCalendarItemOnDate"
|
||||||
|
:display-period-uom="useUserPreferenceStore().deviceSettings.mealplan_displayPeriod"
|
||||||
|
:display-period-count="useUserPreferenceStore().deviceSettings.mealplan_displayPeriodCount"
|
||||||
|
:starting-day-of-week="useUserPreferenceStore().deviceSettings.mealplan_startingDayOfWeek"
|
||||||
|
:display-week-numbers="useUserPreferenceStore().deviceSettings.mealplan_displayWeekNumbers"
|
||||||
@click-date="(date : Date, calendarItems: [], windowEvent: any) => { newPlanDialogDefaultItem.fromDate = date; newPlanDialogDefaultItem.toDate = date; newPlanDialog = true }">
|
@click-date="(date : Date, calendarItems: [], windowEvent: any) => { newPlanDialogDefaultItem.fromDate = date; newPlanDialogDefaultItem.toDate = date; newPlanDialog = true }">
|
||||||
<template #header="{ headerProps }">
|
<template #header="{ headerProps }">
|
||||||
<CalendarViewHeader :header-props="headerProps"></CalendarViewHeader>
|
<CalendarViewHeader :header-props="headerProps"></CalendarViewHeader>
|
||||||
@@ -24,7 +28,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</CalendarView>
|
</CalendarView>
|
||||||
|
|
||||||
<model-edit-dialog model="MealPlan" v-model="newPlanDialog" :itemDefaults="newPlanDialogDefaultItem" @create="(arg: any) => useMealPlanStore().plans.set(arg.id, arg)"></model-edit-dialog>
|
<model-edit-dialog model="MealPlan" v-model="newPlanDialog" :itemDefaults="newPlanDialogDefaultItem"
|
||||||
|
@create="(arg: any) => useMealPlanStore().plans.set(arg.id, arg)"></model-edit-dialog>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
@@ -43,6 +48,7 @@ import {useDisplay} from "vuetify";
|
|||||||
import {useMealPlanStore} from "@/stores/MealPlanStore";
|
import {useMealPlanStore} from "@/stores/MealPlanStore";
|
||||||
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
|
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
|
||||||
import {MealPlan} from "@/openapi";
|
import {MealPlan} from "@/openapi";
|
||||||
|
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||||
|
|
||||||
const {lgAndUp} = useDisplay()
|
const {lgAndUp} = useDisplay()
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-list-subheader>Admin</v-list-subheader>
|
<v-list-subheader>Admin</v-list-subheader>
|
||||||
<v-list-item :to="{name: 'view_settings_api'}" prepend-icon="fa-solid fa-code">{{ $t('API') }}</v-list-item>
|
<v-list-item :to="{name: 'view_settings_api'}" prepend-icon="fa-solid fa-code">{{ $t('API') }}</v-list-item>
|
||||||
<v-list-item prepend-icon="fa-solid fa-server">{{ $t('System') }}</v-list-item>
|
<v-list-item href="/system/" prepend-icon="fa-solid fa-server">{{ $t('System') }}</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const SERVER_SETTINGS_KEY = 'TANDOOR_SERVER_SETTINGS'
|
|||||||
const ACTIVE_SPACE_KEY = 'TANDOOR_ACTIVE_SPACE'
|
const ACTIVE_SPACE_KEY = 'TANDOOR_ACTIVE_SPACE'
|
||||||
|
|
||||||
class DeviceSettings {
|
class DeviceSettings {
|
||||||
|
|
||||||
shopping_show_checked_entries = false
|
shopping_show_checked_entries = false
|
||||||
shopping_show_delayed_entries = false
|
shopping_show_delayed_entries = false
|
||||||
shopping_show_selected_supermarket_only = false
|
shopping_show_selected_supermarket_only = false
|
||||||
@@ -25,14 +24,13 @@ class DeviceSettings {
|
|||||||
mealplan_displayWeekNumbers = true
|
mealplan_displayWeekNumbers = true
|
||||||
|
|
||||||
general_tableItemsPerPage = 10
|
general_tableItemsPerPage = 10
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUserPreferenceStore = defineStore('user_preference_store', () => {
|
export const useUserPreferenceStore = defineStore('user_preference_store', () => {
|
||||||
/**
|
/**
|
||||||
* settings only saved on device to allow per device customization
|
* settings only saved on device to allow per device customization
|
||||||
*/
|
*/
|
||||||
let deviceSettings = useStorage(DEVICE_SETTINGS_KEY, {} as DeviceSettings)
|
let deviceSettings = useStorage(DEVICE_SETTINGS_KEY, new DeviceSettings(), localStorage, {mergeDefaults: true})
|
||||||
/**
|
/**
|
||||||
* database user settings, cache in local storage in case application is started offline
|
* database user settings, cache in local storage in case application is started offline
|
||||||
*/
|
*/
|
||||||
@@ -92,7 +90,7 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
|||||||
/**
|
/**
|
||||||
* load data for currently active space
|
* load data for currently active space
|
||||||
*/
|
*/
|
||||||
function loadActiveSpace(){
|
function loadActiveSpace() {
|
||||||
let api = new ApiApi()
|
let api = new ApiApi()
|
||||||
api.apiSpaceCurrentRetrieve().then(r => {
|
api.apiSpaceCurrentRetrieve().then(r => {
|
||||||
activeSpace.value = r
|
activeSpace.value = r
|
||||||
@@ -104,7 +102,7 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
|||||||
/**
|
/**
|
||||||
* switch to the given space
|
* switch to the given space
|
||||||
*/
|
*/
|
||||||
function switchSpace(space: Space){
|
function switchSpace(space: Space) {
|
||||||
let api = new ApiApi()
|
let api = new ApiApi()
|
||||||
|
|
||||||
api.apiSwitchActiveSpaceRetrieve({spaceId: space.id}).then(r => {
|
api.apiSwitchActiveSpaceRetrieve({spaceId: space.id}).then(r => {
|
||||||
@@ -121,7 +119,7 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
|||||||
// always load active space on first initialization of store
|
// always load active space on first initialization of store
|
||||||
loadActiveSpace()
|
loadActiveSpace()
|
||||||
|
|
||||||
return {deviceSettings, userSettings, serverSettings, activeSpace, loadUserSettings, loadServerSettings,updateUserSettings, switchSpace}
|
return {deviceSettings, userSettings, serverSettings, activeSpace, loadUserSettings, loadServerSettings, updateUserSettings, switchSpace}
|
||||||
})
|
})
|
||||||
|
|
||||||
// enable hot reload for store
|
// enable hot reload for store
|
||||||
|
|||||||
Reference in New Issue
Block a user