diff --git a/dev/scripts/gen_global_componenets.py b/dev/scripts/gen_global_components.py similarity index 99% rename from dev/scripts/gen_global_componenets.py rename to dev/scripts/gen_global_components.py index f1b6b49c933a..4acdbb20ddae 100644 --- a/dev/scripts/gen_global_componenets.py +++ b/dev/scripts/gen_global_components.py @@ -2,7 +2,7 @@ from pathlib import Path from jinja2 import Template -template = """// This Code is auto generated by gen_global_componenets.py +template = """// This Code is auto generated by gen_global_components.py {% for name in global %} import {{ name }} from "@/components/global/{{ name }}.vue"; {% endfor %} {% for name in layout %} import {{ name }} from "@/components/layout/{{ name }}.vue"; diff --git a/dev/scripts/types_gen.py b/dev/scripts/types_gen.py index 922a17365335..db4706951920 100644 --- a/dev/scripts/types_gen.py +++ b/dev/scripts/types_gen.py @@ -5,7 +5,7 @@ from pydantic2ts import generate_typescript_defs CWD = Path(__file__).parent PROJECT_DIR = Path(__file__).parent.parent.parent -SCHEMA_PATH = Path("/Users/hayden/Projects/Vue/mealie/mealie/schema/") +SCHEMA_PATH = PROJECT_DIR / "mealie" / "schema" TYPES_DIR = CWD / "output" / "types" / "api-types" diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index d8c49a718e06..9789bf40c24b 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -4,11 +4,26 @@ module.exports = { browser: true, node: true, }, + parser: "vue-eslint-parser", parserOptions: { parser: "@typescript-eslint/parser", requireConfigFile: false, + tsConfigRootDir: __dirname, + project: ["./tsconfig.json"], + extraFileExtensions: [".vue"], }, - extends: ["@nuxtjs/eslint-config-typescript", "plugin:nuxt/recommended", "prettier"], + extends: [ + "@nuxtjs/eslint-config-typescript", + "plugin:nuxt/recommended", + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + // "plugin:prettier/recommended", + "prettier", + ], + // Re-add once we use nuxt bridge + // See https://v3.nuxtjs.org/getting-started/bridge#update-nuxtconfig + ignorePatterns: ["nuxt.config.js"], plugins: ["prettier"], // add your custom rules here rules: { @@ -27,5 +42,13 @@ module.exports = { allowModifiers: true, }, ], + // TODO Gradually activate all rules + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-explicit-any": "off", }, }; diff --git a/frontend/api/_base.ts b/frontend/api/_base.ts index 55eacc71847a..660bf041be24 100644 --- a/frontend/api/_base.ts +++ b/frontend/api/_base.ts @@ -10,16 +10,6 @@ export interface CrudAPIInterface { // Methods } -export interface CrudAPIMethodsInterface { - // CRUD Methods - getAll(): any; - createOne(): any; - getOne(): any; - updateOne(): any; - patchOne(): any; - deleteOne(): any; -} - export abstract class BaseAPI { requests: ApiRequestInstance; @@ -50,8 +40,8 @@ export abstract class BaseCRUDAPI extends BaseAPI implements CrudAPIInterf return await this.requests.put(this.itemRoute(itemId), payload); } - async patchOne(itemId: string, payload: T) { - return await this.requests.patch(this.itemRoute(itemId), payload); + async patchOne(itemId: string, payload: Partial) { + return await this.requests.patch(this.itemRoute(itemId), payload); } async deleteOne(itemId: string | number) { diff --git a/frontend/api/admin/admin-groups.ts b/frontend/api/admin/admin-groups.ts index 5e76544db917..d374a2f7e33d 100644 --- a/frontend/api/admin/admin-groups.ts +++ b/frontend/api/admin/admin-groups.ts @@ -49,6 +49,7 @@ export class AdminGroupsApi extends BaseCRUDAPI { itemRoute = routes.adminUsersId; async updateOne(id: number, payload: AdminGroupUpdate) { - return await this.requests.put(this.itemRoute(id), payload); + // TODO: This should probably be a patch request, which isn't offered by the API currently + return await this.requests.put(this.itemRoute(id), payload); } } diff --git a/frontend/api/class-interfaces/groups.ts b/frontend/api/class-interfaces/groups.ts index 8c8fe8992f2b..26446bb9636e 100644 --- a/frontend/api/class-interfaces/groups.ts +++ b/frontend/api/class-interfaces/groups.ts @@ -59,10 +59,10 @@ export interface Invitation { } export interface SetPermissions { - userId: number; - canInvite: boolean; - canManage: boolean; - canOrganize: boolean; + userId: string; + canInvite?: boolean; + canManage?: boolean; + canOrganize?: boolean; } export class GroupAPI extends BaseCRUDAPI { @@ -87,7 +87,8 @@ export class GroupAPI extends BaseCRUDAPI { } async setPreferences(payload: UpdatePreferences) { - return await this.requests.put(routes.preferences, payload); + // TODO: This should probably be a patch request, which isn't offered by the API currently + return await this.requests.put(routes.preferences, payload); } async createInvitation(payload: CreateInvitation) { @@ -99,6 +100,7 @@ export class GroupAPI extends BaseCRUDAPI { } async setMemberPermissions(payload: SetPermissions) { - return await this.requests.put(routes.permissions, payload); + // TODO: This should probably be a patch request, which isn't offered by the API currently + return await this.requests.put(routes.permissions, payload); } } diff --git a/frontend/api/class-interfaces/recipe-bulk-actions.ts b/frontend/api/class-interfaces/recipe-bulk-actions.ts index d8644d017fe6..9c81fd362e68 100644 --- a/frontend/api/class-interfaces/recipe-bulk-actions.ts +++ b/frontend/api/class-interfaces/recipe-bulk-actions.ts @@ -6,6 +6,7 @@ interface BasePayload { type exportType = "json"; +// eslint-disable-next-line @typescript-eslint/no-empty-interface interface RecipeBulkDelete extends BasePayload {} interface RecipeBulkExport extends BasePayload { diff --git a/frontend/api/class-interfaces/recipes/recipe.ts b/frontend/api/class-interfaces/recipes/recipe.ts index 7b270daf5c1f..93d467e7bb55 100644 --- a/frontend/api/class-interfaces/recipes/recipe.ts +++ b/frontend/api/class-interfaces/recipes/recipe.ts @@ -80,30 +80,13 @@ export class RecipeAPI extends BaseCRUDAPI { } async createOneByUrl(url: string) { - return await this.requests.post(routes.recipesCreateUrl, { url }); + return await this.requests.post(routes.recipesCreateUrl, { url }); } async createManyByUrl(payload: BulkCreatePayload) { return await this.requests.post(routes.recipesCreateUrlBulk, payload); } - // Methods to Generate reference urls for assets/images * - recipeImage(recipeSlug: string, version = null, key = null) { - return `/api/media/recipes/${recipeSlug}/images/original.webp?&rnd=${key}&version=${version}`; - } - - recipeSmallImage(recipeSlug: string, version = null, key = null) { - return `/api/media/recipes/${recipeSlug}/images/min-original.webp?&rnd=${key}&version=${version}`; - } - - recipeTinyImage(recipeSlug: string, version = null, key = null) { - return `/api/media/recipes/${recipeSlug}/images/tiny-original.webp?&rnd=${key}&version=${version}`; - } - - recipeAssetPath(recipeSlug: string, assetName: string) { - return `/api/media/recipes/${recipeSlug}/assets/${assetName}`; - } - async parseIngredients(parser: Parser, ingredients: Array) { parser = parser || "nlp"; return await this.requests.post(routes.recipesParseIngredients, { parser, ingredients }); diff --git a/frontend/api/class-interfaces/recipes/types.ts b/frontend/api/class-interfaces/recipes/types.ts index 1dda8439f0e7..d4014beb8e80 100644 --- a/frontend/api/class-interfaces/recipes/types.ts +++ b/frontend/api/class-interfaces/recipes/types.ts @@ -1,5 +1,6 @@ import { Category } from "../categories"; import { Tag } from "../tags"; +import { CreateIngredientFood, CreateIngredientUnit, IngredientFood, IngredientUnit } from "~/types/api-types/recipe"; export type Parser = "nlp" | "brute"; @@ -12,26 +13,14 @@ export interface Confidence { food?: number; } -export interface Unit { - name: string; - description: string; - fraction: boolean; - abbreviation: string; -} - -export interface Food { - name: string; - description?: string; -} - export interface Ingredient { - referenceId: string; - title: string; - note: string; - unit: Unit | null; - food: Food | null; - disableAmount: boolean; - quantity: number; + title?: string; + note?: string; + unit?: IngredientUnit | CreateIngredientUnit; + food?: IngredientFood | CreateIngredientFood; + disableAmount?: boolean; + quantity?: number; + referenceId?: string; } export interface ParsedIngredient { diff --git a/frontend/api/class-interfaces/upload.ts b/frontend/api/class-interfaces/upload.ts index 6e8dff2de82e..936491101e66 100644 --- a/frontend/api/class-interfaces/upload.ts +++ b/frontend/api/class-interfaces/upload.ts @@ -2,6 +2,6 @@ import { BaseAPI } from "../_base"; export class UploadFile extends BaseAPI { file(url: string, fileObject: any) { - return this.requests.post(url, fileObject); + return this.requests.post(url, fileObject); } } diff --git a/frontend/api/class-interfaces/utils.ts b/frontend/api/class-interfaces/utils.ts index be01eef40296..a3c457f4e4f4 100644 --- a/frontend/api/class-interfaces/utils.ts +++ b/frontend/api/class-interfaces/utils.ts @@ -11,10 +11,10 @@ export class UtilsAPI extends BaseAPI { } // @ts-ignore - const token: String = response.data.fileToken; + const token: string = response.data.fileToken; const tokenURL = prefix + "/utils/download?token=" + token; window.open(tokenURL, "_blank"); - return await response; + return response; } } diff --git a/frontend/api/requests.ts b/frontend/api/requests.ts deleted file mode 100644 index b1b60b40831a..000000000000 --- a/frontend/api/requests.ts +++ /dev/null @@ -1,47 +0,0 @@ -import axios, { AxiosResponse } from "axios"; - -interface RequestResponse { - response: AxiosResponse | null; - data: T | null; - error: any; -} - -const request = { - async safe(funcCall: any, url: string, data: object = {}): Promise> { - const response = await funcCall(url, data).catch(function (error: object) { - console.log(error); - // Insert Generic Error Handling Here - return { response: null, error, data: null }; - }); - return { response, error: null, data: response.data }; - }, -}; - -export const requests = { - async get(url: string, params = {}): Promise> { - let error = null; - const response = await axios.get(url, { ...params }).catch((e) => { - error = e; - }); - if (response != null) { - return { response, error, data: response?.data }; - } - return { response: null, error, data: null }; - }, - - async post(url: string, data: object) { - return await request.safe(axios.post, url, data); - }, - - async put(url: string, data: object) { - return await request.safe(axios.put, url, data); - }, - - async patch(url: string, data: object) { - return await request.safe(axios.patch, url, data); - }, - - async delete(url: string) { - return await request.safe(axios.delete, url); - }, -}; diff --git a/frontend/components/Domain/Admin/AdminBackupImportOptions.vue b/frontend/components/Domain/Admin/AdminBackupImportOptions.vue index bf5e57d4b1c9..30bb16675e5b 100644 --- a/frontend/components/Domain/Admin/AdminBackupImportOptions.vue +++ b/frontend/components/Domain/Admin/AdminBackupImportOptions.vue @@ -22,50 +22,58 @@ - \ No newline at end of file +}); + diff --git a/frontend/components/Domain/Recipe/RecipeActionMenu.vue b/frontend/components/Domain/Recipe/RecipeActionMenu.vue index f68c2785f0bc..ad3b3dfe2d86 100644 --- a/frontend/components/Domain/Recipe/RecipeActionMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeActionMenu.vue @@ -92,7 +92,8 @@ - \ No newline at end of file + diff --git a/frontend/components/Domain/Recipe/RecipeCardMobile.vue b/frontend/components/Domain/Recipe/RecipeCardMobile.vue index a8dfffafb4f4..3b3f6492593b 100644 --- a/frontend/components/Domain/Recipe/RecipeCardMobile.vue +++ b/frontend/components/Domain/Recipe/RecipeCardMobile.vue @@ -10,15 +10,7 @@ - - - {{ $globals.icons.primary }} - + @@ -61,15 +53,17 @@ - diff --git a/frontend/components/Domain/Recipe/RecipeCardSection.vue b/frontend/components/Domain/Recipe/RecipeCardSection.vue index 4e57fcdcc6ca..899bd95ddc8d 100644 --- a/frontend/components/Domain/Recipe/RecipeCardSection.vue +++ b/frontend/components/Domain/Recipe/RecipeCardSection.vue @@ -102,13 +102,16 @@ - diff --git a/frontend/components/Domain/Recipe/RecipeContextMenu.vue b/frontend/components/Domain/Recipe/RecipeContextMenu.vue index fb1af4c5208d..12f29ed7346c 100644 --- a/frontend/components/Domain/Recipe/RecipeContextMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeContextMenu.vue @@ -167,7 +167,6 @@ export default defineComponent({ pickerMenu: false, }); - // @ts-ignore const { i18n, $globals } = useContext(); // =========================================================================== @@ -262,14 +261,12 @@ export default defineComponent({ } // Note: Print is handled as an event in the parent component - const eventHandlers: { [key: string]: Function } = { - // @ts-ignore - Doens't know about open() + const eventHandlers: { [key: string]: () => void } = { delete: () => { state.recipeDeleteDialog = true; }, edit: () => router.push(`/recipe/${props.slug}` + "?edit=true"), download: handleDownloadEvent, - // @ts-ignore - Doens't know about open() mealplanner: () => { state.mealplannerDialog = true; }, diff --git a/frontend/components/Domain/Recipe/RecipeDataTable.vue b/frontend/components/Domain/Recipe/RecipeDataTable.vue index 0061c37f8bd1..945bbd7e99d7 100644 --- a/frontend/components/Domain/Recipe/RecipeDataTable.vue +++ b/frontend/components/Domain/Recipe/RecipeDataTable.vue @@ -38,7 +38,7 @@ - + \ No newline at end of file + diff --git a/frontend/components/Domain/Recipe/RecipeDialogSearch.vue b/frontend/components/Domain/Recipe/RecipeDialogSearch.vue index f085fd98fb9d..b31e95c82163 100644 --- a/frontend/components/Domain/Recipe/RecipeDialogSearch.vue +++ b/frontend/components/Domain/Recipe/RecipeDialogSearch.vue @@ -54,7 +54,7 @@ @@ -167,4 +164,4 @@ export default defineComponent({ .scroll { overflow-y: scroll; } - \ No newline at end of file + diff --git a/frontend/components/Domain/Recipe/RecipeFavoriteBadge.vue b/frontend/components/Domain/Recipe/RecipeFavoriteBadge.vue index b7a14d5a1d96..1252ef815d95 100644 --- a/frontend/components/Domain/Recipe/RecipeFavoriteBadge.vue +++ b/frontend/components/Domain/Recipe/RecipeFavoriteBadge.vue @@ -20,9 +20,10 @@ - \ No newline at end of file + diff --git a/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue b/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue index 5b2a637db5be..ab16c760fc11 100644 --- a/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue +++ b/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue @@ -25,7 +25,7 @@
- + - diff --git a/frontend/components/Domain/Recipe/RecipeIngredientEditor.vue b/frontend/components/Domain/Recipe/RecipeIngredientEditor.vue index b925cf429408..5eb7806cd7af 100644 --- a/frontend/components/Domain/Recipe/RecipeIngredientEditor.vue +++ b/frontend/components/Domain/Recipe/RecipeIngredientEditor.vue @@ -105,11 +105,12 @@ import { defineComponent, reactive, ref, toRefs } from "@nuxtjs/composition-api"; import { useFoods, useUnits } from "~/composables/recipes"; import { validators } from "~/composables/use-validators"; +import { RecipeIngredient } from "~/types/api-types/recipe"; export default defineComponent({ props: { value: { - type: Object, + type: Object as () => RecipeIngredient, required: true, }, disableAmount: { @@ -157,14 +158,14 @@ export default defineComponent({ } function handleUnitEnter() { - if (value.unit === null || !value.unit.name.includes(unitSearch.value)) { + if (value.unit === undefined || !value.unit.name.includes(unitSearch.value)) { console.log("Creating"); createAssignUnit(); } } function handleFoodEnter() { - if (value.food === null || !value.food.name.includes(foodSearch.value)) { + if (value.food === undefined || !value.food.name.includes(foodSearch.value)) { console.log("Creating"); createAssignFood(); } @@ -194,4 +195,4 @@ export default defineComponent({ margin: 0 !important; padding: 0 !important; } - \ No newline at end of file + diff --git a/frontend/components/Domain/Recipe/RecipeIngredients.vue b/frontend/components/Domain/Recipe/RecipeIngredients.vue index c1764306bc57..eb8ad959f59d 100644 --- a/frontend/components/Domain/Recipe/RecipeIngredients.vue +++ b/frontend/components/Domain/Recipe/RecipeIngredients.vue @@ -23,17 +23,20 @@
- diff --git a/frontend/components/Domain/Recipe/RecipeInstructions.vue b/frontend/components/Domain/Recipe/RecipeInstructions.vue index 788f71d8ee28..ba075ed8ca8f 100644 --- a/frontend/components/Domain/Recipe/RecipeInstructions.vue +++ b/frontend/components/Domain/Recipe/RecipeInstructions.vue @@ -153,7 +153,7 @@ import draggable from "vuedraggable"; // @ts-ignore import VueMarkdown from "@adapttive/vue-markdown"; import { ref, toRefs, reactive, defineComponent, watch, onMounted } from "@nuxtjs/composition-api"; -import { RecipeStep, IngredientToStepRef, RecipeIngredient } from "~/types/api-types/recipe"; +import { RecipeStep, IngredientReferences, RecipeIngredient } from "~/types/api-types/recipe"; import { parseIngredientText } from "~/composables/recipes"; import { uuid4 } from "~/composables/use-utils"; @@ -227,14 +227,18 @@ export default defineComponent({ state.disabledSteps = []; v.forEach((element) => { - showTitleEditor.value[element.id] = validateTitle(element.title); + if (element.id !== undefined) { + showTitleEditor.value[element.id] = validateTitle(element.title); + } }); }); // Eliminate state with an eager call to watcher? onMounted(() => { props.value.forEach((element) => { - showTitleEditor.value[element.id] = validateTitle(element.title); + if (element.id !== undefined) { + showTitleEditor.value[element.id] = validateTitle(element.title); + } }); }); @@ -268,23 +272,23 @@ export default defineComponent({ // =============================================================== // Ingredient Linker - const activeRefs = ref([]); + const activeRefs = ref([]); const activeIndex = ref(0); const activeText = ref(""); - function openDialog(idx: number, refs: IngredientToStepRef[], text: string) { + function openDialog(idx: number, refs: IngredientReferences[], text: string) { setUsedIngredients(); activeText.value = text; activeIndex.value = idx; state.dialog = true; - activeRefs.value = refs.map((ref) => ref.referenceId); + activeRefs.value = refs.map((ref) => ref.referenceId ?? ""); } function setIngredientIds() { const instruction = props.value[activeIndex.value]; instruction.ingredientReferences = activeRefs.value.map((ref) => { return { - referenceId: ref as string, + referenceId: ref, }; }); state.dialog = false; @@ -294,17 +298,19 @@ export default defineComponent({ const usedRefs: { [key: string]: boolean } = {}; props.value.forEach((element) => { - element.ingredientReferences.forEach((ref) => { - usedRefs[ref.referenceId] = true; + element.ingredientReferences?.forEach((ref) => { + if (ref.referenceId !== undefined) { + usedRefs[ref.referenceId] = true; + } }); }); state.usedIngredients = props.ingredients.filter((ing) => { - return ing.referenceId in usedRefs; + return ing.referenceId !== undefined && ing.referenceId in usedRefs; }); state.unusedIngredients = props.ingredients.filter((ing) => { - return !(ing.referenceId in usedRefs); + return !(ing.referenceId !== undefined && ing.referenceId in usedRefs); }); } @@ -343,6 +349,10 @@ export default defineComponent({ props.ingredients.forEach((ingredient) => { const searchText = parseIngredientText(ingredient, props.disableAmount); + if (ingredient.referenceId === undefined) { + return; + } + if (searchText.toLowerCase().includes(" " + word) && !activeRefs.value.includes(ingredient.referenceId)) { console.info("Word Matched", `'${word}'`, ingredient.note); activeRefs.value.push(ingredient.referenceId); @@ -351,7 +361,7 @@ export default defineComponent({ }); } - function getIngredientByRefId(refId: String) { + function getIngredientByRefId(refId: string) { const ing = props.ingredients.find((ing) => ing.referenceId === refId) || ""; if (ing === "") { return ""; diff --git a/frontend/components/Domain/Recipe/RecipeNotes.vue b/frontend/components/Domain/Recipe/RecipeNotes.vue index 0a574fd583f5..2c550105a0a9 100644 --- a/frontend/components/Domain/Recipe/RecipeNotes.vue +++ b/frontend/components/Domain/Recipe/RecipeNotes.vue @@ -31,9 +31,12 @@ - diff --git a/frontend/components/Domain/Recipe/RecipeNutrition.vue b/frontend/components/Domain/Recipe/RecipeNutrition.vue index 8723faf4b9be..116e283d0551 100644 --- a/frontend/components/Domain/Recipe/RecipeNutrition.vue +++ b/frontend/components/Domain/Recipe/RecipeNutrition.vue @@ -33,11 +33,14 @@ - diff --git a/frontend/components/Domain/Recipe/RecipeRating.vue b/frontend/components/Domain/Recipe/RecipeRating.vue index 1b7200fd965a..7487380be6e0 100644 --- a/frontend/components/Domain/Recipe/RecipeRating.vue +++ b/frontend/components/Domain/Recipe/RecipeRating.vue @@ -16,8 +16,8 @@ - diff --git a/frontend/components/Domain/Recipe/RecipeSettingsMenu.vue b/frontend/components/Domain/Recipe/RecipeSettingsMenu.vue index 9cf14b7448e8..ec3abf2271a9 100644 --- a/frontend/components/Domain/Recipe/RecipeSettingsMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeSettingsMenu.vue @@ -34,9 +34,10 @@ - diff --git a/frontend/components/Domain/Recipe/RecipeTimeCard.vue b/frontend/components/Domain/Recipe/RecipeTimeCard.vue index d2c2a9f7611a..6742669183f9 100644 --- a/frontend/components/Domain/Recipe/RecipeTimeCard.vue +++ b/frontend/components/Domain/Recipe/RecipeTimeCard.vue @@ -10,8 +10,10 @@ - \ No newline at end of file + diff --git a/frontend/components/global/AppButtonUpload.vue b/frontend/components/global/AppButtonUpload.vue index cab57c00b061..77a9e7ebf650 100644 --- a/frontend/components/global/AppButtonUpload.vue +++ b/frontend/components/global/AppButtonUpload.vue @@ -10,10 +10,13 @@ - diff --git a/frontend/components/global/AppLoader.vue b/frontend/components/global/AppLoader.vue index 6b3e55dec256..34913a249b6b 100644 --- a/frontend/components/global/AppLoader.vue +++ b/frontend/components/global/AppLoader.vue @@ -20,8 +20,10 @@ - diff --git a/frontend/components/global/AutoForm.vue b/frontend/components/global/AutoForm.vue index a8afb5c6c82e..788d4ff02bc0 100644 --- a/frontend/components/global/AutoForm.vue +++ b/frontend/components/global/AutoForm.vue @@ -137,14 +137,15 @@ - diff --git a/frontend/components/global/BaseAutoForm.vue b/frontend/components/global/BaseAutoForm.vue deleted file mode 100644 index 1ef2d96cbd1b..000000000000 --- a/frontend/components/global/BaseAutoForm.vue +++ /dev/null @@ -1,269 +0,0 @@ - - - - - diff --git a/frontend/components/global/BaseButton.vue b/frontend/components/global/BaseButton.vue index f6c387c832c5..fdfa82018220 100644 --- a/frontend/components/global/BaseButton.vue +++ b/frontend/components/global/BaseButton.vue @@ -28,9 +28,11 @@ - diff --git a/frontend/components/global/BaseCardSectionTitle.vue b/frontend/components/global/BaseCardSectionTitle.vue index a82e588ed1bd..1d1d8634aa90 100644 --- a/frontend/components/global/BaseCardSectionTitle.vue +++ b/frontend/components/global/BaseCardSectionTitle.vue @@ -23,8 +23,10 @@ - diff --git a/frontend/components/global/BaseColorPicker.vue b/frontend/components/global/BaseColorPicker.vue deleted file mode 100644 index c522fdf53adb..000000000000 --- a/frontend/components/global/BaseColorPicker.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - - - diff --git a/frontend/components/global/BaseDialog.vue b/frontend/components/global/BaseDialog.vue index fc62c6a33dac..d230ad02dbbe 100644 --- a/frontend/components/global/BaseDialog.vue +++ b/frontend/components/global/BaseDialog.vue @@ -110,7 +110,7 @@ export default defineComponent({ }, }, setup(props, context) { - const dialog = computed({ + const dialog = computed({ get() { return props.value; }, @@ -129,12 +129,9 @@ export default defineComponent({ }; }, computed: { - determineClose(): Boolean { + determineClose(): boolean { return this.submitted && !this.loading && !this.keepOpen; }, - displayicon(): Boolean { - return this.icon || this.$globals.icons.user; - }, }, watch: { determineClose() { @@ -181,4 +178,4 @@ export default defineComponent({ position: fixed; top: 0; } - \ No newline at end of file + diff --git a/frontend/components/global/BaseDivider.vue b/frontend/components/global/BaseDivider.vue index 9c58a869fd5c..ea98d70d9b91 100644 --- a/frontend/components/global/BaseDivider.vue +++ b/frontend/components/global/BaseDivider.vue @@ -2,8 +2,10 @@ - diff --git a/frontend/components/global/BasePageTitle.vue b/frontend/components/global/BasePageTitle.vue index 196a89d35f31..ae94078d8036 100644 --- a/frontend/components/global/BasePageTitle.vue +++ b/frontend/components/global/BasePageTitle.vue @@ -17,13 +17,15 @@ - \ No newline at end of file +}); + diff --git a/frontend/components/global/BaseStatCard.vue b/frontend/components/global/BaseStatCard.vue index 1d1cb6c9430e..1e2fdf18186f 100644 --- a/frontend/components/global/BaseStatCard.vue +++ b/frontend/components/global/BaseStatCard.vue @@ -1,4 +1,4 @@ -w - \ No newline at end of file + diff --git a/frontend/pages/admin/manage/users/index.vue b/frontend/pages/admin/manage/users/index.vue index 6a5807119d13..4b34e090e6e8 100644 --- a/frontend/pages/admin/manage/users/index.vue +++ b/frontend/pages/admin/manage/users/index.vue @@ -77,7 +77,7 @@ export default defineComponent({ const { loading, deleteUser } = useUser(refreshAllUsers); function handleRowClick(item: UserOut) { - router.push("/admin/manage/users/" + item.id); + router.push(`/admin/manage/users/${item.id}`); } // ========================================================== @@ -114,4 +114,4 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + diff --git a/frontend/pages/admin/site-settings.vue b/frontend/pages/admin/site-settings.vue index 369af0022268..2b9375737666 100644 --- a/frontend/pages/admin/site-settings.vue +++ b/frontend/pages/admin/site-settings.vue @@ -74,7 +74,7 @@ - + - + \ No newline at end of file + diff --git a/frontend/pages/admin/toolbox/notifications.vue b/frontend/pages/admin/toolbox/notifications.vue index 71b3280684fc..f6b986b14a43 100644 --- a/frontend/pages/admin/toolbox/notifications.vue +++ b/frontend/pages/admin/toolbox/notifications.vue @@ -144,14 +144,13 @@ - + - + \ No newline at end of file + diff --git a/frontend/pages/login.vue b/frontend/pages/login.vue index 71e241015e00..9c4387b6fe8f 100644 --- a/frontend/pages/login.vue +++ b/frontend/pages/login.vue @@ -209,7 +209,7 @@ export default defineComponent({ const loggingIn = ref(false); - const allowSignup = computed(() => context.env.ALLOW_SIGNUP); + const allowSignup = computed(() => context.env.ALLOW_SIGNUP as boolean); async function authenticate() { loggingIn.value = true; @@ -221,7 +221,11 @@ export default defineComponent({ try { await $auth.loginWith("local", { data: formData }); } catch (error) { - if (error.response.status === 401) { + // TODO Check if error is an AxiosError, but isAxiosError is not working right now + // See https://github.com/nuxt-community/axios-module/issues/550 + // Import $axios from useContext() + // if ($axios.isAxiosError(error) && error.response?.status === 401) { + if (error.response?.status === 401) { alert.error("Invalid Credentials"); } else { alert.error("Something Went Wrong!"); @@ -250,4 +254,4 @@ export default defineComponent({ .max-button { width: 300px; } - \ No newline at end of file + diff --git a/frontend/pages/meal-plan/planner.vue b/frontend/pages/meal-plan/planner.vue index 446fb56c5bb0..6d0faf3320c2 100644 --- a/frontend/pages/meal-plan/planner.vue +++ b/frontend/pages/meal-plan/planner.vue @@ -210,6 +210,7 @@ import { useMealplans, planTypeOptions } from "~/composables/use-group-mealplan" import { useRecipes, allRecipes } from "~/composables/recipes"; import RecipeCardImage from "~/components/Domain/Recipe/RecipeCardImage.vue"; import RecipeCard from "~/components/Domain/Recipe/RecipeCard.vue"; +import { PlanEntryType } from "~/types/api-types/meal-plan"; export default defineComponent({ components: { @@ -238,7 +239,7 @@ export default defineComponent({ useRecipes(true, true); function filterMealByDate(date: Date) { - if (!mealplans.value) return; + if (!mealplans.value) return []; return mealplans.value.filter((meal) => { const mealDate = parseISO(meal.date); return isSameDay(mealDate, date); @@ -263,14 +264,12 @@ export default defineComponent({ // The drop was cancelled, unsure if anything needs to be done? console.log("Cancel Move Event"); } else { - // A Meal was moved, set the new date value and make a update request and refresh the meals - const fromMealsByIndex = evt.from.getAttribute("data-index"); - const toMealsByIndex = evt.to.getAttribute("data-index"); + // A Meal was moved, set the new date value and make an update request and refresh the meals + const fromMealsByIndex = parseInt(evt.from.getAttribute("data-index") ?? ""); + const toMealsByIndex = parseInt(evt.to.getAttribute("data-index") ?? ""); - if (fromMealsByIndex) { - // @ts-ignore + if (!isNaN(fromMealsByIndex) && !isNaN(toMealsByIndex)) { const mealData = mealsByDate.value[fromMealsByIndex].meals[evt.oldIndex as number]; - // @ts-ignore const destDate = mealsByDate.value[toMealsByIndex].date; mealData.date = format(destDate, "yyyy-MM-dd"); @@ -282,13 +281,12 @@ export default defineComponent({ const mealsByDate = computed(() => { return days.value.map((day) => { - return { date: day, meals: filterMealByDate(day as any) }; + return { date: day, meals: filterMealByDate(day) }; }); }); const days = computed(() => { return Array.from(Array(8).keys()).map( - // @ts-ignore (i) => new Date(weekRange.value.start.getTime() + i * 24 * 60 * 60 * 1000) ); }); @@ -304,7 +302,7 @@ export default defineComponent({ watch(dialog, () => { if (dialog.note) { - newMeal.recipeId = null; + newMeal.recipeId = undefined; } newMeal.title = ""; newMeal.text = ""; @@ -314,13 +312,12 @@ export default defineComponent({ date: "", title: "", text: "", - recipeId: null as Number | null, - entryType: "dinner", + recipeId: undefined as number | undefined, + entryType: "dinner" as PlanEntryType, }); function openDialog(date: Date) { newMeal.date = format(date, "yyyy-MM-dd"); - // @ts-ignore state.createMealDialog = true; } @@ -329,21 +326,20 @@ export default defineComponent({ newMeal.title = ""; newMeal.text = ""; newMeal.entryType = "dinner"; - newMeal.recipeId = null; + newMeal.recipeId = undefined; } async function randomMeal(date: Date) { // TODO: Refactor to use API call to get random recipe - // @ts-ignore - const randomRecipe = allRecipes.value[Math.floor(Math.random() * allRecipes.value.length)]; + const randomRecipe = allRecipes.value?.[Math.floor(Math.random() * allRecipes.value.length)]; + if (!randomRecipe) return; newMeal.date = format(date, "yyyy-MM-dd"); - newMeal.recipeId = randomRecipe.id || null; + newMeal.recipeId = randomRecipe.id; console.log(newMeal.recipeId, randomRecipe.id); - // @ts-ignore await actions.createOne({ ...newMeal }); resetDialog(); } diff --git a/frontend/pages/recipe/_slug/cook.vue b/frontend/pages/recipe/_slug/cook.vue index 42705d9b80fe..6fd2cef247bc 100644 --- a/frontend/pages/recipe/_slug/cook.vue +++ b/frontend/pages/recipe/_slug/cook.vue @@ -94,12 +94,12 @@ export default defineComponent({ const { recipeImage } = useStaticRoutes(); - function getIngredientByRefId(refId: String) { + function getIngredientByRefId(refId: string) { if (!recipe.value) { return; } - const ing = recipe?.value.recipeIngredient.find((ing) => ing.referenceId === refId) || ""; + const ing = recipe?.value.recipeIngredient?.find((ing) => ing.referenceId === refId) || ""; if (ing === "") { return ""; } diff --git a/frontend/pages/recipe/_slug/index.vue b/frontend/pages/recipe/_slug/index.vue index 1c3f4542c7a8..925b07e0f45d 100644 --- a/frontend/pages/recipe/_slug/index.vue +++ b/frontend/pages/recipe/_slug/index.vue @@ -34,7 +34,7 @@ :key="imageKey" :max-width="enableLandscape ? null : '50%'" :min-height="hideImage ? '50' : imageHeight" - :src="recipeImage(recipe.slug, imageKey)" + :src="recipeImage(recipe.slug, '', imageKey)" class="d-print-none" @error="hideImage = true" > @@ -561,7 +561,6 @@ export default defineComponent({ const { recipeImage } = useStaticRoutes(); - // @ts-ignore const { $vuetify } = useContext(); // =========================================================================== @@ -623,7 +622,7 @@ export default defineComponent({ }); async function uploadImage(fileObject: File) { - if (!recipe.value) { + if (!recipe.value || !recipe.value.slug) { return; } const newVersion = await api.recipes.updateImage(recipe.value.slug, fileObject); @@ -656,8 +655,8 @@ export default defineComponent({ referenceId: uuid4(), title: "", note: x, - unit: null, - food: null, + unit: undefined, + food: undefined, disableAmount: true, quantity: 1, }; @@ -671,8 +670,8 @@ export default defineComponent({ referenceId: uuid4(), title: "", note: "", - unit: null, - food: null, + unit: undefined, + food: undefined, disableAmount: true, quantity: 1, }); @@ -762,7 +761,6 @@ export default defineComponent({ head: {}, computed: { imageHeight() { - // @ts-ignore return this.$vuetify.breakpoint.xs ? "200" : "400"; }, }, diff --git a/frontend/pages/recipe/_slug/ingredient-parser.vue b/frontend/pages/recipe/_slug/ingredient-parser.vue index 1d5f6340bff3..64020ca4bf18 100644 --- a/frontend/pages/recipe/_slug/ingredient-parser.vue +++ b/frontend/pages/recipe/_slug/ingredient-parser.vue @@ -80,20 +80,21 @@ - + - + diff --git a/frontend/pages/recipe/create.vue b/frontend/pages/recipe/create.vue index 88b9c5e429ca..05bef746de81 100644 --- a/frontend/pages/recipe/create.vue +++ b/frontend/pages/recipe/create.vue @@ -314,7 +314,17 @@ diff --git a/frontend/pages/register.vue b/frontend/pages/register.vue index ed7017873aa1..210933aacb87 100644 --- a/frontend/pages/register.vue +++ b/frontend/pages/register.vue @@ -104,6 +104,7 @@ import { validators } from "@/composables/use-validators"; import { useUserApi } from "~/composables/api"; import { alert } from "~/composables/use-toast"; import { useRouterQuery } from "@/composables/use-router"; +import { VForm} from "~/types/vuetify"; export default defineComponent({ layout: "basic", @@ -179,4 +180,4 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + diff --git a/frontend/pages/shared/recipes/_id.vue b/frontend/pages/shared/recipes/_id.vue index 3a81d441d19c..b1de494b9faa 100644 --- a/frontend/pages/shared/recipes/_id.vue +++ b/frontend/pages/shared/recipes/_id.vue @@ -325,11 +325,11 @@ export default defineComponent({ if (data) { if (data && data !== undefined) { console.log("Computed Meta. RefKey="); - const imageURL = recipeImage(data.slug); + const imageURL = data.slug ? recipeImage(data.slug) : undefined; title.value = data.name; meta.value = [ - { hid: "og:title", property: "og:title", content: data.name }, + { hid: "og:title", property: "og:title", content: data.name ?? "" }, // @ts-ignore { hid: "og:desc", @@ -339,7 +339,7 @@ export default defineComponent({ { hid: "og-image", property: "og:image", - content: imageURL, + content: imageURL ?? "", }, // @ts-ignore { @@ -360,7 +360,6 @@ export default defineComponent({ } }); - // @ts-ignore const { $vuetify } = useContext(); const enableLandscape = computed(() => { @@ -400,9 +399,8 @@ export default defineComponent({ head: {}, computed: { imageHeight() { - // @ts-ignore return this.$vuetify.breakpoint.xs ? "200" : "400"; }, }, }); - \ No newline at end of file + diff --git a/frontend/pages/user/group/data/migrations.vue b/frontend/pages/user/group/data/migrations.vue index 4e203eeb1c98..8cc413be8d16 100644 --- a/frontend/pages/user/group/data/migrations.vue +++ b/frontend/pages/user/group/data/migrations.vue @@ -79,7 +79,6 @@ const MIGRATIONS = { export default defineComponent({ setup() { - // @ts-ignore const { $globals } = useContext(); const api = useUserApi(); @@ -303,4 +302,4 @@ export default defineComponent({ \ No newline at end of file + diff --git a/frontend/pages/user/group/data/recipes.vue b/frontend/pages/user/group/data/recipes.vue index b9dd6679ed62..8f7da5549909 100644 --- a/frontend/pages/user/group/data/recipes.vue +++ b/frontend/pages/user/group/data/recipes.vue @@ -152,7 +152,7 @@ - + \ No newline at end of file + diff --git a/frontend/pages/user/group/data/reports/_id.vue b/frontend/pages/user/group/data/reports/_id.vue index b8c7644301d9..660badca04fc 100644 --- a/frontend/pages/user/group/data/reports/_id.vue +++ b/frontend/pages/user/group/data/reports/_id.vue @@ -30,7 +30,7 @@ - \ No newline at end of file + diff --git a/frontend/pages/user/profile/api-tokens.vue b/frontend/pages/user/profile/api-tokens.vue index ce3a5e314d51..2c3d36c677af 100644 --- a/frontend/pages/user/profile/api-tokens.vue +++ b/frontend/pages/user/profile/api-tokens.vue @@ -62,10 +62,11 @@ - + - + diff --git a/frontend/pages/user/profile/edit.vue b/frontend/pages/user/profile/edit.vue index 4c0d879a268a..914e8b105398 100644 --- a/frontend/pages/user/profile/edit.vue +++ b/frontend/pages/user/profile/edit.vue @@ -110,11 +110,12 @@ - + - + diff --git a/frontend/plugins/dark-mode.client.ts b/frontend/plugins/dark-mode.client.ts index fb8396593786..8920704d47a7 100644 --- a/frontend/plugins/dark-mode.client.ts +++ b/frontend/plugins/dark-mode.client.ts @@ -1,11 +1,10 @@ +import { Plugin } from "@nuxt/types" import { useDark } from "@vueuse/core"; -export default ({ $vuetify }: any) => { +const darkModePlugin: Plugin = ({ $vuetify }, _) => { const isDark = useDark(); - if (isDark.value) { - $vuetify.theme.dark = true; - } else { - $vuetify.theme.dark = false; - } + $vuetify.theme.dark = isDark.value; }; + +export default darkModePlugin; diff --git a/frontend/plugins/globals.ts b/frontend/plugins/globals.ts index 01bb91b376ee..554a9f8c2d10 100644 --- a/frontend/plugins/globals.ts +++ b/frontend/plugins/globals.ts @@ -1,7 +1,27 @@ +import { Plugin } from "@nuxt/types" import { icons } from "~/utils/icons"; +import { Icon } from "~/utils/icons/icon-type"; -// eslint-disable-next-line no-empty-pattern -export default ({}, inject: any) => { - // Inject $hello(msg) in Vue, context and store. - inject("globals", { icons }); +interface Globals { + icons: Icon; +} + +declare module "vue/types/vue" { + interface Vue { + $globals: Globals; + } +} + +declare module "@nuxt/types" { + interface Context { + $globals: Globals; + } +} + +const globalsPlugin: Plugin = (_, inject) => { + inject("globals", { + icons + }); }; + +export default globalsPlugin diff --git a/frontend/plugins/theme.ts b/frontend/plugins/theme.ts index 7b4e9ce531aa..577d266f7ce0 100644 --- a/frontend/plugins/theme.ts +++ b/frontend/plugins/theme.ts @@ -1,7 +1,11 @@ -export default ({ $vuetify, $config }: any) => { - $vuetify.theme.themes = $config.themes; +import { Plugin } from "@nuxt/types" + +const themePlugin: Plugin = ({ $vuetify, $config }) => { + $vuetify.theme.themes = $config.themes as typeof $vuetify.theme.themes if ($config.useDark) { $vuetify.theme.dark = true; } }; + +export default themePlugin; diff --git a/frontend/plugins/toast.client.ts b/frontend/plugins/toast.client.ts index c26627ecefa8..088cd88d0097 100644 --- a/frontend/plugins/toast.client.ts +++ b/frontend/plugins/toast.client.ts @@ -1,7 +1,8 @@ +import { Plugin } from "@nuxt/types" import { NuxtAxiosInstance } from "@nuxtjs/axios"; import { alert } from "~/composables/use-toast"; -export default function ({ $axios }: { $axios: NuxtAxiosInstance }) { +const toastPlugin: Plugin = ({ $axios }: { $axios: NuxtAxiosInstance }) => { $axios.onResponse((response) => { if (response.data.message) { alert.info(response.data.message); @@ -13,3 +14,5 @@ export default function ({ $axios }: { $axios: NuxtAxiosInstance }) { } }); } + +export default toastPlugin; diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index e109c5618e1c..8c44455991ae 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -16,8 +16,9 @@ "~/*": ["./*"], "@/*": ["./*"] }, - "types": ["@nuxt/types", "@nuxtjs/axios", "@types/node", "@nuxtjs/i18n", "@nuxtjs/auth-next", "@types/sortablejs"] + "types": ["@nuxt/types", "@nuxtjs/axios", "@types/node", "@nuxtjs/i18n", "@nuxtjs/auth-next", "@nuxtjs/vuetify", "@types/sortablejs"] }, + "include": ["**/*", ".eslintrc.js"], "exclude": ["node_modules", ".nuxt", "dist"], "vueCompilerOptions": { "experimentalCompatMode": 2 diff --git a/frontend/types/api-types/admin.ts b/frontend/types/api-types/admin.ts index 1fd75f86c4dc..2b329c93e98c 100644 --- a/frontend/types/api-types/admin.ts +++ b/frontend/types/api-types/admin.ts @@ -5,6 +5,26 @@ /* Do not modify it by hand - just update the pydantic models and then re-run the script */ +export interface AdminAboutInfo { + production: boolean; + version: string; + demoStatus: boolean; + versionLatest: string; + apiPort: number; + apiDocs: boolean; + dbType: string; + dbUrl: string; + defaultGroup: string; +} +export interface AllBackups { + imports: BackupFile[]; + templates: string[]; +} +export interface BackupFile { + name: string; + date: string; + size: string; +} export interface AppInfo { production: boolean; version: string; @@ -17,36 +37,31 @@ export interface AppStatistics { uncategorizedRecipes: number; untaggedRecipes: number; } -export interface BackupJob { - tag?: string; - options: BackupOptions; - templates?: string[]; -} export interface BackupOptions { recipes?: boolean; settings?: boolean; - pages?: boolean; themes?: boolean; groups?: boolean; users?: boolean; notifications?: boolean; } -export interface CategoryBase { - name: string; - id: number; - slug: string; +export interface CheckAppConfig { + emailReady?: boolean; + ldapReady?: boolean; + baseUrlSet?: boolean; } export interface ChowdownURL { url: string; } -export interface Colors { - primary?: string; - accent?: string; - secondary?: string; - success?: string; - info?: string; - warning?: string; - error?: string; +export interface CommentImport { + name: string; + status: boolean; + exception?: string; +} +export interface CreateBackup { + tag?: string; + options: BackupOptions; + templates?: string[]; } export interface CustomPageBase { name: string; @@ -62,51 +77,87 @@ export interface RecipeCategoryResponse { } export interface Recipe { id?: number; - name: string; - slug: string; + userId?: string; + groupId?: string; + name?: string; + slug?: string; image?: unknown; - description?: string; - recipeCategory?: string[]; - tags?: string[]; - rating?: number; - dateAdded?: string; - dateUpdated?: string; recipeYield?: string; - recipeIngredient?: RecipeIngredient[]; - recipeInstructions?: RecipeStep[]; - nutrition?: Nutrition; - tools?: string[]; totalTime?: string; prepTime?: string; + cookTime?: string; performTime?: string; + description?: string; + recipeCategory?: RecipeTag[]; + tags?: RecipeTag[]; + tools?: RecipeTool[]; + rating?: number; + orgURL?: string; + recipeIngredient?: RecipeIngredient[]; + dateAdded?: string; + dateUpdated?: string; + recipeInstructions?: RecipeStep[]; + nutrition?: Nutrition; settings?: RecipeSettings; assets?: RecipeAsset[]; notes?: RecipeNote[]; - orgURL?: string; extras?: { [k: string]: unknown; }; - comments?: CommentOut[]; + comments?: RecipeCommentOut[]; +} +export interface RecipeTag { + name: string; + slug: string; +} +export interface RecipeTool { + name: string; + slug: string; + id?: number; + onHand?: boolean; } export interface RecipeIngredient { title?: string; note?: string; - unit?: RecipeIngredientUnit; - food?: RecipeIngredientFood; + unit?: IngredientUnit | CreateIngredientUnit; + food?: IngredientFood | CreateIngredientFood; disableAmount?: boolean; quantity?: number; + referenceId?: string; } -export interface RecipeIngredientUnit { - name?: string; +export interface IngredientUnit { + name: string; description?: string; + fraction?: boolean; + abbreviation?: string; + id: number; } -export interface RecipeIngredientFood { - name?: string; +export interface CreateIngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; +} +export interface IngredientFood { + name: string; + description?: string; + id: number; +} +export interface CreateIngredientFood { + name: string; description?: string; } export interface RecipeStep { + id?: string; title?: string; text: string; + ingredientReferences?: IngredientReferences[]; +} +/** + * A list of ingredient references. + */ +export interface IngredientReferences { + referenceId?: string; } export interface Nutrition { calories?: string; @@ -124,6 +175,7 @@ export interface RecipeSettings { landscapeView?: boolean; disableComments?: boolean; disableAmount?: boolean; + locked?: boolean; } export interface RecipeAsset { name: string; @@ -134,12 +186,13 @@ export interface RecipeNote { title: string; text: string; } -export interface CommentOut { +export interface RecipeCommentOut { + recipeId: number; text: string; - id: number; - uuid: string; - recipeSlug: string; - dateAdded: string; + id: string; + createdAt: string; + updateAt: string; + userId: string; user: UserBase; } export interface UserBase { @@ -159,16 +212,6 @@ export interface CustomPageOut { categories?: RecipeCategoryResponse[]; id: number; } -export interface DebugInfo { - production: boolean; - version: string; - demoStatus: boolean; - apiPort: number; - apiDocs: boolean; - dbType: string; - dbUrl: string; - defaultGroup: string; -} export interface GroupImport { name: string; status: boolean; @@ -182,7 +225,6 @@ export interface ImportBase { export interface ImportJob { recipes?: boolean; settings?: boolean; - pages?: boolean; themes?: boolean; groups?: boolean; users?: boolean; @@ -191,14 +233,6 @@ export interface ImportJob { force?: boolean; rebase?: boolean; } -export interface Imports { - imports: LocalBackup[]; - templates: string[]; -} -export interface LocalBackup { - name: string; - date: string; -} export interface MigrationFile { name: string; date: string; @@ -229,23 +263,6 @@ export interface SettingsImport { status: boolean; exception?: string; } -export interface SiteSettings { - language?: string; - firstDayOfWeek?: number; - showRecent?: boolean; - cardsPerSection?: number; - categories?: CategoryBase[]; -} -export interface SiteTheme { - id?: number; - name?: string; - colors?: Colors; -} -export interface ThemeImport { - name: string; - status: boolean; - exception?: string; -} export interface UserImport { name: string; status: boolean; diff --git a/frontend/types/api-types/cookbook.ts b/frontend/types/api-types/cookbook.ts new file mode 100644 index 000000000000..ab1592514dba --- /dev/null +++ b/frontend/types/api-types/cookbook.ts @@ -0,0 +1,184 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +/* This file was automatically generated from pydantic models by running pydantic2ts. +/* Do not modify it by hand - just update the pydantic models and then re-run the script +*/ + +export interface CategoryBase { + name: string; + id: number; + slug: string; +} +export interface CreateCookBook { + name: string; + description?: string; + slug?: string; + position?: number; + categories?: CategoryBase[]; +} +export interface ReadCookBook { + name: string; + description?: string; + slug?: string; + position?: number; + categories?: CategoryBase[]; + id: number; + groupId: string; +} +export interface RecipeCategoryResponse { + name: string; + id: number; + slug: string; + recipes?: Recipe[]; +} +export interface Recipe { + id?: number; + userId?: string; + groupId?: string; + name?: string; + slug?: string; + image?: unknown; + recipeYield?: string; + totalTime?: string; + prepTime?: string; + cookTime?: string; + performTime?: string; + description?: string; + recipeCategory?: RecipeTag[]; + tags?: RecipeTag[]; + tools?: RecipeTool[]; + rating?: number; + orgURL?: string; + recipeIngredient?: RecipeIngredient[]; + dateAdded?: string; + dateUpdated?: string; + recipeInstructions?: RecipeStep[]; + nutrition?: Nutrition; + settings?: RecipeSettings; + assets?: RecipeAsset[]; + notes?: RecipeNote[]; + extras?: { + [k: string]: unknown; + }; + comments?: RecipeCommentOut[]; +} +export interface RecipeTag { + name: string; + slug: string; +} +export interface RecipeTool { + name: string; + slug: string; + id?: number; + onHand?: boolean; +} +export interface RecipeIngredient { + title?: string; + note?: string; + unit?: IngredientUnit | CreateIngredientUnit; + food?: IngredientFood | CreateIngredientFood; + disableAmount?: boolean; + quantity?: number; + referenceId?: string; +} +export interface IngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; + id: number; +} +export interface CreateIngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; +} +export interface IngredientFood { + name: string; + description?: string; + id: number; +} +export interface CreateIngredientFood { + name: string; + description?: string; +} +export interface RecipeStep { + id?: string; + title?: string; + text: string; + ingredientReferences?: IngredientReferences[]; +} +/** + * A list of ingredient references. + */ +export interface IngredientReferences { + referenceId?: string; +} +export interface Nutrition { + calories?: string; + fatContent?: string; + proteinContent?: string; + carbohydrateContent?: string; + fiberContent?: string; + sodiumContent?: string; + sugarContent?: string; +} +export interface RecipeSettings { + public?: boolean; + showNutrition?: boolean; + showAssets?: boolean; + landscapeView?: boolean; + disableComments?: boolean; + disableAmount?: boolean; + locked?: boolean; +} +export interface RecipeAsset { + name: string; + icon: string; + fileName?: string; +} +export interface RecipeNote { + title: string; + text: string; +} +export interface RecipeCommentOut { + recipeId: number; + text: string; + id: string; + createdAt: string; + updateAt: string; + userId: string; + user: UserBase; +} +export interface UserBase { + id: number; + username?: string; + admin: boolean; +} +export interface RecipeCookBook { + name: string; + description?: string; + slug?: string; + position?: number; + categories: RecipeCategoryResponse[]; + id: number; + groupId: string; +} +export interface SaveCookBook { + name: string; + description?: string; + slug?: string; + position?: number; + categories?: CategoryBase[]; + groupId: string; +} +export interface UpdateCookBook { + name: string; + description?: string; + slug?: string; + position?: number; + categories?: CategoryBase[]; + id: number; +} diff --git a/frontend/types/api-types/group.ts b/frontend/types/api-types/group.ts new file mode 100644 index 000000000000..672f9244e684 --- /dev/null +++ b/frontend/types/api-types/group.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +/* This file was automatically generated from pydantic models by running pydantic2ts. +/* Do not modify it by hand - just update the pydantic models and then re-run the script +*/ + +export interface CreateWebhook { + enabled?: boolean; + name?: string; + url?: string; + time?: string; +} +export interface ReadWebhook { + enabled?: boolean; + name?: string; + url?: string; + time?: string; + groupId: string; + id: number; +} +export interface SaveWebhook { + enabled?: boolean; + name?: string; + url?: string; + time?: string; + groupId: string; +} diff --git a/frontend/types/api-types/meal-plan.ts b/frontend/types/api-types/meal-plan.ts index 74c3870f9e89..9c768f932c38 100644 --- a/frontend/types/api-types/meal-plan.ts +++ b/frontend/types/api-types/meal-plan.ts @@ -5,6 +5,15 @@ /* Do not modify it by hand - just update the pydantic models and then re-run the script */ +export type PlanEntryType = "breakfast" | "lunch" | "dinner" | "snack"; + +export interface CreatePlanEntry { + date: string; + entryType?: PlanEntryType & string; + title?: string; + text?: string; + recipeId?: number; +} export interface ListItem { title?: string; text?: string; @@ -36,9 +45,90 @@ export interface MealPlanOut { startDate: string; endDate: string; planDays: MealDayIn[]; - uid: number; + id: number; shoppingList?: number; } +export interface ReadPlanEntry { + date: string; + entryType?: PlanEntryType & string; + title?: string; + text?: string; + recipeId?: number; + id: number; + groupId: string; + recipe?: RecipeSummary; +} +export interface RecipeSummary { + id?: number; + userId?: string; + groupId?: string; + name?: string; + slug?: string; + image?: unknown; + recipeYield?: string; + totalTime?: string; + prepTime?: string; + cookTime?: string; + performTime?: string; + description?: string; + recipeCategory?: RecipeTag[]; + tags?: RecipeTag[]; + tools?: RecipeTool[]; + rating?: number; + orgURL?: string; + recipeIngredient?: RecipeIngredient[]; + dateAdded?: string; + dateUpdated?: string; +} +export interface RecipeTag { + name: string; + slug: string; +} +export interface RecipeTool { + name: string; + slug: string; + id?: number; + onHand?: boolean; +} +export interface RecipeIngredient { + title?: string; + note?: string; + unit?: IngredientUnit | CreateIngredientUnit; + food?: IngredientFood | CreateIngredientFood; + disableAmount?: boolean; + quantity?: number; + referenceId?: string; +} +export interface IngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; + id: number; +} +export interface CreateIngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; +} +export interface IngredientFood { + name: string; + description?: string; + id: number; +} +export interface CreateIngredientFood { + name: string; + description?: string; +} +export interface SavePlanEntry { + date: string; + entryType?: PlanEntryType & string; + title?: string; + text?: string; + recipeId?: number; + groupId: string; +} export interface ShoppingListIn { name: string; group?: string; @@ -50,3 +140,12 @@ export interface ShoppingListOut { items: ListItem[]; id: number; } +export interface UpdatePlanEntry { + date: string; + entryType?: PlanEntryType & string; + title?: string; + text?: string; + recipeId?: number; + id: number; + groupId: string; +} diff --git a/frontend/types/api-types/recipe.ts b/frontend/types/api-types/recipe.ts index 738e232b3dcc..dbec3d51ee84 100644 --- a/frontend/types/api-types/recipe.ts +++ b/frontend/types/api-types/recipe.ts @@ -5,14 +5,8 @@ /* Do not modify it by hand - just update the pydantic models and then re-run the script */ -export interface CreateRecipe { - name: string; -} +export type RegisteredParser = "nlp" | "brute"; -export interface AllRecipeRequest { - properties: string[]; - limit?: number; -} export interface CategoryBase { name: string; id: number; @@ -21,26 +15,65 @@ export interface CategoryBase { export interface CategoryIn { name: string; } -export interface CommentIn { - text: string; +export interface CreateIngredientFood { + name: string; + description?: string; } -export interface CommentOut { - text: string; +export interface CreateIngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; +} +export interface CreateRecipe { + name: string; +} +export interface CreateRecipeBulk { + url: string; + categories?: RecipeCategory[]; + tags?: RecipeTag[]; +} +export interface RecipeCategory { + name: string; + slug: string; +} +export interface RecipeTag { + name: string; + slug: string; +} +export interface CreateRecipeByUrl { + url: string; +} +export interface CreateRecipeByUrlBulk { + imports: CreateRecipeBulk[]; +} +export interface IngredientConfidence { + average?: number; + comment?: number; + name?: number; + unit?: number; + quantity?: number; + food?: number; +} +export interface IngredientFood { + name: string; + description?: string; id: number; - uuid: string; - recipeSlug: string; - dateAdded: string; - user: UserBase; } -export interface UserBase { +export interface IngredientRequest { + parser?: RegisteredParser & string; + ingredient: string; +} +export interface IngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; id: number; - username?: string; - admin: boolean; } -export interface CommentSaveToDB { - text: string; - recipeSlug: string; - user: number; +export interface IngredientsRequest { + parser?: RegisteredParser & string; + ingredients: string[]; } export interface Nutrition { calories?: string; @@ -51,60 +84,68 @@ export interface Nutrition { sodiumContent?: string; sugarContent?: string; } +export interface ParsedIngredient { + input?: string; + confidence?: IngredientConfidence; + ingredient: RecipeIngredient; +} +export interface RecipeIngredient { + title?: string; + note?: string; + unit?: IngredientUnit | CreateIngredientUnit; + food?: IngredientFood | CreateIngredientFood; + disableAmount?: boolean; + quantity?: number; + referenceId?: string; +} export interface Recipe { id?: number; - name: string; - slug: string; - image: string; - description: string; - recipeCategory: string[]; - tags: string[]; - rating: number; - dateAdded: string; - dateUpdated: string; + userId?: string; + groupId?: string; + name?: string; + slug?: string; + image?: unknown; recipeYield?: string; - recipeIngredient: RecipeIngredient[]; - recipeInstructions: RecipeStep[]; - nutrition?: Nutrition; - tools?: string[]; totalTime?: string; prepTime?: string; + cookTime?: string; performTime?: string; + description?: string; + recipeCategory?: RecipeTag[]; + tags?: RecipeTag[]; + tools?: RecipeTool[]; + rating?: number; + orgURL?: string; + recipeIngredient?: RecipeIngredient[]; + dateAdded?: string; + dateUpdated?: string; + recipeInstructions?: RecipeStep[]; + nutrition?: Nutrition; settings?: RecipeSettings; assets?: RecipeAsset[]; notes?: RecipeNote[]; - orgURL?: string; extras?: { [k: string]: unknown; }; - comments?: CommentOut[]; + comments?: RecipeCommentOut[]; } -export interface RecipeIngredient { - referenceId: string; - title: string; - note: string; - unit?: RecipeIngredientUnit | null; - food?: RecipeIngredientFood | null; - disableAmount: boolean; - quantity: number; -} -export interface RecipeIngredientUnit { - name?: string; - description?: string; - fraction?: boolean; -} -export interface RecipeIngredientFood { - name?: string; - description?: string; -} -export interface IngredientToStepRef { - referenceId: string; +export interface RecipeTool { + name: string; + slug: string; + id?: number; + onHand?: boolean; } export interface RecipeStep { - id: string; + id?: string; title?: string; text: string; - ingredientReferences: IngredientToStepRef[]; + ingredientReferences?: IngredientReferences[]; +} +/** + * A list of ingredient references. + */ +export interface IngredientReferences { + referenceId?: string; } export interface RecipeSettings { public?: boolean; @@ -113,6 +154,7 @@ export interface RecipeSettings { landscapeView?: boolean; disableComments?: boolean; disableAmount?: boolean; + locked?: boolean; } export interface RecipeAsset { name: string; @@ -123,23 +165,86 @@ export interface RecipeNote { title: string; text: string; } +export interface RecipeCommentOut { + recipeId: number; + text: string; + id: string; + createdAt: string; + updateAt: string; + userId: string; + user: UserBase; +} +export interface UserBase { + id: number; + username?: string; + admin: boolean; +} +export interface RecipeCategoryResponse { + name: string; + id: number; + slug: string; + recipes?: Recipe[]; +} +export interface RecipeCommentCreate { + recipeId: number; + text: string; +} +export interface RecipeCommentSave { + recipeId: number; + text: string; + userId: string; +} +export interface RecipeCommentUpdate { + id: string; + text: string; +} export interface RecipeSlug { slug: string; } export interface RecipeSummary { id?: number; + userId?: string; + groupId?: string; name?: string; slug?: string; image?: unknown; + recipeYield?: string; + totalTime?: string; + prepTime?: string; + cookTime?: string; + performTime?: string; description?: string; - recipeCategory: string[]; - tags: string[]; + recipeCategory?: RecipeTag[]; + tags?: RecipeTag[]; + tools?: RecipeTool[]; rating?: number; + orgURL?: string; + recipeIngredient?: RecipeIngredient[]; dateAdded?: string; dateUpdated?: string; } -export interface RecipeURLIn { - url: string; +export interface RecipeTagResponse { + name: string; + id: number; + slug: string; + recipes?: Recipe[]; +} +export interface RecipeTool1 { + name: string; + onHand?: boolean; + id: number; + slug: string; +} +export interface RecipeToolCreate { + name: string; + onHand?: boolean; +} +export interface RecipeToolResponse { + name: string; + onHand?: boolean; + id: number; + slug: string; + recipes?: Recipe[]; } export interface SlugResponse {} export interface TagBase { diff --git a/frontend/types/api-types/reports.ts b/frontend/types/api-types/reports.ts new file mode 100644 index 000000000000..bcec3be394c7 --- /dev/null +++ b/frontend/types/api-types/reports.ts @@ -0,0 +1,49 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +/* This file was automatically generated from pydantic models by running pydantic2ts. +/* Do not modify it by hand - just update the pydantic models and then re-run the script +*/ + +export type ReportCategory = "backup" | "restore" | "migration"; +export type ReportSummaryStatus = "in-progress" | "success" | "failure" | "partial"; + +export interface ReportCreate { + timestamp?: string; + category: ReportCategory; + groupId: string; + name: string; + status?: ReportSummaryStatus & string; +} +export interface ReportEntryCreate { + reportId: string; + timestamp?: string; + success?: boolean; + message: string; + exception?: string; +} +export interface ReportEntryOut { + reportId: string; + timestamp?: string; + success?: boolean; + message: string; + exception?: string; + id: string; +} +export interface ReportOut { + timestamp?: string; + category: ReportCategory; + groupId: string; + name: string; + status?: ReportSummaryStatus & string; + id: string; + entries?: ReportEntryOut[]; +} +export interface ReportSummary { + timestamp?: string; + category: ReportCategory; + groupId: string; + name: string; + status?: ReportSummaryStatus & string; + id: string; +} diff --git a/frontend/types/api-types/response.ts b/frontend/types/api-types/response.ts new file mode 100644 index 000000000000..b01b46a1a908 --- /dev/null +++ b/frontend/types/api-types/response.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +/* This file was automatically generated from pydantic models by running pydantic2ts. +/* Do not modify it by hand - just update the pydantic models and then re-run the script +*/ + +export interface ErrorResponse { + message: string; + error?: boolean; + exception?: string; +} diff --git a/frontend/types/api-types/server.ts b/frontend/types/api-types/server.ts new file mode 100644 index 000000000000..5b994f11c026 --- /dev/null +++ b/frontend/types/api-types/server.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +/* This file was automatically generated from pydantic models by running pydantic2ts. +/* Do not modify it by hand - just update the pydantic models and then re-run the script +*/ + +export type ServerTaskNames = "Background Task" | "Database Backup" | "Bulk Recipe Import"; +export type ServerTaskStatus = "running" | "finished" | "failed"; + +export interface ServerTask { + groupId: string; + name?: ServerTaskNames & string; + createdAt?: string; + status?: ServerTaskStatus & string; + log?: string; + id: number; +} +export interface ServerTaskCreate { + groupId: string; + name?: ServerTaskNames & string; + createdAt?: string; + status?: ServerTaskStatus & string; + log?: string; +} diff --git a/frontend/types/api-types/user.ts b/frontend/types/api-types/user.ts index 19fbddfc1b92..c258699d2af3 100644 --- a/frontend/types/api-types/user.ts +++ b/frontend/types/api-types/user.ts @@ -16,7 +16,7 @@ export interface ChangePassword { } export interface CreateToken { name: string; - parentId: number; + userId: string; token: string; } export interface GroupBase { @@ -24,48 +24,33 @@ export interface GroupBase { } export interface GroupInDB { name: string; - id: number; + id: string; categories?: CategoryBase[]; - webhookUrls?: string[]; - webhookTime?: string; - webhookEnable: boolean; + webhooks?: unknown[]; users?: UserOut[]; - mealplans?: MealPlanOut[]; shoppingLists?: ShoppingListOut[]; + preferences?: ReadGroupPreferences; } export interface UserOut { - canOrganize: boolean; - canManage: boolean; - canInvite: boolean; username?: string; fullName?: string; email: string; - admin: boolean; + admin?: boolean; group: string; + advanced?: boolean; favoriteRecipes?: string[]; - id: number; + canInvite?: boolean; + canManage?: boolean; + canOrganize?: boolean; + id: string; + groupId: string; tokens?: LongLiveTokenOut[]; + cacheKey: string; } export interface LongLiveTokenOut { name: string; id: number; -} -export interface MealPlanOut { - group: string; - startDate: string; - endDate: string; - planDays: MealDayIn[]; - uid: number; - shoppingList?: number; -} -export interface MealDayIn { - date?: string; - meals: MealIn[]; -} -export interface MealIn { - slug?: string; - name?: string; - description?: string; + createdAt: string; } export interface ShoppingListOut { name: string; @@ -79,39 +64,108 @@ export interface ListItem { quantity?: number; checked?: boolean; } +export interface ReadGroupPreferences { + privateGroup?: boolean; + firstDayOfWeek?: number; + recipePublic?: boolean; + recipeShowNutrition?: boolean; + recipeShowAssets?: boolean; + recipeLandscapeView?: boolean; + recipeDisableComments?: boolean; + recipeDisableAmount?: boolean; + groupId: string; + id: number; +} export interface LoingLiveTokenIn { name: string; } export interface LongLiveTokenInDB { name: string; - parentId: number; + userId: string; token: string; id: number; - user: UserInDB; + user: PrivateUser; } -export interface UserInDB { +export interface PrivateUser { username?: string; fullName?: string; email: string; - admin: boolean; + admin?: boolean; group: string; + advanced?: boolean; favoriteRecipes?: string[]; - id: number; + canInvite?: boolean; + canManage?: boolean; + canOrganize?: boolean; + id: string; + groupId: string; tokens?: LongLiveTokenOut[]; + cacheKey: string; password: string; } export interface RecipeSummary { id?: number; + userId?: string; + groupId?: string; name?: string; slug?: string; image?: unknown; + recipeYield?: string; + totalTime?: string; + prepTime?: string; + cookTime?: string; + performTime?: string; description?: string; - recipeCategory?: string[]; - tags?: string[]; + recipeCategory?: RecipeTag[]; + tags?: RecipeTag[]; + tools?: RecipeTool[]; rating?: number; + orgURL?: string; + recipeIngredient?: RecipeIngredient[]; dateAdded?: string; dateUpdated?: string; } +export interface RecipeTag { + name: string; + slug: string; +} +export interface RecipeTool { + name: string; + slug: string; + id?: number; + onHand?: boolean; +} +export interface RecipeIngredient { + title?: string; + note?: string; + unit?: IngredientUnit | CreateIngredientUnit; + food?: IngredientFood | CreateIngredientFood; + disableAmount?: boolean; + quantity?: number; + referenceId?: string; +} +export interface IngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; + id: number; +} +export interface CreateIngredientUnit { + name: string; + description?: string; + fraction?: boolean; + abbreviation?: string; +} +export interface IngredientFood { + name: string; + description?: string; + id: number; +} +export interface CreateIngredientFood { + name: string; + description?: string; +} export interface SignUpIn { name: string; admin: boolean; @@ -136,34 +190,44 @@ export interface TokenData { } export interface UpdateGroup { name: string; - id: number; + id: string; categories?: CategoryBase[]; - webhookUrls?: string[]; - webhookTime?: string; - webhookEnable: boolean; + webhooks?: unknown[]; } export interface UserBase { username?: string; fullName?: string; email: string; - admin: boolean; + admin?: boolean; group?: string; + advanced?: boolean; favoriteRecipes?: string[]; + canInvite?: boolean; + canManage?: boolean; + canOrganize?: boolean; } export interface UserFavorites { username?: string; fullName?: string; email: string; - admin: boolean; + admin?: boolean; group?: string; + advanced?: boolean; favoriteRecipes?: RecipeSummary[]; + canInvite?: boolean; + canManage?: boolean; + canOrganize?: boolean; } export interface UserIn { username?: string; fullName?: string; email: string; - admin: boolean; + admin?: boolean; group?: string; + advanced?: boolean; favoriteRecipes?: string[]; + canInvite?: boolean; + canManage?: boolean; + canOrganize?: boolean; password: string; } diff --git a/frontend/types/api.ts b/frontend/types/api.ts index 711cade82e5c..5614c5793303 100644 --- a/frontend/types/api.ts +++ b/frontend/types/api.ts @@ -1,15 +1,15 @@ import { AxiosResponse } from "axios"; -interface RequestResponse { +export interface RequestResponse { response: AxiosResponse | null; data: T | null; error: any; } export interface ApiRequestInstance { - get(url: string, data?: T | object): Promise>; - post(url: string, data: T | object | any): Promise>; - put(url: string, data: T | object): Promise>; - patch(url: string, data: T | object): Promise>; - delete(url: string, data?: T | object): Promise>; + get(url: string, data?: unknown): Promise>; + post(url: string, data: unknown): Promise>; + put(url: string, data: U): Promise>; + patch>(url: string, data: U): Promise>; + delete(url: string): Promise>; } diff --git a/frontend/types/application-types.ts b/frontend/types/application-types.ts index 36e53116fc4d..638c82980a81 100644 --- a/frontend/types/application-types.ts +++ b/frontend/types/application-types.ts @@ -1,4 +1,4 @@ -import { TranslateResult } from "vue-i18n"; +import { TranslateResult } from "vue-i18n/types"; export interface SideBarLink { icon: string; diff --git a/frontend/types/auto-forms.ts b/frontend/types/auto-forms.ts index 3d787a957a33..a82ccb8fb01a 100644 --- a/frontend/types/auto-forms.ts +++ b/frontend/types/auto-forms.ts @@ -4,6 +4,7 @@ export interface FormField { section?: string; sectionDetails?: string; label?: string; + hint?: string; varName: string; type: FormFieldType; rules?: string[]; diff --git a/frontend/types/components.d.ts b/frontend/types/components.d.ts index 8b4509d6e004..963fc3dae428 100644 --- a/frontend/types/components.d.ts +++ b/frontend/types/components.d.ts @@ -1,45 +1,53 @@ -// This Code is auto generated by gen_global_componenets.py -import BaseCardSectionTitle from "@/components/global/BaseCardSectionTitle.vue"; -import AppLoader from "@/components/global/AppLoader.vue"; -import BaseButton from "@/components/global/BaseButton.vue"; -import BaseDialog from "@/components/global/BaseDialog.vue"; -import BaseStatCard from "@/components/global/BaseStatCard.vue"; -import ToggleState from "@/components/global/ToggleState.vue"; -import AppButtonCopy from "@/components/global/AppButtonCopy.vue"; -import BaseColorPicker from "@/components/global/BaseColorPicker.vue"; -import BaseDivider from "@/components/global/BaseDivider.vue"; -import AutoForm from "@/components/global/AutoForm.vue"; -import AppButtonUpload from "@/components/global/AppButtonUpload.vue"; -import BasePageTitle from "@/components/global/BasePageTitle.vue"; -import BaseAutoForm from "@/components/global/BaseAutoForm.vue"; +// This Code is auto generated by gen_global_components.py + import BaseCardSectionTitle from "@/components/global/BaseCardSectionTitle.vue"; + import MarkdownEditor from "@/components/global/MarkdownEditor.vue"; + import AppLoader from "@/components/global/AppLoader.vue"; + import BaseOverflowButton from "@/components/global/BaseOverflowButton.vue"; + import ReportTable from "@/components/global/ReportTable.vue"; + import AppToolbar from "@/components/global/AppToolbar.vue"; + import BaseButton from "@/components/global/BaseButton.vue"; + import BaseDialog from "@/components/global/BaseDialog.vue"; + import RecipeJsonEditor from "@/components/global/RecipeJsonEditor.vue"; + import BaseStatCard from "@/components/global/BaseStatCard.vue"; + import ToggleState from "@/components/global/ToggleState.vue"; + import AppButtonCopy from "@/components/global/AppButtonCopy.vue"; + import BaseDivider from "@/components/global/BaseDivider.vue"; + import AutoForm from "@/components/global/AutoForm.vue"; + import AppButtonUpload from "@/components/global/AppButtonUpload.vue"; + import BasePageTitle from "@/components/global/BasePageTitle.vue"; + + import TheSnackbar from "@/components/layout/TheSnackbar.vue"; + import AppHeader from "@/components/layout/AppHeader.vue"; + import AppSidebar from "@/components/layout/AppSidebar.vue"; + import AppFooter from "@/components/layout/AppFooter.vue"; -import TheSnackbar from "@/components/layout/TheSnackbar.vue"; -import AppHeader from "@/components/layout/AppHeader.vue"; -import AppSidebar from "@/components/layout/AppSidebar.vue"; -import AppFooter from "@/components/layout/AppFooter.vue"; declare module "vue" { export interface GlobalComponents { // Global Components - BaseCardSectionTitle: typeof BaseCardSectionTitle; - AppLoader: typeof AppLoader; - BaseButton: typeof BaseButton; - BaseDialog: typeof BaseDialog; - BaseStatCard: typeof BaseStatCard; - ToggleState: typeof ToggleState; - AppButtonCopy: typeof AppButtonCopy; - BaseColorPicker: typeof BaseColorPicker; - BaseDivider: typeof BaseDivider; - AutoForm: typeof AutoForm; - AppButtonUpload: typeof AppButtonUpload; - BasePageTitle: typeof BasePageTitle; - BaseAutoForm: typeof BaseAutoForm; - // Layout Components - TheSnackbar: typeof TheSnackbar; - AppHeader: typeof AppHeader; - AppSidebar: typeof AppSidebar; - AppFooter: typeof AppFooter; + BaseCardSectionTitle: typeof BaseCardSectionTitle; + MarkdownEditor: typeof MarkdownEditor; + AppLoader: typeof AppLoader; + BaseOverflowButton: typeof BaseOverflowButton; + ReportTable: typeof ReportTable; + AppToolbar: typeof AppToolbar; + BaseButton: typeof BaseButton; + BaseDialog: typeof BaseDialog; + RecipeJsonEditor: typeof RecipeJsonEditor; + BaseStatCard: typeof BaseStatCard; + ToggleState: typeof ToggleState; + AppButtonCopy: typeof AppButtonCopy; + BaseDivider: typeof BaseDivider; + AutoForm: typeof AutoForm; + AppButtonUpload: typeof AppButtonUpload; + BasePageTitle: typeof BasePageTitle; + // Layout Components + TheSnackbar: typeof TheSnackbar; + AppHeader: typeof AppHeader; + AppSidebar: typeof AppSidebar; + AppFooter: typeof AppFooter; + } } -export {}; +export {}; \ No newline at end of file diff --git a/frontend/types/index.d.ts b/frontend/types/index.d.ts deleted file mode 100644 index 9d074d1246d8..000000000000 --- a/frontend/types/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Auth from "@nuxtjs/auth-next/dist/core/auth"; - -declare module "vue/types/vue" { - interface Vue { - $auth: Auth; - } -} diff --git a/frontend/types/ts-shim.d.ts b/frontend/types/ts-shim.d.ts index 31f47b3910f7..b39982764200 100644 --- a/frontend/types/ts-shim.d.ts +++ b/frontend/types/ts-shim.d.ts @@ -2,7 +2,3 @@ declare module "*.vue" { import Vue from "vue" export default Vue } - -interface VForm extends HTMLFormElement { - validate(): boolean; -} \ No newline at end of file diff --git a/frontend/types/vue.d.ts b/frontend/types/vue.d.ts deleted file mode 100644 index 7b3204f64d2e..000000000000 --- a/frontend/types/vue.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Vue from "vue"; -import "@nuxt/types"; -import { Icon } from "~/utils/icons/icon-type"; - -interface Globals { - icons: Icon; -} - -declare module "vue/types/vue" { - interface Vue { - $globals: any; - } -} - -declare module "vue/types/options" { - interface ComponentOptions { - $globals?: Globals; - } - interface ComponentOptions { - $globals?: Globals; - } -} diff --git a/frontend/types/vuetify.ts b/frontend/types/vuetify.ts new file mode 100644 index 000000000000..921393debb02 --- /dev/null +++ b/frontend/types/vuetify.ts @@ -0,0 +1,11 @@ +// TODO Remove this file when upgrading to Vuetify 3.0 + +export type VTooltip = Vue & { + deactivate(): void; +} + +export type VForm = Vue & { + validate: () => boolean; + resetValidation: () => boolean; + reset: () => void; +}; diff --git a/frontend/utils/icons/icon-type.ts b/frontend/utils/icons/icon-type.ts index 70cf59224050..2c90633fcbc7 100644 --- a/frontend/utils/icons/icon-type.ts +++ b/frontend/utils/icons/icon-type.ts @@ -1,111 +1,114 @@ export interface Icon { // Primary - primary: String; + primary: string; // General - foods: String; - units: String; - alert: String; - alertCircle: String; - api: String; - arrowLeftBold: String; - arrowUpDown: String; - backupRestore: String; - bellAlert: String; - broom: String; - calendar: String; - calendarMinus: String; - calendarMultiselect: String; - calendarToday: String; - calendarWeek: String; - calendarWeekBegin: String; - cartCheck: String; - check: String; - checkboxBlankOutline: String; - checkboxMarkedCircle: String; - clipboardCheck: String; - clockOutline: String; - codeBraces: String; - codeJson: String; - cog: String; - commentTextMultipleOutline: String; - contentCopy: String; - database: String; - desktopTowerMonitor: String; - devTo: String; - diceMultiple: String; - dotsHorizontal: String; - dotsVertical: String; - download: String; - email: String; - externalLink: String; - eye: String; - eyeOff: String; - file: String; - fileImage: String; - filePDF: String; - filter: String; - folderOutline: String; - food: String; - formatColorFill: String; - formatListCheck: String; - formSelect: String; - github: String; - heart: String; - heartOutline: String; - home: String; - import: String; - information: String; - link: String; - lock: String; - logout: String; - menu: String; - newBox: String; - notificationClearAll: String; - openInNew: String; - orderAlphabeticalAscending: String; - pageLayoutBody: String; - printer: String; - refreshCircle: String; - robot: String; - search: String; - shareVariant: String; - shuffleVariant: String; - sort: String; - star: String; - testTube: String; - tools: String; - translate: String; - upload: String; - viewDashboard: String; - viewModule: String; - weatherNight: String; - weatherSunny: String; - webhook: String; - windowClose: String; - zip: String; + foods: string; + units: string; + alert: string; + alertCircle: string; + api: string; + arrowLeftBold: string; + arrowUpDown: string; + backupRestore: string; + bellAlert: string; + broom: string; + calendar: string; + calendarMinus: string; + calendarMultiselect: string; + calendarToday: string; + calendarWeek: string; + calendarWeekBegin: string; + cartCheck: string; + check: string; + checkboxBlankOutline: string; + checkboxMarkedCircle: string; + clipboardCheck: string; + clockOutline: string; + codeBraces: string; + codeJson: string; + cog: string; + commentTextMultipleOutline: string; + contentCopy: string; + database: string; + desktopTowerMonitor: string; + devTo: string; + diceMultiple: string; + dotsHorizontal: string; + dotsVertical: string; + download: string; + email: string; + externalLink: string; + eye: string; + eyeOff: string; + file: string; + fileImage: string; + filePDF: string; + filter: string; + folderOutline: string; + food: string; + formatColorFill: string; + formatListCheck: string; + formSelect: string; + github: string; + heart: string; + heartOutline: string; + home: string; + import: string; + information: string; + link: string; + lock: string; + logout: string; + menu: string; + newBox: string; + notificationClearAll: string; + openInNew: string; + orderAlphabeticalAscending: string; + pageLayoutBody: string; + potSteam: string; + printer: string; + refreshCircle: string; + robot: string; + search: string; + shareVariant: string; + shuffleVariant: string; + sort: string; + star: string; + testTube: string; + tools: string; + translate: string; + upload: string; + viewDashboard: string; + viewModule: string; + weatherNight: string; + weatherSunny: string; + webhook: string; + windowClose: string; + zip: string; // Crud - backArrow: String; - createAlt: String; - create: String; - delete: String; - save: String; - update: String; - edit: String; - close: String; - minus: String; + backArrow: string; + createAlt: string; + create: string; + delete: string; + save: string; + update: string; + edit: string; + close: string; + minus: string; // Organization - tags: String; - pages: String; + tags: string; + pages: string; // Admin - user: String; - admin: String; - group: String; - accountPlusOutline: String; + user: string; + admin: string; + group: string; + accountPlusOutline: string; - forward: String; - back: String; + forward: string; + back: string; + slotMachine: string; + chevronDown: string; }