-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor/variables-redux #157
Conversation
339c478
to
22fc994
Compare
22fc994
to
c913d5d
Compare
Hi,
|
Thanks for your review, I'll have a look at it! |
You were right, I added both:
Would be even better after #131 |
One more thing to fix : When editing a value and then undoing the changes (the store holds the variable already on the server), an error is thrown in addition to this toast :
|
Done, also added a reset of the user inputs when switching from a service to another which was causing a bug.
This kinda confirms what I thought. Ideally, we should compare the inputted values to the server ones to avoid the "validating these changes would produce no difference" error. However, 2 slices cannot be mixed ( The solution would be to store in a context local to the service the variables modified for a service and its components. Then, possibly persist this context in the global store (or local storage) if we want to keep the user's uncommitted modifications in memory. I'm gonna try to roll back to a local context for this feature but this time using a reducer instead of a simple state (keeping the same logic as the slice). |
Hi, I have other comments ^^' I suppose that the type of the variable is checked before validation.
|
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.
Approved from a fonctional point of view
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.
Approved from a fonctional point of view
The behavior that you describe is a bit odd but is not a big error. In fact, variables that are similar to the one that are one the server shouldn't even be sent. I'll open an issue to improve this later. (#164)
Some Hadoop services ask for boolean, and other for string. It's not really an UI issue. What we could do to improve the ux is:
|
Which issue(s) this PR fixes
Fixes #138
Additional comments
Handle service and component variables through Redux:
config
, to handle user config (read from theconfig.json
in dev mode, and fetched from/config
when exported)variables
, to handle variables fetched from the server with a loading state.userInput
, to hold variables changed by an user for a given service (and its components). Thought, I'm not sure that Redux is the good place to store those infos.log
slice.This PR allows:
useContext
/useReducer
. Redux is well documented and should be easier to maintain.Agreements