Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
jaaydenh merged 7 commits intomainfromfeat/ephemeral-parameters-dialog
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionssite/src/components/Badge/Badge.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The 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",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff 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>
);
};
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,6 +211,15 @@ export const Immutable: Story = {
},
};

exportconstEphemeral:Story={
args:{
parameter:{
...MockPreviewParameter,
ephemeral:true,
},
},
};

exportconstAllBadges:Story={
args:{
parameter:{
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import { useDebouncedValue } from "hooks/debounce";
import{useEffectEvent}from"hooks/hookPolyfills";
import{
CircleAlert,
Hourglass,
Info,
LinkIcon,
Settings,
Expand DownExpand Up@@ -162,6 +163,23 @@ const ParameterLabel: FC<ParameterLabelProps> = ({
</Tooltip>
</TooltipProvider>
)}
{parameter.ephemeral&&(
<TooltipProviderdelayDuration={100}>
<Tooltip>
<TooltipTriggerasChild>
<spanclassName="flex items-center">
<Badgesize="sm"variant="green"border="none">
<Hourglass/>
Ephemeral
</Badge>
</span>
</TooltipTrigger>
<TooltipContentclassName="max-w-xs">
This parameter only applies for a single workspace start
</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
{isPreset&&(
<TooltipProviderdelayDuration={100}>
<Tooltip>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
import{useTheme}from"@emotion/react";
importButtonfrom"@mui/material/Button";
importvisuallyHiddenfrom"@mui/utils/visuallyHidden";
import{API}from"api/api";
importtype{
TemplateVersionParameter,
Workspace,
WorkspaceBuildParameter,
}from"api/typesGenerated";
import{Button}from"components/Button/Button";
import{FormFields}from"components/Form/Form";
import{TopbarButton}from"components/FullPageLayout/Topbar";
import{
Expand All@@ -27,6 +27,7 @@ import { useFormik } from "formik";
import{ChevronDownIcon}from"lucide-react";
importtype{FC}from"react";
import{useQuery}from"react-query";
import{useNavigate}from"react-router-dom";
import{docs}from"utils/docs";
import{getFormHelpers}from"utils/formUtils";
import{
Expand DownExpand Up@@ -72,6 +73,7 @@ export const BuildParametersPopover: FC<BuildParametersPopoverProps> = ({
css={{".MuiPaper-root":{width:304}}}
>
<BuildParametersPopoverContent
workspace={workspace}
ephemeralParameters={ephemeralParameters}
buildParameters={parameters?.buildParameters}
onSubmit={onSubmit}
Expand All@@ -82,18 +84,67 @@ export const BuildParametersPopover: FC<BuildParametersPopoverProps> = ({
};

interfaceBuildParametersPopoverContentProps{
workspace:Workspace;
ephemeralParameters?:TemplateVersionParameter[];
buildParameters?:WorkspaceBuildParameter[];
onSubmit:(buildParameters:WorkspaceBuildParameter[])=>void;
}

constBuildParametersPopoverContent:FC<BuildParametersPopoverContentProps>=({
workspace,
ephemeralParameters,
buildParameters,
onSubmit,
})=>{
consttheme=useTheme();
constpopover=usePopover();
constnavigate=useNavigate();

if(
!workspace.template_use_classic_parameter_flow&&
ephemeralParameters&&
ephemeralParameters.length>0
){
consthandleGoToParameters=()=>{
popover.setOpen(false);
navigate(
`/@${workspace.owner_name}/${workspace.name}/settings/parameters`,
);
};

return(
<divclassName="flex flex-col gap-4 p-5">
<h1className="text-xl m-0 text-content-primary font-semibold leading-none ">
Ephemeral Parameters
</h1>
<pclassName="m-0 text-sm text-content-secondary">
This template has ephemeral parameters that must be configured on the
workspace parameters page
</p>

<div>
<ulclassName="list-none pl-3 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>
</div>

<ButtonclassName="w-full"onClick={handleGoToParameters}>
Go to workspace parameters
</Button>
</div>
);
}

return(
<>
Expand DownExpand Up@@ -206,8 +257,6 @@ const Form: FC<FormProps> = ({
<Button
data-testid="build-parameters-submit"
type="submit"
variant="contained"
color="primary"
css={{width:"100%"}}
>
Build workspace
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp