From 754f30539c7ea8a6185829b47969913e5ac39a25 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Wed, 10 Feb 2021 17:38:35 -0900 Subject: [PATCH 1/2] Refactor/response models (#156) - First Pass * cleanup * split app/db versioning * async file response * refactor/recipe viewer + minor ui improvements * auto grow size * added async file responses * docs/changelog * "/" to open search bar * docs/changelog * change imports to use @/ for imports * cleanup * cleanup * db to session * theme + settings refactor * bug/image save fix * fixed failing tests * fix last json bug - #155 * fix settings import * fixed router link for site title Co-authored-by: hay-kot --- docs/docs/changelog.md | 10 + frontend/src/App.vue | 21 +- frontend/src/api.js | 2 +- frontend/src/api/api-utils.js | 4 +- frontend/src/api/upload.js | 2 +- .../src/components/MealPlan/MealPlanCard.vue | 2 +- .../components/MealPlan/MealPlanEditor.vue | 4 +- .../src/components/MealPlan/MealPlanNew.vue | 4 +- .../components/Recipe/RecipeEditor/index.vue | 26 ++- .../src/components/Recipe/RecipePrint.vue | 2 +- .../src/components/Recipe/RecipeViewer.vue | 193 ------------------ .../Recipe/RecipeViewer/Ingredients.vue | 34 +++ .../components/Recipe/RecipeViewer/Notes.vue | 36 ++++ .../Recipe/RecipeViewer/RecipeChips.vue | 26 +++ .../components/Recipe/RecipeViewer/Steps.vue | 67 ++++++ .../components/Recipe/RecipeViewer/index.vue | 130 ++++++++++++ .../Settings/Backup/AvailableBackupCard.vue | 4 +- .../components/Settings/Backup/BackupCard.vue | 4 +- .../Settings/Backup/NewBackupCard.vue | 5 +- .../src/components/Settings/Backup/index.vue | 2 +- .../Settings/General/HomePageSettings.vue | 2 +- .../Settings/Migration/MigrationCard.vue | 4 +- .../components/Settings/Migration/index.vue | 4 +- .../src/components/Settings/Theme/index.vue | 6 +- .../src/components/Settings/Webhook/index.vue | 2 +- frontend/src/components/UI/AddRecipeFab.vue | 2 +- frontend/src/components/UI/Login.vue | 6 +- frontend/src/components/UI/RecipeCard.vue | 2 +- frontend/src/components/UI/SearchBar.vue | 4 +- frontend/src/components/UI/UploadBtn.vue | 2 +- frontend/src/pages/CategoryPage.vue | 2 +- frontend/src/pages/HomePage.vue | 4 +- frontend/src/pages/MealPlanPage.vue | 4 +- frontend/src/pages/MealPlanThisWeekPage.vue | 4 +- frontend/src/pages/RecipeNewPage.vue | 2 +- frontend/src/pages/RecipePage.vue | 6 +- frontend/src/pages/SettingsPage.vue | 2 +- frontend/src/routes.js | 4 +- frontend/src/store/modules/homePage.js | 10 +- frontend/src/store/modules/userSettings.js | 8 +- frontend/src/store/store.js | 10 +- frontend/src/utils.js | 2 +- mealie/app.py | 22 +- mealie/app_config.py | 3 +- mealie/db/database.py | 8 +- mealie/db/db_base.py | 2 +- mealie/models/meal_models.py | 38 ++++ mealie/models/recipe_models.py | 96 ++++++--- mealie/models/settings_models.py | 26 +++ mealie/models/theme_models.py | 31 +++ mealie/models/user_models.py | 10 - mealie/routes/backup_routes.py | 10 +- mealie/routes/debug_routes.py | 13 +- mealie/routes/meal_routes.py | 41 ++-- mealie/routes/migration_routes.py | 6 +- mealie/routes/recipe/recipe_crud_routes.py | 9 +- mealie/routes/setting_routes.py | 39 ++-- mealie/routes/static_routes.py | 4 +- mealie/routes/theme_routes.py | 23 ++- mealie/routes/user_routes.py | 33 --- mealie/services/backups/exports.py | 16 +- mealie/services/backups/imports.py | 16 +- mealie/services/meal_services.py | 15 +- mealie/services/recipe_services.py | 16 +- mealie/services/scheduler/scheduled_jobs.py | 6 +- mealie/services/scrape_services.py | 19 +- mealie/services/settings_services.py | 147 +------------ mealie/services/theme_services.py | 28 +++ mealie/tests/conftest.py | 6 +- mealie/tests/test_recipes/__init__.py | 0 mealie/tests/test_recipes/test_scraper.py | 99 --------- .../tests/test_routes/test_settings_routes.py | 1 + .../test_scraper/test_scraper.py | 26 +-- mealie/utils/post_webhooks.py | 6 +- 74 files changed, 735 insertions(+), 750 deletions(-) delete mode 100644 frontend/src/components/Recipe/RecipeViewer.vue create mode 100644 frontend/src/components/Recipe/RecipeViewer/Ingredients.vue create mode 100644 frontend/src/components/Recipe/RecipeViewer/Notes.vue create mode 100644 frontend/src/components/Recipe/RecipeViewer/RecipeChips.vue create mode 100644 frontend/src/components/Recipe/RecipeViewer/Steps.vue create mode 100644 frontend/src/components/Recipe/RecipeViewer/index.vue create mode 100644 mealie/models/meal_models.py create mode 100644 mealie/models/settings_models.py create mode 100644 mealie/models/theme_models.py delete mode 100644 mealie/models/user_models.py delete mode 100644 mealie/routes/user_routes.py create mode 100644 mealie/services/theme_services.py delete mode 100644 mealie/tests/test_recipes/__init__.py delete mode 100644 mealie/tests/test_recipes/test_scraper.py diff --git a/docs/docs/changelog.md b/docs/docs/changelog.md index 80d9f4c7e..4d982d00d 100644 --- a/docs/docs/changelog.md +++ b/docs/docs/changelog.md @@ -3,7 +3,17 @@ ## v0.3.0 - Draft! ### Features and Improvements + - Open search with `/` hotkey! - Unified and improved snackbar notifications + - Recipe Viewer + - Categories, Tags, and Notes will not be displayed below the steps on smaller screens + - Recipe Editor + - Text areas now auto grow to fit content + - Description, Steps, and Notes support Markdown! This includes inline html in Markdown. + +### Development / Misc + - Added async file response for images, downloading files. + - Breakup recipe view component ## v0.2.0 - Now with Test! This is, what I think, is a big release! Tons of new features and some great quality of life improvements with some additional features. You may find that I made promises to include some fixes/features in v0.2.0. The short of is I greatly underestimated the work needed to refactor the database to a usable state and integrate categories in a way that is useful for users. This shouldn't be taken as a sign that I'm dropping those feature requests or ignoring them. I felt it was better to push a release in the current state rather than drag on development to try and fulfil all of the promises I made. diff --git a/frontend/src/App.vue b/frontend/src/App.vue index ffd80d668..4509b55a5 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,16 +1,22 @@ - - \ No newline at end of file diff --git a/frontend/src/components/Recipe/RecipeViewer/Ingredients.vue b/frontend/src/components/Recipe/RecipeViewer/Ingredients.vue new file mode 100644 index 000000000..70a8c798c --- /dev/null +++ b/frontend/src/components/Recipe/RecipeViewer/Ingredients.vue @@ -0,0 +1,34 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Recipe/RecipeViewer/Notes.vue b/frontend/src/components/Recipe/RecipeViewer/Notes.vue new file mode 100644 index 000000000..e25701d27 --- /dev/null +++ b/frontend/src/components/Recipe/RecipeViewer/Notes.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Recipe/RecipeViewer/RecipeChips.vue b/frontend/src/components/Recipe/RecipeViewer/RecipeChips.vue new file mode 100644 index 000000000..cde5d99c3 --- /dev/null +++ b/frontend/src/components/Recipe/RecipeViewer/RecipeChips.vue @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Recipe/RecipeViewer/Steps.vue b/frontend/src/components/Recipe/RecipeViewer/Steps.vue new file mode 100644 index 000000000..4b674668e --- /dev/null +++ b/frontend/src/components/Recipe/RecipeViewer/Steps.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Recipe/RecipeViewer/index.vue b/frontend/src/components/Recipe/RecipeViewer/index.vue new file mode 100644 index 000000000..845c63c95 --- /dev/null +++ b/frontend/src/components/Recipe/RecipeViewer/index.vue @@ -0,0 +1,130 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Settings/Backup/AvailableBackupCard.vue b/frontend/src/components/Settings/Backup/AvailableBackupCard.vue index 67b83aa51..7254e5808 100644 --- a/frontend/src/components/Settings/Backup/AvailableBackupCard.vue +++ b/frontend/src/components/Settings/Backup/AvailableBackupCard.vue @@ -38,8 +38,8 @@