Skip to content
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

feat(ui): Add namespace input to ClusterWorkflowTemplate submit. Fixes #10398 #13596

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MasonM
Copy link
Contributor

@MasonM MasonM commented Sep 13, 2024

Fixes #10398

Motivation

This adds support for specifying the namespace when submitting a workflow from a ClusterWorkflowTemplate using an input field on the "Submit Workflow" panel.

Modifications

Updates the <SubmitWorkflowPanel> to allow specifying the namespace via <TextInput>. Initially, I used the <InputFilter> component for this so it could take advantage of autocomplete, but then I realized that's not appropriate here because this isn't a filter and we don't want the "x" button to clear the field.

Verification

Tested locally at http://localhost:8081/cluster-workflow-templates:

Screen.Recording.2024-09-14.at.11.44.38.AM.mp4

This adds support for specifying the namespace when submitting a
workflow from a ClusterWorkflowTemplate using an input field on the
"Submit Workflow".

Initially, I used the `<InputFilter>` component for this so it could
take advantage of autocomplete, but then I realized that's not
appropriate here because this isn't a filter and we don't want the "x"
button to clear the field.

Signed-off-by: Mason Malone <[email protected]>
@MasonM MasonM marked this pull request as ready for review September 13, 2024 23:50
Copy link
Contributor

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the the contribution!

I've left some comments in-line below.

Also, per the issue, did the submit panel just not work before this? If so, that issue should be labeled a bug and this a fix

ui/src/app/workflows/components/submit-workflow-panel.tsx Outdated Show resolved Hide resolved
@@ -31,6 +34,7 @@ export function SubmitWorkflowPanel(props: Props) {
const {navigation} = useContext(Context);
const [entrypoint, setEntrypoint] = useState(workflowEntrypoint);
const [parameters, setParameters] = useState<Parameter[]>([]);
const [namespace, setNamespace] = useState(props.namespace);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is not entirely correct to have props.namespace be the initial state. For a WorkflowTemplate, it will always be props.namespace, and for a ClusterWorkflowTemplate, it will always be the namespace state.

This would be particularly relevant in cases where this panel is off-screen but still rendered; the next time it's on-screen, the prop would not be used.
That's normally not how this component is used, but that is why the correctness matters if it were to be used that way.

Also this should be ordered after the useContext instead of in between the two parameter state variables for better organization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I pushed 59dbea3 to lift the state up to <ClusterWorkflowTemplateDetails>, which is simpler than handling it here

ui/src/app/workflows/components/submit-workflow-panel.tsx Outdated Show resolved Hide resolved
@agilgur5 agilgur5 changed the title feat(ui): Set namespace when submitting ClusterWorkflowTemplate, fixes #10398 feat(ui): Add namespace input to ClusterWorkflowTemplate submit. Fixes #10398 Sep 14, 2024
@agilgur5
Copy link
Contributor

Also if you want to work on another namespace input in the UI, #12041 is highly requested 🙂

@MasonM
Copy link
Contributor Author

MasonM commented Sep 14, 2024

@agilgur5 Thanks for the review!

Also, per the issue, did the submit panel just not work before this? If so, that issue should be labeled a bug and this a fix

Due to the bug in #13593, it wasn't possible to click the "Submit" button, so I tested this by rebasing my branch with that fix. I confirmed it's possible to submit it with the fix, so this isn't a bug.

Signed-off-by: Mason Malone <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Set namespace when submitting ClusterWorkflowTemplate
2 participants