From 1235cb8da54f98d5337092b7ca1bf9f85ef5ea97 Mon Sep 17 00:00:00 2001 From: tooboredtocode Date: Fri, 22 Mar 2024 00:31:56 +0100 Subject: [PATCH 01/62] feat: improve docker run speeds --- Dockerfile | 19 +++++++++++++------ boot.sh | 22 +++++++++++++++++----- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3f17d0f11..a39850725 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg li #Print all logs without buffering it. ENV PYTHONUNBUFFERED 1 +ENV DOCKER true + #This port will be used by gunicorn. EXPOSE 8080 @@ -23,18 +25,23 @@ RUN \ RUN sed -i '/# Development/,$d' requirements.txt RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \ echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ - python -m venv venv && \ - /opt/recipes/venv/bin/python -m pip install --upgrade pip && \ - venv/bin/pip install wheel==0.42.0 && \ - venv/bin/pip install setuptools_rust==1.9.0 && \ - venv/bin/pip install -r requirements.txt --no-cache-dir &&\ + python -m pip install --upgrade pip && \ + pip install wheel==0.42.0 && \ + pip install setuptools_rust==1.9.0 && \ + pip install -r requirements.txt --no-cache-dir &&\ apk --purge del .build-deps #Copy project and execute it. COPY . ./ +# collect the static files +RUN python manage.py collectstatic_js_reverse +RUN python manage.py collectstatic --noinput +# copy the collected static files to a different location, so they can be moved into a potentially mounted volume +RUN mv /opt/recipes/staticfiles /opt/recipes/staticfiles-collect + # collect information from git repositories -RUN /opt/recipes/venv/bin/python version.py +RUN python version.py # delete git repositories to reduce image size RUN find . -type d -name ".git" | xargs rm -rf diff --git a/boot.sh b/boot.sh index ae3dbb51d..1c3c09a76 100644 --- a/boot.sh +++ b/boot.sh @@ -1,5 +1,9 @@ #!/bin/sh -source venv/bin/activate + +# conditionally activate virtualenv, since the docker container does not need it +if [[ "${DOCKER}" != "true" ]]; then + source venv/bin/activate +fi TANDOOR_PORT="${TANDOOR_PORT:-8080}" GUNICORN_WORKERS="${GUNICORN_WORKERS:-3}" @@ -67,12 +71,20 @@ echo "Migrating database" python manage.py migrate -echo "Generating static files" +if [[ "${DOCKER}" == "true" ]]; then + echo "Collecting static files" -python manage.py collectstatic_js_reverse -python manage.py collectstatic --noinput + mkdir -p /opt/recipes/staticfiles + mv /opt/recipes/staticfiles-collect/* /opt/recipes/staticfiles + rm -rf /opt/recipes/staticfiles-collect +else + echo "Generating static files" -echo "Done" + python manage.py collectstatic_js_reverse + python manage.py collectstatic --noinput + + echo "Done" +fi chmod -R 755 /opt/recipes/mediafiles From 5f211e420e2212dd71d1d7120a11e4272aa50643 Mon Sep 17 00:00:00 2001 From: tooboredtocode Date: Fri, 22 Mar 2024 02:50:18 +0100 Subject: [PATCH 02/62] fix: moving into exisiting files --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a39850725..1de5178b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,7 @@ COPY . ./ RUN python manage.py collectstatic_js_reverse RUN python manage.py collectstatic --noinput # copy the collected static files to a different location, so they can be moved into a potentially mounted volume +RUN rm -rf /opt/recipes/staticfiles/* RUN mv /opt/recipes/staticfiles /opt/recipes/staticfiles-collect # collect information from git repositories From ae37abf8b21d3e9f13773d6857efbaed8db501ae Mon Sep 17 00:00:00 2001 From: tooboredtocode Date: Fri, 22 Mar 2024 11:26:26 +0100 Subject: [PATCH 03/62] fix: fix modified the wrong file --- Dockerfile | 1 - boot.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1de5178b4..a39850725 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,6 @@ COPY . ./ RUN python manage.py collectstatic_js_reverse RUN python manage.py collectstatic --noinput # copy the collected static files to a different location, so they can be moved into a potentially mounted volume -RUN rm -rf /opt/recipes/staticfiles/* RUN mv /opt/recipes/staticfiles /opt/recipes/staticfiles-collect # collect information from git repositories diff --git a/boot.sh b/boot.sh index 1c3c09a76..286d6c983 100644 --- a/boot.sh +++ b/boot.sh @@ -75,6 +75,7 @@ if [[ "${DOCKER}" == "true" ]]; then echo "Collecting static files" mkdir -p /opt/recipes/staticfiles + rm -rf /opt/recipes/staticfiles/* mv /opt/recipes/staticfiles-collect/* /opt/recipes/staticfiles rm -rf /opt/recipes/staticfiles-collect else From 7bfa23b953a2a9ee671f23af7d55fbc997461e10 Mon Sep 17 00:00:00 2001 From: tooboredtocode Date: Fri, 22 Mar 2024 11:32:30 +0100 Subject: [PATCH 04/62] feat: better messages --- boot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot.sh b/boot.sh index 286d6c983..7d6ec7442 100644 --- a/boot.sh +++ b/boot.sh @@ -72,14 +72,14 @@ echo "Migrating database" python manage.py migrate if [[ "${DOCKER}" == "true" ]]; then - echo "Collecting static files" + echo "Copying cached static files from docker build" mkdir -p /opt/recipes/staticfiles rm -rf /opt/recipes/staticfiles/* mv /opt/recipes/staticfiles-collect/* /opt/recipes/staticfiles rm -rf /opt/recipes/staticfiles-collect else - echo "Generating static files" + echo "Collecting static files, this may take a while..." python manage.py collectstatic_js_reverse python manage.py collectstatic --noinput From 20b812c2cce1db0101a3fb2a10abca90410e44a3 Mon Sep 17 00:00:00 2001 From: tooboredtocode Date: Fri, 22 Mar 2024 19:04:29 +0100 Subject: [PATCH 05/62] feat: re-add venv --- Dockerfile | 15 ++++++++------- boot.sh | 6 +----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index a39850725..c5856bcfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,23 +25,24 @@ RUN \ RUN sed -i '/# Development/,$d' requirements.txt RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \ echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ - python -m pip install --upgrade pip && \ - pip install wheel==0.42.0 && \ - pip install setuptools_rust==1.9.0 && \ - pip install -r requirements.txt --no-cache-dir &&\ + python -m venv venv && \ + /opt/recipes/venv/bin/python -m pip install --upgrade pip && \ + venv/bin/pip install wheel==0.42.0 && \ + venv/bin/pip install setuptools_rust==1.9.0 && \ + venv/bin/pip install -r requirements.txt --no-cache-dir &&\ apk --purge del .build-deps #Copy project and execute it. COPY . ./ # collect the static files -RUN python manage.py collectstatic_js_reverse -RUN python manage.py collectstatic --noinput +RUN /opt/recipes/venv/bin/python manage.py collectstatic_js_reverse +RUN /opt/recipes/venv/bin/python manage.py collectstatic --noinput # copy the collected static files to a different location, so they can be moved into a potentially mounted volume RUN mv /opt/recipes/staticfiles /opt/recipes/staticfiles-collect # collect information from git repositories -RUN python version.py +RUN /opt/recipes/venv/bin/python version.py # delete git repositories to reduce image size RUN find . -type d -name ".git" | xargs rm -rf diff --git a/boot.sh b/boot.sh index 7d6ec7442..ab5d7fddd 100644 --- a/boot.sh +++ b/boot.sh @@ -1,9 +1,5 @@ #!/bin/sh - -# conditionally activate virtualenv, since the docker container does not need it -if [[ "${DOCKER}" != "true" ]]; then - source venv/bin/activate -fi +source venv/bin/activate TANDOOR_PORT="${TANDOOR_PORT:-8080}" GUNICORN_WORKERS="${GUNICORN_WORKERS:-3}" From 441c55936d895a31cd1d28697e0973fd21183090 Mon Sep 17 00:00:00 2001 From: Mikhail Epifanov Date: Tue, 26 Mar 2024 22:46:04 +0100 Subject: [PATCH 06/62] use normal async client for api calls --- cookbook/connectors/homeassistant.py | 62 ++++++++++++++++------------ requirements.txt | 2 +- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/cookbook/connectors/homeassistant.py b/cookbook/connectors/homeassistant.py index e653c3f3d..bdd52c8b1 100644 --- a/cookbook/connectors/homeassistant.py +++ b/cookbook/connectors/homeassistant.py @@ -1,26 +1,33 @@ import logging from logging import Logger +from typing import Dict +from urllib.parse import urljoin -from homeassistant_api import Client, HomeassistantAPIError, Domain +from aiohttp import ClientError, request from cookbook.connectors.connector import Connector from cookbook.models import ShoppingListEntry, ConnectorConfig, Space class HomeAssistant(Connector): - _domains_cache: dict[str, Domain] _config: ConnectorConfig _logger: Logger - _client: Client def __init__(self, config: ConnectorConfig): if not config.token or not config.url or not config.todo_entity: raise ValueError("config for HomeAssistantConnector in incomplete") - self._domains_cache = dict() self._config = config self._logger = logging.getLogger("connector.HomeAssistant") - self._client = Client(self._config.url, self._config.token, async_cache_session=False, use_async=True) + + async def send_api_call(self, method: str, path: str, data: Dict) -> str: + headers = { + "Authorization": f"Bearer {self._config.token}", + "Content-Type": "application/json" + } + async with request(method, urljoin(self._config.url, path), headers=headers, json=data) as response: + response.raise_for_status() + return await response.json() async def on_shopping_list_entry_created(self, space: Space, shopping_list_entry: ShoppingListEntry) -> None: if not self._config.on_shopping_list_entry_created_enabled: @@ -28,15 +35,17 @@ class HomeAssistant(Connector): item, description = _format_shopping_list_entry(shopping_list_entry) - todo_domain = self._domains_cache.get('todo') - try: - if todo_domain is None: - todo_domain = await self._client.async_get_domain('todo') - self._domains_cache['todo'] = todo_domain + logging.debug(f"adding {item=} to {self._config.name}") - logging.debug(f"pushing {item} to {self._config.name}") - await todo_domain.add_item(entity_id=self._config.todo_entity, item=item) - except HomeassistantAPIError as err: + data = { + "entity_id": self._config.todo_entity, + "item": item, + "description": description, + } + + try: + await self.send_api_call("POST", "services/todo/add_item", data) + except ClientError as err: self._logger.warning(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}") async def on_shopping_list_entry_updated(self, space: Space, shopping_list_entry: ShoppingListEntry) -> None: @@ -48,21 +57,22 @@ class HomeAssistant(Connector): if not self._config.on_shopping_list_entry_deleted_enabled: return - item, description = _format_shopping_list_entry(shopping_list_entry) + item, _ = _format_shopping_list_entry(shopping_list_entry) + + logging.debug(f"removing {item=} from {self._config.name}") + + data = { + "entity_id": self._config.todo_entity, + "item": item, + } - todo_domain = self._domains_cache.get('todo') try: - if todo_domain is None: - todo_domain = await self._client.async_get_domain('todo') - self._domains_cache['todo'] = todo_domain - - logging.debug(f"deleting {item} from {self._config.name}") - await todo_domain.remove_item(entity_id=self._config.todo_entity, item=item) - except HomeassistantAPIError as err: + await self.send_api_call("POST", "services/todo/remove_item", data) + except ClientError as err: self._logger.warning(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}") async def close(self) -> None: - await self._client.async_cache_session.close() + pass def _format_shopping_list_entry(shopping_list_entry: ShoppingListEntry): @@ -76,10 +86,10 @@ def _format_shopping_list_entry(shopping_list_entry: ShoppingListEntry): else: item += ")" - description = "Imported by TandoorRecipes" + description = "From TandoorRecipes" if shopping_list_entry.created_by.first_name and len(shopping_list_entry.created_by.first_name) > 0: - description += f", created by {shopping_list_entry.created_by.first_name}" + description += f", by {shopping_list_entry.created_by.first_name}" else: - description += f", created by {shopping_list_entry.created_by.username}" + description += f", by {shopping_list_entry.created_by.username}" return item, description diff --git a/requirements.txt b/requirements.txt index 1c4962076..3ef2dd2b6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ django-auth-ldap==4.6.0 pyppeteer==2.0.0 validators==0.20.0 pytube==15.0.0 -homeassistant-api==4.1.1.post2 +aiohttp==3.9.3 # Development pytest==8.0.0 From 41a448578aceb4244b1ca80b1e4cabc205a93856 Mon Sep 17 00:00:00 2001 From: Mikhail Epifanov Date: Tue, 26 Mar 2024 23:21:23 +0100 Subject: [PATCH 07/62] extra check if we arent accidently doing a query --- cookbook/connectors/homeassistant.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cookbook/connectors/homeassistant.py b/cookbook/connectors/homeassistant.py index bdd52c8b1..f824a4262 100644 --- a/cookbook/connectors/homeassistant.py +++ b/cookbook/connectors/homeassistant.py @@ -1,6 +1,6 @@ import logging from logging import Logger -from typing import Dict +from typing import Dict, Tuple from urllib.parse import urljoin from aiohttp import ClientError, request @@ -17,10 +17,12 @@ class HomeAssistant(Connector): if not config.token or not config.url or not config.todo_entity: raise ValueError("config for HomeAssistantConnector in incomplete") + if config.url[-1] != "/": + config.url += "/" self._config = config self._logger = logging.getLogger("connector.HomeAssistant") - async def send_api_call(self, method: str, path: str, data: Dict) -> str: + async def homeassistant_api_call(self, method: str, path: str, data: Dict) -> str: headers = { "Authorization": f"Bearer {self._config.token}", "Content-Type": "application/json" @@ -44,7 +46,7 @@ class HomeAssistant(Connector): } try: - await self.send_api_call("POST", "services/todo/add_item", data) + await self.homeassistant_api_call("POST", "services/todo/add_item", data) except ClientError as err: self._logger.warning(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}") @@ -57,6 +59,11 @@ class HomeAssistant(Connector): if not self._config.on_shopping_list_entry_deleted_enabled: return + if not hasattr(shopping_list_entry._state.fields_cache, "food"): + # Sometimes the food foreign key is not loaded, and we cant load it from an async process + self._logger.debug("required property was not present in ShoppingListEntry") + return + item, _ = _format_shopping_list_entry(shopping_list_entry) logging.debug(f"removing {item=} from {self._config.name}") @@ -67,15 +74,16 @@ class HomeAssistant(Connector): } try: - await self.send_api_call("POST", "services/todo/remove_item", data) + await self.homeassistant_api_call("POST", "services/todo/remove_item", data) except ClientError as err: - self._logger.warning(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}") + # This error will always trigger if the item is not present/found + self._logger.debug(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}") async def close(self) -> None: pass -def _format_shopping_list_entry(shopping_list_entry: ShoppingListEntry): +def _format_shopping_list_entry(shopping_list_entry: ShoppingListEntry) -> Tuple[str, str]: item = shopping_list_entry.food.name if shopping_list_entry.amount > 0: item += f" ({shopping_list_entry.amount:.2f}".rstrip('0').rstrip('.') From be388b0d10ac6a3b067f0a9512c87725a7aa8e91 Mon Sep 17 00:00:00 2001 From: Axel Breiterman Date: Tue, 26 Mar 2024 18:14:36 +0000 Subject: [PATCH 08/62] Translated using Weblate (Spanish) Currently translated at 53.1% (258 of 485 strings) Translation: Tandoor/Recipes Backend Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/es/ --- cookbook/locale/es/LC_MESSAGES/django.po | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/cookbook/locale/es/LC_MESSAGES/django.po b/cookbook/locale/es/LC_MESSAGES/django.po index c217d727c..408afd2dd 100644 --- a/cookbook/locale/es/LC_MESSAGES/django.po +++ b/cookbook/locale/es/LC_MESSAGES/django.po @@ -14,8 +14,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-03-21 14:39+0100\n" -"PO-Revision-Date: 2023-09-25 09:59+0000\n" -"Last-Translator: Matias Laporte \n" +"PO-Revision-Date: 2024-03-27 19:02+0000\n" +"Last-Translator: Axel Breiterman \n" "Language-Team: Spanish \n" "Language: es\n" @@ -23,7 +23,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.15\n" +"X-Generator: Weblate 5.4.2\n" #: .\cookbook\forms.py:45 msgid "" @@ -97,14 +97,16 @@ msgid "" "Long Lived Access Token for your HomeAssistant instance" msgstr "" +"Token de larga duraciónpara tu instancia de HomeAssistant" #: .\cookbook\forms.py:193 msgid "Something like http://homeassistant.local:8123/api" -msgstr "" +msgstr "Algo similar a http://homeassistant.local:8123/api" #: .\cookbook\forms.py:205 msgid "http://homeassistant.local:8123/api for example" -msgstr "" +msgstr "por ejemplo http://homeassistant.local:8123/api for example" #: .\cookbook\forms.py:222 .\cookbook\views\edit.py:117 msgid "Storage" @@ -279,7 +281,7 @@ msgstr "Ha alcanzado el número máximo de recetas para su espacio." #: .\cookbook\helper\permission_helper.py:414 msgid "You have more users than allowed in your space." -msgstr "" +msgstr "Tenés mas usuarios que los permitidos en tu espacio" #: .\cookbook\helper\recipe_url_import.py:304 #, fuzzy @@ -309,7 +311,7 @@ msgstr "fermentar" #: .\cookbook\helper\recipe_url_import.py:310 msgid "sous-vide" -msgstr "" +msgstr "sous-vide" #: .\cookbook\helper\shopping_helper.py:150 msgid "You must supply a servings size" @@ -318,7 +320,7 @@ msgstr "Debe proporcionar un tamaño de porción" #: .\cookbook\helper\template_helper.py:95 #: .\cookbook\helper\template_helper.py:97 msgid "Could not parse template code." -msgstr "" +msgstr "No se pudo parsear el código de la planitlla." #: .\cookbook\integration\copymethat.py:44 #: .\cookbook\integration\melarecipes.py:37 @@ -342,6 +344,8 @@ msgid "" "An unexpected error occurred during the import. Please make sure you have " "uploaded a valid file." msgstr "" +"Ocurrió un error inesperado al importar. Por favor asegurate de haber subido " +"un archivo válido." #: .\cookbook\integration\integration.py:217 msgid "The following recipes were ignored because they already existed:" @@ -457,7 +461,7 @@ msgstr "Calorías" #: .\cookbook\migrations\0190_auto_20230525_1506.py:20 msgid "kcal" -msgstr "" +msgstr "kcal" #: .\cookbook\models.py:325 msgid "" From ad8d8daf7986a917b46669ed4a10a860826f9ac9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 06:40:03 +0000 Subject: [PATCH 09/62] Bump express from 4.18.2 to 4.19.2 in /vue Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](https://github.com/expressjs/express/compare/4.18.2...4.19.2) --- updated-dependencies: - dependency-name: express dependency-type: indirect ... Signed-off-by: dependabot[bot] --- vue/yarn.lock | 48 ++++++++++-------------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/vue/yarn.lock b/vue/yarn.lock index fbbdc4b87..663c77a06 100644 --- a/vue/yarn.lock +++ b/vue/yarn.lock @@ -3717,25 +3717,7 @@ bn.js@^5.0.0, bn.js@^5.2.1: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -body-parser@1.20.1: - version "1.20.1" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" - integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== - dependencies: - bytes "3.1.2" - content-type "~1.0.4" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.1" - type-is "~1.6.18" - unpipe "1.0.0" - -body-parser@^1.19.0: +body-parser@1.20.2, body-parser@^1.19.0: version "1.20.2" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== @@ -4511,10 +4493,10 @@ cookie-signature@1.0.6: resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== -cookie@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== +cookie@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== copy-concurrently@^1.0.0: version "1.0.5" @@ -5652,16 +5634,16 @@ express-history-api-fallback@^2.2.1: integrity sha512-swxwm3aP8vrOOvlzOdZvHlSZtJGwHKaY94J6AkrAgCTmcbko3IRwbkhLv2wKV1WeZhjxX58aLMpP3atDBnKuZg== express@^4.17.1, express@^4.17.3: - version "4.18.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" - integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== + version "4.19.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" + integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== dependencies: accepts "~1.3.8" array-flatten "1.1.1" - body-parser "1.20.1" + body-parser "1.20.2" content-disposition "0.5.4" content-type "~1.0.4" - cookie "0.5.0" + cookie "0.6.0" cookie-signature "1.0.6" debug "2.6.9" depd "2.0.0" @@ -9351,16 +9333,6 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - raw-body@2.5.2: version "2.5.2" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" From c1d6e983491f41201dadb670d15dd66d6f186f45 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 28 Mar 2024 16:44:20 +0100 Subject: [PATCH 10/62] playing with meal plan edit dialog --- .../src/components/dialogs/MealPlanDialog.vue | 66 +++++++++++++++++++ .../display/HorizontalMealPlanWindow.vue | 7 +- vue3/src/pages/MealPlanPage.vue | 34 +--------- vue3/src/pages/RecipeSearchPage.vue | 3 +- 4 files changed, 76 insertions(+), 34 deletions(-) create mode 100644 vue3/src/components/dialogs/MealPlanDialog.vue diff --git a/vue3/src/components/dialogs/MealPlanDialog.vue b/vue3/src/components/dialogs/MealPlanDialog.vue new file mode 100644 index 000000000..e1544ca49 --- /dev/null +++ b/vue3/src/components/dialogs/MealPlanDialog.vue @@ -0,0 +1,66 @@ + + + + + \ No newline at end of file diff --git a/vue3/src/components/display/HorizontalMealPlanWindow.vue b/vue3/src/components/display/HorizontalMealPlanWindow.vue index faca43a8e..eb2f07c19 100644 --- a/vue3/src/components/display/HorizontalMealPlanWindow.vue +++ b/vue3/src/components/display/HorizontalMealPlanWindow.vue @@ -19,7 +19,10 @@ {{ mealPlanGridItem.date_label }}
- + + + +
@@ -37,6 +40,7 @@ {{ p.mealType.name }} + @@ -57,6 +61,7 @@ import {useDisplay} from "vuetify"; import {MealPlan, Recipe, RecipeOverview} from "@/openapi"; import {useMealPlanStore} from "@/stores/MealPlanStore"; import {DateTime} from "luxon"; +import MealPlanDialog from "@/components/dialogs/MealPlanDialog.vue"; const {mdAndUp} = useDisplay() const loading = ref(false) diff --git a/vue3/src/pages/MealPlanPage.vue b/vue3/src/pages/MealPlanPage.vue index 9bedb7a14..3fc1fb9ab 100644 --- a/vue3/src/pages/MealPlanPage.vue +++ b/vue3/src/pages/MealPlanPage.vue @@ -1,30 +1,6 @@ diff --git a/vue3/src/vueform.ts b/vue3/src/vueform.ts index c4ab4f7c1..8ae80ff45 100644 --- a/vue3/src/vueform.ts +++ b/vue3/src/vueform.ts @@ -10,9 +10,9 @@ export default defineConfig({ locales: { en }, locale: 'en', overrideClasses: { - // ElementAddon: { - // container: 'vf-addon ps-0 pe-0', - // } + ElementAddon: { + container: 'vf-addon ps-0 pe-0', + } }, }) From cb98b6723f184c3c84c08c312a5e424910d55180 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 29 Mar 2024 20:08:48 +0100 Subject: [PATCH 13/62] first version of meal plan diaglo --- .../src/components/dialogs/MealPlanDialog.vue | 56 +- .../display/HorizontalMealPlanWindow.vue | 22 +- vue3/src/openapi/.openapi-generator/FILES | 20 +- vue3/src/openapi/apis/ApiApi.ts | 1787 +++++++++++++++++ vue3/src/openapi/models/Automation.ts | 18 +- vue3/src/openapi/models/PatchedAutomation.ts | 18 +- vue3/src/openapi/models/index.ts | 20 +- vue3/src/pages/MealPlanPage.vue | 17 +- 8 files changed, 1916 insertions(+), 42 deletions(-) diff --git a/vue3/src/components/dialogs/MealPlanDialog.vue b/vue3/src/components/dialogs/MealPlanDialog.vue index b41e5bffa..efb92f1b7 100644 --- a/vue3/src/components/dialogs/MealPlanDialog.vue +++ b/vue3/src/components/dialogs/MealPlanDialog.vue @@ -6,8 +6,22 @@ + - +