feat: Agent zeigt Warnung wenn er nicht den Kunden-Key nutzt
- last_api_key Spalte in agents, wird bei Heartbeat gesetzt - GetAgentsByCustomer liefert last_api_key mit - Frontend: rot + Warnsymbol wenn Key abweicht vom Kunden-Agent-Key - Grau wenn noch kein Heartbeat mit Key-Info
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import api from '../api/client'
|
||||
import { copyToClipboard } from '../utils/clipboard'
|
||||
import { Plus, Trash2, Edit2, X, Check, ChevronDown, ChevronRight, Copy, Key, Monitor } from 'lucide-react'
|
||||
import { Plus, Trash2, Edit2, X, Check, ChevronDown, ChevronRight, Copy, Key, Monitor, AlertTriangle } from 'lucide-react'
|
||||
|
||||
const PERM_LABELS = {
|
||||
agent: { label: 'Agent', color: 'text-blue-400 bg-blue-900/30 border-blue-700/50' },
|
||||
@@ -232,16 +232,32 @@ function CustomerKeyPanel({ customerId }) {
|
||||
{agents.length === 0 ? (
|
||||
<div className="text-xs text-gray-600">Keine Agents zugeordnet</div>
|
||||
) : (
|
||||
agents.map((a) => (
|
||||
<div key={a.id} className="flex items-center gap-2.5">
|
||||
<span className={`w-1.5 h-1.5 rounded-full flex-shrink-0 ${
|
||||
a.status === 'online' ? 'bg-green-400' :
|
||||
a.status === 'stale' ? 'bg-yellow-400' : 'bg-gray-600'
|
||||
}`} />
|
||||
<span className="text-xs text-gray-300 flex-1 min-w-0 truncate">{a.name}</span>
|
||||
<span className="text-[10px] text-gray-600 font-mono flex-shrink-0">{a.agent_version || '—'}</span>
|
||||
</div>
|
||||
))
|
||||
agents.map((a) => {
|
||||
const wrongKey = agentKey && a.last_api_key && a.last_api_key !== agentKey.key
|
||||
const unknownKey = agentKey && !a.last_api_key
|
||||
return (
|
||||
<div key={a.id} className={`flex items-center gap-2.5 rounded px-1.5 py-0.5 -mx-1.5 ${wrongKey ? 'bg-red-900/20' : ''}`}>
|
||||
<span className={`w-1.5 h-1.5 rounded-full flex-shrink-0 ${
|
||||
a.status === 'online' ? 'bg-green-400' :
|
||||
a.status === 'stale' ? 'bg-yellow-400' : 'bg-gray-600'
|
||||
}`} />
|
||||
<span className={`text-xs flex-1 min-w-0 truncate ${wrongKey ? 'text-red-300' : 'text-gray-300'}`}>
|
||||
{a.name}
|
||||
</span>
|
||||
<span className="text-[10px] text-gray-600 font-mono flex-shrink-0">{a.agent_version || '—'}</span>
|
||||
{wrongKey && (
|
||||
<span title={`Falscher Key: ${a.last_api_key?.substring(0,8)}...`}>
|
||||
<AlertTriangle className="w-3 h-3 text-red-400 flex-shrink-0" />
|
||||
</span>
|
||||
)}
|
||||
{unknownKey && (
|
||||
<span title="Noch kein Heartbeat mit Key-Info">
|
||||
<AlertTriangle className="w-3 h-3 text-gray-600 flex-shrink-0" />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user