From 079ebd8ee16c065a1c939ea1cf221f35b8c5de15 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 23 Jan 2021 19:53:39 -0900 Subject: [PATCH] Migration redesign (#119) * migration redesign init * new color picker * changelog * added UI language selection * fix layout issue on recipe editor * remove git as dependency * added UI editor for original URL * CI/CD Tests * test: fixed migration routes Co-authored-by: Hayden --- .github/workflows/dockerbuild.alpine.yml | 49 --------- .github/workflows/pytest.yml | 18 ++-- dev/dev-notes.md | 18 +--- dev/favicon.png | Bin 0 -> 7219 bytes docs/docs/changelog.md | 12 ++- docs/docs/getting-started/meal-planner.md | 2 +- .../docs/getting-started/migration-imports.md | 17 ++- docs/docs/roadmap.md | 2 +- frontend/jsconfig.json | 3 - frontend/src/App.vue | 1 + frontend/src/api/migration.js | 45 +++----- .../components/Recipe/RecipeEditor/index.vue | 45 ++++---- .../Settings/Backup/AvailableBackupCard.vue | 4 +- .../src/components/Settings/Backup/index.vue | 3 + .../src/components/Settings/General/index.vue | 50 +++++++++ .../Settings/Migration/MigrationCard.vue | 97 ++++++++++++++++++ .../components/Settings/Migration/index.vue | 96 +++++++++++++---- .../Settings/Theme/ColorPickerDialog.vue | 77 +++++++------- .../src/components/UI/SuccessFailureAlert.vue | 54 ++++++---- frontend/src/i18n.js | 34 +++--- frontend/src/main.js | 5 +- frontend/src/pages/SettingsPage.vue | 5 +- frontend/src/store/modules/language.js | 44 ++++++++ frontend/src/store/store.js | 12 ++- mealie/models/migration_models.py | 13 +++ mealie/routes/migration_routes.py | 77 +++++++------- mealie/services/migrations/chowdown.py | 54 +++++----- mealie/services/recipe_services.py | 8 +- .../test_routes/test_migration_routes.py | 8 +- mealie/utils/unzip.py | 18 ++++ poetry.lock | 44 +------- pyproject.toml | 1 - 32 files changed, 549 insertions(+), 367 deletions(-) delete mode 100644 .github/workflows/dockerbuild.alpine.yml create mode 100644 dev/favicon.png create mode 100644 frontend/src/components/Settings/General/index.vue create mode 100644 frontend/src/components/Settings/Migration/MigrationCard.vue create mode 100644 frontend/src/store/modules/language.js create mode 100644 mealie/utils/unzip.py diff --git a/.github/workflows/dockerbuild.alpine.yml b/.github/workflows/dockerbuild.alpine.yml deleted file mode 100644 index 1dec6bfa3..000000000 --- a/.github/workflows/dockerbuild.alpine.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Docker Build Alpine - -on: - push: - branches: - - new-tests - -jobs: - build: - runs-on: ubuntu-latest - steps: - # - # Checkout - # - - name: checkout code - uses: actions/checkout@v2 - # - # Setup QEMU - # - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v1 - # with: - # image: tonistiigi/binfmt:latest - # platforms: all - # - # Setup Buildx - # - - name: install buildx - id: buildx - uses: docker/setup-buildx-action@v1 - with: - install: true - # - # Login to Docker Hub - # - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - # - # Build - # - - name: build the image - run: | - docker build --push \ - --tag hkotel/mealie:alpine \ - --platform linux/amd64,linux/arm/v7,linux/arm64 . diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a384ffe31..210e84fbc 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -30,15 +30,15 @@ jobs: with: virtualenvs-create: true virtualenvs-in-project: true - #---------------------------------------------- - # load cached venv if cache exists - #---------------------------------------------- - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v2 - with: - path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + # #---------------------------------------------- + # # load cached venv if cache exists + # #---------------------------------------------- + # - name: Load cached venv + # id: cached-poetry-dependencies + # uses: actions/cache@v2 + # with: + # path: .venv + # key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} #---------------------------------------------- # install dependencies if cache does not exist #---------------------------------------------- diff --git a/dev/dev-notes.md b/dev/dev-notes.md index f5d3ad44f..2062d6be5 100644 --- a/dev/dev-notes.md +++ b/dev/dev-notes.md @@ -16,15 +16,7 @@ Don't forget to [join the Discord](https://discord.gg/R6QDyJgbD2)! # Todo's -Documentation -- [ ] V0.1.0 Release Notes -- [ ] Nextcloud Migration How To -- [ ] New Docker Setup with Sqlite -- [ ] Update Env Variables -- [ ] New Roadmap / Milestones - Frontend -- [x] Prep / Cook / Total Time Indicator + Editor - [ ] No Meal Today Page instead of Null - [ ] Recipe Print Page - [ ] Recipe Editor Data Validation Client Side @@ -32,12 +24,7 @@ Frontend - [ ] Advanced Search Page, draft started - [ ] Filter by Category - [ ] Filter by Tags -- [ ] Search Bar redesign - - [x] Initial - - [ ] Results redesign -- [x] Replace Backups card with something like Home Assistant -- [x] Replace import card with something like Home Assistant - - [x] Select which imports to do +- [ ] Search Bar Results Redesign Backend - [ ] Database Import @@ -46,11 +33,10 @@ Backend - [ ] Meal Plans - [x] Settings - [x] Themes -- [x] Remove Print / Debug Code +- [ ] Remove Print / Debug Code - [ ] Support how to sections and how to steps - [ ] Recipe request by category/tags - SQL - [ ] Setup Database Migrations diff --git a/dev/favicon.png b/dev/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..0ca99249ead57569d40776c12fb1f5cd9a9bdc32 GIT binary patch literal 7219 zcmb_hc|4R~)PH8iHiPULMJ5?*7!eT$*_TLmWyxOl?8_KSwu%y2V@UR`lzo}#N3tbK zvJN837+Xdr-pB9v*Zar&-#ed~xpVJ%&iCAN=iK{z&v}wfuj;ZQP9XpQVAa>tG6Mhz z_!9y!F@VjDfO0pmp>x+T)&PK)Y0NYyda#dj)-y8(fN&82z{dl?A8-i&0|0_B0I=o= z0Ls|_!0VUadQAlsFx)cK)dE}awST288f@TxdNy~#*74sD<&NeE0Gz(4uccug`fYtC zB9z~?gORe~>!$GfbwK7PmnWYF$ff4m+#8IZV>?hp=p_kzO8$1JN?#ifCALxji;JQZ z|D(Keg37{XsFYeLUCKv0v+@x2cTi)6qAV9hPf0U`ly`_5ZY9lS$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own/repo/", - nextcloudAvaiable: migrationBase + "nextcloud/available/", - nextcloudImport: (selection) => - `${migrationBase}nextcloud/${selection}/import/`, + // New + all: migrationBase, + delete: (folder, file) => `${migrationBase}/${folder}/${file}/delete/`, + import: (folder, file) => `${migrationBase}/${folder}/${file}/import/`, }; export default { - async migrateChowdown(repoURL) { - let postBody = { url: repoURL }; - let response = await apiReq.post(migrationURLs.chowdownURL, postBody); + async getMigrations() { + let response = await apiReq.get(migrationURLs.all); + return response.data; + }, + async delete(folder, file) { + let response = await apiReq.delete(migrationURLs.delete(folder, file)); + return response.data; + }, + async import(folder, file) { + let response = await apiReq.post(migrationURLs.import(folder, file)); store.dispatch("requestRecentRecipes"); return response.data; }, - async getNextcloudImports() { - let response = await apiReq.get(migrationURLs.nextcloudAvaiable); - return response.data; - }, - async importNextcloud(selected) { - let response = await apiReq.post(migrationURLs.nextcloudImport(selected)); - return response.data; - }, - async uploadFile(form_data) { - let response = await apiReq.post(migrationURLs.upload, form_data, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - return response.data; - }, - async delete(file_folder_name) { - let response = await apiReq.delete(migrationURLs.delete(file_folder_name)); - return response.data; - }, }; diff --git a/frontend/src/components/Recipe/RecipeEditor/index.vue b/frontend/src/components/Recipe/RecipeEditor/index.vue index 637fcd49b..74b5d27d1 100644 --- a/frontend/src/components/Recipe/RecipeEditor/index.vue +++ b/frontend/src/components/Recipe/RecipeEditor/index.vue @@ -12,26 +12,26 @@ > - - - - - - - + + + + + + + mdi-plus + diff --git a/frontend/src/components/Settings/Backup/AvailableBackupCard.vue b/frontend/src/components/Settings/Backup/AvailableBackupCard.vue index c89d6915f..67b83aa51 100644 --- a/frontend/src/components/Settings/Backup/AvailableBackupCard.vue +++ b/frontend/src/components/Settings/Backup/AvailableBackupCard.vue @@ -16,11 +16,11 @@ v-for="backup in backups" :key="backup.name" > - + - mdi-backup-restore + mdi-backup-restore
diff --git a/frontend/src/components/Settings/Backup/index.vue b/frontend/src/components/Settings/Backup/index.vue index 70c2c9edb..d16e65164 100644 --- a/frontend/src/components/Settings/Backup/index.vue +++ b/frontend/src/components/Settings/Backup/index.vue @@ -34,6 +34,8 @@ :backups="availableBackups" /> + + General Settings + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/components/Settings/Migration/MigrationCard.vue b/frontend/src/components/Settings/Migration/MigrationCard.vue new file mode 100644 index 000000000..139ff2dc1 --- /dev/null +++ b/frontend/src/components/Settings/Migration/MigrationCard.vue @@ -0,0 +1,97 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Settings/Migration/index.vue b/frontend/src/components/Settings/Migration/index.vue index 4de4e6dcf..976756298 100644 --- a/frontend/src/components/Settings/Migration/index.vue +++ b/frontend/src/components/Settings/Migration/index.vue @@ -1,44 +1,96 @@ diff --git a/frontend/src/components/Settings/Theme/ColorPickerDialog.vue b/frontend/src/components/Settings/Theme/ColorPickerDialog.vue index 6da100082..3504e9e49 100644 --- a/frontend/src/components/Settings/Theme/ColorPickerDialog.vue +++ b/frontend/src/components/Settings/Theme/ColorPickerDialog.vue @@ -1,36 +1,28 @@ @@ -44,21 +36,30 @@ export default { return { dialog: false, swatches: false, - color: "#FF00FF", + color: "#1976D2", + mask: "!#XXXXXXXX", + menu: false, }; }, - + computed: { + swatchStyle() { + const { value, menu } = this; + return { + backgroundColor: value, + cursor: "pointer", + height: "30px", + width: "30px", + borderRadius: menu ? "50%" : "4px", + transition: "border-radius 200ms ease-in-out", + }; + }, + }, watch: { color() { this.updateColor(); }, }, methods: { - toggleSwatches() { - if (this.swatches) { - this.swatches = false; - } else this.swatches = true; - }, updateColor() { this.$emit("input", this.color); }, diff --git a/frontend/src/components/UI/SuccessFailureAlert.vue b/frontend/src/components/UI/SuccessFailureAlert.vue index 784ed2e82..0f6982d63 100644 --- a/frontend/src/components/UI/SuccessFailureAlert.vue +++ b/frontend/src/components/UI/SuccessFailureAlert.vue @@ -1,32 +1,50 @@ diff --git a/frontend/src/i18n.js b/frontend/src/i18n.js index 2b285c50a..41d46703c 100644 --- a/frontend/src/i18n.js +++ b/frontend/src/i18n.js @@ -1,23 +1,27 @@ -import Vue from 'vue' -import VueI18n from 'vue-i18n' +import Vue from "vue"; +import VueI18n from "vue-i18n"; -Vue.use(VueI18n) +Vue.use(VueI18n); -function loadLocaleMessages () { - const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i) - const messages = {} +function loadLocaleMessages() { + const locales = require.context( + "./locales", + true, + /[A-Za-z0-9-_,\s]+\.json$/i + ); + const messages = {}; locales.keys().forEach(key => { - const matched = key.match(/([A-Za-z0-9-_]+)\./i) + const matched = key.match(/([A-Za-z0-9-_]+)\./i); if (matched && matched.length > 1) { - const locale = matched[1] - messages[locale] = locales(key) + const locale = matched[1]; + messages[locale] = locales(key); } - }) - return messages + }); + return messages; } export default new VueI18n({ - locale: process.env.VUE_APP_I18N_LOCALE || 'en', - fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en', - messages: loadLocaleMessages() -}) + locale: "en", + fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || "en", + messages: loadLocaleMessages(), +}); diff --git a/frontend/src/main.js b/frontend/src/main.js index 76a58cfef..a99f64d6a 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -4,7 +4,7 @@ import vuetify from "./plugins/vuetify"; import store from "./store/store"; import VueRouter from "vue-router"; import { routes } from "./routes"; -import i18n from './i18n' +import i18n from "./i18n"; Vue.config.productionTip = false; Vue.use(VueRouter); @@ -14,12 +14,13 @@ const router = new VueRouter({ mode: process.env.NODE_ENV === "production" ? "history" : "hash", }); + new Vue({ vuetify, store, router, i18n, - render: (h) => h(App) + render: h => h(App), }).$mount("#app"); // Truncate diff --git a/frontend/src/pages/SettingsPage.vue b/frontend/src/pages/SettingsPage.vue index 441029ef3..bc1d2a924 100644 --- a/frontend/src/pages/SettingsPage.vue +++ b/frontend/src/pages/SettingsPage.vue @@ -13,7 +13,8 @@ " > - + + @@ -39,6 +40,7 @@