-
Notifications
You must be signed in to change notification settings - Fork 881
feat: Group immutable and mutable rich parameters #5975
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
Conversation
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 a nice change! I think splitting the array into two (mut/immut) would clean up the code a bunch but feel free to think of it as an optional change.
I can't quite put my finger on it, but titles feel a bit verbose. Perhaps I'd prefer a heading with "Workspace parameters" and subheadings "Mutable" and "Immutable". But don't know if that would look better tbh.
@@ -150,7 +151,9 @@ export const WorkspaceBuildParametersPageView: FC< | |||
|
|||
<Maybe | |||
condition={Boolean( | |||
props.templateParameters && props.templateParameters.length === 0, | |||
!props.isLoading && | |||
props.templateParameters && |
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.
Usage could be nicer here if we defaulted to an empty array for the prop.
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.
Before introducing isLoading
it was not possible, but I can retake a look.
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.
Usually, it is not a good idea to use an empty array in the FE because we usually use undefined to identify the "loading data" state. However, if this data is provided internally and not from an external source that depends on an effect like network calls, file reading, etc. Providing an empty array is ok 👍
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.
Also, we could introduce isLoading
and set it as an empty array but I don't see what is the value on it if compared to just letting the value as undefined.
@@ -104,4 +105,18 @@ const getDefaultParameterValues = ( | |||
return paramValues | |||
} | |||
|
|||
export const orderedTemplateParameters = ( |
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 it used in more than one place? If not, I think we can remove the export
or move this function to live in the file where it is used.
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.
It is used in 2 places as it's also in WorkspaceBuildParametersPage
, so I will keep it as is, but thanks for raising this!
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.
FE lgtm!
Related: #5574
This PR introduces a grouping of immutable and mutable rich parameters in Create.... and Update... forms.