feat: show Redeploy button when config changed after deployment
Compare app.updatedAt with deployment.deployedAt — if config was modified after the deployment started, show a primary "Redeploy" button in the Actions column. Also show a toast hint after saving config: "Redeploy to apply changes to running deployments." Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -617,6 +617,7 @@ function OverviewSubTab({ app, deployments, versions, environments, envMap, sele
|
||||
const isSelectedEnv = !selectedEnvId || d.environmentId === selectedEnvId;
|
||||
const canAct = isSelectedEnv && (d.status === 'RUNNING' || d.status === 'STARTING');
|
||||
const canStart = isSelectedEnv && d.status === 'STOPPED';
|
||||
const configChanged = canAct && d.deployedAt && new Date(app.updatedAt) > new Date(d.deployedAt);
|
||||
const url = dEnv ? `/${dEnv.slug}/${app.slug}/` : '';
|
||||
|
||||
return (
|
||||
@@ -641,7 +642,8 @@ function OverviewSubTab({ app, deployments, versions, environments, envMap, sele
|
||||
)}
|
||||
</td>
|
||||
<td><span className={styles.cellMeta}>{d.deployedAt ? timeAgo(d.deployedAt) : '—'}</span></td>
|
||||
<td style={{ textAlign: 'right' }}>
|
||||
<td style={{ textAlign: 'right', display: 'flex', gap: 4, justifyContent: 'flex-end' }}>
|
||||
{configChanged && <Button size="sm" variant="primary" onClick={() => onDeploy(d.appVersionId, d.environmentId)}>Redeploy</Button>}
|
||||
{canAct && <Button size="sm" variant="danger" onClick={() => onStop(d.id)}>Stop</Button>}
|
||||
{canStart && <Button size="sm" variant="secondary" onClick={() => onDeploy(d.appVersionId, d.environmentId)}>Start</Button>}
|
||||
{!isSelectedEnv && <span className={styles.envHint}>switch env to manage</span>}
|
||||
@@ -820,7 +822,7 @@ function ConfigSubTab({ app, environment }: { app: App; environment?: Environmen
|
||||
};
|
||||
try {
|
||||
await updateContainerConfig.mutateAsync({ appId: app.slug, config: containerConfig });
|
||||
toast({ title: 'Configuration saved', variant: 'success' });
|
||||
toast({ title: 'Configuration saved', description: 'Redeploy to apply changes to running deployments.', variant: 'success' });
|
||||
setEditing(false);
|
||||
} catch { toast({ title: 'Failed to save container config', variant: 'error', duration: 86_400_000 }); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user