-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add 'No selection' option to GID selector #254
Conversation
a1a5dd6
to
a53027b
Compare
a53027b
to
af55785
Compare
Note: in the review which lead to #236 was mentioned: This and #236 is about the first part. But it won't solve the other: "the GID field should allow to enter arbitrary integer" - see the old UI. |
985b0c0
to
9604ac0
Compare
I think the PF Select component currently doesn't allow any writing functionality, but I can check with them in case there is some tweak/alternative component we can use for that. If not, I can open a discussion with Brian to find out how to approach this design-wise. I will set the 'WIP' tag on this PR while discussing this topic. |
I checked with the PatternFly team and there is a type of Selector that allows type-ahead functionality. So I can replace the existing Select component with this one and modify the description of the PR. |
@pvoborni - I have added a new commit to handle the type-ahead functionality in the GID field. Feel free to review it and share your thoughts on it. Thanks! |
1aa3e0f
to
2637312
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.
I've provided some simplifying/readability suggestions.
But I'd do one more, I'd say more important. The AddUser
modal is "polluted" with a "large" GID logic that makes the AddUser
component hard to read. It would be more readable to move out the GID logic to a separate component e.g. called GidSelector
which would wrap TypeAheadSelectWithCreate
the same way as the dialog does. Thus the dialog could have only:
import GIdSelector from "../form/GIdSelector"
const [gid, setGid] = useState("");
<GidSelector selected={gid} onSelectedChange={setGid} />
|
||
interface PropsToTypeAheadSelectWithCreate { | ||
initialSelectOptions: SelectOptionProps[]; | ||
onChangeSelectOptions: (selectOptions: SelectOptionProps[]) => void; |
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.
Is this useful? I see that it is used in AddUser
but is there a reason for it?
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.
This is meant to update the selection list options that are retrieved from the AddUser
, IIRC. As this bit was included in the Select with Type ahead original code, I decided to include it as well as part of the functionality.
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.
The fact that it was in the example code is not a reason to have it here. But in this case it was not even in the example. The example implements a component SelectTypeaheadCreatable
that has no externally definable props. I.e. these functions were internal to the component.
The only reason to expose them would be to allow the parent component to work with the new states. E.g. to use them in adding new users. But this imho not needed.
Also with
let gidOptions = getGidOptions(GIDs);
const onChangeGidOptions = (newList: SelectOptionProps[]) => {
gidOptions = newList;
};
it has no effect now.
2637312
to
903be38
Compare
@pvoborni - The code has been updated based on your feedback. Feel free to keep reviewing. |
Provided another round of comments. |
To replicate the same behavior as in the current WebUI, the 'GID' field located in the 'Add user' modal should have a 'No selection' option. Fixes: freeipa#236 Signed-off-by: Carla Martinez <carlmart@redhat.com>
903be38
to
97af0c3
Compare
To replicate the same behavior as in the current WebUI, the Select component should also have the option to add a new GID value. Signed-off-by: Carla Martinez <carlmart@redhat.com>
97af0c3
to
6c2785e
Compare
@pvoborni - As suggested, I removed the |
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.
LGTM
To replicate the same behavior as in the current WebUI, the 'GID' field located in the 'Add user' modal should have a 'No selection' option. Also, a new GID value can be added and associated to a newly-created user.
Fixes: #236