mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-10 10:49:35 +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:
@@ -4518,6 +4518,14 @@ app.get('/api/scheduled-tasks', (req: Request, res: Response): void => {
|
||||
if (ls.getVariant() !== 'admiral') {
|
||||
tasks = tasks.filter(t => t.action === 'update');
|
||||
}
|
||||
// Separate Auto-Update and Scheduled Operations into distinct views
|
||||
const actionFilter = typeof req.query.action === 'string' ? req.query.action : undefined;
|
||||
const excludeAction = typeof req.query.exclude_action === 'string' ? req.query.exclude_action : undefined;
|
||||
if (actionFilter) {
|
||||
tasks = tasks.filter(t => t.action === actionFilter);
|
||||
} else if (excludeAction) {
|
||||
tasks = tasks.filter(t => t.action !== excludeAction);
|
||||
}
|
||||
res.json(tasks);
|
||||
} catch (error) {
|
||||
console.error('[ScheduledTasks] List error:', error);
|
||||
|
||||
Reference in New Issue
Block a user