From 8b84b5fa30d098a464ee891fdf8e4f1f024a1cd6 Mon Sep 17 00:00:00 2001 From: Lorena Hendrix Date: Thu, 21 Nov 2024 17:41:29 +0100 Subject: [PATCH] created js inject function for analytics --- api/dependencies.jl | 4 +- docker-compose-deploy.yml | 58 +++++++++++++-------------- docker-compose.yml | 56 +++++++++++++------------- gui/app.py | 32 +++++++++++++++ gui/output_files/battmo_results.hdf5 | Bin 985592 -> 981888 bytes gui/requirements.txt | 3 +- nginx/project.conf | 28 ++++++------- 7 files changed, 107 insertions(+), 74 deletions(-) diff --git a/api/dependencies.jl b/api/dependencies.jl index e364ce4..8153b99 100644 --- a/api/dependencies.jl +++ b/api/dependencies.jl @@ -1,8 +1,8 @@ using Pkg Pkg.update() Pkg.add("HTTP") -Pkg.add(PackageSpec(;name="BattMo", rev="dev")) -Pkg.add(PackageSpec(;name="Jutul", rev="battmo")) +Pkg.add("BattMo") +Pkg.add("Jutul") Pkg.add("JSON") Pkg.add("HDF5") Pkg.add("UUIDs") diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml index fdc16f6..07e5c5d 100644 --- a/docker-compose-deploy.yml +++ b/docker-compose-deploy.yml @@ -53,38 +53,38 @@ services: - app-network command: streamlit run app.py --global.disableWidgetStateDuplicationWarning true --server.port=8501 - umami: - image: docker.umami.is/umami-software/umami:postgresql-latest - container_name: umami - restart: always - environment: - # BASE_PATH: https://app.batterymodel.com/umami - DATABASE_URL: postgres://umami:password@umami-db/umami - DATABASE_TYPE: postgres - HASH_SALT: ${HASH_SALT} - ports: - - "3000:3000" - networks: - - app-network - depends_on: - - umami-db + # umami: + # image: docker.umami.is/umami-software/umami:postgresql-latest + # container_name: umami + # restart: always + # environment: + # # BASE_PATH: https://app.batterymodel.com/umami + # DATABASE_URL: postgres://umami:password@umami-db/umami + # DATABASE_TYPE: postgres + # HASH_SALT: ${HASH_SALT} + # ports: + # - "3000:3000" + # networks: + # - app-network + # depends_on: + # - umami-db - umami-db: - image: postgres:13 - container_name: umami-db - restart: always - environment: - POSTGRES_USER: umami - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DB: umami - networks: - - app-network - volumes: - - umami_db_data:/var/lib/postgresql/data + # umami-db: + # image: postgres:13 + # container_name: umami-db + # restart: always + # environment: + # POSTGRES_USER: umami + # POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + # POSTGRES_DB: umami + # networks: + # - app-network + # volumes: + # - umami_db_data:/var/lib/postgresql/data # Define volumes at the root level, outside of services -volumes: - umami_db_data: +# volumes: +# umami_db_data: networks: app-network: diff --git a/docker-compose.yml b/docker-compose.yml index 0d3287c..259cbec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,37 +52,37 @@ services: - /usr/share/nginx/html/.well-known:/usr/share/nginx/html/.well-known command: nginx -g 'daemon off;' - umami: - image: docker.umami.is/umami-software/umami:postgresql-latest - container_name: umami - restart: always - environment: - DATABASE_URL: postgres://umami:password@umami-db/umami - DATABASE_TYPE: postgres - HASH_SALT: ${HASH_SALT} # Replace this with a secure, random hash salt - ports: - - "3000:3000" - networks: - - app-network - depends_on: - - umami-db + # umami: + # image: docker.umami.is/umami-software/umami:postgresql-latest + # container_name: umami + # restart: always + # environment: + # DATABASE_URL: postgres://umami:password@umami-db/umami + # DATABASE_TYPE: postgres + # HASH_SALT: ${HASH_SALT} # Replace this with a secure, random hash salt + # ports: + # - "3000:3000" + # networks: + # - app-network + # depends_on: + # - umami-db - umami-db: - image: postgres:13 - container_name: umami-db - restart: always - environment: - POSTGRES_USER: umami - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Replace with a strong password - POSTGRES_DB: umami - networks: - - app-network - volumes: - - umami_db_data:/var/lib/postgresql/data + # umami-db: + # image: postgres:13 + # container_name: umami-db + # restart: always + # environment: + # POSTGRES_USER: umami + # POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Replace with a strong password + # POSTGRES_DB: umami + # networks: + # - app-network + # volumes: + # - umami_db_data:/var/lib/postgresql/data # Define volumes at the root level, outside of services -volumes: - umami_db_data: +# volumes: +# umami_db_data: networks: app-network: diff --git a/gui/app.py b/gui/app.py index 706c3a7..436ee73 100644 --- a/gui/app.py +++ b/gui/app.py @@ -5,6 +5,9 @@ from PIL import Image from app_scripts import app_access import streamlit.components.v1 as components +import pathlib +from bs4 import BeautifulSoup +import shutil ############################## @@ -52,6 +55,35 @@ # ) +def inject_ga(): + UM_ID = "adcac53d-bc65-4ca3-9f98-be5c7c4ee75d" + + UM_JS = """ + +