-
Notifications
You must be signed in to change notification settings - Fork 15
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
Store tags state #264
Store tags state #264
Conversation
a3ea822
to
8c18dda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Here's some thoughts:
Consider the reducing functions you created
addTagToHost
removeTagFromHost
addTagToCluster
removeTagFromCluster
addTagToDatabase
removeTagFromDatabase
addTagToSAPSystem
removeTagFromSAPSystem
All the addTagToSomething
have the same implementation, only differing for the resource being tagged.
All the removeTagFromSomething
have the same implementation, only differing for the resource being untagged.
Probably we can find a way to reduce boiler.
Then, these functions have been added to the specific state slices for host
, cluster
, database
, sapSystem
, which should be fine.
There's also the option to have a dedicated state slice for tags and merge information with selectors.
Not saying we need to do this other way, just asking if you considered it 😄
Last point: the various addTag
and removeTag
functions in the components (the ones that actually call the API) might be cleaned up a bit I believe, as they do the exact same thing, with the difference of the resource being handled and the endpoint that gets hit.
This can very well be a followup.
Maybe this would be the solution, since i see the duplication here necessary due to the different slices being involved as you pointed out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, we might need a refactoring but we can do that in a follow-up PR. Green light from my side, good job!
This PR makes use of the redux store to save the state of the UI components, preventing tags from disappearing when the user changes the view.
It should work for the following views:
Note*: There seems to be some issue with the collapsible that activates when interacting with the tags which prevents the tags from working correctly.
Note**: The tags endpoint for the databases overview one is missing so it can't really be tested yet. Working on that next.