-
Notifications
You must be signed in to change notification settings - Fork 137
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
Prevent No-Folder or root S3 model access #1512
Prevent No-Folder or root S3 model access #1512
Conversation
@vconzola @kywalker-rh @kaedward Is the text "Can either be a folder path or the path to a single model" alright? Also, as discussed, I haven't added any inline alerts. Just enabling and disabling the "Deploy" button if the "Path" is a valid path as shown in the GIF. Here are the other alternatives: With inline alert and validating tick in case of wrong input: Screen.Recording.2023-07-18.at.4.43.13.PM.movWith a validating tick(without inline alert): Screen.Recording.2023-07-18.at.4.45.51.PM.movLet me know if any of these are a better option in place of the above GIF. |
...rc/pages/modelServing/screens/projects/InferenceServiceModal/ManageInferenceServiceModal.tsx
Outdated
Show resolved
Hide resolved
@manaswinidas There are three allowable inputs, correct: (1) a model name in the root folder, (2) a folder path with no model name, or (3) a folder path + model name? If that's true, I prefer more specific helper text without the validation tick and only showing the error helper text when Deploy is selected. I find the helper text and tick changes while typing to be confusing. I'd like @kaedward to share her opinion, but I think helper text that says something like, "This must be a model name, a folder path, or a folder path and model name." would work. If the input is invalid when the user selects deploy we would show error helper text that says something like, "Not a valid model name or folder path." in red with the error icon displayed in the field as shown here: https://www.patternfly.org/v4/components/helper-text/design-guidelines#when-to-use-helper-text. |
@vconzola yes that is correct |
@DaoDaoNoCode Edit seems to work for me, let me know if I'm missing something Screen.Recording.2023-07-18.at.11.05.15.PM.mov |
@manaswinidas What if you had a model mounted with the empty path before? Try to edit that one. |
@DaoDaoNoCode My change is to ensure it's not empty anymore. The "Deploy" button won't be enabled if it's empty or just has |
Hmm, sounds fair. @andrewballantyne WDYT, do we need to consider the previously created models which could possibly mount on the root dir? |
I made a thread in slack -- What is important to note is we need to consider how the flow impacts existing models. What is the downside from having an "invalid" model deployed against the root |
@andrewballantyne For the helper text, how about "Enter the path to a folder or single model."? |
@kaedward Yeah, I guess we can go with that -- my only concern is technically I'd view
Feels weird still... but it's more technically accurate |
@andrewballantyne does this sound any better? |
Thanks @kaedward fits my mental model better... @manaswinidas please implement the last text noted by Katie.
|
@andrewballantyne any other changes regarding the error helperText? I can see some comments above: #1512 (comment) or we stick to enabling the Also, a suggestion: it will be great if we can check whether the folderPath exists from the backend side(if it's not too far-fetched). |
@manaswinidas I don't follow what you're asking here -- if you're asking for more wording, pitch the scenario to @kaedward -- if you're asking for what we should do, I think Vince answered that 🤔 Let me know how I can help! |
@andrewballantyne I was just confirming whether there is a need for an error helperText as shown in the comment here. I think I confused Vince with the GIFs 😅 |
b85c244
to
d0fd60d
Compare
@manaswinidas I think error help text would be useful. Can we detect when an invalid path is entered, or only if the user enters a root folder? |
We are preventing inputs like Screen.Recording.2023-07-20.at.1.43.22.AM.mov |
@kaedward I don't understand where/when you're suggesting that error be displayed? |
We have 2(or 3) options:
My concerns for the second case(disputed opinion): I've found it annoying as a user when I get an error after clicking on the "Submit" button when the form/field could have shown the error while doing it, thus saving me time.)
Would you like me to send GIFs for some or all of these scenarios? |
@vconzola @manaswinidas @kaedward okay, let me step in here and cap this off. (hopefully) My suggested state of this modal is this, let me know if you agree. For the folder field...
Does that make sense to everyone? If not, let us take this to slack (or a meeting), as it'll likely need more back and forth. |
@andrewballantyne @manaswinidas @kaedward I'm OK with everything @andrewballantyne suggested with one exception. i think it's going to look weird if we immediately show the error as soon as the user types"/". It could cause the error message to flash briefly if they don't type the next, non-/ character quickly enough. Can we add a short (500 ms to 1 s - will probably need to play around with it to see what feels right) delay before displaying the error below the field? |
@manaswinidas We don't need any success helperText - only if there's an error. |
lgtm |
For starters, they shouldn't type the slash... the slash is in the UI -- if they do, they can see the error imo; I'm okay with the delay too. Also I imagine most people will probably not type out the value and copy paste it from the path they have in their storage. If we expect the avg user to type the |
For what it is worth -- don't put success intentionally. We are not validating the value, we are just helping them avoid known failure points. Success would mislead the user to think we know if their folder path is accurate -- which we do not. |
I was reiterating the same yesterday, we don't have a success helperText and the check mark in the textbox for the same reason. Also, I've added a 1s delay, let me know if that needs to be changed. This comment has the latest GIF. |
</FormGroup> | ||
); | ||
}) => { | ||
type validate = 'success' | 'warning' | 'error' | 'default'; |
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.
Types are always PascalCase
Also, why do you need this? Infer the data from PF.
React.ComponentProps<typeof FormGroup>['validated']
That should get you the value behind the prop of FormGroup's prop validated
.
const timer = setTimeout(() => { | ||
if (folderPath === '') { | ||
setValidated('default'); | ||
} else if (folderPath === '/' || folderPath.includes('//')) { |
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.
If you get into an error -- I think you're going to not get out of it on paste
... can you switch your logic around if
this, else
set back to default?
@andrewballantyne Iirc, we had an earlier issue where we "ignore" any leading slash. And we should keep that. The idea behind adding the delay is so that the only time the user will see the error is if they enter only one or more / in the input field - which is unlikely to happen. Tl;dr - I think we're good. @manaswinidas One other question... The example text in the input field says, "e.g., data". For this to be a valid input means the model is stored in a folder named "data". Is this confusing? Would it be more clear if we changed this to "data_folder" or removed the example altogether? Thoughts @kaedward ? |
I think the design is fine the way it is... we should log another issue to handle the field if we are changing -- the placeholder and prefix There are code issues and thus I cannot approve at this time. Please fix those when you get a chance @manaswinidas |
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.
Thanks for making the changes -- you really should use PascalCase for your Type variables... but this solves the real problem I saw.
/approve
Give me a moment to spin up my UI to test it, but should work fine. - tested and lgtm but Lucas got to it first
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewballantyne, lucferbux The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue logged for changes discussed in #1512 (comment) : #1601 |
Fixes #1423
Description
/
or///////
-> enable "Deploy" button only if "Path" is valid )GIF(outdated):
Please refer to this comment for the latest GIF
Screen.Recording.2023-07-20.at.1.43.22.AM.mov
How Has This Been Tested?
Test Impact
Added tests for the required "Path" field
Request review criteria:
Self checklist (all need to be checked):
If you have UI changes:
After the PR is posted & before it merges:
main