Skip to content

Commit 7c3c245

Browse files
opencodehangy
andcommitted
chore(templates): resolve merge conflict keeping class-based panels and main features
Merge origin/main into simpler-template. Two conflicted paths; everything else merged cleanly and is staged as-is. Context of each side: - This PR (simpler-template) de-inlines presentation from the knowledge panel template: templates/web/panels/panel.tt.html no longer carries style="..." attributes; the corresponding rules were moved into scss/_product-page.scss as reusable classes (.panel_small, .panel_margin_small/.panel_margin_large, .panel_title_small, .panel_icon very_small/small/large, .small-panel, .small-subtitle, .text-icon, .text-container, .valign-middle, .custom-class, .custom-container, .image_source, .hidden). - main kept the inline styles but functionally extended the same areas of panel.tt.html: panels without elements now render an inactive accordion item (new has_elements variable, accordion-navigation-inactive class, <a> switched to <div> via IF has_elements); new title fallbacks (title -> name) plus new value_string / value (with percent type) subtitle branches; image imgid lookup and nutripatrol_url parameter; actions wrapped in <div>; table_id renamed to element.id; map block rewritten as an ES module import. scss/_product-page.scss: - Conflict was two independent additions at the end of the file. Resolution keeps both blocks verbatim: first the knowledge panel classes from this PR (required by the refactored template - dropping them would leave every panel size/icon/text rule undefined), then main's SVG barcode responsive rules (#barcode_div_code/#barcode_div_svg inline-block, hidden under 600px). No selector or declaration was modified; only the three conflict marker lines were removed. templates/web/panels/panel.tt.html: - wrapper_for_other_types header: applied main's functional changes on top of the PR's class-based markup. The <ul> keeps the panel_margin_[small|large] class instead of main's inline margins; the <li> gains main's accordion-navigation-inactive when has_elements is false; the title tag uses main's <a>/<div> switch while keeping the PR's panel_title_small class instead of main's inline padding style. - subtitle block: kept the PR's class-based span for the existing subtitle branch, and grafted main's new value_string / value / percent branches onto it. Their inline style="font-size:0.9rem;" were expressed through the PR's equivalent small-subtitle class so that new content introduced by main follows this PR's stated goal (no inline styles in templates). Trailing whitespace from main's line was dropped. - Everything outside the conflict regions is the auto-merge result: main's has_elements logic, name/title fallback, value_string/value branches, image handling, action wrappers, table id and module-based map are all retained unchanged. Verification: no conflict markers remain; Template::Toolkit directive counts of the resolved file (opens 65 / ends 67) match main's side exactly, with the same pre-existing +2 comment-banner offset already present in both parents, so no block was broken by the resolution. Merge conflict resolved by Ox Alpha Free (Unlimited), running via OpenCode Zen. Co-authored-by: hangy <hangy@hangy.de>
2 parents b8088be + 6a1c019 commit 7c3c245

5,106 files changed

Lines changed: 2915417 additions & 1052551 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

-6 KB
Binary file not shown.

.devcontainer/devcontainer.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"name": "Perl",
3+
"initializeCommand": "make run_deps",
34
"dockerComposeFile": [
45
"../docker-compose.yml",
56
"../docker/dev.yml",
7+
"../docker/run.yml",
68
"../docker/devcontainer.yml"
79
],
8-
"containerUser": "root",
10+
"containerEnv": {
11+
"HOME": "/tmp"
12+
},
913
"capAdd": [
1014
"SYS_PTRACE"
1115
],
@@ -16,12 +20,12 @@
1620
"runServices": [
1721
"memcached",
1822
"postgres",
19-
"mongodb",
2023
"dynamicfront",
2124
"frontend",
2225
"incron",
2326
"minion",
24-
"redis"
27+
"redis-listener",
28+
"keycloak"
2529
],
2630
"workspaceFolder": "/opt/product-opener",
2731
"customizations": {
@@ -36,7 +40,9 @@
3640
"dbaeumer.vscode-eslint",
3741
"stylelint.vscode-stylelint",
3842
"syler.sass-indented",
39-
"mrorz.language-gettext"
43+
"mrorz.language-gettext",
44+
"SonarSource.sonarlint-vscode",
45+
"codecov.codecov"
4046
]
4147
}
4248
},

.dockerignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
2+
deps/
23
.devcontainer
34
.git
45
.github
@@ -7,6 +8,10 @@ logs
78
debug/
89
perl-language-server.log
910

11+
# tests outputs
12+
tests/unit/outputs/
13+
tests/integration/outputs/
14+
1015
openfoodfacts-mongodbdump.tar.gz
1116
openfoodfacts-products.jsonl.gz
1217
en.openfoodfacts.org.products.csv
@@ -36,4 +41,4 @@ packager-codes/*.csv
3641
packager-codes/*.tsv
3742
packager-codes/*.py
3843
packager-codes/*.json
39-
taxonomies*/**/*.sto
44+
taxonomies*/**/*.json

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ indent_size = 4
2222
# Python files: 4 spaces indentation
2323
[*.py]
2424
indent_size = 4
25+
26+
# Expected test results are for the most part autogenerated and should not have their formatting altered
27+
[tests/*/expected_test_results/*/*.html]
28+
end_of_line = unset
29+
indent_style = unset
30+
indent_size = unset
31+
insert_final_newline = unset
32+
trim_trailing_whitespace = false

.env

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ DOCKER_CLIENT_TIMEOUT=320
33
COMPOSE_HTTP_TIMEOUT=320
44
COMPOSE_PROJECT_NAME=po_off
55
COMPOSE_PATH_SEPARATOR=;
6-
COMPOSE_FILE=docker-compose.yml;docker/dev.yml
6+
COMPOSE_FILE=docker-compose.yml;docker/dev.yml;docker/run.yml
77
COMPOSE_PROFILES=off
88

9+
# when we don't need the dependencies
10+
COMPOSE_FILE_BUILD=docker-compose.yml;docker/dev.yml
11+
912
# exposition of product opener, leave blank to expose on all ports
1013
# ends with ":"
1114
PRODUCT_OPENER_EXPOSE=127.0.0.1:
@@ -25,6 +28,7 @@ WEB_RESOURCES_PATH=./web-default
2528
PRODUCERS_PLATFORM=0
2629
PRODUCT_OPENER_DOMAIN=openfoodfacts.localhost
2730
PRODUCT_OPENER_PORT=80
31+
PRODUCT_OPENER_HOST_PORT=80
2832
PRODUCT_OPENER_FLAVOR=openfoodfacts
2933
PRODUCT_OPENER_FLAVOR_SHORT=off
3034

@@ -45,15 +49,20 @@ MONGODB_CACHE_SIZE=8 # GB
4549
MONGO_INITDB_ROOT_USERNAME=root
4650
MONGO_INITDB_ROOT_PASSWORD=test
4751
ROBOTOFF_URL=http://robotoff.openfoodfacts.localhost:5500 # connect to Robotoff running in separate docker-compose deployment
52+
# Note: we can use port 80
53+
# because product opener nginx acts as a proxy to folksonomy API
54+
# to avoid CORS issues
55+
FOLKSONOMY_URL=http://api.folksonomy.openfoodfacts.localhost
4856
# connect to openfoodfacts-query running in separate docker-compose deployment.
4957
# To test locally change to http://host.docker.internal:5510
58+
# Note you will need to add basic auth to this if you want to upload scans, e.g. http://USER:PASSWORD@query:5510
5059
QUERY_URL=http://query:5510
5160
EVENTS_URL=
5261
FACETS_KP_URL = https://facets-kp.openfoodfacts.org/render-to-html
5362
# we push updated products to Redis stream so that every service is notified
5463
# when a product is updated/deleted/created
55-
# use `redis:6379` locally if you want to enable Redis
56-
REDIS_URL=
64+
# and for users subscription / removal etc.
65+
REDIS_URL=redis:6379
5766
GOOGLE_CLOUD_VISION_API_KEY=
5867
CROWDIN_PROJECT_IDENTIFIER=
5968
CROWDIN_PROJECT_KEY=
@@ -63,5 +72,49 @@ GEOLITE2_ACCOUNT_ID=
6372
ELASTICSEARCH_HOSTS=
6473
LOG_LEVEL_ROOT=TRACE
6574
LOG_LEVEL_MONGODB=TRACE
75+
LOG_LEVEL_RATE_LIMITER=TRACE
76+
ODOO_CRM_URL=
77+
ODOO_CRM_DB=
78+
ODOO_CRM_USER=
79+
ODOO_CRM_PASSWORD=
80+
# SLACK_HOOK_URLS=\#infrastructure=https://example.com,\#team=https://example.org
81+
82+
# No need to have it running, it's just to compose a URL
83+
# you might also use the .net service
84+
NUTRIPATROL_URL=http://nutripatrol.localhost
85+
86+
# Keycloak configuration
87+
# See Auth.pm for definition of levels
88+
# IMPORTANT: These are set in Config2.pm on public deployments.
89+
OIDC_IMPLEMENTATION_LEVEL=5
90+
OIDC_DISCOVERY_URL=http://keycloak:8080/realms/openfoodfacts/.well-known/openid-configuration
91+
OIDC_CLIENT_ID=OFF
92+
OIDC_CLIENT_SECRET=Cf4NdSAjZsNO9HLcuXeuvukzFu00roQa
93+
94+
BUILD_CACHE_REPO=openfoodfacts/openfoodfacts-build-cache
95+
96+
# If you want the rate limiter to block requests (return 429) instead of doing nothing,
97+
# set this to 1. Any other value will disable the blocking.
98+
RATE_LIMITER_BLOCKING_ENABLED=1
99+
100+
COMMON_NET_NAME=off_shared_network
101+
102+
#11901: Remove once production is migrated. Values are:
103+
# 0-Keep existing behaviour, 1-write to JSON and STO (STO is still source of truth), 2-Write to JSON and delete STO
104+
# If the product JSON files need to be removed after reverting back to level 0 then can be deleted with
105+
# find /mnt/podata/products -name "*.json" ! -name "*scans.json" -delete
106+
SERIALIZE_TO_JSON=2
107+
108+
# recipe-estimator product service
109+
# To test a locally running recipe-estimator with product opener in a docker dev environment:
110+
# - run recipe-estimator with `uvicorn recipe_estimator.main:app --reload --host 0.0.0.0`
111+
# - set environment variable to http://host.docker.internal:5521/api/v3/estimate_recipe
112+
RECIPE_ESTIMATOR_URL=https://recipe-estimator.openfoodfacts.org/api/v3/estimate_recipe
113+
114+
# Set recipe_estimator_service to "estimate_recipe" to get default algorithm,
115+
# or "estimate_recipe_[glop|scipy|cvxpy] to use a specific algorithm
116+
# or "product_opener" to use the legacy Product Opener algorithm
117+
RECIPE_ESTIMATOR_SERVICE=product_opener
66118

67-
BUILD_CACHE_REPO=openfoodfacts/openfoodfacts-build-cache
119+
# API Key required to access health check API, set to any value to enable the check of the key, set to the expected value to have a successful check
120+
HEALTH_CHECK_API_KEY=

.eslintignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)