Wire device execution mode controls into UI

This commit is contained in:
kris
2026-04-06 11:10:51 +08:00
parent 27ab594921
commit 43c733069c
11 changed files with 1033 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
import { NextRequest, NextResponse } from "next/server";
import { requireRequestSession } from "@/lib/boss-auth";
import { updateDevice } from "@/lib/boss-data";
import { applyProjectConflictDecision, updateDevice } from "@/lib/boss-data";
export async function PATCH(
request: NextRequest,
@@ -19,9 +19,33 @@ export async function PATCH(
endpoint?: string;
note?: string;
projects?: string[];
capabilities?: {
gui?: {
connected?: boolean;
lastSeenAt?: string;
lastActiveProjectId?: string;
};
cli?: {
connected?: boolean;
lastSeenAt?: string;
lastActiveProjectId?: string;
};
};
preferredExecutionMode?: "gui" | "cli";
projectId?: string;
folderKey?: string;
conflictDecision?: "forbid" | "allow_once" | "allow_always";
};
try {
if (body.conflictDecision && body.projectId) {
await applyProjectConflictDecision({
deviceId,
projectId: body.projectId,
folderKey: body.folderKey,
decision: body.conflictDecision,
});
}
const device = await updateDevice(deviceId, body);
return NextResponse.json({ ok: true, device });
} catch (error) {

View File

@@ -55,6 +55,7 @@ export default async function DevicesPage({
device={workspace.selectedDevice}
relatedThreads={workspace.relatedThreads}
activeEnrollment={workspace.activeEnrollment}
workspace={workspace}
/>
<div className="mt-3">
<DeviceImportDraftManager