@peers-app/peers-ui 0.34.9 → 0.34.11
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 +23 -0
- package/dist/screens/monitoring/device-picker.js +30 -0
- package/dist/screens/monitoring/devices-tab.d.ts +6 -0
- package/dist/screens/monitoring/devices-tab.js +74 -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/monitored-devices.d.ts +84 -0
- package/dist/screens/monitoring/monitored-devices.js +193 -0
- package/dist/screens/monitoring/monitoring-routes.d.ts +40 -0
- package/dist/screens/monitoring/monitoring-routes.js +82 -0
- package/dist/screens/monitoring/monitoring-screen.d.ts +18 -0
- package/dist/screens/monitoring/monitoring-screen.js +71 -0
- package/dist/screens/monitoring/overview-tab.d.ts +51 -0
- package/dist/screens/monitoring/overview-tab.js +136 -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 +37 -0
- package/dist/screens/monitoring/use-telemetry.js +119 -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
|
@@ -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.11",
|
|
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.11",
|
|
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.11",
|
|
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",
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ConsoleLogsList = void 0;
|
|
40
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
42
|
-
const lodash_1 = require("lodash");
|
|
43
|
-
const react_1 = __importStar(require("react"));
|
|
44
|
-
const react_infinite_scroll_component_1 = __importDefault(require("react-infinite-scroll-component"));
|
|
45
|
-
const loading_indicator_1 = require("../../components/loading-indicator");
|
|
46
|
-
const globals_1 = require("../../globals");
|
|
47
|
-
const hooks_1 = require("../../hooks");
|
|
48
|
-
const ui_loader_1 = require("../../ui-router/ui-loader");
|
|
49
|
-
const color_mode_dropdown_1 = require("../settings/color-mode-dropdown");
|
|
50
|
-
const follow_newest_1 = require("./follow-newest");
|
|
51
|
-
const log_display_1 = require("./log-display");
|
|
52
|
-
const log_filters_1 = require("./log-filters");
|
|
53
|
-
const mobile_log_card_1 = require("./mobile-log-card");
|
|
54
|
-
const resizable_table_header_1 = require("./resizable-table-header");
|
|
55
|
-
const windowHeight = () => window.innerHeight;
|
|
56
|
-
const DEFAULT_COLUMNS = [
|
|
57
|
-
{ key: "timestamp", label: "Timestamp", width: 150 },
|
|
58
|
-
{ key: "level", label: "Level", width: 80 },
|
|
59
|
-
{ key: "process", label: "Process", width: 100 },
|
|
60
|
-
{ key: "source", label: "Source", width: 120 },
|
|
61
|
-
{ key: "message", label: "Message", width: 600 },
|
|
62
|
-
];
|
|
63
|
-
/** Filterable console log screen with desktop columns and mobile log cards. */
|
|
64
|
-
const ConsoleLogsList = () => {
|
|
65
|
-
const logs = (0, hooks_1.useObservableState)([]);
|
|
66
|
-
const [allLogsLoaded, setAllLogsLoaded] = (0, react_1.useState)(false);
|
|
67
|
-
const loadMoreId = (0, hooks_1.useObservableState)((0, peers_sdk_1.newid)(), true);
|
|
68
|
-
const [levelFilter, setLevelFilter] = (0, react_1.useState)("all");
|
|
69
|
-
const [processFilter, setProcessFilter] = (0, react_1.useState)("all");
|
|
70
|
-
const searchText = (0, hooks_1.useObservableState)("");
|
|
71
|
-
/** Observable ref is stable — depend on this string in hooks so search changes refetch. */
|
|
72
|
-
const searchQuery = searchText();
|
|
73
|
-
const [columns, setColumns] = (0, react_1.useState)(DEFAULT_COLUMNS);
|
|
74
|
-
const [totalLogCount, setTotalLogCount] = (0, react_1.useState)(0);
|
|
75
|
-
const [_colorMode] = (0, hooks_1.useObservable)(color_mode_dropdown_1.colorMode);
|
|
76
|
-
const logsEndRef = react_1.default.useRef(null);
|
|
77
|
-
const scrollAreaRef = react_1.default.useRef(null);
|
|
78
|
-
const containerRef = react_1.default.useRef(null);
|
|
79
|
-
(0, hooks_1.useObservable)(globals_1.isDesktop);
|
|
80
|
-
const isMobile = !(0, globals_1.isDesktop)();
|
|
81
|
-
const batchSize = 50;
|
|
82
|
-
// Track fixed column widths to trigger message column recalculation
|
|
83
|
-
const _fixedColumnsWidthKey = (0, react_1.useMemo)(() => {
|
|
84
|
-
return columns
|
|
85
|
-
.filter((col) => col.key !== "message")
|
|
86
|
-
.map((col) => `${col.key}:${col.width}`)
|
|
87
|
-
.join(",");
|
|
88
|
-
}, [columns]);
|
|
89
|
-
// Calculate message column width based on available space.
|
|
90
|
-
// Do not depend on `columns` — updating the message column width changes `columns` and would re-enter this effect forever.
|
|
91
|
-
// Re-run when fixed (non-message) column widths change (`_fixedColumnsWidthKey`) or on window resize.
|
|
92
|
-
(0, react_1.useEffect)(() => {
|
|
93
|
-
const updateMessageColumnWidth = () => {
|
|
94
|
-
if (!containerRef.current)
|
|
95
|
-
return;
|
|
96
|
-
const containerWidth = containerRef.current.offsetWidth;
|
|
97
|
-
setColumns((prev) => {
|
|
98
|
-
const fixedColumnsWidth = prev
|
|
99
|
-
.filter((col) => col.key !== "message")
|
|
100
|
-
.reduce((sum, col) => sum + col.width, 0);
|
|
101
|
-
const messageWidth = Math.max(200, containerWidth - fixedColumnsWidth - 20); // 20px for scrollbar
|
|
102
|
-
return prev.map((col) => (col.key === "message" ? { ...col, width: messageWidth } : col));
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
updateMessageColumnWidth();
|
|
106
|
-
window.addEventListener("resize", updateMessageColumnWidth);
|
|
107
|
-
return () => {
|
|
108
|
-
window.removeEventListener("resize", updateMessageColumnWidth);
|
|
109
|
-
};
|
|
110
|
-
}, [_fixedColumnsWidthKey]);
|
|
111
|
-
// Build filter from UI state
|
|
112
|
-
const buildFilter = (0, react_1.useCallback)(() => {
|
|
113
|
-
const filter = {};
|
|
114
|
-
if (levelFilter !== "all") {
|
|
115
|
-
filter.level = levelFilter;
|
|
116
|
-
}
|
|
117
|
-
if (processFilter !== "all") {
|
|
118
|
-
filter.process = processFilter;
|
|
119
|
-
}
|
|
120
|
-
if (searchQuery.trim()) {
|
|
121
|
-
filter.message = { $matchWords: searchQuery };
|
|
122
|
-
}
|
|
123
|
-
return filter;
|
|
124
|
-
}, [levelFilter, processFilter, searchQuery]);
|
|
125
|
-
// Update total log count
|
|
126
|
-
const updateLogCount = (0, react_1.useCallback)(async () => {
|
|
127
|
-
const table = await (0, peers_sdk_1.ConsoleLogs)();
|
|
128
|
-
const filter = buildFilter();
|
|
129
|
-
const count = await table.count(filter);
|
|
130
|
-
setTotalLogCount(count);
|
|
131
|
-
}, [buildFilter]);
|
|
132
|
-
// Fetch logs using cursor-based pagination
|
|
133
|
-
const fetchLogs = (0, react_1.useCallback)(async (lastLog) => {
|
|
134
|
-
const table = await (0, peers_sdk_1.ConsoleLogs)();
|
|
135
|
-
const base = buildFilter();
|
|
136
|
-
const filter = lastLog
|
|
137
|
-
? { ...base, logId: { $lt: lastLog.logId } }
|
|
138
|
-
: base;
|
|
139
|
-
return table.list(filter, {
|
|
140
|
-
pageSize: batchSize,
|
|
141
|
-
sortBy: ["-timestamp", "-logId"],
|
|
142
|
-
});
|
|
143
|
-
}, [buildFilter]);
|
|
144
|
-
const loadMoreLogsRef = (0, react_1.useRef)(async () => { });
|
|
145
|
-
// Load older logs (prepend to list)
|
|
146
|
-
const loadMoreLogs = (0, react_1.useCallback)(async (startLoadId) => {
|
|
147
|
-
if (startLoadId && startLoadId !== loadMoreId()) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const sid = startLoadId ?? loadMoreId();
|
|
151
|
-
const oldestLog = logs()[0];
|
|
152
|
-
const fetchedLogs = await fetchLogs(oldestLog);
|
|
153
|
-
if (loadMoreId() !== sid) {
|
|
154
|
-
await loadMoreLogsRef.current(loadMoreId());
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (fetchedLogs.length === 0) {
|
|
158
|
-
setAllLogsLoaded(true);
|
|
159
|
-
}
|
|
160
|
-
let _logs = (0, lodash_1.sortBy)([...logs(), ...fetchedLogs], "timestamp");
|
|
161
|
-
_logs = (0, lodash_1.uniqBy)(_logs, (l) => l.logId);
|
|
162
|
-
logs(_logs);
|
|
163
|
-
}, [fetchLogs, loadMoreId, logs]);
|
|
164
|
-
loadMoreLogsRef.current = loadMoreLogs;
|
|
165
|
-
const scrollToBottom = (0, react_1.useCallback)((behavior, delay = 100) => {
|
|
166
|
-
setTimeout(() => {
|
|
167
|
-
logsEndRef.current?.scrollIntoView({ behavior });
|
|
168
|
-
}, delay);
|
|
169
|
-
}, []);
|
|
170
|
-
const logCount = logs().length;
|
|
171
|
-
// Initial load and ensure screen is filled
|
|
172
|
-
const minHeightOfLog = 30;
|
|
173
|
-
(0, react_1.useEffect)(() => {
|
|
174
|
-
if (!allLogsLoaded && (!logCount || logCount * minHeightOfLog < windowHeight())) {
|
|
175
|
-
void loadMoreLogs();
|
|
176
|
-
}
|
|
177
|
-
}, [allLogsLoaded, loadMoreLogs, logCount]);
|
|
178
|
-
// Reset when filters change (`logs` is a stable observable setter; effect is driven by filter fields and callbacks).
|
|
179
|
-
(0, react_1.useEffect)(() => {
|
|
180
|
-
loadMoreId((0, peers_sdk_1.newid)());
|
|
181
|
-
logs([]);
|
|
182
|
-
void updateLogCount();
|
|
183
|
-
setAllLogsLoaded(false);
|
|
184
|
-
void loadMoreLogs();
|
|
185
|
-
}, [levelFilter, processFilter, searchQuery, loadMoreId, loadMoreLogs, updateLogCount]);
|
|
186
|
-
// Subscribe to new logs (`searchText` ref is stable; handler calls searchText() per event for current query).
|
|
187
|
-
(0, react_1.useEffect)(() => {
|
|
188
|
-
let sub;
|
|
189
|
-
(0, peers_sdk_1.ConsoleLogs)().then((table) => {
|
|
190
|
-
sub = table.dataChanged.subscribe((evt) => {
|
|
191
|
-
// Update count whenever data changes
|
|
192
|
-
void updateLogCount();
|
|
193
|
-
const log = evt.dataObject;
|
|
194
|
-
// Check if log matches current filters
|
|
195
|
-
if (levelFilter !== "all" && log.level !== levelFilter)
|
|
196
|
-
return;
|
|
197
|
-
if (processFilter !== "all" && log.process !== processFilter)
|
|
198
|
-
return;
|
|
199
|
-
if (searchText()) {
|
|
200
|
-
const logMessage = log.message.toLowerCase();
|
|
201
|
-
const filterOut = searchText()
|
|
202
|
-
.toLowerCase()
|
|
203
|
-
.split(" ")
|
|
204
|
-
.some((word) => !logMessage.includes(word));
|
|
205
|
-
if (filterOut)
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
// Don't add we're only showing a limited batch and this is older
|
|
209
|
-
const timestamps = logs().map((l) => l.timestamp);
|
|
210
|
-
const oldestTs = (0, lodash_1.min)(timestamps);
|
|
211
|
-
if (logs().length > batchSize && oldestTs !== undefined && oldestTs > log.timestamp) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (evt.op === "insert") {
|
|
215
|
-
// Follow new logs only from the newest end; leave a reader scrolled back where they are.
|
|
216
|
-
const following = (0, follow_newest_1.isAtNewestEnd)(scrollAreaRef.current);
|
|
217
|
-
let _logs = (0, lodash_1.sortBy)([...logs(), log], "timestamp");
|
|
218
|
-
_logs = (0, lodash_1.uniqBy)(_logs, (l) => l.logId);
|
|
219
|
-
logs(_logs);
|
|
220
|
-
if (following)
|
|
221
|
-
scrollToBottom("smooth");
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
return () => {
|
|
226
|
-
sub?.unsubscribe();
|
|
227
|
-
};
|
|
228
|
-
}, [levelFilter, processFilter, logs, scrollToBottom, searchText, updateLogCount]);
|
|
229
|
-
async function handleClearLogs() {
|
|
230
|
-
if (confirm("Are you sure you want to clear all console logs?")) {
|
|
231
|
-
try {
|
|
232
|
-
const table = await (0, peers_sdk_1.ConsoleLogs)();
|
|
233
|
-
await table.deleteOldLogs(Date.now());
|
|
234
|
-
logs([]);
|
|
235
|
-
setTotalLogCount(0);
|
|
236
|
-
}
|
|
237
|
-
catch (err) {
|
|
238
|
-
console.error("Failed to clear logs:", err);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
const _logs = (0, lodash_1.uniqBy)(logs(), (l) => l.logId);
|
|
243
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-fluid", style: { height: "calc(100dvh - 100px)", display: "flex", flexDirection: "column" }, children: [(0, jsx_runtime_1.jsx)(log_filters_1.LogFilters, { levelFilter: levelFilter, setLevelFilter: setLevelFilter, processFilter: processFilter, setProcessFilter: setProcessFilter, searchText: searchText(), setSearchText: searchText }), (0, jsx_runtime_1.jsxs)("div", { ref: containerRef, style: {
|
|
244
|
-
flex: 1,
|
|
245
|
-
display: "flex",
|
|
246
|
-
flexDirection: "column",
|
|
247
|
-
backgroundColor: _colorMode === "dark" ? "#1a1a1a" : "var(--peers-surface-bg)",
|
|
248
|
-
borderRadius: "0.25rem",
|
|
249
|
-
marginBottom: "50px",
|
|
250
|
-
overflow: "hidden",
|
|
251
|
-
}, children: [!isMobile && ((0, jsx_runtime_1.jsx)(resizable_table_header_1.ResizableTableHeader, { columns: columns, onColumnsChange: setColumns, colorMode: _colorMode })), (0, jsx_runtime_1.jsx)("div", { ref: scrollAreaRef, id: "scrollableLogsDiv", style: {
|
|
252
|
-
flex: 1,
|
|
253
|
-
overflow: "auto",
|
|
254
|
-
display: "flex",
|
|
255
|
-
flexDirection: "column-reverse",
|
|
256
|
-
}, children: (0, jsx_runtime_1.jsxs)(react_infinite_scroll_component_1.default, { dataLength: _logs.length, next: loadMoreLogs, style: { display: "flex", flexDirection: "column-reverse", overflow: "hidden" }, inverse: true, hasMore: !allLogsLoaded, loader: (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {}), scrollableTarget: "scrollableLogsDiv", endMessage: (0, jsx_runtime_1.jsx)("div", { className: "d-flex justify-content-center p-3", children: (0, jsx_runtime_1.jsx)("div", { className: "text-muted", children: (0, jsx_runtime_1.jsx)("i", { children: "beginning of logs" }) }) }), children: [(0, jsx_runtime_1.jsx)("div", { ref: logsEndRef }), _logs.length === 0 && allLogsLoaded ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center p-5 text-muted", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-inbox display-1" }), (0, jsx_runtime_1.jsx)("p", { className: "mt-2", children: "No logs found" })] })) : isMobile ? (
|
|
257
|
-
/* Mobile: Card-based layout */
|
|
258
|
-
(0, jsx_runtime_1.jsx)("div", { children: _logs.map((log) => ((0, jsx_runtime_1.jsx)(mobile_log_card_1.MobileLogCard, { log: log, colorMode: _colorMode }, log.logId))) })) : (
|
|
259
|
-
/* Desktop: Table layout */
|
|
260
|
-
(0, jsx_runtime_1.jsx)("table", { className: "table table-sm table-hover mb-0", style: { fontSize: "0.85rem", tableLayout: "fixed", width: "100%" }, children: (0, jsx_runtime_1.jsx)("tbody", { children: _logs.map((log) => ((0, jsx_runtime_1.jsx)(log_display_1.LogDisplay, { log: log, columns: columns }, log.logId))) }) }))] }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
261
|
-
position: "fixed",
|
|
262
|
-
bottom: 0,
|
|
263
|
-
left: 0,
|
|
264
|
-
right: 0,
|
|
265
|
-
padding: "0.5rem 1rem",
|
|
266
|
-
backgroundColor: _colorMode === "dark" ? "#2a2a2a" : "var(--peers-surface-bg)",
|
|
267
|
-
borderTop: "1px solid var(--peers-surface-border, #dee2e6)",
|
|
268
|
-
zIndex: 1000,
|
|
269
|
-
display: "flex",
|
|
270
|
-
justifyContent: "space-between",
|
|
271
|
-
alignItems: "center",
|
|
272
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { className: "text-muted small", children: totalLogCount > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-ul me-1" }), totalLogCount, " log", totalLogCount !== 1 ? "s" : ""] })) : ((0, jsx_runtime_1.jsx)("span", { children: "\u00A0" })) }), (0, jsx_runtime_1.jsxs)("button", { className: "btn btn-sm btn-outline-danger", onClick: handleClearLogs, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-trash me-1" }), "Clear All"] })] })] }));
|
|
273
|
-
};
|
|
274
|
-
exports.ConsoleLogsList = ConsoleLogsList;
|
|
275
|
-
(0, ui_loader_1.registerInternalPeersUI)({
|
|
276
|
-
component: exports.ConsoleLogsList,
|
|
277
|
-
routes: [
|
|
278
|
-
{
|
|
279
|
-
isMatch: (_props, context) => context.path === "console-logs",
|
|
280
|
-
uiCategory: "screen",
|
|
281
|
-
priority: 0,
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** How close to the newest log, in pixels, still counts as following new logs. */
|
|
2
|
-
export declare const FOLLOW_NEWEST_PX = 40;
|
|
3
|
-
/**
|
|
4
|
-
* Whether the logs list is scrolled to its newest end, so a new log should scroll into view. The
|
|
5
|
-
* list runs `column-reverse`: the newest end is `scrollTop` 0, and scrolling back to older logs
|
|
6
|
-
* makes it negative (positive in some older engines, hence the absolute value).
|
|
7
|
-
*
|
|
8
|
-
* @param element - The scrolling list, or null before it renders (counts as following).
|
|
9
|
-
* @returns False while the user has scrolled back to read older logs.
|
|
10
|
-
*/
|
|
11
|
-
export declare function isAtNewestEnd(element: Pick<HTMLElement, "scrollTop"> | null): boolean;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FOLLOW_NEWEST_PX = void 0;
|
|
4
|
-
exports.isAtNewestEnd = isAtNewestEnd;
|
|
5
|
-
/** How close to the newest log, in pixels, still counts as following new logs. */
|
|
6
|
-
exports.FOLLOW_NEWEST_PX = 40;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the logs list is scrolled to its newest end, so a new log should scroll into view. The
|
|
9
|
-
* list runs `column-reverse`: the newest end is `scrollTop` 0, and scrolling back to older logs
|
|
10
|
-
* makes it negative (positive in some older engines, hence the absolute value).
|
|
11
|
-
*
|
|
12
|
-
* @param element - The scrolling list, or null before it renders (counts as following).
|
|
13
|
-
* @returns False while the user has scrolled back to read older logs.
|
|
14
|
-
*/
|
|
15
|
-
function isAtNewestEnd(element) {
|
|
16
|
-
return !element || Math.abs(element.scrollTop) <= exports.FOLLOW_NEWEST_PX;
|
|
17
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type IConsoleLog } from "@peers-app/peers-sdk";
|
|
2
|
-
interface Column {
|
|
3
|
-
key: string;
|
|
4
|
-
label: string;
|
|
5
|
-
width: number;
|
|
6
|
-
}
|
|
7
|
-
interface LogDisplayProps {
|
|
8
|
-
log: IConsoleLog;
|
|
9
|
-
columns: Column[];
|
|
10
|
-
}
|
|
11
|
-
export declare const LogDisplay: ({ log, columns }: LogDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LogDisplay = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
9
|
-
const moment_1 = __importDefault(require("moment"));
|
|
10
|
-
const getLevelColor = (level) => {
|
|
11
|
-
switch (level) {
|
|
12
|
-
case "error":
|
|
13
|
-
return "#dc3545"; // Red - matches console error
|
|
14
|
-
case "warn":
|
|
15
|
-
return "#ffc107"; // Yellow - matches console warn
|
|
16
|
-
case "info":
|
|
17
|
-
return "#0dcaf0"; // Cyan - matches console info
|
|
18
|
-
case "log":
|
|
19
|
-
return "#6c757d"; // Gray - default log color
|
|
20
|
-
case "debug":
|
|
21
|
-
return "#6c757d"; // Gray - debug color
|
|
22
|
-
default:
|
|
23
|
-
return "#6c757d";
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const getProcessColor = (process) => {
|
|
27
|
-
switch (process) {
|
|
28
|
-
case "ui":
|
|
29
|
-
case "renderer":
|
|
30
|
-
return "#0dcaf0"; // Cyan - matches console logger
|
|
31
|
-
case "electron":
|
|
32
|
-
case "main":
|
|
33
|
-
return "#d946ef"; // Magenta - matches console logger
|
|
34
|
-
default:
|
|
35
|
-
return "#6c757d"; // Gray for unknown
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const getLevelIcon = (level) => {
|
|
39
|
-
switch (level) {
|
|
40
|
-
case "error":
|
|
41
|
-
return "bi-x-circle-fill";
|
|
42
|
-
case "warn":
|
|
43
|
-
return "bi-exclamation-triangle-fill";
|
|
44
|
-
case "info":
|
|
45
|
-
return "bi-info-circle-fill";
|
|
46
|
-
case "debug":
|
|
47
|
-
return "bi-bug-fill";
|
|
48
|
-
default:
|
|
49
|
-
return "bi-chat-square-text";
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const LogDisplay = ({ log, columns }) => {
|
|
53
|
-
const getColumnWidth = (key) => {
|
|
54
|
-
const column = columns.find((c) => c.key === key);
|
|
55
|
-
return column ? `${column.width}px` : "auto";
|
|
56
|
-
};
|
|
57
|
-
if (typeof log.context === "string") {
|
|
58
|
-
try {
|
|
59
|
-
log.context = (0, peers_sdk_1.fromJSONString)(log.context);
|
|
60
|
-
}
|
|
61
|
-
catch (_err) { }
|
|
62
|
-
}
|
|
63
|
-
return ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { className: "text-nowrap", style: { fontSize: "0.75rem", width: getColumnWidth("timestamp"), padding: "0.5rem" }, children: (0, moment_1.default)(log.timestamp).format("MM/DD HH:mm:ss.SSS") }), (0, jsx_runtime_1.jsx)("td", { style: { width: getColumnWidth("level"), padding: "0.5rem" }, children: (0, jsx_runtime_1.jsxs)("span", { className: "badge text-white", style: { backgroundColor: getLevelColor(log.level) }, children: [(0, jsx_runtime_1.jsx)("i", { className: `${getLevelIcon(log.level)} me-1` }), log.level] }) }), (0, jsx_runtime_1.jsx)("td", { style: { width: getColumnWidth("process"), padding: "0.5rem" }, children: (0, jsx_runtime_1.jsx)("span", { className: "badge text-white", style: { backgroundColor: getProcessColor(log.process) }, children: log.process }) }), (0, jsx_runtime_1.jsx)("td", { className: "text-truncate", style: {
|
|
64
|
-
width: getColumnWidth("source"),
|
|
65
|
-
padding: "0.5rem",
|
|
66
|
-
maxWidth: getColumnWidth("source"),
|
|
67
|
-
}, title: log.source || "", children: log.source || "-" }), (0, jsx_runtime_1.jsxs)("td", { style: { width: getColumnWidth("message"), wordBreak: "break-word", padding: "0.5rem" }, children: [log.message, log.context && ((0, jsx_runtime_1.jsxs)("details", { className: "mt-1", children: [(0, jsx_runtime_1.jsxs)("summary", { className: "text-muted small", style: { cursor: "pointer" }, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-code-square me-1" }), "Context"] }), (0, jsx_runtime_1.jsx)("pre", { className: "small mt-1 p-2 bg-secondary bg-opacity-10 rounded", style: { fontSize: "0.7rem" }, children: JSON.stringify((0, peers_sdk_1.toJSON)(log.context), null, 2) })] })), log.stackTrace && ((0, jsx_runtime_1.jsxs)("details", { className: "mt-1", children: [(0, jsx_runtime_1.jsxs)("summary", { className: "text-danger small", style: { cursor: "pointer" }, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-bug me-1" }), "Stack Trace"] }), (0, jsx_runtime_1.jsx)("pre", { className: "small mt-1 p-2 bg-danger bg-opacity-10 rounded text-danger", style: { fontSize: "0.7rem" }, children: log.stackTrace })] }))] })] }));
|
|
68
|
-
};
|
|
69
|
-
exports.LogDisplay = LogDisplay;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface LogFiltersProps {
|
|
2
|
-
levelFilter: string;
|
|
3
|
-
setLevelFilter: (value: string) => void;
|
|
4
|
-
processFilter: string;
|
|
5
|
-
setProcessFilter: (value: string) => void;
|
|
6
|
-
searchText: string;
|
|
7
|
-
setSearchText: (value: string) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare const LogFilters: ({ levelFilter, setLevelFilter, processFilter, setProcessFilter, searchText, setSearchText, }: LogFiltersProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogFilters = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const LogFilters = ({ levelFilter, setLevelFilter, processFilter, setProcessFilter, searchText, setSearchText, }) => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "mb-3", style: { position: "sticky", top: 0, zIndex: 10, backgroundColor: "inherit" }, children: (0, jsx_runtime_1.jsxs)("div", { className: "row g-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "col-md-3", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", children: "Level" }), (0, jsx_runtime_1.jsxs)("select", { className: "form-select form-select-sm", value: levelFilter, onChange: (e) => setLevelFilter(e.target.value), children: [(0, jsx_runtime_1.jsx)("option", { value: "all", children: "All Levels" }), (0, jsx_runtime_1.jsx)("option", { value: "error", children: "Error" }), (0, jsx_runtime_1.jsx)("option", { value: "warn", children: "Warning" }), (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: "debug", children: "Debug" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "col-md-3", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", children: "Process" }), (0, jsx_runtime_1.jsxs)("select", { className: "form-select form-select-sm", value: processFilter, onChange: (e) => setProcessFilter(e.target.value), children: [(0, jsx_runtime_1.jsx)("option", { value: "all", children: "All Processes" }), (0, jsx_runtime_1.jsx)("option", { value: "electron", children: "Electron" }), (0, jsx_runtime_1.jsx)("option", { value: "ui", children: "UI" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "col-md-6", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small", children: "Search" }), (0, jsx_runtime_1.jsx)("input", { type: "text", className: "form-control form-control-sm", placeholder: "Search log messages...", value: searchText, onChange: (e) => setSearchText(e.target.value) })] })] }) }));
|
|
7
|
-
};
|
|
8
|
-
exports.LogFilters = LogFilters;
|