mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 12:49:02 -05:00
switched to litellm
This commit is contained in:
65
vue3/src/components/model_editors/RecipeBookEditor.vue
Normal file
65
vue3/src/components/model_editors/RecipeBookEditor.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<model-editor-base
|
||||
:loading="loading"
|
||||
:dialog="dialog"
|
||||
@save="saveObject"
|
||||
@delete="deleteObject"
|
||||
@close="emit('close')"
|
||||
:is-update="isUpdate()"
|
||||
:is-changed="editingObjChanged"
|
||||
:model-class="modelClass"
|
||||
:object-name="editingObjName()">
|
||||
<v-card-text>
|
||||
<v-form :disabled="loading">
|
||||
<v-row>
|
||||
<v-col cols="10">
|
||||
<v-text-field label="Token" v-model="editingObj.token" disabled></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="2">
|
||||
<btn-copy :copy-value="editingObj.token" class="me-1"></btn-copy>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-text-field label="Scope" v-model="editingObj.scope"></v-text-field>
|
||||
<v-date-input :label="$t('Valid Until')" v-model="editingObj.expires"></v-date-input>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</model-editor-base>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
import {VDateInput} from 'vuetify/labs/VDateInput' //TODO remove once component is out of labs
|
||||
import {onMounted, PropType} from "vue";
|
||||
import {AccessToken} from "@/openapi";
|
||||
|
||||
import {DateTime} from "luxon";
|
||||
import BtnCopy from "@/components/buttons/BtnCopy.vue";
|
||||
|
||||
import {useModelEditorFunctions} from "@/composables/useModelEditorFunctions";
|
||||
import ModelEditorBase from "@/components/model_editors/ModelEditorBase.vue";
|
||||
|
||||
const props = defineProps({
|
||||
item: {type: {} as PropType<AccessToken>, required: false, default: null},
|
||||
itemId: {type: [Number, String], required: false, default: undefined},
|
||||
dialog: {type: Boolean, default: false}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['create', 'save', 'delete', 'close'])
|
||||
const {setupState, deleteObject, saveObject, isUpdate, editingObjName, loading, editingObj, editingObjChanged, modelClass} = useModelEditorFunctions<AccessToken>('AccessToken', emit)
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
setupState(props.item, props.itemId, {
|
||||
newItemFunction: () => {
|
||||
editingObj.value.expires = DateTime.now().plus({year: 1}).toJSDate()
|
||||
editingObj.value.scope = 'read write'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
42
vue3/src/pages/BooksPage.vue
Normal file
42
vue3/src/pages/BooksPage.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<horizontal-meal-plan-window></horizontal-meal-plan-window>
|
||||
|
||||
<v-card v-if="totalRecipes == 0" class="mt-5 mb-5">
|
||||
<v-card-title><i class="fa-solid fa-eye-slash"></i> {{ $t('search_no_recipes') }}</v-card-title>
|
||||
<v-card-text>
|
||||
<v-btn-group divided>
|
||||
<v-btn size="large" color="success" prepend-icon="$create" :to="{ name: 'ModelEditPage', params: {model: 'recipe'} }">{{ $t('Create Recipe') }}</v-btn>
|
||||
<v-btn size="large" color="primary" prepend-icon="fa-solid fa-globe" :to="{ name: 'RecipeImportPage', params: {} }">{{ $t('Import Recipe') }}</v-btn>
|
||||
</v-btn-group>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
<horizontal-recipe-scroller :skeletons="4" mode="recent"></horizontal-recipe-scroller>
|
||||
<horizontal-recipe-scroller :skeletons="4" mode="new"></horizontal-recipe-scroller>
|
||||
<horizontal-recipe-scroller :skeletons="4" mode="keyword"></horizontal-recipe-scroller>
|
||||
<horizontal-recipe-scroller :skeletons="4" mode="random"></horizontal-recipe-scroller>
|
||||
<horizontal-recipe-scroller :skeletons="2" mode="rating"></horizontal-recipe-scroller>
|
||||
<horizontal-recipe-scroller :skeletons="4" mode="keyword"></horizontal-recipe-scroller>
|
||||
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {onMounted, ref} from "vue"
|
||||
import {ApiApi} from "@/openapi"
|
||||
import HorizontalRecipeScroller from "@/components/display/HorizontalRecipeWindow.vue"
|
||||
import HorizontalMealPlanWindow from "@/components/display/HorizontalMealPlanWindow.vue"
|
||||
|
||||
const totalRecipes = ref(-1)
|
||||
|
||||
onMounted(() => {
|
||||
const api = new ApiApi()
|
||||
|
||||
api.apiRecipeList({pageSize: 1}).then((r) => {
|
||||
totalRecipes.value = r.count
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user