diff --git a/dev/scripts/app_routes_gen.py b/dev/scripts/app_routes_gen.py index c15267d90..aa52c1da9 100644 --- a/dev/scripts/app_routes_gen.py +++ b/dev/scripts/app_routes_gen.py @@ -1,12 +1,10 @@ import json import re from pathlib import Path -from typing import Optional import slugify from jinja2 import Template from mealie.app import app -from pydantic import BaseModel CWD = Path(__file__).parent OUT_FILE = CWD.joinpath("output", "app_routes.py") diff --git a/dev/scripts/output/app_routes.py b/dev/scripts/output/app_routes.py index 6c43040c9..40e4b2c16 100644 --- a/dev/scripts/output/app_routes.py +++ b/dev/scripts/output/app_routes.py @@ -2,25 +2,32 @@ class AppRoutes: def __init__(self) -> None: self.prefix = "/api" - self.users_sign_ups = "/api/users/sign-ups" self.auth_token = "/api/auth/token" self.auth_token_long = "/api/auth/token/long" self.auth_refresh = "/api/auth/refresh" + self.users_sign_ups = "/api/users/sign-ups" self.users = "/api/users" self.users_self = "/api/users/self" + self.users_api_tokens = "/api/users-tokens" self.groups = "/api/groups" self.groups_self = "/api/groups/self" - self.recipes = "/api/recipes" + self.recipes_summary = "/api/recipes/summary" + self.recipes_summary_untagged = "/api/recipes/summary/untagged" + self.recipes_summary_uncategorized = "/api/recipes/summary/uncategorized" self.recipes_category = "/api/recipes/category" self.recipes_tag = "/api/recipes/tag" - self.categories = "/api/categories" - self.recipes_tags = "/api/recipes/tags/" self.recipes_create = "/api/recipes/create" self.recipes_create_url = "/api/recipes/create-url" + self.categories = "/api/categories" + self.categories_empty = "/api/categories/empty" + self.tags = "/api/tags" + self.tags_empty = "/api/tags/empty" + self.about_events = "/api/about/events" self.meal_plans_all = "/api/meal-plans/all" self.meal_plans_create = "/api/meal-plans/create" self.meal_plans_this_week = "/api/meal-plans/this-week" self.meal_plans_today = "/api/meal-plans/today" + self.meal_plans_today_image = "/api/meal-plans/today/image" self.site_settings_custom_pages = "/api/site-settings/custom-pages" self.site_settings = "/api/site-settings" self.site_settings_webhooks_test = "/api/site-settings/webhooks/test" @@ -30,8 +37,12 @@ class AppRoutes: self.backups_export_database = "/api/backups/export/database" self.backups_upload = "/api/backups/upload" self.migrations = "/api/migrations" + self.debug = "/api/debug" + self.debug_statistics = "/api/debug/statistics" self.debug_version = "/api/debug/version" self.debug_last_recipe_json = "/api/debug/last-recipe-json" + self.debug_log = "/api/debug/log" + self.utils_download = "/api/utils/download" def users_sign_ups_token(self, token): return f"{self.prefix}/users/sign-ups/{token}" @@ -48,21 +59,36 @@ class AppRoutes: def users_id_password(self, id): return f"{self.prefix}/users/{id}/password" + def users_api_tokens_token_id(self, token_id): + return f"{self.prefix}/users-tokens/{token_id}" + def groups_id(self, id): return f"{self.prefix}/groups/{id}" - def categories_category(self, category): - return f"{self.prefix}/categories/{category}" - - def recipes_tags_tag(self, tag): - return f"{self.prefix}/recipes/tags/{tag}" - def recipes_recipe_slug(self, recipe_slug): return f"{self.prefix}/recipes/{recipe_slug}" def recipes_recipe_slug_image(self, recipe_slug): return f"{self.prefix}/recipes/{recipe_slug}/image" + def recipes_recipe_slug_assets(self, recipe_slug): + return f"{self.prefix}/recipes/{recipe_slug}/assets" + + def categories_category(self, category): + return f"{self.prefix}/categories/{category}" + + def tags_tag(self, tag): + return f"{self.prefix}/tags/{tag}" + + def media_recipes_recipe_slug_images_file_name(self, recipe_slug, file_name): + return f"{self.prefix}/media/recipes/{recipe_slug}/images/{file_name}" + + def media_recipes_recipe_slug_assets_file_name(self, recipe_slug, file_name): + return f"{self.prefix}/media/recipes/{recipe_slug}/assets/{file_name}" + + def about_events_id(self, id): + return f"{self.prefix}/about/events/{id}" + def meal_plans_plan_id(self, plan_id): return f"{self.prefix}/meal-plans/{plan_id}" @@ -72,8 +98,8 @@ class AppRoutes: def site_settings_custom_pages_id(self, id): return f"{self.prefix}/site-settings/custom-pages/{id}" - def themes_theme_name(self, theme_name): - return f"{self.prefix}/themes/{theme_name}" + def themes_id(self, id): + return f"{self.prefix}/themes/{id}" def backups_file_name_download(self, file_name): return f"{self.prefix}/backups/{file_name}/download" @@ -84,14 +110,14 @@ class AppRoutes: def backups_file_name_delete(self, file_name): return f"{self.prefix}/backups/{file_name}/delete" - def migrations_type_file_name_import(self, type, file_name): - return f"{self.prefix}/migrations/{type}/{file_name}/import" + def migrations_import_type_file_name_import(self, import_type, file_name): + return f"{self.prefix}/migrations/{import_type}/{file_name}/import" - def migrations_type_file_name_delete(self, type, file_name): - return f"{self.prefix}/migrations/{type}/{file_name}/delete" + def migrations_import_type_file_name_delete(self, import_type, file_name): + return f"{self.prefix}/migrations/{import_type}/{file_name}/delete" - def migrations_type_upload(self, type): - return f"{self.prefix}/migrations/{type}/upload" + def migrations_import_type_upload(self, import_type): + return f"{self.prefix}/migrations/{import_type}/upload" def debug_log_num(self, num): return f"{self.prefix}/debug/log/{num}" diff --git a/docs/docs/changelog/v0.5.0.md b/docs/docs/changelog/v0.5.0.md index 1f2aff96d..15050e5df 100644 --- a/docs/docs/changelog/v0.5.0.md +++ b/docs/docs/changelog/v0.5.0.md @@ -1,4 +1,4 @@ -# v0.5.0 COOL TITLE GOES HERE +# v0.5.0 Too Many Changes! **App Version: v0.5.0** @@ -9,11 +9,14 @@ !!! error "Breaking Changes" #### Database - Database version has been bumped from v0.4.x -> v0.5.0. You will need to export and import your data. + Database version has been bumped from v0.4.x -> v0.5.0. You will need to export and import your data. Moving forward, we will be using database migrations (BETA) to do this automatically. Note that you still must backup your data. If you don't, it's entirely possible something may go wrong and you could lose your data on upgrade. #### Image Directory the /data/img directory has been depreciated. All images are now stored in the /recipes/{slug}/image directory. Images should be migrated automatically, but you may experience issues related to this change. + #### API Usage + If you have been using the API directly, many of the routes and status codes have changed. You may experience issues with directly consuming the API. + ## Bug Fixes - Fixed #332 - Language settings are saved for one browser - Fixes #281 - Slow Handling of Large Sets of Recipes @@ -24,23 +27,31 @@ ### Highlights - Beta Support for Postgres! 🎉 See the getting started page for details -- Recipe Steps now support sections, assets, and additional settings. +- Recipe Features + - Step Sections + - Recipe Assets + - Additional View Settings. - New Toolbox Page! - - Bulk assign categories and tags by keyword search - - Title case all Categories or Tags with 1 click - - Create/Rename/Delete Operations for Tags/Categories - - Remove Unused Categories or Tags with 1 click + - Bulk assign categories and tags by keyword search + - Title case all Categories or Tags with 1 click + - Create/Rename/Delete Operations for Tags/Categories + - Remove Unused Categories or Tags with 1 click - Recipe Cards now have a menu button for quick actions! - - Edit - - Delete - - Download (As Json) - - Copy Link -- Rating can be updated without entering the editor - Closes #25 + - Edit + - Delete + - Download (As Json) + - Copy Link +- New Profile Dashboard! + - Edit Your Profile + - Create/Edit Themes + - View other users in your Group + - See what's for dinner + - Manage Long Live API Tokens (New) - New Admin Dashboard! 🎉 - - Now you can get some insight on your application with application statics and events. - - See uncategorized/untagged recipes and organize them! - - Backup/Restore right from your dashboard - - See server side events. Now you can know who deleted your favorite recipe! + - Now you can get some insight on your application with application statics and events. + - See uncategorized/untagged recipes and organize them! + - Backup/Restore right from your dashboard + - See server side events. Now you can know who deleted your favorite recipe! ### Performance - Images are now served up by the Caddy increase performance and offloading some loads from the API server @@ -48,6 +59,16 @@ - All images are now converted to .webp for better compression ### General +- New 'Dark' Theme Packages with Mealie +- Updated Recipe Card Sections Toolbar + - New Sort Options (They work this time!) + - Alphabetical + - Rating + - Created Date + - Updated Date + - Shuffle (Random Sort) + - New 'Random' Recipe button on recipe sections. Random recipes are selected from the filtered results below. For example, on the "Cakes" category page, you will only get recipes in the "Cakes" category. +- Rating can be updated without entering the editor - Closes #25 - Updated recipe editor styles and moved notes to below the steps. - Redesigned search bar - 'Dinner this week' shows a warning when no meal is planned yet @@ -55,11 +76,11 @@ - More localization - Start date for Week is now selectable - Languages are now managed through Crowdin -- The main App bar went through a major overhaul - - Sidebar can now be toggled everywhere. - - New and improved mobile friendly bottom bar - - Improved styling for search bar in desktop - - Improved search layout on mobile +- Application Bar was Rewritten + - Sidebar can now be toggled everywhere. + - New and improved mobile friendly bottom bar + - Improved styling for search bar in desktop + - Improved search layout on mobile - Profile image now shown on all sidebars ### Behind the Scenes @@ -69,4 +90,4 @@ - Refactor UI components to fit Vue best practices (WIP) - The API returns more consistent status codes - The API returns error code instead of error text when appropriate - - ⚠️ May cause side-effects if you were directly consuming the API \ No newline at end of file + - ⚠️ May cause side-effects if you were directly consuming the API \ No newline at end of file diff --git a/docs/docs/getting-started/organizing-recipes.md b/docs/docs/getting-started/organizing-recipes.md index 67b42d609..639190f61 100644 --- a/docs/docs/getting-started/organizing-recipes.md +++ b/docs/docs/getting-started/organizing-recipes.md @@ -1,5 +1,19 @@ # Organizing Recipes +Below are some general guidelines that were considered when creating the organization structure for recipes. + + +## From The Community + +> My categories are mostly based on the 'course' they belong to. Appetizers, Starters, Main course, but also sauces or beverages. When I'm looking for an idea for an every day dinner, I just browse "main course". +> +> My tags are for picking the exact type of meal I'm looking for, based on my mood or my guests' diet, like gluten-free, vegetarian, sweet-sour or casserole. They can also act as sub-categories, like "alcohol" for beverages or "hot meal" for a main course. +> +> User: [sephrat](https://github.com/sephrat) + + +## Structure + !!! tip Below is a suggestion of guidelines my wife and I use for organizing our recipes within Mealie. Mealie is fairly flexible, so feel free to utilize how you'd like! 👍 diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html index e26f964e1..3455949e0 100644 --- a/docs/docs/overrides/api.html +++ b/docs/docs/overrides/api.html @@ -14,7 +14,7 @@
diff --git a/frontend/src/api/users.js b/frontend/src/api/users.js index 11609ff29..1ded3c6e9 100644 --- a/frontend/src/api/users.js +++ b/frontend/src/api/users.js @@ -16,17 +16,10 @@ const usersURLs = { userID: id => `${userPrefix}/${id}`, password: id => `${userPrefix}/${id}/password`, resetPassword: id => `${userPrefix}/${id}/reset-password`, + userAPICreate: `${userPrefix}/api-tokens`, + userAPIDelete: id => `${userPrefix}/api-tokens/${id}`, }; -function deleteErrorText(response) { - switch (response.data.detail) { - case "SUPER_USER": - return i18n.t("user.error-cannot-delete-super-user"); - - default: - return i18n.t("user.you-are-not-allowed-to-delete-this-user"); - } -} export const userAPI = { async login(formData) { let response = await apiReq.post(authURLs.token, formData, null, function() { @@ -90,4 +83,21 @@ export const userAPI = { () => i18n.t("user.password-has-been-reset-to-the-default-password") ); }, + async createAPIToken(name) { + const response = await apiReq.post(usersURLs.userAPICreate, { name }); + return response.data; + }, + async deleteAPIToken(id) { + const response = await apiReq.delete(usersURLs.userAPIDelete(id)); + return response.data; + }, +}; + +const deleteErrorText = response => { + switch (response.data.detail) { + case "SUPER_USER": + return i18n.t("user.error-cannot-delete-super-user"); + default: + return i18n.t("user.you-are-not-allowed-to-delete-this-user"); + } }; diff --git a/frontend/src/components/FormHelpers/CategoryTagSelector.vue b/frontend/src/components/FormHelpers/CategoryTagSelector.vue index 4a95208b5..32b5eeba3 100644 --- a/frontend/src/components/FormHelpers/CategoryTagSelector.vue +++ b/frontend/src/components/FormHelpers/CategoryTagSelector.vue @@ -100,7 +100,10 @@ export default { } }, flat() { - return this.selected.length > 0 && this.solo; + if (this.selected) { + return this.selected.length > 0 && this.solo; + } + return false; }, }, methods: { diff --git a/frontend/src/components/UI/CardSection.vue b/frontend/src/components/UI/CardSection.vue index c9e712739..da98e3b6b 100644 --- a/frontend/src/components/UI/CardSection.vue +++ b/frontend/src/components/UI/CardSection.vue @@ -7,26 +7,50 @@ {{ title }} - Random + + mdi-dice-multiple + + {{ $t("general.random") }} - + + + mdi-order-alphabetical-ascending + {{ $t("general.sort-alphabetically") }} + + mdi-star + {{ $t("general.rating") }} + + + mdi-new-box + + {{ $t("general.created") }} + + + mdi-update + {{ $t("general.updated") }} - - {{ $t("general.created") }} + + + mdi-shuffle-variant + + {{ $t("general.shuffle") }} @@ -114,6 +138,7 @@ export default { }, data() { return { + sortLoading: false, cardLimit: 30, loading: false, EVENTS: { @@ -121,6 +146,7 @@ export default { rating: "rating", created: "created", updated: "updated", + shuffle: "shuffle", }, }; }, @@ -165,6 +191,7 @@ export default { this.$router.push(`/recipe/${recipe.slug}`); }, sortRecipes(sortType) { + this.sortLoading = true; let sortTarget = [...this.recipes]; switch (sortType) { case this.EVENTS.az: @@ -179,11 +206,16 @@ export default { case this.EVENTS.updated: utils.recipe.sortByUpdated(sortTarget); break; + case this.EVENTS.shuffle: + utils.recipe.shuffle(sortTarget); + break; default: console.log("Unknown Event", sortType); return; } + this.$emit(SORT_EVENT, sortTarget); + this.sortLoading = false; }, }, }; diff --git a/frontend/src/components/UI/TheSidebar.vue b/frontend/src/components/UI/TheSidebar.vue index bf9543f7e..6153efec6 100644 --- a/frontend/src/components/UI/TheSidebar.vue +++ b/frontend/src/components/UI/TheSidebar.vue @@ -2,7 +2,7 @@
+ diff --git a/frontend/src/pages/Recipes/CategoryPage.vue b/frontend/src/pages/Recipes/CategoryPage.vue index 2d0acf225..89818210f 100644 --- a/frontend/src/pages/Recipes/CategoryPage.vue +++ b/frontend/src/pages/Recipes/CategoryPage.vue @@ -1,13 +1,6 @@ @@ -22,20 +15,30 @@ export default { return { title: "", recipes: [], + sortedResults: [], }; }, computed: { currentCategory() { return this.$route.params.category; }, + shownRecipes() { + if (this.sortedResults.length > 0) { + return this.sortedResults; + } else { + return this.recipes; + } + }, }, watch: { async currentCategory() { + this.sortedResults = []; this.getRecipes(); }, }, mounted() { this.getRecipes(); + this.sortedResults = []; }, methods: { async getRecipes() { @@ -43,11 +46,8 @@ export default { this.title = data.name; this.recipes = data.recipes; }, - sortAZ() { - this.recipes.sort((a, b) => (a.name > b.name ? 1 : -1)); - }, - sortRecent() { - this.recipes.sort((a, b) => (a.dateAdded > b.dateAdded ? -1 : 1)); + assignSorted(val) { + this.sortedResults = val.slice(); }, }, }; diff --git a/frontend/src/pages/Recipes/CustomPage.vue b/frontend/src/pages/Recipes/CustomPage.vue index 91d2bbe82..ad6f6003a 100644 --- a/frontend/src/pages/Recipes/CustomPage.vue +++ b/frontend/src/pages/Recipes/CustomPage.vue @@ -1,24 +1,23 @@