Skip to content

Commit f45aed6

Browse files
committed
small interactive demo polush
1 parent b613c1a commit f45aed6

3 files changed

Lines changed: 102 additions & 48 deletions

File tree

docs/evaluate/development-production-features/serverless-workers/demo.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ import { ServerlessWorkerDemo } from '@site/src/components';
4545

4646
## Next steps
4747

48-
- [Serverless Workers - Go SDK](/develop/go/workers/serverless-workers/aws-lambda) for SDK-specific configuration, defaults, and lifecycle details.
48+
- [Serverless Workers](/serverless-workers) for concepts, autoscaling, and lifecycle details.
4949
- [Deploy a Serverless Worker](/production-deployment/worker-deployments/serverless-workers) for the full end-to-end deployment guide.

src/components/elements/ServerlessWorkerDemo.js

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ export default function ServerlessWorkerDemo() {
253253
}));
254254
};
255255

256-
// Jump to the last step and start simulation
257-
setActiveStep(STEPS.length - 1);
258-
259256
setSim({
260257
running: true,
261258
nodeStates: [...IDLE_NODES],
@@ -355,9 +352,10 @@ export default function ServerlessWorkerDemo() {
355352
<div className={styles.demo}>
356353
{/* ── Simulation: the main interactive area ── */}
357354
<div className={styles.columns}>
358-
<div className={styles.leftCol}>
359-
<section className={styles.section}>
360-
<h3 className={styles.sectionTitle}>Serverless Worker Flow</h3>
355+
<h3 className={`${styles.sectionTitle} ${styles.row1Left}`}>Serverless Worker Flow</h3>
356+
<div className={styles.row1Right} />
357+
358+
<div className={styles.row2Left}>
361359
<div className={styles.flowDiagram}>
362360
{FLOW_NODES.map((node, i) => (
363361
<React.Fragment key={i}>
@@ -383,10 +381,29 @@ export default function ServerlessWorkerDemo() {
383381
</React.Fragment>
384382
))}
385383
</div>
386-
</section>
384+
</div>
387385

388-
<section className={styles.section}>
389-
<h3 className={styles.sectionTitle}>Execution Log</h3>
386+
<div className={styles.row2Right}>
387+
<button
388+
className={`${styles.executeBtn} ${sim.running ? styles.executeBtnDisabled : ''}`}
389+
onClick={handleSimulate}
390+
disabled={sim.running}
391+
>
392+
{sim.running ? (
393+
<>
394+
<span className={styles.spinner} />
395+
Running...
396+
</>
397+
) : (
398+
'Simulate Workflow'
399+
)}
400+
</button>
401+
</div>
402+
403+
<h3 className={`${styles.sectionTitle} ${styles.row3Left}`}>Execution Log</h3>
404+
<h3 className={`${styles.sectionTitle} ${styles.row3Right}`}>Configuration</h3>
405+
406+
<div className={styles.row4Left}>
390407
<div className={styles.log} ref={logScrollRef}>
391408
{sim.log.length === 0 ? (
392409
<div className={styles.logPlaceholder}>
@@ -403,34 +420,13 @@ export default function ServerlessWorkerDemo() {
403420
</div>
404421
))
405422
)}
406-
</div>
407-
408-
{sim.status === 'completed' && (
409-
<div className={styles.resultSuccess}>Workflow completed successfully.</div>
410-
)}
411-
</section>
412-
</div>
413-
414-
<div className={styles.rightCol}>
415-
<section className={styles.section}>
416-
<button
417-
className={`${styles.executeBtn} ${sim.running ? styles.executeBtnDisabled : ''}`}
418-
onClick={handleSimulate}
419-
disabled={sim.running}
420-
>
421-
{sim.running ? (
422-
<>
423-
<span className={styles.spinner} />
424-
Running...
425-
</>
426-
) : (
427-
'Simulate Workflow'
423+
{sim.status === 'completed' && (
424+
<div className={styles.resultSuccess}>Workflow completed successfully.</div>
428425
)}
429-
</button>
430-
</section>
426+
</div>
427+
</div>
431428

432-
<section className={styles.section}>
433-
<h3 className={styles.sectionTitle}>Configuration</h3>
429+
<div className={styles.row4Right}>
434430
<div className={styles.configGrid}>
435431
<ConfigField
436432
label="Deployment Name"
@@ -458,8 +454,7 @@ export default function ServerlessWorkerDemo() {
458454
onChange={handleFunctionNameChange}
459455
/>
460456
</div>
461-
</section>
462-
</div>
457+
</div>
463458
</div>
464459

465460
<Admonition type="note" title="Simulated logs">

src/components/elements/serverless-worker-demo.module.css

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,73 @@
4040
/* ── Two-column layout (simulation + config) ──────────────────────────── */
4141

4242
.columns {
43-
display: flex;
44-
gap: 24px;
45-
align-items: flex-start;
43+
display: grid;
44+
grid-template-columns: 1fr 1fr;
45+
grid-template-rows: auto auto 1fr auto;
46+
gap: 8px 24px;
4647
}
4748

48-
.leftCol,
49-
.rightCol {
50-
flex: 1;
51-
min-width: 0;
49+
.row1Left {
50+
grid-column: 1;
51+
grid-row: 1;
52+
align-self: end;
53+
}
54+
55+
.row1Right {
56+
grid-column: 2;
57+
grid-row: 1;
58+
align-self: end;
59+
}
60+
61+
.row2Left {
62+
grid-column: 1;
63+
grid-row: 2;
64+
align-self: center;
65+
}
66+
67+
.row2Right {
68+
grid-column: 2;
69+
grid-row: 2;
70+
align-self: center;
71+
}
72+
73+
.row3Left {
74+
grid-column: 1;
75+
grid-row: 3;
76+
align-self: end;
77+
padding-top: 16px;
78+
}
79+
80+
.row3Right {
81+
grid-column: 2;
82+
grid-row: 3;
83+
align-self: end;
84+
padding-top: 16px;
85+
}
86+
87+
.row4Left {
88+
grid-column: 1;
89+
grid-row: 4;
90+
margin-bottom: 20px;
91+
}
92+
93+
.row4Right {
94+
grid-column: 2;
95+
grid-row: 4;
96+
margin-bottom: 20px;
5297
}
5398

5499
@media (max-width: 900px) {
55100
.columns {
56-
flex-direction: column;
101+
grid-template-columns: 1fr;
102+
grid-template-rows: auto;
103+
}
104+
.row1Left, .row1Right,
105+
.row2Left, .row2Right,
106+
.row3Left, .row3Right,
107+
.row4Left, .row4Right {
108+
grid-column: 1;
109+
grid-row: auto;
57110
}
58111
}
59112

@@ -282,18 +335,24 @@
282335
border: 1px solid var(--ifm-color-emphasis-200);
283336
border-radius: 6px;
284337
padding: 12px;
285-
max-height: 260px;
338+
min-height: 100%;
339+
max-height: 300px;
286340
overflow-y: auto;
287341
font-family: var(--ifm-font-family-monospace);
288342
font-size: 0.78rem;
289343
line-height: 1.6;
344+
display: flex;
345+
flex-direction: column;
290346
}
291347

292348
.logPlaceholder {
293349
color: var(--ifm-font-color-secondary);
294350
font-style: italic;
295351
text-align: center;
296-
padding: 24px 0;
352+
flex: 1;
353+
display: flex;
354+
align-items: center;
355+
justify-content: center;
297356
}
298357

299358
.logLine {

0 commit comments

Comments
 (0)