Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework startup process #595

Closed
3 of 7 tasks
TheSlimvReal opened this issue Jan 10, 2021 · 1 comment
Closed
3 of 7 tasks

Rework startup process #595

TheSlimvReal opened this issue Jan 10, 2021 · 1 comment
Labels
Type: Refactoring / Technical Enh. Technical Enhancement without changes for the user

Comments

@TheSlimvReal
Copy link
Collaborator

TheSlimvReal commented Jan 10, 2021

Currently, the startup process consists of many setup processes including the initialization of the app config, the setup of the database, the creation of routes and the navigation links. Working towards having a single application which serves any customer and only loads data from a different database, this initial setup needs to be adjusted.

When the website is opened for the first time on a device, only the _user DB should be available to check whether the user has valid login credentials. The AppConfig needs to be available because it holds the link to the database.

When the user successfully logs in for the first time, the correct database can be fetched. This allows to retrieve the configuration of the application together with all the other entities. At this point the app should wait until the configuration was loaded from the database. After this is done, the router and the navigation can be set up.

For further logins from the same device, the login process can also work against the local database and all the steps that need the configuration from the database can already run before the user is logged in.

Steps to do:

  • Evaluate which services need to be available for the initial login process
  • Make sure the session only uses the _user DB for the initial login
  • Provide a hook which executes asynchronous tasks that have to be run after the user successfully logged in for the first time but before the application can be used (load config, init routing, init navigationbar, ...)
  • Add the config and all dependent services to the previously implemented hook
  • If the local DB is already present, the previously described tasks can already run before the user is logged in, but they still need to be finished before the application is ready to use

Cleanup from PR #594

  • remove entityMapper parameter from ConfigService.save/load
  • remove EntityModule dependency from AdminModul and AdminComponent
@TheSlimvReal
Copy link
Collaborator Author

Some things to consider:

  • this.router.navigate([], { relativeTo: this.activatedRoute }); needs to be called once in the startup process after routes are initialized from the config
  • The config currently always emits the defaulConfig on startup (config is a BehaviorSubject) this should be changed to the defaultConfig being provided through a demo data generator service to not interfere with the production mode
  • Maybe adjust the config service so it only emits new values when the new config actually differs to prevent unnecessary reloads/initializations
  • create a clear concept of runtime dependencies (e.g. login -> load config -> init routes -> apply new routes) to cleanup app component and make the dependencies more visible.

@sleidig sleidig moved this from Todo to In Progress in Important Fixes & Enhancements May 16, 2022
TheSlimvReal added a commit that referenced this issue May 24, 2022
solves #595 

Co-authored-by: Sebastian Leidig <sebastian.leidig@gmail.com>
Repository owner moved this from In Progress to Done in Important Fixes & Enhancements May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactoring / Technical Enh. Technical Enhancement without changes for the user
Projects
No open projects
Development

No branches or pull requests

2 participants