Open shankari opened 1 year ago
Response from @AlirezaRa94
Now that we have STUDY_NAME in the docker-compose, we have the dynamic config before loading the dashboard layouts. But if we want to infer it from the URL, we need to get it in a request, and this happens after loading the dashboard, which will break everything. To solve this problem, we can add a welcome page and set the dynamic config at this time, and then we can load the dashboard. I'm also open to hearing your ideas on this.
At an even more basic level, in the public dashboard, the viz_scripts are run automatically in the background, so they cannot infer the study name from the URL (because they are not invoked via a URL). However, this is a webapp, so you have the URL, and should be able to infer the study name from the URL like the frontend of the public dashboard does.
https://github.com/e-mission/em-public-dashboard/blob/main/frontend/index.html#L354
This ensures that the code "just works" and avoids requiring a lot of configuration. You should be able to do something similar using https://dash.plotly.com/dash-core-components/location, which you do already get in https://github.com/e-mission/op-admin-dashboard/pull/7/files#diff-9f23c8b13c9e75b67a44235089ab45e194bb00a6339db3295e9ff6a0646f2cc7R154
I agree that automatically inferring the values is less flexible, and I am open to including the CONFIG_PATH in the environment variables. But making the configuration uber flexible also opens us to subtle bugs caused by mismatched config settings. So I think the study name should be automatically inferred.