Add self-serve Edge Agents management with navigation, routes, and tabs. Update legacy redirects and extend unit and E2E tests.
This commit is contained in:
@@ -1896,7 +1896,7 @@ function createHttpEdgeGatewayFixture(options = {}) {
|
||||
level: "INFO",
|
||||
stream: "relay",
|
||||
source: "RELAY_DISPATCH",
|
||||
message: "Relay SWITCH M-7 handled by local via BROKER_FAST_PATH",
|
||||
message: "MACHINE ON Roskilde Maskine handled by local via BROKER_FAST_PATH",
|
||||
context: {
|
||||
module: "selfserve",
|
||||
module_responsible: "selfserve",
|
||||
@@ -1904,6 +1904,9 @@ function createHttpEdgeGatewayFixture(options = {}) {
|
||||
handler: "local",
|
||||
delivery_channel: "BROKER_FAST_PATH",
|
||||
relay_id: "M-7",
|
||||
relay_name: "Roskilde Maskine",
|
||||
relay_role: "MACHINE",
|
||||
description: "MACHINE ON Roskilde Maskine handled by local via BROKER_FAST_PATH",
|
||||
action: "SWITCH",
|
||||
target_on: true,
|
||||
associated: {
|
||||
@@ -1924,6 +1927,38 @@ function createHttpEdgeGatewayFixture(options = {}) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 804,
|
||||
created_at: "2026-04-08 08:14:56",
|
||||
level: "INFO",
|
||||
stream: "relay",
|
||||
source: "RELAY_DISPATCH",
|
||||
message: "Relay SWITCH IN-7 handled by local via BROKER_FAST_PATH",
|
||||
context: {
|
||||
module: "selfserve",
|
||||
module_responsible: "selfserve",
|
||||
reason: "Open self-serve ENTRY gate relay",
|
||||
handler: "local",
|
||||
delivery_channel: "BROKER_FAST_PATH",
|
||||
relay_id: "IN-7",
|
||||
relay_name: "Roskilde indkoerselspc",
|
||||
relay_role: "ENTRY",
|
||||
action: "SWITCH",
|
||||
target_on: true,
|
||||
signal: {
|
||||
command_type: "SET_RELAY_STATE",
|
||||
relay_id: "IN-7",
|
||||
request: {
|
||||
relayId: "IN-7",
|
||||
on: true,
|
||||
},
|
||||
},
|
||||
response: {
|
||||
online: true,
|
||||
on: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
operations: [
|
||||
createFixtureOperation(
|
||||
@@ -4037,7 +4072,7 @@ function buildEdgeGatewayHardwareDepartmentWorkspace(edgeGatewayFixture, departm
|
||||
actions.push({
|
||||
code: "INSTALL_GATEWAY",
|
||||
label: "Install first edge gateway",
|
||||
path: "/superuser/configuration/edgegateway",
|
||||
path: "/superuser/selfserve/edge-agents",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4270,6 +4305,60 @@ async function handleEdgeGatewayRoute({ route, request, parsedUrl, pathname, met
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pathname.endsWith("/edgegateway/config/broker-diagnostics") && method === "POST") {
|
||||
const body = request.postDataJSON?.() || {};
|
||||
const target = String(body.target || "all");
|
||||
const payload = {
|
||||
target,
|
||||
checked_at: "2026-04-28 10:00:00",
|
||||
broker_auth_mode: String(body.broker_auth_mode || edgeGatewayFixture.config.broker_auth_mode || "manager"),
|
||||
broker_shared_secret_configured: Boolean(
|
||||
body.broker_shared_secret || edgeGatewayFixture.config.broker_shared_secret
|
||||
),
|
||||
};
|
||||
|
||||
if (target === "internal" || target === "all") {
|
||||
payload.internal_broker_connection = {
|
||||
ok: Boolean(body.broker_url),
|
||||
status: body.broker_url ? "connected" : "not_configured",
|
||||
status_code: body.broker_url ? 200 : null,
|
||||
url: body.broker_url || null,
|
||||
message: body.broker_url
|
||||
? "Internal broker responded to the health check."
|
||||
: "Internal broker URL is not configured.",
|
||||
};
|
||||
}
|
||||
|
||||
if (target === "public" || target === "all") {
|
||||
payload.public_broker_url = {
|
||||
ok: Boolean(body.public_broker_url),
|
||||
status: body.public_broker_url ? "connected" : "not_configured",
|
||||
status_code: body.public_broker_url ? 200 : null,
|
||||
url: body.public_broker_url || null,
|
||||
message: body.public_broker_url
|
||||
? "Public broker responded to the health check."
|
||||
: "Public broker URL is not configured.",
|
||||
};
|
||||
}
|
||||
|
||||
if (target === "secret" || target === "all") {
|
||||
const validSecret =
|
||||
String(body.broker_shared_secret || "") === String(edgeGatewayFixture.config.broker_shared_secret || "");
|
||||
payload.broker_shared_secret = {
|
||||
ok: validSecret,
|
||||
status: validSecret ? "validated" : "secret_rejected",
|
||||
status_code: validSecret ? 200 : 403,
|
||||
url: body.broker_url || edgeGatewayFixture.config.broker_url || null,
|
||||
message: validSecret
|
||||
? "Broker accepted the configured shared secret."
|
||||
: "Broker rejected the configured shared secret.",
|
||||
};
|
||||
}
|
||||
|
||||
await route.fulfill(json({ data: payload }));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (edgeGatewayWorkspaceDepartmentsPattern.test(pathname) && method === "GET") {
|
||||
const hardware = ensureEdgeGatewayHardwareFixture(edgeGatewayFixture);
|
||||
const summaries = (hardware?.departments || [])
|
||||
|
||||
Reference in New Issue
Block a user