@peers-app/peers-ui 0.34.9 → 0.34.10
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/apps-home/apps-home.js +6 -4
- package/dist/components/router.d.ts +1 -1
- package/dist/components/router.js +1 -1
- package/dist/screens/identity/identity-routes.d.ts +2 -1
- package/dist/screens/identity/identity-routes.js +6 -1
- package/dist/screens/monitoring/alerts-tab.d.ts +13 -0
- package/dist/screens/monitoring/alerts-tab.js +68 -0
- package/dist/screens/monitoring/badges.d.ts +25 -0
- package/dist/screens/monitoring/badges.js +68 -0
- package/dist/screens/monitoring/calls-tab.d.ts +30 -0
- package/dist/screens/monitoring/calls-tab.js +104 -0
- package/dist/screens/monitoring/charts/chart-math.d.ts +103 -0
- package/dist/screens/monitoring/charts/chart-math.js +200 -0
- package/dist/screens/monitoring/charts/histogram-chart.d.ts +25 -0
- package/dist/screens/monitoring/charts/histogram-chart.js +74 -0
- package/dist/screens/monitoring/charts/line-chart.d.ts +33 -0
- package/dist/screens/monitoring/charts/line-chart.js +103 -0
- package/dist/screens/monitoring/charts/sparkline.d.ts +30 -0
- package/dist/screens/monitoring/charts/sparkline.js +61 -0
- package/dist/screens/monitoring/charts/use-width.d.ts +9 -0
- package/dist/screens/monitoring/charts/use-width.js +31 -0
- package/dist/screens/monitoring/definition-forms.d.ts +113 -0
- package/dist/screens/monitoring/definition-forms.js +341 -0
- package/dist/screens/monitoring/definitions-tab.d.ts +20 -0
- package/dist/screens/monitoring/definitions-tab.js +110 -0
- package/dist/screens/monitoring/device-picker.d.ts +22 -0
- package/dist/screens/monitoring/device-picker.js +29 -0
- package/dist/screens/monitoring/form-fields.d.ts +76 -0
- package/dist/screens/monitoring/form-fields.js +65 -0
- package/dist/screens/monitoring/format.d.ts +51 -0
- package/dist/screens/monitoring/format.js +150 -0
- package/dist/screens/monitoring/log-lines.d.ts +74 -0
- package/dist/screens/monitoring/log-lines.js +138 -0
- package/dist/screens/monitoring/log-row.d.ts +12 -0
- package/dist/screens/monitoring/log-row.js +23 -0
- package/dist/screens/monitoring/logs-tab.d.ts +15 -0
- package/dist/screens/monitoring/logs-tab.js +256 -0
- package/dist/screens/monitoring/metric-definition-form.d.ts +15 -0
- package/dist/screens/monitoring/metric-definition-form.js +50 -0
- package/dist/screens/monitoring/metrics-tab.d.ts +37 -0
- package/dist/screens/monitoring/metrics-tab.js +149 -0
- package/dist/screens/monitoring/monitoring-routes.d.ts +40 -0
- package/dist/screens/monitoring/monitoring-routes.js +81 -0
- package/dist/screens/monitoring/monitoring-screen.d.ts +17 -0
- package/dist/screens/monitoring/monitoring-screen.js +63 -0
- package/dist/screens/monitoring/overview-tab.d.ts +33 -0
- package/dist/screens/monitoring/overview-tab.js +121 -0
- package/dist/screens/monitoring/telemetry-client.d.ts +48 -0
- package/dist/screens/monitoring/telemetry-client.js +92 -0
- package/dist/screens/monitoring/trigger-form.d.ts +18 -0
- package/dist/screens/monitoring/trigger-form.js +71 -0
- package/dist/screens/monitoring/use-telemetry.d.ts +39 -0
- package/dist/screens/monitoring/use-telemetry.js +120 -0
- package/dist/screens/network-viewer/remote-logs-panel.d.ts +1 -1
- package/dist/screens/network-viewer/remote-logs-panel.js +5 -3
- package/dist/system-apps/index.d.ts +1 -1
- package/dist/system-apps/index.js +5 -5
- package/dist/system-apps/monitoring.app.d.ts +6 -0
- package/dist/system-apps/monitoring.app.js +13 -0
- package/dist/tabs-layout/tabs-state.d.ts +4 -2
- package/dist/tabs-layout/tabs-state.js +23 -11
- package/dist/theme.css +32 -0
- package/package.json +3 -3
- package/dist/screens/console-logs/console-logs-list.d.ts +0 -2
- package/dist/screens/console-logs/console-logs-list.js +0 -284
- package/dist/screens/console-logs/follow-newest.d.ts +0 -11
- package/dist/screens/console-logs/follow-newest.js +0 -17
- package/dist/screens/console-logs/log-display.d.ts +0 -12
- package/dist/screens/console-logs/log-display.js +0 -69
- package/dist/screens/console-logs/log-filters.d.ts +0 -10
- package/dist/screens/console-logs/log-filters.js +0 -8
- package/dist/screens/console-logs/mobile-log-card.d.ts +0 -8
- package/dist/screens/console-logs/mobile-log-card.js +0 -94
- package/dist/screens/console-logs/resizable-table-header.d.ts +0 -14
- package/dist/screens/console-logs/resizable-table-header.js +0 -62
- package/dist/system-apps/console-logs.app.d.ts +0 -2
- package/dist/system-apps/console-logs.app.js +0 -8
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTelemetryRead = useTelemetryRead;
|
|
4
|
+
exports.useMyDevices = useMyDevices;
|
|
5
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const hooks_1 = require("../../hooks");
|
|
8
|
+
const devices_list_1 = require("../devices/devices-list");
|
|
9
|
+
const telemetry_client_1 = require("./telemetry-client");
|
|
10
|
+
/**
|
|
11
|
+
* Read from a device's System Telemetry, again whenever `deps` change and, while the page is
|
|
12
|
+
* visible, `refreshMs` after the last read finished. A refresh keeps the last result on screen (a
|
|
13
|
+
* view dims it); a failed read clears it; a different device starts empty, so one device's numbers
|
|
14
|
+
* never show under another's name.
|
|
15
|
+
*
|
|
16
|
+
* @param deviceId - The device to read; omit for this device.
|
|
17
|
+
* @param read - The read, given the device's consumer.
|
|
18
|
+
* @param deps - What the read depends on, besides the device.
|
|
19
|
+
* @param refreshMs - Read again this often; omit to read only on change.
|
|
20
|
+
*/
|
|
21
|
+
function useTelemetryRead(deviceId, read, deps, refreshMs) {
|
|
22
|
+
const [state, setState] = (0, react_1.useState)({
|
|
23
|
+
loading: true,
|
|
24
|
+
deviceId,
|
|
25
|
+
});
|
|
26
|
+
const runRef = (0, react_1.useRef)(0);
|
|
27
|
+
const readRef = (0, react_1.useRef)(read);
|
|
28
|
+
readRef.current = read;
|
|
29
|
+
const run = (0, react_1.useCallback)(async () => {
|
|
30
|
+
// A local save may finish and request a refresh after this section has closed.
|
|
31
|
+
if (!readRef.current)
|
|
32
|
+
return;
|
|
33
|
+
const id = ++runRef.current;
|
|
34
|
+
setState((prev) => prev.deviceId === deviceId ? { ...prev, loading: true } : { loading: true, deviceId });
|
|
35
|
+
try {
|
|
36
|
+
const telemetry = await (0, telemetry_client_1.getTelemetry)(deviceId);
|
|
37
|
+
if (id !== runRef.current)
|
|
38
|
+
return;
|
|
39
|
+
const data = await readRef.current(telemetry);
|
|
40
|
+
if (id === runRef.current)
|
|
41
|
+
setState({ data, loading: false, deviceId, readAt: Date.now() });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (id === runRef.current)
|
|
45
|
+
setState({ error, loading: false, deviceId });
|
|
46
|
+
}
|
|
47
|
+
}, [deviceId, ...deps]);
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
readRef.current = read;
|
|
50
|
+
void run();
|
|
51
|
+
return () => {
|
|
52
|
+
runRef.current++;
|
|
53
|
+
readRef.current = undefined;
|
|
54
|
+
};
|
|
55
|
+
}, [run]);
|
|
56
|
+
// Start the interval from the latest settled read, including a manual refresh.
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
if (!refreshMs || state.loading)
|
|
59
|
+
return;
|
|
60
|
+
const timer = setInterval(() => {
|
|
61
|
+
if (typeof document === "undefined" || !document.hidden)
|
|
62
|
+
void run();
|
|
63
|
+
}, refreshMs);
|
|
64
|
+
return () => clearInterval(timer);
|
|
65
|
+
}, [run, refreshMs, state]);
|
|
66
|
+
const current = state.deviceId === deviceId;
|
|
67
|
+
return {
|
|
68
|
+
data: current ? state.data : undefined,
|
|
69
|
+
error: current ? state.error : undefined,
|
|
70
|
+
loading: state.loading || !current,
|
|
71
|
+
readAt: current ? state.readAt : undefined,
|
|
72
|
+
refresh: () => void run(),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The signed-in user's devices: this one first, then the others by name. `undefined` until
|
|
77
|
+
* they're read. Whether one can be reached shows when Monitoring reads it.
|
|
78
|
+
*/
|
|
79
|
+
function useMyDevices() {
|
|
80
|
+
const userContext = (0, hooks_1.usePromise)(peers_sdk_1.getUserContext);
|
|
81
|
+
const [thisId] = (0, hooks_1.useObservable)(peers_sdk_1.thisDeviceId);
|
|
82
|
+
const [devices, setDevices] = (0, react_1.useState)();
|
|
83
|
+
(0, react_1.useEffect)(() => {
|
|
84
|
+
if (!userContext)
|
|
85
|
+
return;
|
|
86
|
+
let disposed = false;
|
|
87
|
+
const table = (0, peers_sdk_1.Devices)(userContext.userDataContext);
|
|
88
|
+
const load = async () => {
|
|
89
|
+
const rows = await table.list();
|
|
90
|
+
if (!disposed)
|
|
91
|
+
setDevices((0, devices_list_1.devicesForUser)(rows, userContext.userId));
|
|
92
|
+
};
|
|
93
|
+
void load();
|
|
94
|
+
const subscription = table.dataChanged.subscribe(() => void load());
|
|
95
|
+
return () => {
|
|
96
|
+
disposed = true;
|
|
97
|
+
subscription.unsubscribe();
|
|
98
|
+
};
|
|
99
|
+
}, [userContext]);
|
|
100
|
+
if (!devices)
|
|
101
|
+
return undefined;
|
|
102
|
+
const mine = devices.find((d) => d.deviceId === thisId);
|
|
103
|
+
const others = devices
|
|
104
|
+
.filter((d) => d.deviceId !== thisId)
|
|
105
|
+
.sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
|
|
106
|
+
const list = [];
|
|
107
|
+
list.push({
|
|
108
|
+
deviceId: thisId ?? "",
|
|
109
|
+
name: mine?.name ?? "",
|
|
110
|
+
isThisDevice: true,
|
|
111
|
+
});
|
|
112
|
+
for (const device of others) {
|
|
113
|
+
list.push({
|
|
114
|
+
deviceId: device.deviceId,
|
|
115
|
+
name: device.name || device.deviceId,
|
|
116
|
+
isThisDevice: false,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return list;
|
|
120
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface RemoteLogsPanelProps {
|
|
2
2
|
deviceId: string;
|
|
3
3
|
}
|
|
4
|
-
/** Read-only
|
|
4
|
+
/** Read-only panel of a directly connected, provider-authorized device's stored log lines. */
|
|
5
5
|
export declare function RemoteLogsPanel({ deviceId }: RemoteLogsPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RemoteLogsPanel = RemoteLogsPanel;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const log_lines_1 = require("../monitoring/log-lines");
|
|
6
7
|
const network_viewer_ipc_1 = require("./network-viewer-ipc");
|
|
7
8
|
function RemoteLogRow({ log }) {
|
|
8
|
-
|
|
9
|
+
const error = (0, log_lines_1.lineError)(log);
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "border-bottom py-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-wrap gap-2 align-items-center small", children: [(0, jsx_runtime_1.jsx)("code", { children: new Date(log.timestamp).toLocaleTimeString() }), (0, jsx_runtime_1.jsx)("span", { className: `badge ${log.level === "error" ? "bg-danger" : "bg-secondary"}`, children: log.level }), (0, jsx_runtime_1.jsx)("span", { className: "badge bg-info text-dark", children: log.process }), log.source && (0, jsx_runtime_1.jsx)("span", { className: "text-muted", children: log.source }), log.event && (0, jsx_runtime_1.jsx)("code", { className: "text-muted", children: log.event })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-1", style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere" }, children: log.message }), error?.stack && ((0, jsx_runtime_1.jsx)("pre", { className: "small rounded p-2 mt-1 mb-0 bg-danger bg-opacity-10 text-danger-emphasis", style: { maxHeight: "240px", whiteSpace: "pre-wrap" }, children: error.stack })), log.data && ((0, jsx_runtime_1.jsxs)("details", { className: "mt-1", children: [(0, jsx_runtime_1.jsx)("summary", { className: "small text-muted", children: "Data" }), (0, jsx_runtime_1.jsx)("pre", { className: "small bg-body-tertiary rounded p-2 mt-1", style: { maxHeight: "240px" }, children: JSON.stringify(log.data, null, 2) })] }))] }));
|
|
9
11
|
}
|
|
10
|
-
/** Read-only
|
|
12
|
+
/** Read-only panel of a directly connected, provider-authorized device's stored log lines. */
|
|
11
13
|
function RemoteLogsPanel({ deviceId }) {
|
|
12
14
|
const [result, setResult] = (0, react_1.useState)(null);
|
|
13
15
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
@@ -56,5 +58,5 @@ function RemoteLogsPanel({ deviceId }) {
|
|
|
56
58
|
anchor.click();
|
|
57
59
|
URL.revokeObjectURL(url);
|
|
58
60
|
}, [deviceId, result]);
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between align-items-center border-bottom pb-2 mb-3", children: [(0, jsx_runtime_1.jsx)("h6", { className: "mb-0", children: "Remote
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between align-items-center border-bottom pb-2 mb-3", children: [(0, jsx_runtime_1.jsx)("h6", { className: "mb-0", children: "Remote logs" }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-secondary", onClick: exportLogs, disabled: !result, children: "Export JSON" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: () => void loadLogs(), disabled: loading, children: loading ? "Loading..." : result ? "Refresh" : "Load logs" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row g-2 mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "col-md-3", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", htmlFor: "remote-logs-process", children: "Process" }), (0, jsx_runtime_1.jsx)("input", { id: "remote-logs-process", className: "form-control form-control-sm", value: processName, onChange: (event) => setProcessName(event.target.value), placeholder: "All processes" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "col-md-2", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", htmlFor: "remote-logs-level", children: "Level" }), (0, jsx_runtime_1.jsxs)("select", { id: "remote-logs-level", className: "form-select form-select-sm", value: level, onChange: (event) => setLevel(event.target.value), children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: "All" }), (0, jsx_runtime_1.jsx)("option", { value: "debug", children: "Debug" }), (0, jsx_runtime_1.jsx)("option", { value: "info", children: "Info" }), (0, jsx_runtime_1.jsx)("option", { value: "log", children: "Log" }), (0, jsx_runtime_1.jsx)("option", { value: "warn", children: "Warn" }), (0, jsx_runtime_1.jsx)("option", { value: "error", children: "Error" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "col-md-2", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", htmlFor: "remote-logs-minutes", children: "Time range" }), (0, jsx_runtime_1.jsxs)("select", { id: "remote-logs-minutes", className: "form-select form-select-sm", value: minutes, onChange: (event) => setMinutes(event.target.value), children: [(0, jsx_runtime_1.jsx)("option", { value: "15", children: "15 minutes" }), (0, jsx_runtime_1.jsx)("option", { value: "60", children: "1 hour" }), (0, jsx_runtime_1.jsx)("option", { value: "360", children: "6 hours" }), (0, jsx_runtime_1.jsx)("option", { value: "0", children: "All retained" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "col-md-5", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", htmlFor: "remote-logs-search", children: "Message words" }), (0, jsx_runtime_1.jsx)("input", { id: "remote-logs-search", className: "form-control form-control-sm", value: search, onChange: (event) => setSearch(event.target.value), placeholder: "BrowserWebRTC" })] })] }), error && (0, jsx_runtime_1.jsx)("div", { className: "alert alert-danger py-2", children: error }), result && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "small text-muted mb-2", children: ["Showing ", result.logs.length, result.truncated ? " newest" : "", " matching logs", result.truncated ? "; narrow the filters to see a different slice" : "", "; queried", " ", new Date(result.queriedAt).toLocaleString(), "."] }), (0, jsx_runtime_1.jsx)("div", { className: "border rounded px-2", style: { maxHeight: "420px", overflowY: "auto" }, children: result.logs.length ? (result.logs.map((log) => (0, jsx_runtime_1.jsx)(RemoteLogRow, { log: log }, log.logId))) : ((0, jsx_runtime_1.jsx)("div", { className: "text-muted py-3 text-center", children: "No matching remote logs." })) })] }))] }));
|
|
60
62
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IAppNav } from "@peers-app/peers-sdk";
|
|
2
2
|
import type { IPackageWithNavs } from "../ui-router/routes-loader";
|
|
3
3
|
export { consoleApp, isConsolePath } from "./console.app";
|
|
4
|
-
export { consoleLogsApp } from "./console-logs.app";
|
|
5
4
|
export { dataExplorerApp } from "./data-explorer.app";
|
|
6
5
|
export { identityApp } from "./identity.app";
|
|
7
6
|
export { mobileSettingsApp } from "./mobile-settings.app";
|
|
7
|
+
export { monitoringApp } from "./monitoring.app";
|
|
8
8
|
export { networkViewerApp } from "./network-viewer.app";
|
|
9
9
|
export { notificationsApp } from "./notifications.app";
|
|
10
10
|
export { packagesApp } from "./packages.app";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.systemPackage = exports.systemApps = exports.variablesApp = exports.typesApp = exports.toolsApp = exports.settingsApp = exports.searchApp = exports.packagesApp = exports.notificationsApp = exports.networkViewerApp = exports.
|
|
3
|
+
exports.systemPackage = exports.systemApps = exports.variablesApp = exports.typesApp = exports.toolsApp = exports.settingsApp = exports.searchApp = exports.packagesApp = exports.notificationsApp = exports.networkViewerApp = exports.monitoringApp = exports.mobileSettingsApp = exports.identityApp = exports.dataExplorerApp = exports.isConsolePath = exports.consoleApp = void 0;
|
|
4
4
|
var console_app_1 = require("./console.app");
|
|
5
5
|
Object.defineProperty(exports, "consoleApp", { enumerable: true, get: function () { return console_app_1.consoleApp; } });
|
|
6
6
|
Object.defineProperty(exports, "isConsolePath", { enumerable: true, get: function () { return console_app_1.isConsolePath; } });
|
|
7
|
-
var console_logs_app_1 = require("./console-logs.app");
|
|
8
|
-
Object.defineProperty(exports, "consoleLogsApp", { enumerable: true, get: function () { return console_logs_app_1.consoleLogsApp; } });
|
|
9
7
|
var data_explorer_app_1 = require("./data-explorer.app");
|
|
10
8
|
Object.defineProperty(exports, "dataExplorerApp", { enumerable: true, get: function () { return data_explorer_app_1.dataExplorerApp; } });
|
|
11
9
|
var identity_app_1 = require("./identity.app");
|
|
12
10
|
Object.defineProperty(exports, "identityApp", { enumerable: true, get: function () { return identity_app_1.identityApp; } });
|
|
13
11
|
var mobile_settings_app_1 = require("./mobile-settings.app");
|
|
14
12
|
Object.defineProperty(exports, "mobileSettingsApp", { enumerable: true, get: function () { return mobile_settings_app_1.mobileSettingsApp; } });
|
|
13
|
+
var monitoring_app_1 = require("./monitoring.app");
|
|
14
|
+
Object.defineProperty(exports, "monitoringApp", { enumerable: true, get: function () { return monitoring_app_1.monitoringApp; } });
|
|
15
15
|
var network_viewer_app_1 = require("./network-viewer.app");
|
|
16
16
|
Object.defineProperty(exports, "networkViewerApp", { enumerable: true, get: function () { return network_viewer_app_1.networkViewerApp; } });
|
|
17
17
|
var notifications_app_1 = require("./notifications.app");
|
|
@@ -30,10 +30,10 @@ Object.defineProperty(exports, "typesApp", { enumerable: true, get: function ()
|
|
|
30
30
|
var variables_app_1 = require("./variables.app");
|
|
31
31
|
Object.defineProperty(exports, "variablesApp", { enumerable: true, get: function () { return variables_app_1.variablesApp; } });
|
|
32
32
|
const console_app_2 = require("./console.app");
|
|
33
|
-
const console_logs_app_2 = require("./console-logs.app");
|
|
34
33
|
const data_explorer_app_2 = require("./data-explorer.app");
|
|
35
34
|
const identity_app_2 = require("./identity.app");
|
|
36
35
|
const mobile_settings_app_2 = require("./mobile-settings.app");
|
|
36
|
+
const monitoring_app_2 = require("./monitoring.app");
|
|
37
37
|
const network_viewer_app_2 = require("./network-viewer.app");
|
|
38
38
|
const notifications_app_2 = require("./notifications.app");
|
|
39
39
|
const packages_app_2 = require("./packages.app");
|
|
@@ -54,7 +54,7 @@ exports.systemApps = [
|
|
|
54
54
|
// System Tools & Debugging
|
|
55
55
|
network_viewer_app_2.networkViewerApp,
|
|
56
56
|
console_app_2.consoleApp,
|
|
57
|
-
|
|
57
|
+
monitoring_app_2.monitoringApp,
|
|
58
58
|
data_explorer_app_2.dataExplorerApp,
|
|
59
59
|
// Core Management Apps
|
|
60
60
|
types_app_2.typesApp,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IAppNav } from "@peers-app/peers-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Monitoring: a device's logs, metrics, calls and alerts, and the metric and trigger definitions
|
|
4
|
+
* behind them. It replaced Console Logs, whose `console-logs` path opens its Logs section.
|
|
5
|
+
*/
|
|
6
|
+
export declare const monitoringApp: IAppNav;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.monitoringApp = void 0;
|
|
4
|
+
const monitoring_routes_1 = require("../screens/monitoring/monitoring-routes");
|
|
5
|
+
/**
|
|
6
|
+
* Monitoring: a device's logs, metrics, calls and alerts, and the metric and trigger definitions
|
|
7
|
+
* behind them. It replaced Console Logs, whose `console-logs` path opens its Logs section.
|
|
8
|
+
*/
|
|
9
|
+
exports.monitoringApp = {
|
|
10
|
+
name: "Monitoring",
|
|
11
|
+
iconClassName: "bi-activity",
|
|
12
|
+
navigationPath: monitoring_routes_1.MONITORING_APP_PATH,
|
|
13
|
+
};
|
|
@@ -69,8 +69,10 @@ export declare function isRemovedAppRoute(path: string): boolean;
|
|
|
69
69
|
* Rewrite stored tabs onto canonical routes.
|
|
70
70
|
*
|
|
71
71
|
* Contacts, Groups, and Devices tabs from before the Identity app become one
|
|
72
|
-
* Identity tab
|
|
73
|
-
*
|
|
72
|
+
* Identity tab, and duplicate Monitoring tabs (a Console Logs tab beside a
|
|
73
|
+
* Monitoring one) become one Monitoring tab, so two don't both read. The active
|
|
74
|
+
* tab is kept when it is one of those duplicates. Tabs of removed apps are
|
|
75
|
+
* dropped.
|
|
74
76
|
*
|
|
75
77
|
* @param tabs - Persisted tabs.
|
|
76
78
|
* @param activeId - Persisted active tab id.
|
|
@@ -11,6 +11,7 @@ const globals_1 = require("../globals");
|
|
|
11
11
|
const frame_protocol_1 = require("../isolated-screens/frame-protocol");
|
|
12
12
|
const frame_realm_1 = require("../isolated-screens/frame-realm");
|
|
13
13
|
const identity_routes_1 = require("../screens/identity/identity-routes");
|
|
14
|
+
const monitoring_routes_1 = require("../screens/monitoring/monitoring-routes");
|
|
14
15
|
const system_apps_1 = require("../system-apps");
|
|
15
16
|
const routes_loader_1 = require("../ui-router/routes-loader");
|
|
16
17
|
const tab_order_1 = require("./tab-order");
|
|
@@ -216,8 +217,10 @@ function isRemovedAppRoute(path) {
|
|
|
216
217
|
* Rewrite stored tabs onto canonical routes.
|
|
217
218
|
*
|
|
218
219
|
* Contacts, Groups, and Devices tabs from before the Identity app become one
|
|
219
|
-
* Identity tab
|
|
220
|
-
*
|
|
220
|
+
* Identity tab, and duplicate Monitoring tabs (a Console Logs tab beside a
|
|
221
|
+
* Monitoring one) become one Monitoring tab, so two don't both read. The active
|
|
222
|
+
* tab is kept when it is one of those duplicates. Tabs of removed apps are
|
|
223
|
+
* dropped.
|
|
221
224
|
*
|
|
222
225
|
* @param tabs - Persisted tabs.
|
|
223
226
|
* @param activeId - Persisted active tab id.
|
|
@@ -225,7 +228,7 @@ function isRemovedAppRoute(path) {
|
|
|
225
228
|
function restoreNavigationState(tabs, activeId) {
|
|
226
229
|
const kept = tabs.filter((tab) => tab.tabId === "launcher" || !isRemovedAppRoute(tab.path));
|
|
227
230
|
const migrated = (kept.length > 0 ? kept : [tab_order_1.launcherApp]).map(migrateStoredTab);
|
|
228
|
-
const merged =
|
|
231
|
+
const merged = SINGLE_TAB_APPS.reduce((state, isAppPath) => mergeAppTabs(state.tabs, state.activeId, isAppPath), { tabs: migrated, activeId });
|
|
229
232
|
const activeExists = merged.tabs.some((tab) => tab.tabId === merged.activeId);
|
|
230
233
|
return {
|
|
231
234
|
tabs: merged.tabs,
|
|
@@ -363,22 +366,31 @@ function migrateStoredTab(tab) {
|
|
|
363
366
|
return tab;
|
|
364
367
|
}
|
|
365
368
|
const app = determineAppFromPath(path);
|
|
366
|
-
|
|
369
|
+
// A tab moved to another app (Identity's aliases, Console Logs into Monitoring) takes its name
|
|
370
|
+
// and icon.
|
|
371
|
+
const renamed = app?.navItem.navigationPath === identity_routes_1.IDENTITY_APP_PATH ||
|
|
372
|
+
app?.navItem.navigationPath === monitoring_routes_1.MONITORING_APP_PATH;
|
|
367
373
|
return {
|
|
368
374
|
...tab,
|
|
369
375
|
path,
|
|
370
376
|
packageId: app?.package.packageId ?? tab.packageId,
|
|
371
|
-
title:
|
|
372
|
-
iconClassName:
|
|
377
|
+
title: renamed ? app?.navItem.displayName || app?.navItem.name || tab.title : tab.title,
|
|
378
|
+
iconClassName: renamed ? app?.navItem.iconClassName || tab.iconClassName : tab.iconClassName,
|
|
373
379
|
};
|
|
374
380
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
381
|
+
/** Apps restored as one tab: each tests whether a route is the app's. */
|
|
382
|
+
const SINGLE_TAB_APPS = [
|
|
383
|
+
identity_routes_1.isIdentityPath,
|
|
384
|
+
(path) => (0, monitoring_routes_1.parseMonitoringLocation)(path) !== undefined,
|
|
385
|
+
];
|
|
386
|
+
/** Keep one of an app's tabs: the active one if it's among them, else the first. */
|
|
387
|
+
function mergeAppTabs(tabs, activeId, isAppPath) {
|
|
388
|
+
const appTabs = tabs.filter((tab) => isAppPath(tab.path));
|
|
389
|
+
if (appTabs.length <= 1) {
|
|
378
390
|
return { tabs, activeId };
|
|
379
391
|
}
|
|
380
|
-
const keeper =
|
|
381
|
-
const remove = new Set(
|
|
392
|
+
const keeper = appTabs.find((tab) => tab.tabId === activeId) ?? appTabs[0];
|
|
393
|
+
const remove = new Set(appTabs.filter((tab) => tab.tabId !== keeper.tabId).map((tab) => tab.tabId));
|
|
382
394
|
return {
|
|
383
395
|
tabs: tabs.filter((tab) => !remove.has(tab.tabId)),
|
|
384
396
|
activeId: remove.has(activeId) ? keeper.tabId : activeId,
|
package/dist/theme.css
CHANGED
|
@@ -2657,3 +2657,35 @@
|
|
|
2657
2657
|
background: rgba(255, 212, 0, 0.4);
|
|
2658
2658
|
color: inherit;
|
|
2659
2659
|
}
|
|
2660
|
+
|
|
2661
|
+
/*
|
|
2662
|
+
* Monitoring's charts. Series colors are the dataviz reference palette's eight categorical slots,
|
|
2663
|
+
* in their order (it keeps neighbors apart for color-blind readers), with steps validated against
|
|
2664
|
+
* each mode's surface. Grid and axis lines are translucent ink, so they show on a card or the page.
|
|
2665
|
+
*/
|
|
2666
|
+
:root,
|
|
2667
|
+
[data-bs-theme="light"] {
|
|
2668
|
+
--peers-viz-1: #2a78d6;
|
|
2669
|
+
--peers-viz-2: #eb6834;
|
|
2670
|
+
--peers-viz-3: #1baf7a;
|
|
2671
|
+
--peers-viz-4: #eda100;
|
|
2672
|
+
--peers-viz-5: #e87ba4;
|
|
2673
|
+
--peers-viz-6: #008300;
|
|
2674
|
+
--peers-viz-7: #6250d6;
|
|
2675
|
+
--peers-viz-8: #e34948;
|
|
2676
|
+
--peers-viz-grid: rgba(33, 37, 41, 0.1);
|
|
2677
|
+
--peers-viz-axis: rgba(33, 37, 41, 0.3);
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
[data-bs-theme="dark"] {
|
|
2681
|
+
--peers-viz-1: #3987e5;
|
|
2682
|
+
--peers-viz-2: #d95926;
|
|
2683
|
+
--peers-viz-3: #199e70;
|
|
2684
|
+
--peers-viz-4: #c98500;
|
|
2685
|
+
--peers-viz-5: #d55181;
|
|
2686
|
+
--peers-viz-6: #0ca30c;
|
|
2687
|
+
--peers-viz-7: #9085e9;
|
|
2688
|
+
--peers-viz-8: #e66767;
|
|
2689
|
+
--peers-viz-grid: rgba(255, 255, 255, 0.1);
|
|
2690
|
+
--peers-viz-axis: rgba(255, 255, 255, 0.25);
|
|
2691
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peers-app/peers-ui",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/peers-app/peers-ui.git"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"lint:fix": "biome check --write ."
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@peers-app/peers-sdk": "^0.34.
|
|
39
|
+
"@peers-app/peers-sdk": "^0.34.10",
|
|
40
40
|
"bootstrap": "^5.3.3",
|
|
41
41
|
"react": "^18.0.0",
|
|
42
42
|
"react-dom": "^18.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/preset-react": "^7.24.1",
|
|
48
48
|
"@babel/preset-typescript": "^7.27.1",
|
|
49
49
|
"@biomejs/biome": "2.3.11",
|
|
50
|
-
"@peers-app/peers-sdk": "0.34.
|
|
50
|
+
"@peers-app/peers-sdk": "0.34.10",
|
|
51
51
|
"@testing-library/dom": "^10.4.0",
|
|
52
52
|
"@testing-library/jest-dom": "^6.6.3",
|
|
53
53
|
"@testing-library/react": "^16.3.0",
|