Spaces:
Runtime error
Runtime error
File size: 1,879 Bytes
1e24842 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import React from 'react';
import { RefreshCw, Zap, Download } from 'lucide-react';
export default function PlanHeader({
executionPlan, stepResults,
isRunningAll, executingStep,
onRunAll, onReset, onExport,
}) {
const successCount = Object.values(stepResults).filter(r => r.analysis?.status === 'success').length;
const pct = executionPlan.length > 0
? Math.round((successCount / executionPlan.length) * 100)
: 0;
return (
<div className="plan-meta">
<div>
<div className="h-eyebrow">Execution plan</div>
<div style={{ display: 'flex', alignItems: 'baseline', gap: 10, marginTop: 2 }}>
<span style={{ fontSize: 15, fontWeight: 600, color: 'var(--fg-0)' }}>{executionPlan.length} steps</span>
</div>
</div>
<div className="grow"/>
<div style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 12, color: 'var(--fg-2)' }}>
<span style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--ok)', display: 'inline-block' }}/>
{successCount}
<span style={{ color: 'var(--fg-3)' }}>/ {executionPlan.length} ok</span>
</div>
<div className="progress">
<i style={{ width: `${pct}%` }}/>
</div>
{onExport && (
<button className="btn" onClick={onExport} title="Export as Postman Collection">
<Download size={13}/> Export
</button>
)}
<button className="btn" onClick={onReset}>
<RefreshCw size={13}/> Reset
</button>
<button
className="btn btn-primary"
onClick={onRunAll}
disabled={isRunningAll || !!executingStep}
style={{ gap: 6 }}
>
{isRunningAll
? <><RefreshCw size={13} style={{ animation: 'spin 1s linear infinite' }}/> Running…</>
: <><Zap size={13}/> Run all</>}
</button>
</div>
);
}
|