Skip to content

Commit 8a5dcf0

Browse files
committed
cp dines
1 parent 7fa6f01 commit 8a5dcf0

1 file changed

Lines changed: 40 additions & 4 deletions

File tree

src/components/DevboxCreatePage.tsx

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import type { Snapshot } from "../store/snapshotStore.js";
3434
import type { NetworkPolicy } from "../store/networkPolicyStore.js";
3535
import type { GatewayConfig } from "../store/gatewayConfigStore.js";
3636
import { SecretCreatePage } from "./SecretCreatePage.js";
37+
import { GatewayConfigCreatePage } from "./GatewayConfigCreatePage.js";
3738

3839
// Secret list interface for the picker
3940
interface SecretListItem {
@@ -172,6 +173,8 @@ export const DevboxCreatePage = ({
172173
} | null>(null);
173174
const [showInlineSecretCreate, setShowInlineSecretCreate] =
174175
React.useState(false);
176+
const [showInlineGatewayConfigCreate, setShowInlineGatewayConfigCreate] =
177+
React.useState(false);
175178
// Gateway attach form: when active, shows a mini-form to configure a gateway
176179
const [gatewayFormActive, setGatewayFormActive] = React.useState(false);
177180
const [gatewayFormField, setGatewayFormField] = React.useState<
@@ -415,7 +418,8 @@ export const DevboxCreatePage = ({
415418
!showNetworkPolicyPicker &&
416419
!showGatewayPicker &&
417420
!showSecretPicker &&
418-
!showInlineSecretCreate,
421+
!showInlineSecretCreate &&
422+
!showInlineGatewayConfigCreate,
419423
},
420424
);
421425

@@ -729,7 +733,8 @@ export const DevboxCreatePage = ({
729733
inGatewaySection &&
730734
!showGatewayPicker &&
731735
!showSecretPicker &&
732-
!showInlineSecretCreate,
736+
!showInlineSecretCreate &&
737+
!showInlineGatewayConfigCreate,
733738
},
734739
);
735740

@@ -1170,6 +1175,32 @@ export const DevboxCreatePage = ({
11701175
);
11711176
}
11721177

1178+
// Inline gateway config creation screen (from gateway attach flow)
1179+
if (showInlineGatewayConfigCreate) {
1180+
return (
1181+
<GatewayConfigCreatePage
1182+
onBack={() => {
1183+
setShowInlineGatewayConfigCreate(false);
1184+
// Return to gateway picker
1185+
setShowGatewayPicker(true);
1186+
}}
1187+
onCreate={(config) => {
1188+
setShowInlineGatewayConfigCreate(false);
1189+
// Auto-select the newly created gateway config
1190+
const configName = config.name || config.id;
1191+
setPendingGateway({ id: config.id, name: configName });
1192+
const autoEnvName = configName
1193+
.toUpperCase()
1194+
.replace(/[^A-Z0-9]+/g, "_")
1195+
.replace(/^_|_$/g, "");
1196+
setGatewayEnvPrefix(autoEnvName);
1197+
setShowGatewayPicker(false);
1198+
setGatewayFormField("envName");
1199+
}}
1200+
/>
1201+
);
1202+
}
1203+
11731204
// Gateway config picker screen
11741205
if (showGatewayPicker) {
11751206
const buildGatewayColumns = (tw: number): Column<GatewayConfig>[] => {
@@ -1236,14 +1267,19 @@ export const DevboxCreatePage = ({
12361267
getItemLabel: (config) => config.name || config.id,
12371268
columns: buildGatewayColumns,
12381269
mode: "single",
1239-
emptyMessage: "No gateway configs found",
1240-
searchPlaceholder: "Search gateway configs...",
1270+
emptyMessage: "No AI gateways found",
1271+
searchPlaceholder: "Search AI gateways...",
12411272
breadcrumbItems: [
12421273
{ label: "Devboxes" },
12431274
{ label: "Create" },
12441275
{ label: "Attach AI Gateway" },
12451276
{ label: "Select Config", active: true },
12461277
],
1278+
onCreateNew: () => {
1279+
setShowGatewayPicker(false);
1280+
setShowInlineGatewayConfigCreate(true);
1281+
},
1282+
createNewLabel: "Create AI gateway",
12471283
}}
12481284
onSelect={handleGatewaySelect}
12491285
onCancel={() => {

0 commit comments

Comments
 (0)