Skip to content

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

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Feb 2, 2023

Related: #5574

This PR introduces a grouping of immutable and mutable rich parameters in Create.... and Update... forms.

Screenshot 2023-02-02 at 14 39 06

Screenshot 2023-02-02 at 14 38 51

@mtojek mtojek self-assigned this Feb 2, 2023
@mtojek mtojek requested a review from BrunoQuaresma February 2, 2023 13:41
@mtojek mtojek marked this pull request as ready for review February 2, 2023 13:41
@mtojek mtojek mentioned this pull request Feb 2, 2023
Copy link
Member

@mafredri mafredri left a 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 &&
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Collaborator

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 👍

Copy link
Collaborator

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 = (
Copy link
Collaborator

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.

Copy link
Member Author

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!

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

FE lgtm!

@mtojek mtojek merged commit e27f7ac into coder:main Feb 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2023
@bpmct bpmct added this to the Rich Parameters GA milestone Feb 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants