feat: implement Phase 3 - Batch Operations
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 59s

Features added:
- Multi-select functionality for processes with checkboxes
- Floating BatchActions toolbar appears when processes are selected
- Batch operations: Start Selected, Stop Selected, Restart Selected
- Select All / Deselect All button in processes page
- Visual feedback with ring indicator on selected cards
- Click card to toggle selection, buttons prevent card selection

Implementation details:
- Created batch API routes: /api/supervisor/processes/{start-all,stop-all,restart-all}
- Added React Query hooks: useStartAllProcesses, useStopAllProcesses, useRestartAllProcesses
- Created BatchActions component with floating toolbar
- Enhanced ProcessCard with optional selection mode (isSelected, onSelectionChange props)
- Updated processes page with selection state management
- Checkbox prevents event bubbling to avoid conflicts with action buttons

UX improvements:
- Selected cards show primary ring with offset
- BatchActions toolbar slides up from bottom
- Selection count displayed in toolbar
- Clear selection with X button or after batch action completes

Phase 3 complete (4-6 hours estimated)
This commit is contained in:
2025-11-23 19:14:04 +01:00
parent 5c028cdc11
commit 236786cb31
7 changed files with 369 additions and 10 deletions

View File

@@ -0,0 +1,30 @@
import { NextRequest, NextResponse } from 'next/server';
import { createSupervisorClient } from '@/lib/supervisor/client';
// POST - Restart all processes (stop then start)
export async function POST(request: NextRequest) {
try {
const body = await request.json().catch(() => ({}));
const wait = body.wait ?? true;
const client = createSupervisorClient();
// Stop all processes first
await client.stopAllProcesses(wait);
// Then start them
const results = await client.startAllProcesses(wait);
return NextResponse.json({
success: true,
message: 'Restarted all processes',
results,
});
} catch (error: any) {
console.error('Supervisor restart all processes error:', error);
return NextResponse.json(
{ error: error.message || 'Failed to restart all processes' },
{ status: 500 }
);
}
}