mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-07 09:24:09 +00:00
feat(resources): bind prune to fingerprinted itemized plans (#1611)
* feat(resources): bind prune to fingerprinted itemized plans * fix(resources): repair prune plan volume usage and preview list Source volume RefCount from docker df, keep preview rows from flex-shrinking, tighten managed image attribution and becomesFree, and stop audit summaries from claiming success on rejected prunes.
This commit is contained in:
@@ -35,6 +35,7 @@ export const AUDIT_ROUTE_SUMMARIES: Record<string, string> = {
|
||||
// System operations
|
||||
'POST /system/prune': 'Pruned system resources',
|
||||
'POST /system/prune/orphans': 'Pruned orphan containers',
|
||||
'POST /system/prune/plan': 'Built prune plan',
|
||||
'POST /system/prune/system': 'Pruned system resources',
|
||||
'POST /system/images/delete': 'Deleted images',
|
||||
'POST /system/volumes/delete': 'Deleted volumes',
|
||||
@@ -158,8 +159,19 @@ const SORTED_PATTERNS = Object.entries(AUDIT_ROUTE_SUMMARIES)
|
||||
* falls back to prefix matching. Returns a generic method+path string
|
||||
* if no pattern matches.
|
||||
*/
|
||||
export function getAuditSummary(method: string, apiPath: string): string {
|
||||
export function getAuditSummary(method: string, apiPath: string, statusCode?: number): string {
|
||||
const normalized = apiPath.replace(/^\//, '');
|
||||
// Do not claim a successful prune when the request was rejected or blocked.
|
||||
if (typeof statusCode === 'number' && statusCode >= 400) {
|
||||
if (method === 'POST' && normalized.startsWith('system/prune/system')) {
|
||||
if (statusCode === 409) return 'Prune blocked: plan stale';
|
||||
if (statusCode === 400) return 'Prune request rejected';
|
||||
return `Prune failed (${statusCode})`;
|
||||
}
|
||||
if (method === 'POST' && normalized.startsWith('system/prune/plan')) {
|
||||
return `Prune plan failed (${statusCode})`;
|
||||
}
|
||||
}
|
||||
const normalizedSegments = normalized.split('/');
|
||||
|
||||
for (const [pattern, summary] of SORTED_PATTERNS) {
|
||||
|
||||
Reference in New Issue
Block a user