From f23b566689af9aaf72b363c176ab2e30d500fdca Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 17 Feb 2022 14:53:40 +0100 Subject: [PATCH 1/7] changed feature request template --- .github/ISSUE_TEMPLATE/feature_request.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index ad823cfac..bbefb0e48 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -29,11 +29,3 @@ body: attributes: label: "Additional context" description: "Add any other context or screenshots about the feature request here." - - type: checkboxes - attributes: - label: "Contribute" - description: "Are you willing and able to help develop this feature?" - options: - - label: "Yes" - - label: "Partly" - - label: "No" From 7e5019eed3fd54afab772a79b559531758960ab9 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 17 Feb 2022 14:57:28 +0100 Subject: [PATCH 2/7] fixed share write permission for meal plan --- cookbook/views/api.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 0a4b61586..360d6d0e3 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -107,6 +107,7 @@ class ExtendedRecipeMixin(): ''' ExtendedRecipe annotates a queryset with recipe_image and recipe_count values ''' + @classmethod def annotate_recipe(self, queryset=None, request=None, serializer=None, tree=False): extended = str2bool(request.query_params.get('extended', None)) @@ -146,10 +147,10 @@ class FuzzyFilterMixin(ViewSetMixin, ExtendedRecipeMixin): if fuzzy: self.queryset = ( self.queryset - .annotate(starts=Case(When(name__istartswith=query, then=(Value(.3, output_field=IntegerField()))), default=Value(0))) - .annotate(trigram=TrigramSimilarity('name', query)) - .annotate(sort=F('starts')+F('trigram')) - .order_by('-sort') + .annotate(starts=Case(When(name__istartswith=query, then=(Value(.3, output_field=IntegerField()))), default=Value(0))) + .annotate(trigram=TrigramSimilarity('name', query)) + .annotate(sort=F('starts') + F('trigram')) + .order_by('-sort') ) else: # TODO have this check unaccent search settings or other search preferences? @@ -183,8 +184,8 @@ class FuzzyFilterMixin(ViewSetMixin, ExtendedRecipeMixin): class MergeMixin(ViewSetMixin): - @ decorators.action(detail=True, url_path='merge/(?P[^/.]+)', methods=['PUT'], ) - @ decorators.renderer_classes((TemplateHTMLRenderer, JSONRenderer)) + @decorators.action(detail=True, url_path='merge/(?P[^/.]+)', methods=['PUT'], ) + @decorators.renderer_classes((TemplateHTMLRenderer, JSONRenderer)) def merge(self, request, pk, target): self.description = f"Merge {self.basename} onto target {self.basename} with ID of [int]." @@ -280,8 +281,8 @@ class TreeMixin(MergeMixin, FuzzyFilterMixin, ExtendedRecipeMixin): return self.annotate_recipe(queryset=self.queryset, request=self.request, serializer=self.serializer_class, tree=True) - @ decorators.action(detail=True, url_path='move/(?P[^/.]+)', methods=['PUT'], ) - @ decorators.renderer_classes((TemplateHTMLRenderer, JSONRenderer)) + @decorators.action(detail=True, url_path='move/(?P[^/.]+)', methods=['PUT'], ) + @decorators.renderer_classes((TemplateHTMLRenderer, JSONRenderer)) def move(self, request, pk, parent): self.description = f"Move {self.basename} to be a child of {self.basename} with ID of [int]. Use ID: 0 to move {self.basename} to the root." if self.model.node_order_by: @@ -461,7 +462,7 @@ class FoodViewSet(viewsets.ModelViewSet, TreeMixin): # onhand_status = self.queryset.annotate(onhand_status=Exists(onhand_users_set__in=[shared_users])) return self.queryset.annotate(shopping_status=Exists(shopping_status)).prefetch_related('onhand_users', 'inherit_fields').select_related('recipe', 'supermarket_category') - @ decorators.action(detail=True, methods=['PUT'], serializer_class=FoodShoppingUpdateSerializer,) + @decorators.action(detail=True, methods=['PUT'], serializer_class=FoodShoppingUpdateSerializer, ) # TODO DRF only allows one action in a decorator action without overriding get_operation_id_base() this should be PUT and DELETE probably def shopping(self, request, pk): if self.request.space.demo: @@ -540,7 +541,7 @@ class MealPlanViewSet(viewsets.ModelViewSet): """ queryset = MealPlan.objects serializer_class = MealPlanSerializer - permission_classes = [CustomIsOwner] + permission_classes = [CustomIsOwner | CustomIsShared] def get_queryset(self): queryset = self.queryset.filter( From 6a73ac0a331d14132249718439a90e783c65755e Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 17 Feb 2022 15:20:42 +0100 Subject: [PATCH 3/7] fixed editor leave warning --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 14ccd0c3f..215f9fb86 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -656,8 +656,8 @@ export default { }, warnPageLeave: function (event) { if (this.recipe_changed) { - event.returnValue = "" - return "" + event.returnValue = "this_string_cant_be_empty_because_of_firefox" + return "this_string_cant_be_empty_because_of_firefox" } }, loadRecipe: function () { @@ -672,8 +672,8 @@ export default { // set default visibility style for each component of the step this.recipe.steps.forEach((s) => { this.$set(s, "time_visible", s.time !== 0) - this.$set(s, "ingredients_visible", s.ingredients.length > 0) - this.$set(s, "instruction_visible", s.instruction !== "") + this.$set(s, "ingredients_visible", s.ingredients.length > 0 || this.recipe.steps.length === 1) + this.$set(s, "instruction_visible", s.instruction !== "" || this.recipe.steps.length === 1) this.$set(s, "step_recipe_visible", s.step_recipe !== null) this.$set(s, "file_visible", s.file !== null) }) From 26a5c665de29e1b1cdd06e472743940cc689b41d Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 17 Feb 2022 15:30:08 +0100 Subject: [PATCH 4/7] fixed instructions rendering next to ingredients on small devices --- vue/src/components/StepComponent.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vue/src/components/StepComponent.vue b/vue/src/components/StepComponent.vue index 38ccdf19f..f7c2b8ba8 100644 --- a/vue/src/components/StepComponent.vue +++ b/vue/src/components/StepComponent.vue @@ -32,15 +32,16 @@
-
- +
+
+ :class="{ 'col-md-8 col-12': recipe.steps.length > 1, 'col-md-12 col-12': recipe.steps.length <= 1 }">
From 9e7a908136ef18c2aa585e055e844b5f299facda Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Fri, 18 Feb 2022 13:23:51 +0100 Subject: [PATCH 5/7] Add syntax highlighting for nginx subpath example --- docs/install/docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/install/docker.md b/docs/install/docker.md index b8ed504eb..e309099ef 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -354,7 +354,7 @@ follow these instructions: If hosting under a sub-path you might want to change the default nginx config (which gets mounted through the named volume from the application container into the nginx container) with the following config. -``` +```nginx location /my_app { # change to subfolder name include /config/nginx/proxy.conf; proxy_pass https://mywebapp.com/; # change to your host name:port @@ -378,4 +378,4 @@ location /static/ { client_max_body_size 16M; } -``` \ No newline at end of file +``` From e691eaf72ff839e567cf8844b2464d0c11a0f22d Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Fri, 18 Feb 2022 13:25:20 +0100 Subject: [PATCH 6/7] Update docker.md --- docs/install/docker.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/install/docker.md b/docs/install/docker.md index e309099ef..dea392b38 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -371,7 +371,6 @@ location /media/ { } - location /static/ { include /config/nginx/proxy.conf; alias /staticfiles/; From 21df09d0ba5d3bb1c2115e60a70d235c0687e2ce Mon Sep 17 00:00:00 2001 From: Maxi Date: Fri, 18 Feb 2022 16:35:27 +0100 Subject: [PATCH 7/7] Added 502 error page for system startup --- nginx/conf.d/Recipes.conf | 7 +++++++ nginx/conf.d/errorpages/http502.html | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 nginx/conf.d/errorpages/http502.html diff --git a/nginx/conf.d/Recipes.conf b/nginx/conf.d/Recipes.conf index 71fbed51e..22829720f 100644 --- a/nginx/conf.d/Recipes.conf +++ b/nginx/conf.d/Recipes.conf @@ -12,5 +12,12 @@ server { location / { proxy_set_header Host $http_host; proxy_pass http://web_recipes:8080; + + error_page 502 /errors/http502.html; + } + + location /errors/ { + alias /etc/nginx/conf.d/errorpages/; + internal; } } diff --git a/nginx/conf.d/errorpages/http502.html b/nginx/conf.d/errorpages/http502.html new file mode 100644 index 000000000..e984b9782 --- /dev/null +++ b/nginx/conf.d/errorpages/http502.html @@ -0,0 +1,20 @@ + + + + + + 502 - Webservice currently unavailable + + + +

Tandoor Recipes is not yet available 502

+

+ Services are still trying to start.
+ Please allow up to 3 minutes after you started the application on your server.

+ If this status persists, check the application or docker logs for further information.
+ After checking and trying everything mentioned in the docs, you can request help on the project's GitHub page. +

+
+ + + \ No newline at end of file