@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,421 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type INetworkGroupDetails,
|
|
3
|
-
type INetworkGroupSyncInfo,
|
|
4
|
-
TrustLevel,
|
|
5
|
-
} from "@peers-app/peers-sdk";
|
|
6
|
-
import { useCallback, useEffect, useState } from "react";
|
|
7
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
8
|
-
import { TrustLevelBadge } from "../../components/trust-level-badge";
|
|
9
|
-
import {
|
|
10
|
-
getNetworkControlConsumer,
|
|
11
|
-
getNetworkDiagnosticsConsumer,
|
|
12
|
-
getNetworkViewerPlatformApi,
|
|
13
|
-
} from "./network-viewer-ipc";
|
|
14
|
-
|
|
15
|
-
interface IGroupDetailsModalProps {
|
|
16
|
-
groupId: string;
|
|
17
|
-
onClose: () => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function GroupDetailsModal({ groupId, onClose }: IGroupDetailsModalProps) {
|
|
21
|
-
const [group, setGroup] = useState<INetworkGroupDetails | null>(null);
|
|
22
|
-
const [syncInfo, setSyncInfo] = useState<INetworkGroupSyncInfo | null>(null);
|
|
23
|
-
const [loading, setLoading] = useState(true);
|
|
24
|
-
const [notFound, setNotFound] = useState(false);
|
|
25
|
-
const [downloading, setDownloading] = useState(false);
|
|
26
|
-
const [downloadProgress, setDownloadProgress] = useState<string | null>(null);
|
|
27
|
-
const [downloadResult, setDownloadResult] = useState<{
|
|
28
|
-
success: boolean;
|
|
29
|
-
message: string;
|
|
30
|
-
filePath?: string;
|
|
31
|
-
size?: number;
|
|
32
|
-
} | null>(null);
|
|
33
|
-
const [fullSyncing, setFullSyncing] = useState(false);
|
|
34
|
-
const [fullSyncResult, setFullSyncResult] = useState<{
|
|
35
|
-
success: boolean;
|
|
36
|
-
message: string;
|
|
37
|
-
} | null>(null);
|
|
38
|
-
const [syncingNow, setSyncingNow] = useState(false);
|
|
39
|
-
const [syncNowResult, setSyncNowResult] = useState<{
|
|
40
|
-
success: boolean;
|
|
41
|
-
message: string;
|
|
42
|
-
} | null>(null);
|
|
43
|
-
const platformApi = getNetworkViewerPlatformApi();
|
|
44
|
-
|
|
45
|
-
const loadData = useCallback(async () => {
|
|
46
|
-
try {
|
|
47
|
-
const diagnostics = await getNetworkDiagnosticsConsumer();
|
|
48
|
-
const [{ group: groupDetails }, { groups }] = await Promise.all([
|
|
49
|
-
diagnostics.tools.getGroupDetails({ groupId }),
|
|
50
|
-
diagnostics.tools.getGroupSyncStatus({ groupId }),
|
|
51
|
-
]);
|
|
52
|
-
|
|
53
|
-
if (!groupDetails) {
|
|
54
|
-
setNotFound(true);
|
|
55
|
-
} else {
|
|
56
|
-
setGroup(groupDetails);
|
|
57
|
-
setNotFound(false);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (groups.length > 0) {
|
|
61
|
-
setSyncInfo(groups[0]);
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error("Error loading group details:", error);
|
|
65
|
-
setNotFound(true);
|
|
66
|
-
} finally {
|
|
67
|
-
setLoading(false);
|
|
68
|
-
}
|
|
69
|
-
}, [groupId]);
|
|
70
|
-
|
|
71
|
-
const handleDownloadDatabase = async (deviceId: string) => {
|
|
72
|
-
try {
|
|
73
|
-
setDownloading(true);
|
|
74
|
-
setDownloadProgress("Preparing download...");
|
|
75
|
-
setDownloadResult(null);
|
|
76
|
-
|
|
77
|
-
if (!platformApi?.downloadRemoteDatabase) {
|
|
78
|
-
setDownloadResult({
|
|
79
|
-
success: false,
|
|
80
|
-
message: "Download API not available",
|
|
81
|
-
});
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
setDownloadProgress("Downloading database...");
|
|
86
|
-
const result = (await platformApi.downloadRemoteDatabase(groupId, deviceId)) as {
|
|
87
|
-
success: boolean;
|
|
88
|
-
message: string;
|
|
89
|
-
filePath?: string;
|
|
90
|
-
size?: number;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
setDownloadResult(result);
|
|
94
|
-
if (result.success) {
|
|
95
|
-
setDownloadProgress(null);
|
|
96
|
-
}
|
|
97
|
-
} catch (error: unknown) {
|
|
98
|
-
console.error("Error downloading database:", error);
|
|
99
|
-
setDownloadResult({
|
|
100
|
-
success: false,
|
|
101
|
-
message: error instanceof Error ? error.message : "Download failed",
|
|
102
|
-
});
|
|
103
|
-
} finally {
|
|
104
|
-
setDownloading(false);
|
|
105
|
-
setDownloadProgress(null);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const handleSyncNow = async () => {
|
|
110
|
-
setSyncingNow(true);
|
|
111
|
-
setSyncNowResult(null);
|
|
112
|
-
try {
|
|
113
|
-
const control = await getNetworkControlConsumer();
|
|
114
|
-
const result = await control.tools.syncGroupNow({ groupId });
|
|
115
|
-
setSyncNowResult(result);
|
|
116
|
-
if (result.success) {
|
|
117
|
-
await loadData();
|
|
118
|
-
}
|
|
119
|
-
} catch (error) {
|
|
120
|
-
setSyncNowResult({
|
|
121
|
-
success: false,
|
|
122
|
-
message: error instanceof Error ? error.message : String(error),
|
|
123
|
-
});
|
|
124
|
-
} finally {
|
|
125
|
-
setSyncingNow(false);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const handleFullSync = async () => {
|
|
130
|
-
if (
|
|
131
|
-
!confirm(
|
|
132
|
-
`Do a full sync for "${group?.groupName || groupId}"? This resets local change tracking for only this context and may transfer substantial data.`,
|
|
133
|
-
)
|
|
134
|
-
) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
setFullSyncing(true);
|
|
138
|
-
setFullSyncResult(null);
|
|
139
|
-
try {
|
|
140
|
-
const control = await getNetworkControlConsumer();
|
|
141
|
-
const result = await control.tools.resetChangeTracking({ dataContextId: groupId });
|
|
142
|
-
setFullSyncResult(result);
|
|
143
|
-
if (result.success) {
|
|
144
|
-
await loadData();
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
setFullSyncResult({
|
|
148
|
-
success: false,
|
|
149
|
-
message: error instanceof Error ? error.message : String(error),
|
|
150
|
-
});
|
|
151
|
-
} finally {
|
|
152
|
-
setFullSyncing(false);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
useEffect(() => {
|
|
157
|
-
loadData();
|
|
158
|
-
}, [loadData]);
|
|
159
|
-
|
|
160
|
-
return (
|
|
161
|
-
<div
|
|
162
|
-
className="position-fixed top-0 start-0 w-100 h-100 d-flex align-items-start justify-content-center"
|
|
163
|
-
style={{
|
|
164
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
|
165
|
-
zIndex: 1050,
|
|
166
|
-
overflowY: "auto",
|
|
167
|
-
paddingTop: "2rem",
|
|
168
|
-
paddingBottom: "2rem",
|
|
169
|
-
}}
|
|
170
|
-
onClick={onClose}
|
|
171
|
-
>
|
|
172
|
-
<div
|
|
173
|
-
className="card"
|
|
174
|
-
style={{ maxWidth: "900px", width: "90%", maxHeight: "90vh" }}
|
|
175
|
-
onClick={(e) => e.stopPropagation()}
|
|
176
|
-
>
|
|
177
|
-
{/* Header */}
|
|
178
|
-
<div className="card-header d-flex justify-content-between align-items-center">
|
|
179
|
-
<div>
|
|
180
|
-
<h5 className="mb-0">{loading ? "Loading..." : group?.groupName || "Group Details"}</h5>
|
|
181
|
-
{group && (
|
|
182
|
-
<small className="text-muted">
|
|
183
|
-
<code>{group.groupId}</code>
|
|
184
|
-
</small>
|
|
185
|
-
)}
|
|
186
|
-
</div>
|
|
187
|
-
<button className="btn-close" onClick={onClose} aria-label="Close"></button>
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
{/* Body */}
|
|
191
|
-
<div className="card-body" style={{ overflowY: "auto", maxHeight: "calc(90vh - 120px)" }}>
|
|
192
|
-
{loading && <LoadingIndicator />}
|
|
193
|
-
|
|
194
|
-
{!loading && (notFound || !group) && (
|
|
195
|
-
<div className="alert alert-warning">Group not found.</div>
|
|
196
|
-
)}
|
|
197
|
-
|
|
198
|
-
{!loading && group && (
|
|
199
|
-
<>
|
|
200
|
-
{/* Group Info */}
|
|
201
|
-
<div className="mb-4">
|
|
202
|
-
<h6 className="border-bottom pb-2 mb-3">Group Information</h6>
|
|
203
|
-
<div className="row">
|
|
204
|
-
<div className="col-md-6 mb-3">
|
|
205
|
-
<strong>Group ID:</strong>
|
|
206
|
-
<br />
|
|
207
|
-
<code className="text-muted small">{group.groupId}</code>
|
|
208
|
-
</div>
|
|
209
|
-
<div className="col-md-6 mb-3">
|
|
210
|
-
<strong>Group Name:</strong>
|
|
211
|
-
<br />
|
|
212
|
-
<span>{group.groupName}</span>
|
|
213
|
-
</div>
|
|
214
|
-
<div className="col-md-6 mb-3">
|
|
215
|
-
<strong>Founder:</strong>
|
|
216
|
-
<br />
|
|
217
|
-
{group.founderUserName ? (
|
|
218
|
-
<>
|
|
219
|
-
<span>{group.founderUserName}</span>
|
|
220
|
-
<br />
|
|
221
|
-
<code className="text-muted small">{group.founderUserId}</code>
|
|
222
|
-
</>
|
|
223
|
-
) : (
|
|
224
|
-
<code className="text-muted small">{group.founderUserId}</code>
|
|
225
|
-
)}
|
|
226
|
-
</div>
|
|
227
|
-
<div className="col-md-6 mb-3">
|
|
228
|
-
<strong>Total Members:</strong>
|
|
229
|
-
<br />
|
|
230
|
-
<span className="h5">{group.members.length}</span>
|
|
231
|
-
</div>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
|
|
235
|
-
{/* Members List */}
|
|
236
|
-
{group.members.length > 0 && (
|
|
237
|
-
<div className="mb-4">
|
|
238
|
-
<h6 className="border-bottom pb-2 mb-3">Members ({group.members.length})</h6>
|
|
239
|
-
<div className="table-responsive">
|
|
240
|
-
<table className="table table-sm table-hover">
|
|
241
|
-
<thead>
|
|
242
|
-
<tr>
|
|
243
|
-
<th>User</th>
|
|
244
|
-
<th>User ID</th>
|
|
245
|
-
<th>Role</th>
|
|
246
|
-
<th>Trust Level</th>
|
|
247
|
-
</tr>
|
|
248
|
-
</thead>
|
|
249
|
-
<tbody>
|
|
250
|
-
{group.members.map((member) => (
|
|
251
|
-
<tr key={member.userId}>
|
|
252
|
-
<td>{member.userName || <span className="text-muted">-</span>}</td>
|
|
253
|
-
<td>
|
|
254
|
-
<code className="text-muted small">{member.userId}</code>
|
|
255
|
-
</td>
|
|
256
|
-
<td>
|
|
257
|
-
<span className="badge bg-primary">{member.role}</span>
|
|
258
|
-
</td>
|
|
259
|
-
<td>
|
|
260
|
-
<TrustLevelBadge level={member.trustLevel || TrustLevel.Unknown} />
|
|
261
|
-
</td>
|
|
262
|
-
</tr>
|
|
263
|
-
))}
|
|
264
|
-
</tbody>
|
|
265
|
-
</table>
|
|
266
|
-
</div>
|
|
267
|
-
</div>
|
|
268
|
-
)}
|
|
269
|
-
|
|
270
|
-
<div className="mb-4">
|
|
271
|
-
<h6 className="border-bottom pb-2 mb-3">
|
|
272
|
-
<i className="bi bi-arrow-repeat me-2"></i>
|
|
273
|
-
Synchronization
|
|
274
|
-
</h6>
|
|
275
|
-
<p className="text-muted small mb-3">
|
|
276
|
-
<strong>Sync now</strong> notifies connected peers that this context may have
|
|
277
|
-
changes. <strong>Do full sync</strong> resets change tracking for this context and
|
|
278
|
-
rebuilds synchronization state; that may transfer substantial data and should be
|
|
279
|
-
used only to repair suspected drift.
|
|
280
|
-
</p>
|
|
281
|
-
<div className="d-flex flex-wrap gap-2">
|
|
282
|
-
<button
|
|
283
|
-
type="button"
|
|
284
|
-
className="btn btn-sm btn-outline-primary"
|
|
285
|
-
onClick={() => void handleSyncNow()}
|
|
286
|
-
disabled={syncingNow || fullSyncing}
|
|
287
|
-
>
|
|
288
|
-
{syncingNow ? "Sending sync notification..." : "Sync now"}
|
|
289
|
-
</button>
|
|
290
|
-
<button
|
|
291
|
-
type="button"
|
|
292
|
-
className="btn btn-sm btn-outline-warning"
|
|
293
|
-
onClick={() => void handleFullSync()}
|
|
294
|
-
disabled={fullSyncing || syncingNow}
|
|
295
|
-
>
|
|
296
|
-
{fullSyncing ? "Starting full sync..." : "Do full sync"}
|
|
297
|
-
</button>
|
|
298
|
-
</div>
|
|
299
|
-
{syncNowResult && (
|
|
300
|
-
<div
|
|
301
|
-
className={`alert mt-3 mb-0 ${syncNowResult.success ? "alert-success" : "alert-danger"}`}
|
|
302
|
-
role="status"
|
|
303
|
-
>
|
|
304
|
-
{syncNowResult.message}
|
|
305
|
-
</div>
|
|
306
|
-
)}
|
|
307
|
-
{fullSyncResult && (
|
|
308
|
-
<div
|
|
309
|
-
className={`alert mt-3 mb-0 ${fullSyncResult.success ? "alert-success" : "alert-danger"}`}
|
|
310
|
-
role="status"
|
|
311
|
-
>
|
|
312
|
-
{fullSyncResult.message}
|
|
313
|
-
</div>
|
|
314
|
-
)}
|
|
315
|
-
</div>
|
|
316
|
-
|
|
317
|
-
{/* Database Download Section */}
|
|
318
|
-
{platformApi?.downloadRemoteDatabase ? (
|
|
319
|
-
<div className="mb-4">
|
|
320
|
-
<h6 className="border-bottom pb-2 mb-3">
|
|
321
|
-
<i className="bi bi-download me-2"></i>
|
|
322
|
-
Download Database (Fast Sync)
|
|
323
|
-
</h6>
|
|
324
|
-
<p className="text-muted small mb-3">
|
|
325
|
-
Download the entire database from a connected device. This is useful for fast
|
|
326
|
-
initial sync on a new device. The database will be saved as a backup file.
|
|
327
|
-
</p>
|
|
328
|
-
|
|
329
|
-
{syncInfo && syncInfo.connectedDevices.length > 0 ? (
|
|
330
|
-
<div>
|
|
331
|
-
<label className="form-label">Select a connected device:</label>
|
|
332
|
-
<div className="d-flex flex-wrap gap-2">
|
|
333
|
-
{syncInfo.connectedDevices.map((device) => (
|
|
334
|
-
<button
|
|
335
|
-
key={device.deviceId}
|
|
336
|
-
className="btn btn-outline-primary btn-sm"
|
|
337
|
-
onClick={() => handleDownloadDatabase(device.deviceId)}
|
|
338
|
-
disabled={downloading}
|
|
339
|
-
>
|
|
340
|
-
{downloading ? (
|
|
341
|
-
<>
|
|
342
|
-
<span
|
|
343
|
-
className="spinner-border spinner-border-sm me-1"
|
|
344
|
-
role="status"
|
|
345
|
-
aria-hidden="true"
|
|
346
|
-
></span>
|
|
347
|
-
Downloading...
|
|
348
|
-
</>
|
|
349
|
-
) : (
|
|
350
|
-
<>
|
|
351
|
-
<i className="bi bi-cloud-download me-1"></i>
|
|
352
|
-
{device.deviceId.substring(0, 8)}...
|
|
353
|
-
<span className="badge bg-secondary ms-1">
|
|
354
|
-
{Math.round(device.latencyMs)}ms
|
|
355
|
-
</span>
|
|
356
|
-
</>
|
|
357
|
-
)}
|
|
358
|
-
</button>
|
|
359
|
-
))}
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
) : (
|
|
363
|
-
<div className="alert alert-info mb-0">
|
|
364
|
-
<i className="bi bi-info-circle me-2"></i>
|
|
365
|
-
No devices are currently connected to this group. Connect to a device first to
|
|
366
|
-
download its database.
|
|
367
|
-
</div>
|
|
368
|
-
)}
|
|
369
|
-
|
|
370
|
-
{downloadProgress && (
|
|
371
|
-
<div className="mt-3">
|
|
372
|
-
<div className="d-flex align-items-center">
|
|
373
|
-
<span
|
|
374
|
-
className="spinner-border spinner-border-sm me-2"
|
|
375
|
-
role="status"
|
|
376
|
-
aria-hidden="true"
|
|
377
|
-
></span>
|
|
378
|
-
<span>{downloadProgress}</span>
|
|
379
|
-
</div>
|
|
380
|
-
</div>
|
|
381
|
-
)}
|
|
382
|
-
|
|
383
|
-
{downloadResult && (
|
|
384
|
-
<div
|
|
385
|
-
className={`alert mt-3 mb-0 ${downloadResult.success ? "alert-success" : "alert-danger"}`}
|
|
386
|
-
>
|
|
387
|
-
{downloadResult.success ? (
|
|
388
|
-
<>
|
|
389
|
-
<i className="bi bi-check-circle me-2"></i>
|
|
390
|
-
<strong>Download complete!</strong>
|
|
391
|
-
<br />
|
|
392
|
-
<small>
|
|
393
|
-
File: <code>{downloadResult.filePath}</code>
|
|
394
|
-
<br />
|
|
395
|
-
Size:{" "}
|
|
396
|
-
{downloadResult.size
|
|
397
|
-
? `${(downloadResult.size / (1024 * 1024)).toFixed(2)} MB`
|
|
398
|
-
: "Unknown"}
|
|
399
|
-
</small>
|
|
400
|
-
</>
|
|
401
|
-
) : (
|
|
402
|
-
<>
|
|
403
|
-
<i className="bi bi-exclamation-circle me-2"></i>
|
|
404
|
-
<strong>Download failed:</strong> {downloadResult.message}
|
|
405
|
-
</>
|
|
406
|
-
)}
|
|
407
|
-
</div>
|
|
408
|
-
)}
|
|
409
|
-
</div>
|
|
410
|
-
) : (
|
|
411
|
-
<div className="alert alert-info mb-4">
|
|
412
|
-
Raw database download is available only in the Electron desktop app.
|
|
413
|
-
</div>
|
|
414
|
-
)}
|
|
415
|
-
</>
|
|
416
|
-
)}
|
|
417
|
-
</div>
|
|
418
|
-
</div>
|
|
419
|
-
</div>
|
|
420
|
-
);
|
|
421
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Import all network viewer screen components to ensure they register their routes
|
|
2
|
-
import "./network-viewer";
|
|
3
|
-
|
|
4
|
-
export * from "./connection-troubleshooter";
|
|
5
|
-
export * from "./cpu-usage-graph";
|
|
6
|
-
export * from "./device-details-modal";
|
|
7
|
-
export * from "./network-viewer";
|
|
8
|
-
export * from "./usage-graph";
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CONTRACT_REQUEST_CHANNEL,
|
|
3
|
-
inProcessTransportPair,
|
|
4
|
-
newid,
|
|
5
|
-
registerHostContractTransport,
|
|
6
|
-
} from "@peers-app/peers-sdk";
|
|
7
|
-
import { getNetworkControlConsumer, getNetworkDiagnosticsConsumer } from "./network-viewer-ipc";
|
|
8
|
-
|
|
9
|
-
function setupHost(label: string) {
|
|
10
|
-
const [consumerTransport, providerTransport] = inProcessTransportPair();
|
|
11
|
-
providerTransport.on(CONTRACT_REQUEST_CHANNEL, (call) => {
|
|
12
|
-
if (call.member === "observable" && call.name === "status" && call.operation === "get") {
|
|
13
|
-
return {
|
|
14
|
-
state: "offline",
|
|
15
|
-
connectionCount: 0,
|
|
16
|
-
syncingContextCount: 0,
|
|
17
|
-
errorCount: 0,
|
|
18
|
-
disconnectedContextCount: 0,
|
|
19
|
-
connectedContextCount: 0,
|
|
20
|
-
errors: [],
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (call.member === "tool" && call.name === "getOverview") {
|
|
24
|
-
return { overview: { localDeviceId: label } };
|
|
25
|
-
}
|
|
26
|
-
if (call.member === "tool" && call.name === "refreshNetworkInfo") {
|
|
27
|
-
return { success: true, message: label };
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
dispose: registerHostContractTransport(consumerTransport),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
describe("Network Viewer host consumers", () => {
|
|
37
|
-
it("caches consumers for one transport and recreates them after replacement", async () => {
|
|
38
|
-
const firstHost = setupHost(newid());
|
|
39
|
-
const firstDiagnostics = await getNetworkDiagnosticsConsumer();
|
|
40
|
-
expect(await getNetworkDiagnosticsConsumer()).toBe(firstDiagnostics);
|
|
41
|
-
|
|
42
|
-
const secondLabel = newid();
|
|
43
|
-
const secondHost = setupHost(secondLabel);
|
|
44
|
-
const secondDiagnostics = await getNetworkDiagnosticsConsumer();
|
|
45
|
-
const control = await getNetworkControlConsumer();
|
|
46
|
-
|
|
47
|
-
expect(secondDiagnostics).not.toBe(firstDiagnostics);
|
|
48
|
-
await expect(firstDiagnostics.tools.getOverview()).rejects.toThrow("disposed");
|
|
49
|
-
await expect(control.tools.refreshNetworkInfo()).resolves.toEqual({
|
|
50
|
-
success: true,
|
|
51
|
-
message: secondLabel,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
secondHost.dispose();
|
|
55
|
-
firstHost.dispose();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("shares one consumer pair across concurrent callers", async () => {
|
|
59
|
-
const host = setupHost(newid());
|
|
60
|
-
const [first, second, third] = await Promise.all([
|
|
61
|
-
getNetworkDiagnosticsConsumer(),
|
|
62
|
-
getNetworkDiagnosticsConsumer(),
|
|
63
|
-
getNetworkControlConsumer(),
|
|
64
|
-
]);
|
|
65
|
-
|
|
66
|
-
expect(second).toBe(first);
|
|
67
|
-
const cachedControl = await getNetworkControlConsumer();
|
|
68
|
-
expect(third).toBe(cachedControl);
|
|
69
|
-
|
|
70
|
-
host.dispose();
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getNetworkControlContractDefinition,
|
|
3
|
-
getNetworkDiagnosticsContractDefinition,
|
|
4
|
-
hostContractConsumer,
|
|
5
|
-
type INetworkControlConsumer,
|
|
6
|
-
type INetworkDiagnosticsConsumer,
|
|
7
|
-
} from "@peers-app/peers-sdk";
|
|
8
|
-
|
|
9
|
-
/** Electron-only capabilities intentionally excluded from portable network contracts. */
|
|
10
|
-
export type NetworkViewerPlatformApi = {
|
|
11
|
-
downloadRemoteDatabase?: (groupId: string, deviceId: string) => Promise<unknown>;
|
|
12
|
-
runDiagnostics: () => Promise<unknown>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type WindowWithNetworkViewer = Window & {
|
|
16
|
-
electronAPI?: { networkViewer?: NetworkViewerPlatformApi };
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const diagnostics = hostContractConsumer<INetworkDiagnosticsConsumer>(
|
|
20
|
-
getNetworkDiagnosticsContractDefinition(),
|
|
21
|
-
);
|
|
22
|
-
const control = hostContractConsumer<INetworkControlConsumer>(
|
|
23
|
-
getNetworkControlContractDefinition(),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
/** Return a typed diagnostics consumer bound to the current local host transport. */
|
|
27
|
-
export async function getNetworkDiagnosticsConsumer(): Promise<INetworkDiagnosticsConsumer> {
|
|
28
|
-
return diagnostics.get();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Return a typed control consumer bound to the current local host transport. */
|
|
32
|
-
export async function getNetworkControlConsumer(): Promise<INetworkControlConsumer> {
|
|
33
|
-
return control.get();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Return the context-isolated desktop-only capability bridge, when available. */
|
|
37
|
-
export function getNetworkViewerPlatformApi(): NetworkViewerPlatformApi | undefined {
|
|
38
|
-
return (window as WindowWithNetworkViewer).electronAPI?.networkViewer;
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { observable } from "@peers-app/peers-sdk";
|
|
2
|
-
|
|
3
|
-
/** Pane shown inside the Network Viewer tab. */
|
|
4
|
-
export type NetworkViewerSection = "main" | "sync-recovery";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Which Network Viewer pane is showing.
|
|
8
|
-
*
|
|
9
|
-
* The status overlay sets this before focusing the Network tab, so Sync recovery
|
|
10
|
-
* opens inside that tab instead of replacing whatever screen is current.
|
|
11
|
-
*/
|
|
12
|
-
export const networkViewerSection = observable<NetworkViewerSection>("main");
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render, waitFor } from "@testing-library/react";
|
|
2
|
-
import { NetworkViewerList } from "./network-viewer";
|
|
3
|
-
import { networkViewerSection } from "./network-viewer-section";
|
|
4
|
-
|
|
5
|
-
jest.mock("../../ui-router/ui-loader", () => ({
|
|
6
|
-
registerInternalPeersUI: jest.fn(),
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
jest.mock("./network-viewer-ipc", () => ({
|
|
10
|
-
getNetworkDiagnosticsConsumer: async () => ({
|
|
11
|
-
tools: {
|
|
12
|
-
getOverview: async () => ({
|
|
13
|
-
overview: {
|
|
14
|
-
localDeviceId: "device",
|
|
15
|
-
localUserId: "user",
|
|
16
|
-
totalConnections: 0,
|
|
17
|
-
availableSlots: 8,
|
|
18
|
-
maxConnections: 8,
|
|
19
|
-
cpuPercent: 0,
|
|
20
|
-
memPercent: 0,
|
|
21
|
-
groups: [],
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
getConnections: async () => ({ connections: [] }),
|
|
25
|
-
getGroupSyncStatus: async () => ({ groups: [] }),
|
|
26
|
-
getDisconnectedDevices: async () => ({ devices: [] }),
|
|
27
|
-
getSyncRecoveryEntries: async () => ({ entries: [] }),
|
|
28
|
-
},
|
|
29
|
-
observables: {
|
|
30
|
-
status: {
|
|
31
|
-
subscribe: () => ({ dispose() {} }),
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
getNetworkControlConsumer: async () => ({ tools: {} }),
|
|
36
|
-
getNetworkViewerPlatformApi: () => undefined,
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
describe("Network Viewer sections", () => {
|
|
40
|
-
beforeEach(() => {
|
|
41
|
-
networkViewerSection("main");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("shows Sync recovery in place and returns to the overview", async () => {
|
|
45
|
-
const view = render(<NetworkViewerList />);
|
|
46
|
-
await waitFor(() => {
|
|
47
|
-
expect(view.getByRole("heading", { name: "Network Viewer" })).toBeTruthy();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
fireEvent.click(view.getByRole("button", { name: "Sync recovery" }));
|
|
51
|
-
expect(await view.findByRole("heading", { name: "Sync recovery" })).toBeTruthy();
|
|
52
|
-
expect(view.queryByRole("heading", { name: "Network Viewer" })).toBeNull();
|
|
53
|
-
|
|
54
|
-
fireEvent.click(view.getByRole("button", { name: "Back" }));
|
|
55
|
-
expect(view.getByRole("heading", { name: "Network Viewer" })).toBeTruthy();
|
|
56
|
-
view.unmount();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("opens on Sync recovery when the overlay selects that pane", async () => {
|
|
60
|
-
networkViewerSection("sync-recovery");
|
|
61
|
-
const view = render(<NetworkViewerList />);
|
|
62
|
-
|
|
63
|
-
expect(await view.findByRole("heading", { name: "Sync recovery" })).toBeTruthy();
|
|
64
|
-
expect(await view.findByText("No records are waiting in the recovery queue.")).toBeTruthy();
|
|
65
|
-
expect(view.queryByRole("heading", { name: "Network Viewer" })).toBeNull();
|
|
66
|
-
view.unmount();
|
|
67
|
-
});
|
|
68
|
-
});
|