From c5bf639edd8d3baf367e65a8ab113527c99ba12c Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 22 May 2026 11:14:19 +0100 Subject: [PATCH 1/7] test ccpbiosim web theme --- .../templates/form/webform.html | 4 +- .../templates/macros/webform.html | 6 ++ biosimdb_interface/templates/main/base.html | 85 ++++++++++++++++++- biosimdb_interface/templates/main/head.html | 76 +++++++++++++++-- 4 files changed, 160 insertions(+), 11 deletions(-) diff --git a/biosimdb_interface/templates/form/webform.html b/biosimdb_interface/templates/form/webform.html index 5911eb0..89e2b3b 100644 --- a/biosimdb_interface/templates/form/webform.html +++ b/biosimdb_interface/templates/form/webform.html @@ -75,12 +75,12 @@
{{ section.title }}
{% endfor %} -
+
diff --git a/biosimdb_interface/templates/macros/webform.html b/biosimdb_interface/templates/macros/webform.html index 8ed46c8..ef87c74 100644 --- a/biosimdb_interface/templates/macros/webform.html +++ b/biosimdb_interface/templates/macros/webform.html @@ -241,6 +241,12 @@
Simulation Metadata
{{ meta_group.label or meta_section }} {% endfor %} + + +
+ + +
{% for meta_section, meta_group in simulation_metadata.items() %} diff --git a/biosimdb_interface/templates/main/base.html b/biosimdb_interface/templates/main/base.html index 34d8a0a..13f4880 100644 --- a/biosimdb_interface/templates/main/base.html +++ b/biosimdb_interface/templates/main/base.html @@ -19,8 +19,10 @@ {% include 'main/head.html' %} - + + + {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %}
@@ -34,8 +36,87 @@ {% endif %} {% endwith %} - {% block content %}{% endblock %} + +
+
+ +
+ +
+ + + +
+
+ + +
+
+
+
+ + {% block content %}{% endblock %} +
+
+
+ + + + + + + + + {% block scripts %} {% endblock %} diff --git a/biosimdb_interface/templates/main/head.html b/biosimdb_interface/templates/main/head.html index 6a1ff7b..c5f70aa 100644 --- a/biosimdb_interface/templates/main/head.html +++ b/biosimdb_interface/templates/main/head.html @@ -9,12 +9,74 @@ - Page title and favicon #} - - - + + + + +Our Community + + + - - BioSimDB Interface - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + From 065ee7e3845285c4b8d1f2394ac3023529bca764 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 22 May 2026 11:39:52 +0100 Subject: [PATCH 2/7] add biosim-extractor install to docker --- docker/Dockerfile | 14 +++++++++----- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2cad6e9..be0ceef 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,12 +8,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ && rm -rf /var/lib/apt/lists/* +# Copy biosim-extractor and install it +COPY biosim-extractor /biosim-extractor +RUN pip install --no-cache-dir /biosim-extractor + # Install the package -COPY pyproject.toml . -COPY README.md . -COPY LICENSE . -COPY biosimdb_interface/ biosimdb_interface/ -RUN pip install --no-cache-dir . +COPY biosimdb-interface/pyproject.toml . +COPY biosimdb-interface/README.md . +COPY biosimdb-interface/LICENSE . +COPY biosimdb-interface /biosimdb-interface +RUN pip install --no-cache-dir /biosimdb-interface # Copy schema files at a known path (mounted at runtime for dev — see below) # COPY ../biosim-schema /biosim-schema diff --git a/pyproject.toml b/pyproject.toml index 6dea243..0507f8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ dependencies = [ "MDAnalysis==2.10.0", "python-dotenv==1.2.2", "gunicorn>=23,<24", - "biosim-extractor @ git+ssh://git@github.com/CCPBioSim/biosim-extractor.git" + # "biosim-extractor @ git+ssh://git@github.com/CCPBioSim/biosim-extractor.git" ] [project.urls] From 3060d1c778093afabf362b1c00ddf3c768fd1228 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 22 May 2026 11:59:13 +0100 Subject: [PATCH 3/7] update schema links in dockerfile --- docker/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index be0ceef..bbab24f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,6 +8,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ && rm -rf /var/lib/apt/lists/* + +# Copy schema files into the image +COPY ../biosim-schema/schema_webformfields.json /app/schema_webformfields.json +COPY ../biosim-schema/schema_enginemappings.json /app/schema_enginemappings.json +COPY ../biosim-schema/biosim_schema/schema/biosim_schema.yaml /app/biosim_schema.yaml + +# Set environment variables to point to these files inside the container +ENV WEBFORM_SCHEMA_PATH=/app/schema_webformfields.json +ENV ENGINE_MAPPING_SCHEMA_PATH=/app/schema_enginemappings.json +ENV BIOSIM_SCHEMA_PATH=/app/biosim_schema.yaml + # Copy biosim-extractor and install it COPY biosim-extractor /biosim-extractor RUN pip install --no-cache-dir /biosim-extractor From 5e434271025f231fc0d5981ce50a5008bbf10ccb Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 22 May 2026 14:50:21 +0100 Subject: [PATCH 4/7] update paths to schema files --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index bbab24f..26215a3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Copy schema files into the image -COPY ../biosim-schema/schema_webformfields.json /app/schema_webformfields.json -COPY ../biosim-schema/schema_enginemappings.json /app/schema_enginemappings.json -COPY ../biosim-schema/biosim_schema/schema/biosim_schema.yaml /app/biosim_schema.yaml +COPY biosim-schema/schema_webformfields.json /app/schema_webformfields.json +COPY biosim-schema/schema_enginemappings.json /app/schema_enginemappings.json +COPY biosim-schema/biosim_schema/schema/biosim_schema.yaml /app/biosim_schema.yaml # Set environment variables to point to these files inside the container ENV WEBFORM_SCHEMA_PATH=/app/schema_webformfields.json From 817ada40f40e2369accf12724c941c8bfd0b96d5 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 22 May 2026 17:16:17 +0100 Subject: [PATCH 5/7] add new base to app --- biosimdb_interface/__init__.py | 13 ++++++++++--- biosimdb_interface/schema/__init__.py | 0 biosimdb_interface/static/js/form/metadata.js | 4 ++-- biosimdb_interface/templates/form/webform.html | 2 +- biosimdb_interface/templates/main/base.html | 5 +++++ tests/conftest.py | 1 + 6 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 biosimdb_interface/schema/__init__.py diff --git a/biosimdb_interface/__init__.py b/biosimdb_interface/__init__.py index 1ecbea1..c7b6090 100644 --- a/biosimdb_interface/__init__.py +++ b/biosimdb_interface/__init__.py @@ -26,13 +26,17 @@ def create_app(test_config=None): Configured Flask app instance. """ # create and configure the app + APPLICATION_BASE = os.getenv("APPLICATION_BASE", "") app = Flask( __name__, # name of the current Python module template_folder="templates", # where html files are stored. static_folder="static", # used for css and js files. + static_url_path=f"{APPLICATION_BASE}/static", instance_relative_config=True, ) # create flask instance + app.config["APPLICATION_BASE"] = os.getenv("APPLICATION_BASE", "") + # check secret key is not "dev" for prod secret_key = os.getenv("SECRET_KEY", "dev") if secret_key == "dev" and not app.debug: @@ -61,7 +65,10 @@ def create_app(test_config=None): @app.context_processor def inject_base_url(): - return {"BASE_URL": app.config.get("BASE_URL", "")} + return { + "BASE_URL": app.config.get("BASE_URL", ""), + "APPLICATION_BASE": app.config.get("APPLICATION_BASE", ""), + } # ensure the instance folder exists try: @@ -71,10 +78,10 @@ def inject_base_url(): from .form import form_bp - app.register_blueprint(form_bp) + app.register_blueprint(form_bp, url_prefix=app.config["APPLICATION_BASE"]) from .login import bp as login_bp - app.register_blueprint(login_bp) + app.register_blueprint(login_bp, url_prefix=app.config["APPLICATION_BASE"]) return app diff --git a/biosimdb_interface/schema/__init__.py b/biosimdb_interface/schema/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/biosimdb_interface/static/js/form/metadata.js b/biosimdb_interface/static/js/form/metadata.js index fe7ead0..930ed40 100644 --- a/biosimdb_interface/static/js/form/metadata.js +++ b/biosimdb_interface/static/js/form/metadata.js @@ -28,7 +28,7 @@ document.addEventListener('click', function(e) { }); }); - fetch('/extract_metadata', { + fetch(window.APPLICATION_BASE + '/extract_metadata', { method: 'POST', body: formData }) @@ -421,7 +421,7 @@ function requireExtraction(form) { function validateAndSubmit(form, onSuccess) { const formData = new FormData(form); formData.append('save', '1'); - fetch('/webform', { method: 'POST', body: formData }) + fetch(window.APPLICATION_BASE + '/webform', { method: 'POST', body: formData }) .then(r => r.json()) .then(data => { if (data.validation_errors && data.validation_errors.length > 0) { diff --git a/biosimdb_interface/templates/form/webform.html b/biosimdb_interface/templates/form/webform.html index 89e2b3b..7d5be19 100644 --- a/biosimdb_interface/templates/form/webform.html +++ b/biosimdb_interface/templates/form/webform.html @@ -29,7 +29,7 @@
-
+
BioSimDB ↗ diff --git a/biosimdb_interface/templates/main/base.html b/biosimdb_interface/templates/main/base.html index 13f4880..03b90e3 100644 --- a/biosimdb_interface/templates/main/base.html +++ b/biosimdb_interface/templates/main/base.html @@ -119,6 +119,11 @@ {% block scripts %} + + + {% endblock %} diff --git a/tests/conftest.py b/tests/conftest.py index 872c36f..421de93 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,6 +21,7 @@ def app(): "BASE_URL": "http://localhost", "REDIRECT_URI": "http://localhost/callback", "SCOPES": "test", + "APPLICATION_BASE": "", } ) yield app From 14c481b21aee3b54741fc864e5923e2ed422b65c Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 19 Jun 2026 09:33:38 +0100 Subject: [PATCH 6/7] update page title --- biosimdb_interface/templates/main/head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biosimdb_interface/templates/main/head.html b/biosimdb_interface/templates/main/head.html index c5f70aa..82d95c4 100644 --- a/biosimdb_interface/templates/main/head.html +++ b/biosimdb_interface/templates/main/head.html @@ -13,7 +13,7 @@ -Our Community +BioSimDB From 57f5a4acedd593490d64c0c9550dad8e4c76dd18 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Fri, 19 Jun 2026 22:02:41 +0100 Subject: [PATCH 7/7] add joomla html if JOOMLA_BASE_URL is present --- biosimdb_interface/__init__.py | 2 + biosimdb_interface/templates/main/base.html | 90 +++---------------- biosimdb_interface/templates/main/head.html | 73 ++------------- .../templates/main/joomla_footer.html | 26 ++++++ .../templates/main/joomla_head.html | 63 +++++++++++++ .../templates/main/joomla_header.html | 48 ++++++++++ 6 files changed, 158 insertions(+), 144 deletions(-) create mode 100644 biosimdb_interface/templates/main/joomla_footer.html create mode 100644 biosimdb_interface/templates/main/joomla_head.html create mode 100644 biosimdb_interface/templates/main/joomla_header.html diff --git a/biosimdb_interface/__init__.py b/biosimdb_interface/__init__.py index b9b28e5..582900e 100644 --- a/biosimdb_interface/__init__.py +++ b/biosimdb_interface/__init__.py @@ -51,6 +51,7 @@ def create_app(test_config=None): AUTH_URL=os.getenv("AUTH_URL", ""), TOKEN_URL=os.getenv("TOKEN_URL", ""), BASE_URL=os.getenv("BASE_URL", ""), + JOOMLA_BASE_URL=os.getenv("JOOMLA_BASE_URL", "").rstrip("/"), API_BASE=os.getenv("API_BASE", ""), REDIRECT_URI=os.getenv("REDIRECT_URI", ""), SCOPES=os.getenv("SCOPES", "").strip(), @@ -67,6 +68,7 @@ def create_app(test_config=None): def inject_base_url(): return { "BASE_URL": app.config.get("BASE_URL", ""), + "JOOMLA_BASE_URL": app.config.get("JOOMLA_BASE_URL", ""), "APPLICATION_BASE": app.config.get("APPLICATION_BASE", ""), } diff --git a/biosimdb_interface/templates/main/base.html b/biosimdb_interface/templates/main/base.html index 03b90e3..809cf76 100644 --- a/biosimdb_interface/templates/main/base.html +++ b/biosimdb_interface/templates/main/base.html @@ -1,5 +1,4 @@ {# - base.html Site-wide base template. All other templates extend this. Blocks: @@ -9,7 +8,8 @@ Features: - Renders flashed messages as dismissible Bootstrap alerts. - Loads Bootstrap 5 JS bundle from CDN. - - Includes head.html for shared content (meta, CSS, title). + - Includes head.html for shared content. + - Includes Joomla header/footer only when JOOMLA_BASE_URL is configured. #} @@ -19,8 +19,7 @@ {% include 'main/head.html' %} - - + {% with messages = get_flashed_messages(with_categories=true) %} @@ -36,85 +35,24 @@ {% endif %} {% endwith %} - -
- -
- -
- -
- - - -
-
- + {% if JOOMLA_BASE_URL %} + {% include 'main/joomla_header.html' %} + {% endif %} -
-
-
+
+
+ {% if JOOMLA_BASE_URL %} +
+ {% endif %}
- {% block content %}{% endblock %}
- - - - - - + {% if JOOMLA_BASE_URL %} + {% include 'main/joomla_footer.html' %} + {% endif %} {% block scripts %} diff --git a/biosimdb_interface/templates/main/head.html b/biosimdb_interface/templates/main/head.html index 82d95c4..18f1fd9 100644 --- a/biosimdb_interface/templates/main/head.html +++ b/biosimdb_interface/templates/main/head.html @@ -1,82 +1,19 @@ {# - head.html Shared partial included by base.html. - Loads: - - Bootstrap 5.3.2 CSS (CDN) (https://getbootstrap.com/docs/5.3/) - - Application stylesheet (styles/styles.css) - - Application SCSS (styles/styles.scss) - - Page title and favicon + Loads core app assets. Joomla assets are included only when + JOOMLA_BASE_URL is configured. #} - - BioSimDB - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{% if JOOMLA_BASE_URL %} + {% include 'main/joomla_head.html' %} +{% endif %} - diff --git a/biosimdb_interface/templates/main/joomla_footer.html b/biosimdb_interface/templates/main/joomla_footer.html new file mode 100644 index 0000000..00692ba --- /dev/null +++ b/biosimdb_interface/templates/main/joomla_footer.html @@ -0,0 +1,26 @@ +{# + Joomla site footer. + + Included only when JOOMLA_BASE_URL is configured. +#} + + + + + + diff --git a/biosimdb_interface/templates/main/joomla_head.html b/biosimdb_interface/templates/main/joomla_head.html new file mode 100644 index 0000000..6fc1c28 --- /dev/null +++ b/biosimdb_interface/templates/main/joomla_head.html @@ -0,0 +1,63 @@ +{# + Joomla assets. + + Included only when JOOMLA_BASE_URL is configured. +#} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/biosimdb_interface/templates/main/joomla_header.html b/biosimdb_interface/templates/main/joomla_header.html new file mode 100644 index 0000000..a7ce162 --- /dev/null +++ b/biosimdb_interface/templates/main/joomla_header.html @@ -0,0 +1,48 @@ +{# + Joomla site header. + + Included only when JOOMLA_BASE_URL is configured. +#} + +
+
+ +
+ +
+ +
+