Improve deploy script button feedback
All checks were successful
Build and Push Container / build (push) Successful in 36s
All checks were successful
Build and Push Container / build (push) Successful in 36s
- Show spinning loader and "Deploying script to {host}..." message while deploying
- Show error message in UI when deployment fails (instead of just console.error)
- Better visual feedback for both initial deploy and retry scenarios
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,11 @@ export default function DiscoveryResults({ scanId, scan, analysis, devMode, onCo
|
|||||||
const pushMetric = result.push_metric;
|
const pushMetric = result.push_metric;
|
||||||
|
|
||||||
if (!monitorId || !pushMetric) {
|
if (!monitorId || !pushMetric) {
|
||||||
console.error('Missing monitor ID or push metric for deployment');
|
const errorMsg = `Missing data for deployment: monitorID=${monitorId}, push_metric=${pushMetric}`;
|
||||||
|
console.error(errorMsg, result);
|
||||||
|
setCreateResults(prev => prev.map((r, i) =>
|
||||||
|
i === resultIndex ? { ...r, deployment: { status: 'failed', error: errorMsg } } : r
|
||||||
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,6 +379,14 @@ export default function DiscoveryResults({ scanId, scan, analysis, devMode, onCo
|
|||||||
</svg>
|
</svg>
|
||||||
<span>Script deployed to {result.deployment.script_path}</span>
|
<span>Script deployed to {result.deployment.script_path}</span>
|
||||||
</>
|
</>
|
||||||
|
) : deployingScripts[index] ? (
|
||||||
|
<>
|
||||||
|
<svg className="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" fill="none" />
|
||||||
|
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||||
|
</svg>
|
||||||
|
<span>Deploying script to {scan.hostname}...</span>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
@@ -383,10 +395,9 @@ export default function DiscoveryResults({ scanId, scan, analysis, devMode, onCo
|
|||||||
<span>Deployment failed: {result.deployment.error}</span>
|
<span>Deployment failed: {result.deployment.error}</span>
|
||||||
<button
|
<button
|
||||||
onClick={() => handleRetryDeploy(index, result)}
|
onClick={() => handleRetryDeploy(index, result)}
|
||||||
disabled={deployingScripts[index]}
|
className="ml-2 px-2 py-0.5 text-xs bg-purple-600 hover:bg-purple-500 text-white rounded transition-colors"
|
||||||
className="ml-2 px-2 py-0.5 text-xs bg-purple-600 hover:bg-purple-500 disabled:bg-slate-600 text-white rounded transition-colors"
|
|
||||||
>
|
>
|
||||||
{deployingScripts[index] ? 'Deploying...' : 'Retry Deploy'}
|
Retry Deploy
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -402,17 +413,28 @@ export default function DiscoveryResults({ scanId, scan, analysis, devMode, onCo
|
|||||||
{/* Push monitor without deployment info (needs manual deploy) */}
|
{/* Push monitor without deployment info (needs manual deploy) */}
|
||||||
{result.type === 'push' && result.status === 'created' && !result.deployment && (
|
{result.type === 'push' && result.status === 'created' && !result.deployment && (
|
||||||
<div className="mt-2 ml-7 text-sm text-amber-400 flex items-center gap-2">
|
<div className="mt-2 ml-7 text-sm text-amber-400 flex items-center gap-2">
|
||||||
|
{deployingScripts[index] ? (
|
||||||
|
<>
|
||||||
|
<svg className="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" fill="none" />
|
||||||
|
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
|
||||||
|
</svg>
|
||||||
|
<span>Deploying script to {scan.hostname}...</span>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
||||||
</svg>
|
</svg>
|
||||||
<span>Script not deployed</span>
|
<span>Script not deployed</span>
|
||||||
<button
|
<button
|
||||||
onClick={() => handleRetryDeploy(index, result)}
|
onClick={() => handleRetryDeploy(index, result)}
|
||||||
disabled={deployingScripts[index]}
|
className="ml-2 px-2 py-0.5 text-xs bg-purple-600 hover:bg-purple-500 text-white rounded transition-colors"
|
||||||
className="ml-2 px-2 py-0.5 text-xs bg-purple-600 hover:bg-purple-500 disabled:bg-slate-600 text-white rounded transition-colors"
|
|
||||||
>
|
>
|
||||||
{deployingScripts[index] ? 'Deploying...' : 'Deploy Script'}
|
Deploy Script
|
||||||
</button>
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user