mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 17:41:58 -06:00
Adjusted Agent Node Design
This commit is contained in:
@@ -40,28 +40,26 @@ const BorealisAgentNode = ({ id, data }) => {
|
|||||||
return grouped;
|
return grouped;
|
||||||
}, [agents]);
|
}, [agents]);
|
||||||
|
|
||||||
const hostOptions = useMemo(() => {
|
const hostOptions = useMemo(() => {
|
||||||
const entries = Object.entries(agentsByHostname)
|
const entries = Object.entries(agentsByHostname)
|
||||||
.map(([host, contexts]) => {
|
.map(([host, contexts]) => {
|
||||||
const candidates = [contexts.currentuser, contexts.system].filter(Boolean);
|
const candidates = [contexts.currentuser, contexts.system].filter(Boolean);
|
||||||
if (!candidates.length) return null;
|
if (!candidates.length) return null;
|
||||||
const badge = (record) => {
|
|
||||||
if (!record) return "✕";
|
const label = host;
|
||||||
const st = (record.status || "").toString().toLowerCase();
|
const latest = Math.max(...candidates.map((r) => r.last_seen || 0));
|
||||||
if (st === "provisioned") return "✓";
|
|
||||||
return "•";
|
return { host, label, contexts, latest };
|
||||||
};
|
})
|
||||||
const label = `${host} (CURRENTUSER ${badge(contexts.currentuser)}, SYSTEM ${badge(contexts.system)})`;
|
.filter(Boolean)
|
||||||
const latest = Math.max(...candidates.map((r) => r.last_seen || 0));
|
.sort((a, b) => {
|
||||||
return { host, label, contexts, latest };
|
if (b.latest !== a.latest) return b.latest - a.latest;
|
||||||
})
|
return a.host.localeCompare(b.host);
|
||||||
.filter(Boolean)
|
});
|
||||||
.sort((a, b) => {
|
|
||||||
if (b.latest !== a.latest) return b.latest - a.latest;
|
return entries;
|
||||||
return a.host.localeCompare(b.host);
|
}, [agentsByHostname]);
|
||||||
});
|
|
||||||
return entries;
|
|
||||||
}, [agentsByHostname]);
|
|
||||||
|
|
||||||
// Fetch Agents Periodically
|
// Fetch Agents Periodically
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -72,7 +70,7 @@ const BorealisAgentNode = ({ id, data }) => {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
fetchAgents();
|
fetchAgents();
|
||||||
const interval = setInterval(fetchAgents, 4000);
|
const interval = setInterval(fetchAgents, 10000); // Update Agent List Every 10 Seconds
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -237,9 +235,9 @@ const BorealisAgentNode = ({ id, data }) => {
|
|||||||
style={{ top: "100%", background: "#58a6ff" }}
|
style={{ top: "100%", background: "#58a6ff" }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="borealis-node-header">Borealis Agent</div>
|
<div className="borealis-node-header">Device Agent</div>
|
||||||
<div className="borealis-node-content" style={{ fontSize: "9px" }}>
|
<div className="borealis-node-content" style={{ fontSize: "9px" }}>
|
||||||
<label>Device:</label>
|
<label>Current Device:</label>
|
||||||
<select
|
<select
|
||||||
value={selectedHost}
|
value={selectedHost}
|
||||||
onChange={(e) => setSelectedHost(e.target.value)}
|
onChange={(e) => setSelectedHost(e.target.value)}
|
||||||
@@ -253,23 +251,23 @@ const BorealisAgentNode = ({ id, data }) => {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label>Agent Context:</label>
|
<label>Available Agent Context(s):</label>
|
||||||
<select
|
<select
|
||||||
value={selectedMode}
|
value={selectedMode}
|
||||||
onChange={(e) => setSelectedMode(e.target.value)}
|
onChange={(e) => setSelectedMode(e.target.value)}
|
||||||
style={{ width: "100%", marginBottom: "6px", fontSize: "9px" }}
|
style={{ width: "100%", marginBottom: "2px", fontSize: "9px" }}
|
||||||
disabled={!selectedHost}
|
disabled={!selectedHost}
|
||||||
>
|
>
|
||||||
<option value="currentuser" disabled={!activeHostContexts?.currentuser}>
|
<option value="currentuser" disabled={!activeHostContexts?.currentuser}>
|
||||||
CURRENTUSER Agent
|
CURRENTUSER (Screen Capture / Macros)
|
||||||
</option>
|
</option>
|
||||||
<option value="system" disabled={!activeHostContexts?.system}>
|
<option value="system" disabled={!activeHostContexts?.system}>
|
||||||
SYSTEM Agent
|
SYSTEM (Scripts)
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<div style={{ fontSize: "8px", color: "#aaa", marginBottom: "4px" }}>
|
<div style={{ fontSize: "6px", color: "#aaa", marginBottom: "6px" }}>
|
||||||
Target Agent ID:{" "}
|
Agent ID:{" "}
|
||||||
{selectedAgent ? (
|
{selectedAgent ? (
|
||||||
<span style={{ color: "#eee" }}>{selectedAgent}</span>
|
<span style={{ color: "#eee" }}>{selectedAgent}</span>
|
||||||
) : (
|
) : (
|
||||||
@@ -293,14 +291,6 @@ const BorealisAgentNode = ({ id, data }) => {
|
|||||||
Connect to Agent
|
Connect to Agent
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<hr style={{ margin: "6px 0", borderColor: "#444" }} />
|
|
||||||
|
|
||||||
<div style={{ fontSize: "8px", color: "#aaa" }}>
|
|
||||||
Status: <strong>{selectedAgentStatus}</strong>
|
|
||||||
<br />
|
|
||||||
Attach <strong>Agent Role Nodes</strong> to define live behavior.
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -309,7 +299,7 @@ const BorealisAgentNode = ({ id, data }) => {
|
|||||||
// Node Registration Object with sidebar config and docs
|
// Node Registration Object with sidebar config and docs
|
||||||
export default {
|
export default {
|
||||||
type: "Borealis_Agent",
|
type: "Borealis_Agent",
|
||||||
label: "Borealis Agent",
|
label: "Device Agent",
|
||||||
description: `
|
description: `
|
||||||
Select and connect to a remote Borealis Agent.
|
Select and connect to a remote Borealis Agent.
|
||||||
- Assign roles to agent dynamically by connecting "Agent Role" nodes.
|
- Assign roles to agent dynamically by connecting "Agent Role" nodes.
|
||||||
|
|||||||
Reference in New Issue
Block a user