Skip to content

feat: Group immutable and mutable rich parameters - #5975

Merged
mtojek merged 1 commit into
coder:mainfrom
mtojek:5574-group-mutables
Feb 2, 2023
Merged

mtojek merged 1 commit into
coder:mainfrom
mtojek:5574-group-mutables

Conversation

@mtojek

@mtojek mtojek commented Feb 2, 2023 •

Copy link
Copy Markdown
Member

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

@mafredri mafredri left a comment •

Copy link
Copy Markdown
Member

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.

condition={Boolean(
props.templateParameters && props.templateParameters.length === 0,
!props.isLoading &&
props.templateParameters &&

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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.

return paramValues
}

export const orderedTemplateParameters = (

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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!

@BrunoQuaresma BrunoQuaresma left a comment

Copy link
Copy Markdown
Contributor

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