diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 403322a22..e832159f8 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -17,13 +17,15 @@ const Dashboard = (props) => { numberOfAvailablePaths, wsClients, providerStatistics, - uptime + uptime, + devices } = props.serverStatistics || { deltaRate: 0, numberOfAvailablePaths: 0, wsClients: 0, providerStatistics: {}, - uptime: '' + uptime: '', + devices: [] } const providerStatus = props.providerStatus || [] const errorCount = providerStatus.filter((s) => s.type === 'error').length @@ -66,6 +68,11 @@ const Dashboard = (props) => { } const renderActivity = (providerId, providerStats, linkType) => { + let device = providerId + if (providerId.startsWith('ws.')) { + const found = devices.find((d) => d.clientId === providerId.slice(3)) + device = found && found.description ? found.description : providerId + } return (
  • props.history.push(`/dashboard`)}> { {linkType === 'plugin' ? pluginNameLink(providerId) - : providerIdLink(providerId)} + : providerIdLink(providerId, device)} {providerStats.writeRate > 0 && ( @@ -285,11 +292,11 @@ function pluginNameLink(id) { return {id} } -function providerIdLink(id) { +function providerIdLink(id, name) { if (id === 'defaults') { return {id} } else if (id.startsWith('ws.')) { - return {id} + return {name} } else { return {id} } diff --git a/src/deltastats.ts b/src/deltastats.ts index d59ede8da..9e167b1bd 100644 --- a/src/deltastats.ts +++ b/src/deltastats.ts @@ -17,7 +17,7 @@ import { isUndefined, values } from 'lodash' import { EventEmitter } from 'node:events' - +import { getSecurityConfig } from './security' const STATS_UPDATE_INTERVAL_SECONDS = 5 export const CONNECTION_WRITE_EVENT_NAME = 'connectionwrite' @@ -73,6 +73,15 @@ export function startDeltaStatistics( return setInterval(() => { updateProviderPeriodStats(app) const anyApp = app as any + const config = getSecurityConfig(anyApp) + let devices = [] + if ( + anyApp && + anyApp.securityStrategy && + typeof anyApp.securityStrategy.getDevices === 'function' + ) { + devices = anyApp.securityStrategy.getDevices(config) + } app.emit('serverevent', { type: 'SERVERSTATISTICS', from: 'signalk-server', @@ -83,7 +92,8 @@ export function startDeltaStatistics( numberOfAvailablePaths: anyApp.streambundle.getAvailablePaths().length, wsClients: anyApp.interfaces.ws ? anyApp.interfaces.ws.numClients() : 0, providerStatistics: app.providerStatistics, - uptime: process.uptime() + uptime: process.uptime(), + devices: devices } }) app.lastIntervalDeltaCount = app.deltaCount