mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-11 03:06:54 +00:00
fix(schedules): filter auto-update policies from Scheduled Operations view (#420)
* fix(schedules): filter auto-update policies from Scheduled Operations view Auto-update policies (action=update) were appearing in both the Auto-Update tab and the Scheduled Operations tab. Added server-side action/exclude_action query params to GET /api/scheduled-tasks. ScheduledOperationsView now requests ?exclude_action=update and AutoUpdatePoliciesView requests ?action=update, so each view only shows its relevant tasks. * fix(schedules): use typeof guard for query param type safety Express can parse ?action[]=x as an array. Use typeof === 'string' guard instead of unsafe type assertion.
This commit is contained in:
@@ -115,10 +115,9 @@ function AutoUpdatePoliciesContent({ filterNodeId, onClearFilter }: AutoUpdatePo
|
||||
const fetchPolicies = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await apiFetch('/scheduled-tasks', { localOnly: true });
|
||||
const res = await apiFetch('/scheduled-tasks?action=update', { localOnly: true });
|
||||
if (res.ok) {
|
||||
const all: ScheduledTask[] = await res.json();
|
||||
setPolicies(all.filter(t => t.action === 'update'));
|
||||
setPolicies(await res.json());
|
||||
}
|
||||
} catch {
|
||||
// Non-critical
|
||||
|
||||
@@ -118,7 +118,7 @@ export default function ScheduledOperationsView({ filterNodeId, onClearFilter }:
|
||||
const fetchTasks = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await apiFetch('/scheduled-tasks', { localOnly: true });
|
||||
const res = await apiFetch('/scheduled-tasks?exclude_action=update', { localOnly: true });
|
||||
if (res.ok) {
|
||||
setTasks(await res.json());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user