All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 58s
Features added:
- Group-based process organization with collapsible cards
- Batch operations for groups (Start All, Stop All, Restart All)
- Group statistics display (running, stopped, fatal counts)
- Dedicated /groups page for group-centric management
- View toggle in /processes page (Flat view | Grouped view)
Implementation details:
- Created group API routes: /api/supervisor/groups/[name]/{start,stop,restart}
- Added React Query hooks: useStartProcessGroup, useStopProcessGroup, useRestartProcessGroup
- Created components: GroupCard, GroupView, GroupSelector
- Updated Navbar with Groups navigation link
- Integrated grouped view in processes page with toggle
Phase 2 complete (6-8 hours estimated)
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { createSupervisorClient } from '@/lib/supervisor/client';
|
|
|
|
interface RouteParams {
|
|
params: Promise<{ name: string }>;
|
|
}
|
|
|
|
// POST - Restart all processes in a group (stop then start)
|
|
export async function POST(request: NextRequest, { params }: RouteParams) {
|
|
try {
|
|
const { name } = await params;
|
|
const body = await request.json().catch(() => ({}));
|
|
const wait = body.wait ?? true;
|
|
|
|
const client = createSupervisorClient();
|
|
|
|
// Stop all processes in the group first
|
|
await client.stopProcessGroup(name, wait);
|
|
|
|
// Then start them
|
|
const results = await client.startProcessGroup(name, wait);
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
message: `Restarted process group: ${name}`,
|
|
results,
|
|
});
|
|
} catch (error: any) {
|
|
console.error('Supervisor restart process group error:', error);
|
|
return NextResponse.json(
|
|
{ error: error.message || 'Failed to restart process group' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|