feat(plugin): support enterprise extension (#861)

This commit is contained in:
Haze
2026-04-16 17:15:25 +08:00
committed by GitHub
Unverified
parent 2fefbf3aba
commit b884db629e
29 changed files with 847 additions and 22 deletions

View File

@@ -114,21 +114,22 @@ function removeDeletedTarget(groups: ChannelGroupItem[], target: DeleteTarget):
return groups.filter((group) => group.channelType !== target.channelType);
}
const DEFAULT_GATEWAY_HEALTH: GatewayHealthSummary = {
state: 'healthy',
reasons: [],
consecutiveHeartbeatMisses: 0,
};
export function Channels() {
const { t } = useTranslation('channels');
const gatewayStatus = useGatewayStore((state) => state.status);
const lastGatewayStateRef = useRef(gatewayStatus.state);
const defaultGatewayHealth = useMemo<GatewayHealthSummary>(() => ({
state: 'healthy',
reasons: [],
consecutiveHeartbeatMisses: 0,
}), []);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [channelGroups, setChannelGroups] = useState<ChannelGroupItem[]>([]);
const [agents, setAgents] = useState<AgentItem[]>([]);
const [gatewayHealth, setGatewayHealth] = useState<GatewayHealthSummary>(defaultGatewayHealth);
const [gatewayHealth, setGatewayHealth] = useState<GatewayHealthSummary>(DEFAULT_GATEWAY_HEALTH);
const [diagnosticsSnapshot, setDiagnosticsSnapshot] = useState<GatewayDiagnosticSnapshot | null>(null);
const [showDiagnostics, setShowDiagnostics] = useState(false);
const [diagnosticsLoading, setDiagnosticsLoading] = useState(false);
@@ -208,7 +209,7 @@ export function Channels() {
setChannelGroups(channelsPayload.channels || []);
setAgents(agentsRes.agents || []);
setGatewayHealth(channelsPayload.gatewayHealth || defaultGatewayHealth);
setGatewayHealth(channelsPayload.gatewayHealth || DEFAULT_GATEWAY_HEALTH);
setDiagnosticsSnapshot(null);
setShowDiagnostics(false);
console.info(