bitwarden / web

The website vault (vault.bitwarden.com).
https://vault.bitwarden.com
Other
2.58k stars 405 forks source link

[EC-197] Create Organizations Module #1661

Closed eliykat closed 2 years ago

eliykat commented 2 years ago

Type of change

Objective

Start to tidy up LooseComponentsModule by creating a separate OrganizationsModule. Plus related refactors.

We should probably hold off merging this during feature (maybe even regression) testing, so that we don't diverge too much from bugs we're fixing in rc. But any feedback on that question is welcome.

we-should-take-d9ccba85ff

Code changes

Main changes for OrganizationsModule:

Changes related to ProvidersModule:

I suspect we're still exporting & importing too many things around the place, but I'll leave it here for now.

Screenshots

Before you submit

Hinton commented 2 years ago

We should look into changing vault from depending on organizations to having organizations depend on vault at a later stage. This could allow us to lazy load the organizations module if we find the need. (As vault would always need to be loaded)

addisonbeck commented 2 years ago

I'm not of the opinion that there is a place for an OrganizationModule (except maybe just for routing). Modules typically align with features, and an Organization is more of a data model that constrains a feature. I'm concerned that going down this path will lead to another slight mess like the current component structure where two pages can look almost identical and do the same things but not be near each other in the application structure or easily share properly scoped dependancies.

Not imposing here, but I would like to weigh the pros and cons of creating top level modules for everything currently being declared by the OrganizationsModule. I think they universally make sense as Domain Modules or Routed Modules, and if we are going to move them out of LooseComponentsModule it should be to dedicated top level modules. This allows for more... modularity 🀑

eliykat commented 2 years ago

@addisonbeck That's good feedback, so you're thinking of something like this?

OssRoutingModule
β”œβ”€ OrganizationRoutingModule          <- routing only
   β”œβ”€ ManageModule           <- domain/routed modules per the current folder structure
   β”œβ”€ PoliciesModule
   β”œβ”€ ServicesModule
   β”œβ”€ SettingsModule
   β”œβ”€ ToolsModule
   β”œβ”€ ...etc

Do you see these being moved under src/app/modules according to functionality, like you did for the VaultModule? I can see that you had a restructure in mind there, but I'm not sure how it fits in with what we do currently.

@Hinton I don't follow you, the changes in this PR do have the OrganizationsModule lazy loaded (it's not imported anywhere else than in OssRoutingModule). Except for the OrganizationVaultModule, but that doesn't reference OrganizationsModule.

addisonbeck commented 2 years ago

so you're thinking of something like this?

More or less. I have a few other ideas that I think might help us isolate functionality better. I'm making a branch off of this and will try and get something concrete and functional written to share for discussion.

Update 05/26/22: there is a sentiment developing that we need to fix this sooner than later, and I haven't been able to give it enough time. It's okay with me if we move forward with this as is or with the tree structure mentioned above.

eliykat commented 2 years ago

Update: after some further discussions, I'm going to adopt the structure in my comment above and I'll put this back up for review.

eliykat commented 2 years ago

Closing as I will reopen in the clients repo.