Add safe manual instance rebalancing

This commit is contained in:
2026-10-08 12:37:56 -04:00
parent 26de43639f
commit 012cd51a66
45 changed files with 2006 additions and 154 deletions
+7 -1
View File
@@ -119,6 +119,12 @@ export function provisioningReturn(value: string | null | undefined): { href: st
}
return { href: '/provisioning' + (params.size ? `?${params}` : ''), label: 'Back to Provisioning' };
}
if (url.pathname === '/capacity' && url.searchParams.get('rebalance') === '1') {
const params = new URLSearchParams({ rebalance: '1' });
const run = url.searchParams.get('rebalanceRun');
if (run) params.set('rebalanceRun', run);
return { href: `/capacity?${params}`, label: 'Back to rebalance' };
}
const match = url.pathname.match(/^\/(campaigns|betas|maintenance|collections\/launches)\/[^/]+$/);
if (match) return { href: url.pathname, label: `Back to ${match[1] === 'collections/launches' ? 'collection' : match[1] === 'campaigns' ? 'campaign' : match[1] === 'betas' ? 'beta' : 'maintenance'}` };
} catch { /* Fall back to the local list. */ }
@@ -180,7 +186,7 @@ export function isProvisioningDetail(value: unknown, id: string): value is Provi
if (!record(value.activity) || !number(value.activity.total) || !(value.activity.latestId === null || number(value.activity.latestId))
|| !(value.activity.failureExcerpt === null || event(value.activity.failureExcerpt))) return false;
if (!Array.isArray(value.sources) || !value.sources.every(source => record(source)
&& ['campaign', 'beta', 'maintenance', 'watchdog', 'autoscaling'].includes(source.kind as string)
&& ['campaign', 'beta', 'maintenance', 'watchdog', 'autoscaling', 'rebalance'].includes(source.kind as string)
&& text(source.source_id) && text(source.label) && localLink(source.href))) return false;
if (!(value.collection === null || record(value.collection) && text(value.collection.id) && text(value.collection.name))) return false;
if (!record(value.capacity) || !timestamp(value.capacity.evaluatedAt) || !Array.isArray(value.capacity.pools)