@peers-app/peers-ui 0.27.3 → 0.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -1
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/sync-recovery.js +103 -1
- package/dist/screens/variables/variable-details.js +2 -1
- package/dist/tabs-layout/network-status-indicator.js +26 -12
- package/dist/tabs-layout/use-network-status.d.ts +6 -1
- package/dist/tabs-layout/use-network-status.js +27 -4
- package/package.json +9 -3
- package/.claude/settings.local.json +0 -34
- package/.github/README.md +0 -52
- package/.github/workflows/delete-all-artifacts.yml +0 -49
- package/.github/workflows/publish.yml +0 -51
- package/babel.config.js +0 -7
- package/biome.json +0 -198
- package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
- package/dist/app-updates/app-updates-consumer.test.js +0 -56
- package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
- package/dist/app-updates/app-updates-settings.test.js +0 -93
- package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
- package/dist/app-updates/remote-app-update-panel.test.js +0 -165
- package/dist/components/access-level-field.test.d.ts +0 -1
- package/dist/components/access-level-field.test.js +0 -28
- package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
- package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
- package/dist/components/responsive-section-nav.test.d.ts +0 -1
- package/dist/components/responsive-section-nav.test.js +0 -45
- package/dist/globals-hash.test.d.ts +0 -1
- package/dist/globals-hash.test.js +0 -16
- package/dist/hooks/use-observable-state.test.d.ts +0 -1
- package/dist/hooks/use-observable-state.test.js +0 -64
- package/dist/hooks/use-observable.test.d.ts +0 -1
- package/dist/hooks/use-observable.test.js +0 -191
- package/dist/hooks/use-rows.test.d.ts +0 -1
- package/dist/hooks/use-rows.test.js +0 -175
- package/dist/hooks/use-tool.test.d.ts +0 -1
- package/dist/hooks/use-tool.test.js +0 -190
- package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
- package/dist/host-shell/host-shell-consumer.test.js +0 -28
- package/dist/root-layout/root-layout-host.test.d.ts +0 -1
- package/dist/root-layout/root-layout-host.test.js +0 -86
- package/dist/screens/account/account-screen.test.d.ts +0 -1
- package/dist/screens/account/account-screen.test.js +0 -51
- package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
- package/dist/screens/assistants/assistant-config.test.js +0 -57
- package/dist/screens/contacts/contact-list.test.d.ts +0 -1
- package/dist/screens/contacts/contact-list.test.js +0 -48
- package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
- package/dist/screens/device-pairing/device-pairing.test.js +0 -119
- package/dist/screens/devices/devices-list.test.d.ts +0 -1
- package/dist/screens/devices/devices-list.test.js +0 -53
- package/dist/screens/groups/group-list.test.d.ts +0 -1
- package/dist/screens/groups/group-list.test.js +0 -38
- package/dist/screens/identity/identity-routes.test.d.ts +0 -1
- package/dist/screens/identity/identity-routes.test.js +0 -51
- package/dist/screens/identity/identity-screen.test.d.ts +0 -1
- package/dist/screens/identity/identity-screen.test.js +0 -103
- package/dist/screens/invites/accept-invite.test.d.ts +0 -1
- package/dist/screens/invites/accept-invite.test.js +0 -103
- package/dist/screens/invites/activity-view.test.d.ts +0 -1
- package/dist/screens/invites/activity-view.test.js +0 -108
- package/dist/screens/invites/invite-classify.test.d.ts +0 -1
- package/dist/screens/invites/invite-classify.test.js +0 -115
- package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
- package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
- package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
- package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
- package/dist/screens/packages/package-helpers.test.d.ts +0 -1
- package/dist/screens/packages/package-helpers.test.js +0 -53
- package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
- package/dist/screens/packages/package-runtime-status.test.js +0 -50
- package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
- package/dist/screens/packages/packages-ipc.test.js +0 -43
- package/dist/screens/settings/settings-page.test.d.ts +0 -1
- package/dist/screens/settings/settings-page.test.js +0 -19
- package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-access-ipc.test.js +0 -40
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
- package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
- package/dist/tabs-layout/network-status-indicator.test.js +0 -665
- package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
- package/dist/tabs-layout/tabs-state.test.js +0 -110
- package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
- package/dist/tabs-layout/use-network-status.test.js +0 -45
- package/dist/ui-router/ui-loader.test.d.ts +0 -1
- package/dist/ui-router/ui-loader.test.js +0 -91
- package/jest.config.js +0 -25
- package/release-guard.js +0 -10
- package/src/app-updates/app-update-controls.tsx +0 -73
- package/src/app-updates/app-updates-consumer.test.ts +0 -83
- package/src/app-updates/app-updates-consumer.ts +0 -121
- package/src/app-updates/app-updates-settings.test.tsx +0 -109
- package/src/app-updates/app-updates-settings.tsx +0 -136
- package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
- package/src/app-updates/remote-app-update-panel.tsx +0 -210
- package/src/app-updates/use-app-update-status.ts +0 -16
- package/src/command-palette/command-palette-ui.tsx +0 -564
- package/src/command-palette/command-palette.ts +0 -242
- package/src/components/access-level-field.test.tsx +0 -32
- package/src/components/access-level-field.tsx +0 -68
- package/src/components/checkbox.tsx +0 -25
- package/src/components/group-switcher.tsx +0 -526
- package/src/components/input-date.tsx +0 -29
- package/src/components/input-number.tsx +0 -83
- package/src/components/input.tsx +0 -25
- package/src/components/inverse-lazy-list.tsx +0 -107
- package/src/components/io-schema-values.tsx +0 -103
- package/src/components/io-schema.tsx +0 -259
- package/src/components/lazy-list.tsx +0 -115
- package/src/components/list-screen.tsx +0 -126
- package/src/components/loading-indicator.tsx +0 -7
- package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
- package/src/components/markdown-editor/editor-inline.tsx +0 -9
- package/src/components/markdown-editor/editor.tsx +0 -158
- package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
- package/src/components/markdown-editor/mention-node.ts +0 -204
- package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
- package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
- package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
- package/src/components/markdown-editor/theme.ts +0 -46
- package/src/components/markdown-editor/toolbar.tsx +0 -269
- package/src/components/markdown-with-mentions.tsx +0 -198
- package/src/components/message-logs/message-logs.tsx +0 -523
- package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
- package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
- package/src/components/messages/avatar.tsx +0 -171
- package/src/components/messages/channel-message-list.tsx +0 -189
- package/src/components/messages/channel-view.tsx +0 -92
- package/src/components/messages/message-compose.tsx +0 -192
- package/src/components/messages/message-display.tsx +0 -231
- package/src/components/messages/thread-message-list.tsx +0 -135
- package/src/components/qr-scanner.tsx +0 -180
- package/src/components/responsive-section-nav.test.tsx +0 -88
- package/src/components/responsive-section-nav.tsx +0 -92
- package/src/components/router.tsx +0 -175
- package/src/components/save-button.tsx +0 -134
- package/src/components/sortable-list.tsx +0 -130
- package/src/components/tabs.tsx +0 -76
- package/src/components/tooltip.tsx +0 -43
- package/src/components/trust-level-badge.tsx +0 -44
- package/src/components/trust-level-dropdown.tsx +0 -136
- package/src/components/typeahead.tsx +0 -357
- package/src/globals-hash.test.ts +0 -19
- package/src/globals.tsx +0 -226
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-host-contract.ts +0 -75
- package/src/hooks/use-observable-state.test.tsx +0 -101
- package/src/hooks/use-observable-state.ts +0 -29
- package/src/hooks/use-observable.test.tsx +0 -258
- package/src/hooks/use-observable.ts +0 -67
- package/src/hooks/use-on-screen.ts +0 -24
- package/src/hooks/use-promise.ts +0 -34
- package/src/hooks/use-rows.test.tsx +0 -196
- package/src/hooks/use-rows.ts +0 -120
- package/src/hooks/use-subscription.ts +0 -24
- package/src/hooks/use-tool.test.tsx +0 -225
- package/src/hooks/use-tool.ts +0 -116
- package/src/host-shell/host-shell-consumer.test.ts +0 -32
- package/src/host-shell/host-shell-consumer.ts +0 -53
- package/src/index.tsx +0 -42
- package/src/mention-configs.ts +0 -185
- package/src/operator-console/operator-console-state.ts +0 -119
- package/src/operator-console/operator-console.tsx +0 -233
- package/src/peers-services-registration.ts +0 -6
- package/src/root-layout/global-overlays.ts +0 -50
- package/src/root-layout/layout-picker.tsx +0 -47
- package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
- package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
- package/src/root-layout/root-layout-host.test.tsx +0 -108
- package/src/root-layout/root-layout-host.tsx +0 -147
- package/src/root-layout/root-layout-registry.ts +0 -51
- package/src/root-layout/root-layout-state.ts +0 -55
- package/src/root-layout/root-layout.ts +0 -32
- package/src/screens/account/account-screen.test.tsx +0 -65
- package/src/screens/account/account-screen.tsx +0 -942
- package/src/screens/assistants/assistant-config.test.tsx +0 -54
- package/src/screens/assistants/assistant-config.tsx +0 -121
- package/src/screens/assistants/assistant-details.tsx +0 -89
- package/src/screens/assistants/assistant-info.tsx +0 -66
- package/src/screens/assistants/assistant-list.tsx +0 -145
- package/src/screens/assistants/assistant-tools.tsx +0 -82
- package/src/screens/console-logs/console-logs-list.tsx +0 -374
- package/src/screens/console-logs/log-display.tsx +0 -137
- package/src/screens/console-logs/log-filters.tsx +0 -64
- package/src/screens/console-logs/mobile-log-card.tsx +0 -161
- package/src/screens/console-logs/resizable-table-header.tsx +0 -110
- package/src/screens/contacts/contact-details.tsx +0 -123
- package/src/screens/contacts/contact-list.test.tsx +0 -59
- package/src/screens/contacts/contact-list.tsx +0 -286
- package/src/screens/contacts/index.ts +0 -2
- package/src/screens/data-explorer/data-explorer.tsx +0 -633
- package/src/screens/data-explorer/index.ts +0 -6
- package/src/screens/data-explorer/query-executor.tsx +0 -520
- package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
- package/src/screens/device-pairing/device-pairing.tsx +0 -461
- package/src/screens/device-pairing/identity-ipc.ts +0 -25
- package/src/screens/device-pairing/index.ts +0 -2
- package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
- package/src/screens/devices/devices-list.test.tsx +0 -68
- package/src/screens/devices/devices-list.tsx +0 -365
- package/src/screens/devices/index.ts +0 -1
- package/src/screens/groups/group-details.tsx +0 -160
- package/src/screens/groups/group-invite-panel.tsx +0 -311
- package/src/screens/groups/group-list.test.tsx +0 -44
- package/src/screens/groups/group-list.tsx +0 -317
- package/src/screens/groups/group-members.tsx +0 -343
- package/src/screens/groups/index.ts +0 -3
- package/src/screens/identity/identity-routes.test.ts +0 -70
- package/src/screens/identity/identity-routes.ts +0 -301
- package/src/screens/identity/identity-screen.test.tsx +0 -138
- package/src/screens/identity/identity-screen.tsx +0 -282
- package/src/screens/identity/index.ts +0 -2
- package/src/screens/identity/invite-contact-panel.tsx +0 -45
- package/src/screens/identity/profile-invite.tsx +0 -93
- package/src/screens/invites/accept-invite.test.tsx +0 -115
- package/src/screens/invites/accept-invite.tsx +0 -318
- package/src/screens/invites/activity-view.test.tsx +0 -127
- package/src/screens/invites/activity-view.tsx +0 -162
- package/src/screens/invites/index.ts +0 -6
- package/src/screens/invites/invite-capture.ts +0 -104
- package/src/screens/invites/invite-classify.test.ts +0 -129
- package/src/screens/invites/invite-share.tsx +0 -104
- package/src/screens/invites/invites-ipc.ts +0 -25
- package/src/screens/invites/pending-invites-list.tsx +0 -256
- package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
- package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
- package/src/screens/network-viewer/device-details-modal.tsx +0 -339
- package/src/screens/network-viewer/group-details-modal.tsx +0 -421
- package/src/screens/network-viewer/index.ts +0 -8
- package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
- package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
- package/src/screens/network-viewer/network-viewer-section.ts +0 -12
- package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
- package/src/screens/network-viewer/network-viewer.tsx +0 -708
- package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
- package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
- package/src/screens/network-viewer/sync-recovery.tsx +0 -461
- package/src/screens/network-viewer/usage-graph.tsx +0 -455
- package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
- package/src/screens/packages/local-folders-ipc.ts +0 -28
- package/src/screens/packages/package-details.tsx +0 -166
- package/src/screens/packages/package-helpers.test.ts +0 -57
- package/src/screens/packages/package-helpers.ts +0 -137
- package/src/screens/packages/package-info.tsx +0 -354
- package/src/screens/packages/package-list.tsx +0 -519
- package/src/screens/packages/package-network-panel.tsx +0 -82
- package/src/screens/packages/package-new-local.tsx +0 -100
- package/src/screens/packages/package-runtime-status.test.tsx +0 -58
- package/src/screens/packages/package-runtime-status.tsx +0 -68
- package/src/screens/packages/package-versions.tsx +0 -298
- package/src/screens/packages/packages-ipc.test.ts +0 -47
- package/src/screens/packages/packages-ipc.ts +0 -125
- package/src/screens/peer-types/peer-type-details.tsx +0 -172
- package/src/screens/peer-types/peer-type-list.tsx +0 -64
- package/src/screens/search/global-search.tsx +0 -406
- package/src/screens/settings/color-mode-dropdown.tsx +0 -82
- package/src/screens/settings/settings-page.test.tsx +0 -24
- package/src/screens/settings/settings-page.tsx +0 -426
- package/src/screens/setup-user.tsx +0 -355
- package/src/screens/tools/tool-access-ipc.test.ts +0 -55
- package/src/screens/tools/tool-access-ipc.ts +0 -27
- package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
- package/src/screens/tools/tool-catalog-ipc.ts +0 -51
- package/src/screens/tools/tool-details.tsx +0 -52
- package/src/screens/tools/tool-info.tsx +0 -45
- package/src/screens/tools/tool-list.tsx +0 -106
- package/src/screens/tools/tool-schema.tsx +0 -44
- package/src/screens/tools/tool-test-details.tsx +0 -89
- package/src/screens/tools/tool-test-list.tsx +0 -73
- package/src/screens/variables/variable-details.tsx +0 -289
- package/src/screens/variables/variable-list.tsx +0 -110
- package/src/screens/welcome-modal.tsx +0 -294
- package/src/screens/workflows/workflow-details.tsx +0 -115
- package/src/screens/workflows/workflow-info.tsx +0 -22
- package/src/screens/workflows/workflow-instructions.tsx +0 -134
- package/src/screens/workflows/workflow-list.tsx +0 -117
- package/src/setupTests.ts +0 -38
- package/src/system-apps/assistants.app.ts +0 -7
- package/src/system-apps/console-logs.app.ts +0 -7
- package/src/system-apps/data-explorer.app.ts +0 -8
- package/src/system-apps/identity.app.ts +0 -9
- package/src/system-apps/index.ts +0 -77
- package/src/system-apps/mobile-settings.app.ts +0 -7
- package/src/system-apps/network-viewer.app.ts +0 -8
- package/src/system-apps/packages.app.ts +0 -7
- package/src/system-apps/search.app.ts +0 -8
- package/src/system-apps/settings.app.ts +0 -7
- package/src/system-apps/threads.app.ts +0 -7
- package/src/system-apps/tools.app.ts +0 -7
- package/src/system-apps/types.app.ts +0 -7
- package/src/system-apps/variables.app.ts +0 -7
- package/src/system-apps/workflows.app.ts +0 -7
- package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
- package/src/tabs-layout/network-status-indicator.tsx +0 -756
- package/src/tabs-layout/tabs-layout.tsx +0 -857
- package/src/tabs-layout/tabs-state.test.ts +0 -152
- package/src/tabs-layout/tabs-state.ts +0 -587
- package/src/tabs-layout/use-network-status.test.tsx +0 -58
- package/src/tabs-layout/use-network-status.ts +0 -68
- package/src/ui-defaults/index.ts +0 -2
- package/src/ui-defaults/list-screen.tsx +0 -94
- package/src/ui-defaults/markdown-field.tsx +0 -87
- package/src/ui-router/routes-loader.ts +0 -193
- package/src/ui-router/ui-loader.test.tsx +0 -108
- package/src/ui-router/ui-loader.tsx +0 -606
- package/src/utils.ts +0 -95
- package/tsconfig.json +0 -18
|
@@ -1,708 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type INetworkConnectionInfo,
|
|
3
|
-
type INetworkDisconnectedDevice,
|
|
4
|
-
type INetworkGroupSyncInfo,
|
|
5
|
-
type INetworkOverview,
|
|
6
|
-
TrustLevel,
|
|
7
|
-
} from "@peers-app/peers-sdk";
|
|
8
|
-
import { useCallback, useEffect, useState } from "react";
|
|
9
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
10
|
-
import { TrustLevelBadge } from "../../components/trust-level-badge";
|
|
11
|
-
import { useObservable } from "../../hooks";
|
|
12
|
-
import { registerInternalPeersUI } from "../../ui-router/ui-loader";
|
|
13
|
-
import { ConnectionTroubleshooter } from "./connection-troubleshooter";
|
|
14
|
-
import { DeviceDetailsModal } from "./device-details-modal";
|
|
15
|
-
import { GroupDetailsModal } from "./group-details-modal";
|
|
16
|
-
import {
|
|
17
|
-
getNetworkControlConsumer,
|
|
18
|
-
getNetworkDiagnosticsConsumer,
|
|
19
|
-
getNetworkViewerPlatformApi,
|
|
20
|
-
} from "./network-viewer-ipc";
|
|
21
|
-
import { networkViewerSection } from "./network-viewer-section";
|
|
22
|
-
import { SyncRecoveryScreen } from "./sync-recovery";
|
|
23
|
-
import { UsageGraph } from "./usage-graph";
|
|
24
|
-
|
|
25
|
-
/** Format bytes to human-readable string (KB, MB, GB) */
|
|
26
|
-
function formatBytes(bytes: number): string {
|
|
27
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
28
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
29
|
-
if (bytes < 1024 * 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
30
|
-
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Format transfer rate to human-readable string (KB/s or MB/s) */
|
|
34
|
-
function formatRate(mbps: number | undefined): string {
|
|
35
|
-
if (mbps === undefined || mbps === 0) return "0 KB/s";
|
|
36
|
-
// Show KB/s if less than 0.1 MB/s (100 KB/s)
|
|
37
|
-
if (mbps < 0.1) {
|
|
38
|
-
const kbps = mbps * 1024;
|
|
39
|
-
return `${kbps.toFixed(1)} KB/s`;
|
|
40
|
-
}
|
|
41
|
-
return `${mbps.toFixed(2)} MB/s`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Network Viewer screen.
|
|
46
|
-
*
|
|
47
|
-
* Shows connections, group sync, and disconnected devices, and hosts the
|
|
48
|
-
* Sync Recovery pane selected from the network status indicator.
|
|
49
|
-
*/
|
|
50
|
-
export function NetworkViewerList() {
|
|
51
|
-
const [overview, setOverview] = useState<INetworkOverview | null>(null);
|
|
52
|
-
const [connections, setConnections] = useState<INetworkConnectionInfo[]>([]);
|
|
53
|
-
const [groupSyncInfo, setGroupSyncInfo] = useState<INetworkGroupSyncInfo[]>([]);
|
|
54
|
-
const [disconnectedDevices, setDisconnectedDevices] = useState<INetworkDisconnectedDevice[]>([]);
|
|
55
|
-
const [loading, setLoading] = useState(true);
|
|
56
|
-
const [refreshing, setRefreshing] = useState(false);
|
|
57
|
-
const [selectedDeviceId, setSelectedDeviceId] = useState<string | null>(null);
|
|
58
|
-
const [selectedGroupId, setSelectedGroupId] = useState<string | null>(null);
|
|
59
|
-
const [connecting, setConnecting] = useState<Set<string>>(new Set());
|
|
60
|
-
const [showTroubleshooter, setShowTroubleshooter] = useState(false);
|
|
61
|
-
const [viewerSection] = useObservable(networkViewerSection);
|
|
62
|
-
|
|
63
|
-
const loadData = useCallback(async () => {
|
|
64
|
-
try {
|
|
65
|
-
const diagnostics = await getNetworkDiagnosticsConsumer();
|
|
66
|
-
const [
|
|
67
|
-
{ overview: overviewData },
|
|
68
|
-
{ connections: connectionsData },
|
|
69
|
-
{ groups: groupSyncData },
|
|
70
|
-
{ devices: disconnectedData },
|
|
71
|
-
] = await Promise.all([
|
|
72
|
-
diagnostics.tools.getOverview(),
|
|
73
|
-
diagnostics.tools.getConnections(),
|
|
74
|
-
diagnostics.tools.getGroupSyncStatus(),
|
|
75
|
-
diagnostics.tools.getDisconnectedDevices(),
|
|
76
|
-
]);
|
|
77
|
-
|
|
78
|
-
setOverview(overviewData);
|
|
79
|
-
setConnections(connectionsData);
|
|
80
|
-
setGroupSyncInfo(groupSyncData);
|
|
81
|
-
setDisconnectedDevices(disconnectedData);
|
|
82
|
-
} catch (error) {
|
|
83
|
-
console.error("Error loading network data:", error);
|
|
84
|
-
} finally {
|
|
85
|
-
setLoading(false);
|
|
86
|
-
}
|
|
87
|
-
}, []);
|
|
88
|
-
|
|
89
|
-
const handleRefresh = async () => {
|
|
90
|
-
setRefreshing(true);
|
|
91
|
-
try {
|
|
92
|
-
const control = await getNetworkControlConsumer();
|
|
93
|
-
const result = await control.tools.refreshNetworkInfo();
|
|
94
|
-
if (result.success) {
|
|
95
|
-
await loadData();
|
|
96
|
-
} else {
|
|
97
|
-
alert(result.message);
|
|
98
|
-
}
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.error("Error refreshing network info:", error);
|
|
101
|
-
} finally {
|
|
102
|
-
setRefreshing(false);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const handleDisconnect = async (deviceId: string) => {
|
|
107
|
-
if (!confirm("Are you sure you want to disconnect from this device?")) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
const control = await getNetworkControlConsumer();
|
|
113
|
-
const result = await control.tools.disconnectDevice({ deviceId });
|
|
114
|
-
if (result.success) {
|
|
115
|
-
await loadData();
|
|
116
|
-
} else {
|
|
117
|
-
alert(result.message);
|
|
118
|
-
}
|
|
119
|
-
} catch (error) {
|
|
120
|
-
console.error("Error disconnecting device:", error);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const handleViewDetails = (deviceId: string) => {
|
|
125
|
-
setSelectedDeviceId(deviceId);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const handleConnectToDevice = async (deviceId: string) => {
|
|
129
|
-
try {
|
|
130
|
-
const control = await getNetworkControlConsumer();
|
|
131
|
-
setConnecting((prev) => new Set(prev).add(deviceId));
|
|
132
|
-
const result = await control.tools.connectToDevice({ deviceId });
|
|
133
|
-
if (result.success) {
|
|
134
|
-
await loadData();
|
|
135
|
-
} else {
|
|
136
|
-
alert(`Failed to connect: ${result.message}`);
|
|
137
|
-
}
|
|
138
|
-
} catch (error) {
|
|
139
|
-
console.error("Error connecting to device:", error);
|
|
140
|
-
alert("Error connecting to device");
|
|
141
|
-
} finally {
|
|
142
|
-
setConnecting((prev) => {
|
|
143
|
-
const newSet = new Set(prev);
|
|
144
|
-
newSet.delete(deviceId);
|
|
145
|
-
return newSet;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const handleDeleteDevice = async (deviceId: string) => {
|
|
151
|
-
try {
|
|
152
|
-
const control = await getNetworkControlConsumer();
|
|
153
|
-
const result = await control.tools.deleteDevice({ deviceId });
|
|
154
|
-
if (result.success) {
|
|
155
|
-
await loadData();
|
|
156
|
-
} else {
|
|
157
|
-
alert(`Failed to delete device: ${result.message}`);
|
|
158
|
-
}
|
|
159
|
-
} catch (error) {
|
|
160
|
-
console.error("Error deleting device:", error);
|
|
161
|
-
alert("Error deleting device");
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
useEffect(() => {
|
|
166
|
-
loadData();
|
|
167
|
-
// Auto-refresh every 5 seconds
|
|
168
|
-
const interval = setInterval(loadData, 5000);
|
|
169
|
-
return () => clearInterval(interval);
|
|
170
|
-
}, [loadData]);
|
|
171
|
-
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
if (viewerSection === "sync-recovery") {
|
|
174
|
-
setShowTroubleshooter(false);
|
|
175
|
-
}
|
|
176
|
-
}, [viewerSection]);
|
|
177
|
-
|
|
178
|
-
if (viewerSection === "sync-recovery") {
|
|
179
|
-
return <SyncRecoveryScreen onBack={() => networkViewerSection("main")} />;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (loading) {
|
|
183
|
-
return <LoadingIndicator />;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (!overview) {
|
|
187
|
-
return (
|
|
188
|
-
<div className="container-fluid p-4">
|
|
189
|
-
<div className="alert alert-warning">Unable to load network information.</div>
|
|
190
|
-
</div>
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (showTroubleshooter) {
|
|
195
|
-
return <ConnectionTroubleshooter onBack={() => setShowTroubleshooter(false)} />;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<div className="container-fluid p-4">
|
|
200
|
-
<div className="d-flex justify-content-between align-items-center mb-4">
|
|
201
|
-
<h2>Network Viewer</h2>
|
|
202
|
-
<div className="d-flex gap-2">
|
|
203
|
-
{getNetworkViewerPlatformApi()?.runDiagnostics && (
|
|
204
|
-
<button
|
|
205
|
-
className="btn btn-sm btn-outline-warning"
|
|
206
|
-
onClick={() => setShowTroubleshooter(true)}
|
|
207
|
-
title="Run connection diagnostics"
|
|
208
|
-
>
|
|
209
|
-
<i className="bi bi-stethoscope me-1"></i>
|
|
210
|
-
Troubleshoot
|
|
211
|
-
</button>
|
|
212
|
-
)}
|
|
213
|
-
<button
|
|
214
|
-
className="btn btn-sm btn-outline-secondary"
|
|
215
|
-
onClick={() => networkViewerSection("sync-recovery")}
|
|
216
|
-
title="Records that could not be materialized"
|
|
217
|
-
>
|
|
218
|
-
Sync recovery
|
|
219
|
-
</button>
|
|
220
|
-
<button className="btn btn-sm btn-primary" onClick={handleRefresh} disabled={refreshing}>
|
|
221
|
-
<i className={`bi bi-arrow-clockwise ${refreshing ? "spin" : ""}`}></i>
|
|
222
|
-
{refreshing ? " Refreshing..." : " Refresh"}
|
|
223
|
-
</button>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
{/* Device Identifiers */}
|
|
228
|
-
<div className="card mb-2">
|
|
229
|
-
<div className="card-body">
|
|
230
|
-
<h5 className="card-title">Local Device</h5>
|
|
231
|
-
<div className="row">
|
|
232
|
-
<div className="col-md-6">
|
|
233
|
-
<strong>Device ID:</strong>{" "}
|
|
234
|
-
<code className="text-muted small">{overview.localDeviceId}</code>
|
|
235
|
-
</div>
|
|
236
|
-
<div className="col-md-6">
|
|
237
|
-
<strong>User ID:</strong>{" "}
|
|
238
|
-
<code className="text-muted small">{overview.localUserId}</code>
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
</div>
|
|
243
|
-
|
|
244
|
-
{/* Device info - group count, connection, cpu, memory */}
|
|
245
|
-
<div className="row mb-4">
|
|
246
|
-
<div className="col-md-4">
|
|
247
|
-
<div className="card" style={{ height: "100%" }}>
|
|
248
|
-
<div className="card-body p-2">
|
|
249
|
-
<UsageGraph
|
|
250
|
-
label="Connections"
|
|
251
|
-
fetchUsage={async () => {
|
|
252
|
-
const diagnostics = await getNetworkDiagnosticsConsumer();
|
|
253
|
-
const { overview: currentOverview } = await diagnostics.tools.getOverview();
|
|
254
|
-
return currentOverview.totalConnections;
|
|
255
|
-
}}
|
|
256
|
-
durationMinutes={5}
|
|
257
|
-
updateInterval={5000}
|
|
258
|
-
color="rgba(111, 66, 193, 1)"
|
|
259
|
-
colorZones={[
|
|
260
|
-
{ maxValue: 1, color: "rgba(220, 53, 69, 1)" },
|
|
261
|
-
{ maxValue: 2, color: "rgba(255, 193, 7, 1)" },
|
|
262
|
-
{ maxValue: overview?.maxConnections || 30, color: "rgba(111, 66, 193, 1)" },
|
|
263
|
-
]}
|
|
264
|
-
minValue={0}
|
|
265
|
-
maxValue={overview?.maxConnections || 30}
|
|
266
|
-
formatOverlayText={(value) => `Connections: ${Math.round(value)}`}
|
|
267
|
-
/>
|
|
268
|
-
</div>
|
|
269
|
-
</div>
|
|
270
|
-
</div>
|
|
271
|
-
|
|
272
|
-
<div className="col-md-4">
|
|
273
|
-
<div className="card" style={{ height: "100%" }}>
|
|
274
|
-
<div className="card-body p-2">
|
|
275
|
-
<UsageGraph
|
|
276
|
-
label="CPU"
|
|
277
|
-
fetchUsage={async () => {
|
|
278
|
-
const diagnostics = await getNetworkDiagnosticsConsumer();
|
|
279
|
-
const { overview: currentOverview } = await diagnostics.tools.getOverview();
|
|
280
|
-
return currentOverview.cpuPercent;
|
|
281
|
-
}}
|
|
282
|
-
durationMinutes={5}
|
|
283
|
-
updateInterval={5000}
|
|
284
|
-
color="rgba(13, 110, 253, 1)"
|
|
285
|
-
colorZones={[
|
|
286
|
-
{ maxValue: 60, color: "rgba(13, 110, 253, 1)" },
|
|
287
|
-
{ maxValue: 80, color: "rgba(255, 193, 7, 1)" },
|
|
288
|
-
{ maxValue: Infinity, color: "rgba(220, 53, 69, 1)" },
|
|
289
|
-
]}
|
|
290
|
-
/>
|
|
291
|
-
</div>
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
<div className="col-md-4">
|
|
295
|
-
<div className="card" style={{ height: "100%" }}>
|
|
296
|
-
<div className="card-body p-2">
|
|
297
|
-
<UsageGraph
|
|
298
|
-
label="Memory"
|
|
299
|
-
fetchUsage={async () => {
|
|
300
|
-
const diagnostics = await getNetworkDiagnosticsConsumer();
|
|
301
|
-
const { overview: currentOverview } = await diagnostics.tools.getOverview();
|
|
302
|
-
return currentOverview.memPercent;
|
|
303
|
-
}}
|
|
304
|
-
durationMinutes={5}
|
|
305
|
-
updateInterval={5000}
|
|
306
|
-
color="rgba(25, 135, 84, 1)"
|
|
307
|
-
colorZones={[
|
|
308
|
-
{ maxValue: 60, color: "rgba(25, 135, 84, 1)" },
|
|
309
|
-
{ maxValue: 80, color: "rgba(255, 193, 7, 1)" },
|
|
310
|
-
{ maxValue: Infinity, color: "rgba(220, 53, 69, 1)" },
|
|
311
|
-
]}
|
|
312
|
-
/>
|
|
313
|
-
</div>
|
|
314
|
-
</div>
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
|
|
318
|
-
{/* Connections List */}
|
|
319
|
-
<div className="card mb-4">
|
|
320
|
-
<div className="card-body">
|
|
321
|
-
<h5 className="card-title">Active Connections</h5>
|
|
322
|
-
{connections.length === 0 ? (
|
|
323
|
-
<p className="text-muted">No active connections</p>
|
|
324
|
-
) : (
|
|
325
|
-
<div className="table-responsive">
|
|
326
|
-
<table className="table table-hover">
|
|
327
|
-
<thead>
|
|
328
|
-
<tr>
|
|
329
|
-
<th>User</th>
|
|
330
|
-
<th>User Trust</th>
|
|
331
|
-
<th>Device Trust</th>
|
|
332
|
-
<th>Device</th>
|
|
333
|
-
{/* <th>Path Type</th> */}
|
|
334
|
-
<th>Handshake</th>
|
|
335
|
-
<th>Connection Address</th>
|
|
336
|
-
<th>Shared Groups</th>
|
|
337
|
-
<th>Latency</th>
|
|
338
|
-
<th>Error Rate</th>
|
|
339
|
-
<th>Throughput</th>
|
|
340
|
-
{/* <th>State</th> */}
|
|
341
|
-
<th>Actions</th>
|
|
342
|
-
</tr>
|
|
343
|
-
</thead>
|
|
344
|
-
<tbody>
|
|
345
|
-
{connections.map((conn) => {
|
|
346
|
-
return (
|
|
347
|
-
<tr key={conn.deviceId}>
|
|
348
|
-
<td>
|
|
349
|
-
{conn.userName || conn.userId}
|
|
350
|
-
{!conn.userName && (
|
|
351
|
-
<>
|
|
352
|
-
<br />
|
|
353
|
-
<small className="text-muted">{conn.userId}</small>
|
|
354
|
-
</>
|
|
355
|
-
)}
|
|
356
|
-
</td>
|
|
357
|
-
<td>
|
|
358
|
-
<TrustLevelBadge level={conn.userTrustLevel || TrustLevel.Unknown} />
|
|
359
|
-
</td>
|
|
360
|
-
<td>
|
|
361
|
-
<TrustLevelBadge level={conn.deviceTrustLevel || TrustLevel.Unknown} />
|
|
362
|
-
</td>
|
|
363
|
-
<td>
|
|
364
|
-
{conn.deviceName ? (
|
|
365
|
-
<>
|
|
366
|
-
<span className="small">{conn.deviceName}</span>
|
|
367
|
-
<br />
|
|
368
|
-
<code className="text-muted small" style={{ fontSize: ".7em" }}>
|
|
369
|
-
{conn.deviceId}
|
|
370
|
-
</code>
|
|
371
|
-
</>
|
|
372
|
-
) : (
|
|
373
|
-
<code className="text-muted small">{conn.deviceId}</code>
|
|
374
|
-
)}
|
|
375
|
-
</td>
|
|
376
|
-
{/* <td>
|
|
377
|
-
<span
|
|
378
|
-
className={`badge bg-${
|
|
379
|
-
conn.pathType === 'direct' ? 'success' : 'info'
|
|
380
|
-
}`}
|
|
381
|
-
>
|
|
382
|
-
{conn.pathType}
|
|
383
|
-
</span>
|
|
384
|
-
</td> */}
|
|
385
|
-
<td>
|
|
386
|
-
<span className={`badge bg-${conn.isServer ? "secondary" : "primary"}`}>
|
|
387
|
-
{conn.isServer ? "Receiver" : "Initiator"}
|
|
388
|
-
</span>
|
|
389
|
-
</td>
|
|
390
|
-
<td>
|
|
391
|
-
{conn.connectionAddress ? (
|
|
392
|
-
<small className="text-muted">{conn.connectionAddress}</small>
|
|
393
|
-
) : (
|
|
394
|
-
<span className="text-muted">-</span>
|
|
395
|
-
)}
|
|
396
|
-
</td>
|
|
397
|
-
<td>{conn.sharedGroups.length}</td>
|
|
398
|
-
<td>
|
|
399
|
-
<span
|
|
400
|
-
className={`badge bg-${
|
|
401
|
-
conn.latencyMs < 200
|
|
402
|
-
? "success"
|
|
403
|
-
: conn.latencyMs < 600
|
|
404
|
-
? "warning"
|
|
405
|
-
: "danger"
|
|
406
|
-
}`}
|
|
407
|
-
>
|
|
408
|
-
{Math.round(conn.latencyMs)}ms
|
|
409
|
-
</span>
|
|
410
|
-
</td>
|
|
411
|
-
<td>
|
|
412
|
-
<span
|
|
413
|
-
className={`badge bg-${
|
|
414
|
-
conn.errorRate < 0.05
|
|
415
|
-
? "success"
|
|
416
|
-
: conn.errorRate < 0.2
|
|
417
|
-
? "warning"
|
|
418
|
-
: "danger"
|
|
419
|
-
}`}
|
|
420
|
-
>
|
|
421
|
-
{(conn.errorRate * 100).toFixed(1)}%
|
|
422
|
-
</span>
|
|
423
|
-
</td>
|
|
424
|
-
<td>
|
|
425
|
-
<small>
|
|
426
|
-
<span className="text-success">↑{formatRate(conn.sendRateMBps)}</span>
|
|
427
|
-
{" / "}
|
|
428
|
-
<span className="text-primary">
|
|
429
|
-
↓{formatRate(conn.receiveRateMBps)}
|
|
430
|
-
</span>
|
|
431
|
-
</small>
|
|
432
|
-
<br />
|
|
433
|
-
<small className="text-muted">
|
|
434
|
-
{formatBytes(conn.bytesSent || 0)} /{" "}
|
|
435
|
-
{formatBytes(conn.bytesReceived || 0)}
|
|
436
|
-
</small>
|
|
437
|
-
</td>
|
|
438
|
-
{/* <td>
|
|
439
|
-
<span className="badge bg-success">{conn.connectionState}</span>
|
|
440
|
-
</td> */}
|
|
441
|
-
<td>
|
|
442
|
-
<button
|
|
443
|
-
className="btn btn-sm btn-outline-primary me-2"
|
|
444
|
-
onClick={() => handleViewDetails(conn.deviceId)}
|
|
445
|
-
title="View Details"
|
|
446
|
-
>
|
|
447
|
-
<i className="bi bi-info-circle"></i>
|
|
448
|
-
</button>
|
|
449
|
-
<button
|
|
450
|
-
className="btn btn-sm btn-outline-danger"
|
|
451
|
-
onClick={() => handleDisconnect(conn.deviceId)}
|
|
452
|
-
title="Disconnect"
|
|
453
|
-
>
|
|
454
|
-
<i className="bi bi-x-circle"></i>
|
|
455
|
-
</button>
|
|
456
|
-
</td>
|
|
457
|
-
</tr>
|
|
458
|
-
);
|
|
459
|
-
})}
|
|
460
|
-
</tbody>
|
|
461
|
-
</table>
|
|
462
|
-
</div>
|
|
463
|
-
)}
|
|
464
|
-
</div>
|
|
465
|
-
</div>
|
|
466
|
-
|
|
467
|
-
{/* Group Sync Status */}
|
|
468
|
-
<div className="card mb-4">
|
|
469
|
-
<div className="card-body">
|
|
470
|
-
<h5 className="card-title">Group Sync Status</h5>
|
|
471
|
-
{groupSyncInfo.length === 0 ? (
|
|
472
|
-
<p className="text-muted">No groups found</p>
|
|
473
|
-
) : (
|
|
474
|
-
<div className="table-responsive">
|
|
475
|
-
<table className="table table-hover">
|
|
476
|
-
<thead>
|
|
477
|
-
<tr>
|
|
478
|
-
<th>Group Name</th>
|
|
479
|
-
<th>Connected Devices</th>
|
|
480
|
-
<th>Preferred Devices</th>
|
|
481
|
-
<th>Last Sync</th>
|
|
482
|
-
<th>Total Members</th>
|
|
483
|
-
</tr>
|
|
484
|
-
</thead>
|
|
485
|
-
<tbody>
|
|
486
|
-
{groupSyncInfo.map((group) => (
|
|
487
|
-
<tr key={group.groupId}>
|
|
488
|
-
<td>
|
|
489
|
-
<strong>{group.groupName}</strong>
|
|
490
|
-
<br />
|
|
491
|
-
<code className="text-muted small">{group.groupId}</code>
|
|
492
|
-
</td>
|
|
493
|
-
<td>
|
|
494
|
-
{group.connectedDevices.length > 0 ? (
|
|
495
|
-
<div>
|
|
496
|
-
<span className="badge bg-success mb-1">
|
|
497
|
-
{group.connectedDevices.length} device
|
|
498
|
-
{group.connectedDevices.length !== 1 ? "s" : ""}
|
|
499
|
-
</span>
|
|
500
|
-
<div className="mt-2">
|
|
501
|
-
{group.connectedDevices.map((device, idx) => (
|
|
502
|
-
<div key={device.deviceId} className="mb-2">
|
|
503
|
-
<small>
|
|
504
|
-
<code className="text-muted">{device.deviceId}</code>
|
|
505
|
-
{device.closed && (
|
|
506
|
-
<span className="badge bg-danger ms-2">Closed</span>
|
|
507
|
-
)}
|
|
508
|
-
</small>
|
|
509
|
-
<div className="d-flex gap-2 mt-1">
|
|
510
|
-
<span
|
|
511
|
-
className={`badge bg-${
|
|
512
|
-
device.latencyMs < 200
|
|
513
|
-
? "success"
|
|
514
|
-
: device.latencyMs < 600
|
|
515
|
-
? "warning"
|
|
516
|
-
: "danger"
|
|
517
|
-
}`}
|
|
518
|
-
>
|
|
519
|
-
{Math.round(device.latencyMs)}ms
|
|
520
|
-
</span>
|
|
521
|
-
<span
|
|
522
|
-
className={`badge bg-${
|
|
523
|
-
device.errorRate < 0.05
|
|
524
|
-
? "success"
|
|
525
|
-
: device.errorRate < 0.2
|
|
526
|
-
? "warning"
|
|
527
|
-
: "danger"
|
|
528
|
-
}`}
|
|
529
|
-
>
|
|
530
|
-
{(device.errorRate * 100).toFixed(1)}% errors
|
|
531
|
-
</span>
|
|
532
|
-
<span className="badge bg-info">
|
|
533
|
-
Last:{" "}
|
|
534
|
-
{device.timestampLastApplied
|
|
535
|
-
? new Date(device.timestampLastApplied).toLocaleString()
|
|
536
|
-
: "Never"}
|
|
537
|
-
</span>
|
|
538
|
-
</div>
|
|
539
|
-
{idx < group.connectedDevices.length - 1 && (
|
|
540
|
-
<hr className="my-2" />
|
|
541
|
-
)}
|
|
542
|
-
</div>
|
|
543
|
-
))}
|
|
544
|
-
</div>
|
|
545
|
-
</div>
|
|
546
|
-
) : (
|
|
547
|
-
<span className="text-muted">No connected devices</span>
|
|
548
|
-
)}
|
|
549
|
-
</td>
|
|
550
|
-
<td>
|
|
551
|
-
{group.preferredDeviceIds.length > 0 ? (
|
|
552
|
-
<div>
|
|
553
|
-
<span className="badge bg-primary mb-2">
|
|
554
|
-
{group.preferredDeviceIds.length} preferred
|
|
555
|
-
</span>
|
|
556
|
-
<div>
|
|
557
|
-
{group.preferredDeviceIds.map((deviceId) => (
|
|
558
|
-
<div key={deviceId}>
|
|
559
|
-
<small>
|
|
560
|
-
<code className="text-muted">{deviceId}</code>
|
|
561
|
-
</small>
|
|
562
|
-
</div>
|
|
563
|
-
))}
|
|
564
|
-
</div>
|
|
565
|
-
</div>
|
|
566
|
-
) : (
|
|
567
|
-
<span className="text-muted">None</span>
|
|
568
|
-
)}
|
|
569
|
-
</td>
|
|
570
|
-
<td>
|
|
571
|
-
<small>
|
|
572
|
-
{group.lastSyncTimestamp > 0
|
|
573
|
-
? new Date(group.lastSyncTimestamp).toLocaleString()
|
|
574
|
-
: "Never"}
|
|
575
|
-
</small>
|
|
576
|
-
</td>
|
|
577
|
-
<td>
|
|
578
|
-
<button
|
|
579
|
-
className="btn btn-sm btn-outline-primary"
|
|
580
|
-
onClick={() => setSelectedGroupId(group.groupId)}
|
|
581
|
-
title="View Group Details"
|
|
582
|
-
>
|
|
583
|
-
{group.totalMembers}
|
|
584
|
-
</button>
|
|
585
|
-
</td>
|
|
586
|
-
</tr>
|
|
587
|
-
))}
|
|
588
|
-
</tbody>
|
|
589
|
-
</table>
|
|
590
|
-
</div>
|
|
591
|
-
)}
|
|
592
|
-
</div>
|
|
593
|
-
</div>
|
|
594
|
-
|
|
595
|
-
{/* Disconnected Devices */}
|
|
596
|
-
<div className="card">
|
|
597
|
-
<div className="card-body">
|
|
598
|
-
<h5 className="card-title">Disconnected Devices</h5>
|
|
599
|
-
{disconnectedDevices.length === 0 ? (
|
|
600
|
-
<p className="text-muted">No known disconnected devices</p>
|
|
601
|
-
) : (
|
|
602
|
-
<div className="table-responsive">
|
|
603
|
-
<table className="table table-hover">
|
|
604
|
-
<thead>
|
|
605
|
-
<tr>
|
|
606
|
-
<th>User</th>
|
|
607
|
-
<th>Trust Level</th>
|
|
608
|
-
<th>Device ID</th>
|
|
609
|
-
<th>Device Name</th>
|
|
610
|
-
<th>First Seen</th>
|
|
611
|
-
<th>Last Seen</th>
|
|
612
|
-
<th>Actions</th>
|
|
613
|
-
</tr>
|
|
614
|
-
</thead>
|
|
615
|
-
<tbody>
|
|
616
|
-
{disconnectedDevices
|
|
617
|
-
.sort((a, b) => new Date(b.lastSeen).getTime() - new Date(a.lastSeen).getTime())
|
|
618
|
-
.map((device) => (
|
|
619
|
-
<tr key={device.deviceId}>
|
|
620
|
-
<td>
|
|
621
|
-
{device.userName || device.userId}
|
|
622
|
-
{!device.userName && (
|
|
623
|
-
<>
|
|
624
|
-
<br />
|
|
625
|
-
<small className="text-muted">{device.userId}</small>
|
|
626
|
-
</>
|
|
627
|
-
)}
|
|
628
|
-
</td>
|
|
629
|
-
<td>
|
|
630
|
-
<TrustLevelBadge level={device.trustLevel || TrustLevel.Unknown} />
|
|
631
|
-
</td>
|
|
632
|
-
<td>
|
|
633
|
-
<code className="text-muted small">{device.deviceId}</code>
|
|
634
|
-
</td>
|
|
635
|
-
<td>{device.name || <span className="text-muted">-</span>}</td>
|
|
636
|
-
<td>
|
|
637
|
-
<small>{new Date(device.firstSeen).toLocaleString()}</small>
|
|
638
|
-
</td>
|
|
639
|
-
<td>
|
|
640
|
-
<small>{new Date(device.lastSeen).toLocaleString()}</small>
|
|
641
|
-
</td>
|
|
642
|
-
<td>
|
|
643
|
-
<button
|
|
644
|
-
className="btn btn-sm btn-outline-success me-2"
|
|
645
|
-
onClick={() => handleConnectToDevice(device.deviceId)}
|
|
646
|
-
disabled={connecting.has(device.deviceId)}
|
|
647
|
-
title="Connect to device"
|
|
648
|
-
>
|
|
649
|
-
{connecting.has(device.deviceId) ? (
|
|
650
|
-
<>
|
|
651
|
-
<span
|
|
652
|
-
className="spinner-border spinner-border-sm me-1"
|
|
653
|
-
role="status"
|
|
654
|
-
aria-hidden="true"
|
|
655
|
-
></span>
|
|
656
|
-
Connecting...
|
|
657
|
-
</>
|
|
658
|
-
) : (
|
|
659
|
-
<>
|
|
660
|
-
<i className="bi bi-arrow-right-circle"></i> Connect
|
|
661
|
-
</>
|
|
662
|
-
)}
|
|
663
|
-
</button>
|
|
664
|
-
<button
|
|
665
|
-
className="btn btn-sm btn-outline-danger"
|
|
666
|
-
onClick={() => handleDeleteDevice(device.deviceId)}
|
|
667
|
-
title="Forget this device"
|
|
668
|
-
>
|
|
669
|
-
<i className="bi bi-trash"></i>
|
|
670
|
-
</button>
|
|
671
|
-
</td>
|
|
672
|
-
</tr>
|
|
673
|
-
))}
|
|
674
|
-
</tbody>
|
|
675
|
-
</table>
|
|
676
|
-
</div>
|
|
677
|
-
)}
|
|
678
|
-
</div>
|
|
679
|
-
</div>
|
|
680
|
-
|
|
681
|
-
{/* Device Details Modal */}
|
|
682
|
-
{selectedDeviceId && (
|
|
683
|
-
<DeviceDetailsModal
|
|
684
|
-
deviceId={selectedDeviceId}
|
|
685
|
-
onClose={() => setSelectedDeviceId(null)}
|
|
686
|
-
onDisconnect={loadData}
|
|
687
|
-
/>
|
|
688
|
-
)}
|
|
689
|
-
|
|
690
|
-
{/* Group Details Modal */}
|
|
691
|
-
{selectedGroupId && (
|
|
692
|
-
<GroupDetailsModal groupId={selectedGroupId} onClose={() => setSelectedGroupId(null)} />
|
|
693
|
-
)}
|
|
694
|
-
</div>
|
|
695
|
-
);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
registerInternalPeersUI({
|
|
699
|
-
peersUIId: "network-viewer-list-ui",
|
|
700
|
-
component: NetworkViewerList,
|
|
701
|
-
routes: [
|
|
702
|
-
{
|
|
703
|
-
isMatch: (_props, context) => context.path === "network-viewer",
|
|
704
|
-
uiCategory: "screen",
|
|
705
|
-
priority: 2,
|
|
706
|
-
},
|
|
707
|
-
],
|
|
708
|
-
});
|