Fix: Add protected_label field immune to Proxy overwrites - UI always reads protected_label first
This commit is contained in:
1 parent
90817cb2f8
commit
773e654616
2 files changed
+5
-2
No files matched your search
@@ -30,9 +30,12 @@ export async function updateAgent(agentId: string, label: string) {
|
||||
return { success: false, message: "Agent tidak ditemukan di database lokal." };
|
||||
}
|
||||
|
||||
// Write both label AND protected_label.
|
||||
// protected_label is ONLY set by the UI — the Proxy NEVER touches it.
|
||||
// This ensures custom names survive even if the Proxy overwrites label field.
|
||||
await db.collection('agent_registry').updateOne(
|
||||
{ _id: agent._id },
|
||||
{ $set: { label: label } }
|
||||
{ $set: { label: label, protected_label: label } }
|
||||
);
|
||||
|
||||
// Bismillah: Hapus semua data duplikat/hantu milik agent ini agar tidak ditimpa oleh proxy lawas/bug ganda
|
||||
|
||||
@@ -160,7 +160,7 @@ export async function fetchAgentsFromMongo(
|
||||
organization_uuid: '',
|
||||
provisioned: item.provisioned ?? true,
|
||||
activated: true,
|
||||
label: item.label || uuid,
|
||||
label: item.protected_label || item.label || uuid,
|
||||
created_at: { human: 'N/A', date: '', unix_time: 0 },
|
||||
updated_at: { human: 'N/A', date: '', unix_time: 0 },
|
||||
last_seen_at: {
|
||||
|
||||
Reference in new issue
Block a user