Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Commit a6d39b3

Browse files
authored
Add confirmation modal to workflows (#3267)
AWS - Terminate instance The search of this workflow doesn't work on staging AWS - Resize Autoscaling Group ![Screenshot 2025-03-28 at 10 48 43 a m](https://github.com/user-attachments/assets/0ee63d8e-672c-415f-8638-7661f142a674)
1 parent cdb9a7a commit a6d39b3

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

frontend/workflows/ec2/src/resize-asg.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
MetadataTable,
99
NotePanel,
1010
Resolver,
11+
Typography,
1112
useWizardContext,
1213
} from "@clutch-sh/core";
1314
import { useDataLayout } from "@clutch-sh/data-layout";
@@ -117,6 +118,14 @@ const Confirm: React.FC<ConfirmChild> = ({ notes }) => {
117118
);
118119
};
119120

121+
const ConfirmResizeAutoscalingGroup = () => {
122+
const group = useDataLayout("groupData").displayValue() as IClutch.aws.ec2.v1.AutoscalingGroup;
123+
124+
return (
125+
<Typography variant="body1">{`You are about to resize autoscaling group ${group.name}, are you sure to proceed?`}</Typography>
126+
);
127+
};
128+
120129
const ResizeAutoscalingGroup: React.FC<WorkflowProps> = ({ heading, resolverType, notes = [] }) => {
121130
const dataLayout = {
122131
groupData: {},
@@ -136,7 +145,13 @@ const ResizeAutoscalingGroup: React.FC<WorkflowProps> = ({ heading, resolverType
136145
return (
137146
<Wizard dataLayout={dataLayout} heading={heading}>
138147
<GroupIdentifier name="Lookup" resolverType={resolverType} />
139-
<GroupDetails name="Modify" />
148+
<GroupDetails
149+
name="Modify"
150+
confirmActionSettings={{
151+
title: "Resize Autoscaling Group",
152+
description: <ConfirmResizeAutoscalingGroup />,
153+
}}
154+
/>
140155
<Confirm name="Result" notes={notes} />
141156
</Wizard>
142157
);

frontend/workflows/ec2/src/terminate-instance.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
MetadataTable,
1111
NotePanel,
1212
Resolver,
13+
Typography,
1314
useWizardContext,
1415
} from "@clutch-sh/core";
1516
import { useDataLayout } from "@clutch-sh/data-layout";
@@ -92,6 +93,15 @@ const Confirm: React.FC<ConfirmChild> = ({ notes }) => {
9293
);
9394
};
9495

96+
const ConfirmTerminateInstance = () => {
97+
const resourceData = useDataLayout("resourceData");
98+
const instance = resourceData.displayValue() as IClutch.aws.ec2.v1.Instance;
99+
100+
return (
101+
<Typography variant="body1">{`You are about to terminate instance ${instance?.tags?.Name}, are you sure to proceed?`}</Typography>
102+
);
103+
};
104+
95105
const TerminateInstance: React.FC<WorkflowProps> = ({ heading, resolverType, notes = [] }) => {
96106
const dataLayout = {
97107
resourceData: {},
@@ -110,7 +120,13 @@ const TerminateInstance: React.FC<WorkflowProps> = ({ heading, resolverType, not
110120
return (
111121
<Wizard dataLayout={dataLayout} heading={heading}>
112122
<InstanceIdentifier name="Lookup" resolverType={resolverType} />
113-
<InstanceDetails name="Verify" />
123+
<InstanceDetails
124+
name="Verify"
125+
confirmActionSettings={{
126+
title: "Terminate Instance",
127+
description: <ConfirmTerminateInstance />,
128+
}}
129+
/>
114130
<Confirm name="Result" notes={notes} />
115131
</Wizard>
116132
);

frontend/workflows/k8s/src/cordon-node.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const ConfirmCordonNode = () => {
8282
const node = useDataLayout("resourceData").displayValue() as IClutch.k8s.v1.Node;
8383

8484
return (
85-
<Typography variant="body1">{`You are about to ${node.unschedulable ? "uncordon" : "cordon"} ${
85+
<Typography variant="body1">{`You are about to ${node.unschedulable ? "cordon" : "uncordon"} ${
8686
node.name
8787
}, are you sure to proceed?`}</Typography>
8888
);

0 commit comments

Comments
 (0)