Allow deleting settled autoscaling policies

This commit is contained in:
2026-10-06 23:41:37 -04:00
parent 285279ee6d
commit 34648b34e0
7 changed files with 131 additions and 5 deletions
+4 -1
View File
@@ -60,7 +60,10 @@ function warningMessages(raw: string): string[] {
function sourceDetails(source: Omit<ProvisioningSource, 'label' | 'href'>): ProvisioningSource {
const id = source.source_id;
if (source.kind === 'autoscaling') return { ...source, label: 'Autoscaling policy', href: `/autoscaling#${encodeURIComponent(id)}` };
if (source.kind === 'autoscaling') {
const exists = !!db().prepare('SELECT 1 FROM autoscaling_policies WHERE id=?').get(id);
return { ...source, label: exists ? 'Autoscaling policy' : 'Deleted autoscaling policy', href: exists ? `/autoscaling#${encodeURIComponent(id)}` : null };
}
if (source.kind === 'campaign') {
const row = db().prepare(`SELECT d.action, d.beta_id, s.name FROM deployments d
LEFT JOIN scripts s ON s.id=COALESCE(d.script_id, (SELECT script_id FROM deployment_scripts WHERE deployment_id=d.id ORDER BY script_id LIMIT 1))