mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-01 11:47:46 +02:00
fix(permissions): self-heal Administrators to ALL_PERMISSIONS on upgrade + Pipelines runs dashboard polish
Administrators system group sync - Fresh installs already bootstrap with ALL_PERMISSIONS, so they always have every permission. Upgrades previously only got what one-off backfill blocks in seed_default_groups() explicitly listed (library:purge, archives:purge, the OWN/ALL read-flag block, orca_cloud:auth, pipelines:*). Any Permission enum member added without a matching block silently stayed missing on existing admin rows. The most recent gap was printer_sensor_history:read (Sensor History charts returned 403 for upgraded admins). - seed_default_groups() now syncs Administrators to ALL_PERMISSIONS on every startup: append every Permission value that isn't already on the row. Additive only -- hand-added custom permissions are preserved. - The pure-admin one-off backfills (library:purge / archives:purge block, the OWN/ALL + orca_cloud:auth + legacy-read-flag block, the Administrators branch of the pipeline backfill) are retired since the sync subsumes them. Non-admin backfills (Operators / Viewers OWN-tier reads, Operators orca_cloud:auth, pipelines for non-admin groups, makerworld:*, clear_plate cross-group adders) are untouched. - Tests: test_administrators_printer_sensor_history_read_backfilled (regression for the reported gap), test_administrators_sync_covers_every_current_permission (generic invariant -- any future new permission lands on admin without needing a one-off test), test_administrators_sync_is_additive_only (custom permissions preserved). 12/12 backfill-migration + 102/102 broader permission tests green; ruff clean. Pipelines runs dashboard - PipelineRunsPage.tsx: the Pipeline / Status / Target filter row's three native <select> elements are replaced with a bambu-themed FilterDropdown (button trigger, floating menu, optgroup-style headers for the Target picker, hover + selected states with a check mark, closes on outside click and Escape). Same value/onChange contract -- visual only. - SlicerPipelinesPanel.tsx: wrap list?.pipelines ?? [] in useMemo so the reference is stable when the data is stable. Fixes the react-hooks/exhaustive-deps warning where the inline fallback returned a fresh empty array every render, invalidating both downstream useMemo caches (target-options + filtered-pipelines list).
This commit is contained in:
@@ -6390,17 +6390,26 @@ export const api = {
|
||||
offset?: number;
|
||||
pipelineId?: number;
|
||||
status?: string;
|
||||
targetPrinterId?: number;
|
||||
targetModelClass?: string;
|
||||
} = {}) => {
|
||||
const search = new URLSearchParams();
|
||||
if (params.limit) search.set('limit', String(params.limit));
|
||||
if (params.offset) search.set('offset', String(params.offset));
|
||||
if (params.pipelineId) search.set('pipeline_id', String(params.pipelineId));
|
||||
if (params.status) search.set('status', params.status);
|
||||
if (params.targetPrinterId) search.set('target_printer_id', String(params.targetPrinterId));
|
||||
if (params.targetModelClass) search.set('target_model_class', params.targetModelClass);
|
||||
const q = search.toString();
|
||||
return request<PipelineRunListResponse>(
|
||||
`/pipeline-runs${q ? '?' + q : ''}`,
|
||||
);
|
||||
},
|
||||
// Clear terminal pipeline runs (#1425 PR C polish). Deletes all runs in
|
||||
// a terminal state (completed/failed/cancelled/partial_failure); in-flight
|
||||
// runs are preserved.
|
||||
clearTerminalPipelineRuns: () =>
|
||||
request<{ deleted: number }>('/pipeline-runs/clear', { method: 'POST' }),
|
||||
getPipelineRun: (runId: number) =>
|
||||
request<PipelineRun>(`/pipeline-runs/${runId}`),
|
||||
cancelPipelineRun: (runId: number) =>
|
||||
|
||||
Reference in New Issue
Block a user