- Notifications
You must be signed in to change notification settings - Fork921
feat: add ephemeral parameter dialog for workspace start/restart#18413
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
99f7a2d
7f56518
abea8ec
1ff6988
c7e1fad
6d69706
718350d
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -22,6 +22,8 @@ const badgeVariants = cva( | ||
"border border-solid border-border-warning bg-surface-orange text-content-warning shadow", | ||
destructive: | ||
"border border-solid border-border-destructive bg-surface-red text-highlight-red shadow", | ||
green: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is only meant to be used for ephemeral parameters and no other use cases. It felt like calling this ephemeral is too specific for the badge component so I left it as a generic green for now. | ||
"border border-solid border-surface-green bg-surface-green text-highlight-green shadow", | ||
}, | ||
size:{ | ||
xs:"text-2xs font-regular h-5 [&_svg]:hidden rounded px-1.5", | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
importtype{TemplateVersionParameter}from"api/typesGenerated"; | ||
import{Button}from"components/Button/Button"; | ||
import{ | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
}from"components/Dialog/Dialog"; | ||
importtype{FC}from"react"; | ||
import{useNavigate}from"react-router-dom"; | ||
interfaceEphemeralParametersDialogProps{ | ||
open:boolean; | ||
onClose:()=>void; | ||
onContinue:()=>void; | ||
ephemeralParameters:TemplateVersionParameter[]; | ||
workspaceOwner:string; | ||
workspaceName:string; | ||
templateVersionId:string; | ||
} | ||
exportconstEphemeralParametersDialog:FC<EphemeralParametersDialogProps>=({ | ||
open, | ||
onClose, | ||
onContinue, | ||
ephemeralParameters, | ||
workspaceOwner, | ||
workspaceName, | ||
templateVersionId, | ||
})=>{ | ||
constnavigate=useNavigate(); | ||
consthandleGoToParameters=()=>{ | ||
onClose(); | ||
navigate( | ||
`/@${workspaceOwner}/${workspaceName}/settings/parameters?templateVersionId=${templateVersionId}`, | ||
); | ||
}; | ||
return( | ||
<Dialogopen={open}onOpenChange={(isOpen)=>!isOpen&&onClose()}> | ||
<DialogContent> | ||
<DialogHeader> | ||
<DialogTitle>Ephemeral Parameters Detected</DialogTitle> | ||
<DialogDescription> | ||
This workspace template has{" "} | ||
<strongclassName="text-content-primary"> | ||
{ephemeralParameters.length} | ||
</strong>{" "} | ||
ephemeral parameters that will be reset to their default values | ||
</DialogDescription> | ||
<DialogDescription> | ||
<ulclassName="list-none pl-6 space-y-2"> | ||
{ephemeralParameters.map((param)=>( | ||
<likey={param.name}> | ||
<pclassName="text-content-primary m-0 font-bold"> | ||
{param.display_name||param.name} | ||
</p> | ||
{param.description&&( | ||
<pclassName="m-0 text-sm text-content-secondary"> | ||
{param.description} | ||
</p> | ||
)} | ||
</li> | ||
))} | ||
</ul> | ||
</DialogDescription> | ||
<DialogDescription> | ||
Would you like to go to the workspace parameters page to review and | ||
update these parameters before continuing? | ||
</DialogDescription> | ||
</DialogHeader> | ||
<DialogFooter> | ||
<ButtononClick={onContinue}variant="outline"> | ||
Continue | ||
</Button> | ||
<ButtononClick={handleGoToParameters}> | ||
Go to workspace parameters | ||
</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.