mirror of
https://github.com/smittix/intercept.git
synced 2026-04-25 07:10:00 -07:00
Improve mode transitions and add nav perf instrumentation
This commit is contained in:
@@ -187,13 +187,39 @@ const CommandPalette = (function() {
|
||||
title: 'View Aircraft Dashboard',
|
||||
description: 'Open dedicated ADS-B dashboard page',
|
||||
keyword: 'aircraft adsb dashboard',
|
||||
run: () => { window.location.href = '/adsb/dashboard'; }
|
||||
run: () => {
|
||||
if (window.InterceptNavPerf && typeof window.InterceptNavPerf.markStart === 'function') {
|
||||
window.InterceptNavPerf.markStart({
|
||||
targetPath: '/adsb/dashboard',
|
||||
trigger: 'command-palette',
|
||||
sourceMode: (typeof currentMode === 'string' && currentMode) ? currentMode : null,
|
||||
activeScans: (typeof getActiveScanSummary === 'function') ? getActiveScanSummary() : null,
|
||||
});
|
||||
}
|
||||
if (typeof stopActiveLocalScansForNavigation === 'function') {
|
||||
stopActiveLocalScansForNavigation();
|
||||
}
|
||||
window.location.href = '/adsb/dashboard';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'View Vessel Dashboard',
|
||||
description: 'Open dedicated AIS dashboard page',
|
||||
keyword: 'vessel ais dashboard',
|
||||
run: () => { window.location.href = '/ais/dashboard'; }
|
||||
run: () => {
|
||||
if (window.InterceptNavPerf && typeof window.InterceptNavPerf.markStart === 'function') {
|
||||
window.InterceptNavPerf.markStart({
|
||||
targetPath: '/ais/dashboard',
|
||||
trigger: 'command-palette',
|
||||
sourceMode: (typeof currentMode === 'string' && currentMode) ? currentMode : null,
|
||||
activeScans: (typeof getActiveScanSummary === 'function') ? getActiveScanSummary() : null,
|
||||
});
|
||||
}
|
||||
if (typeof stopActiveLocalScansForNavigation === 'function') {
|
||||
stopActiveLocalScansForNavigation();
|
||||
}
|
||||
window.location.href = '/ais/dashboard';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Kill All Running Processes',
|
||||
|
||||
@@ -18,6 +18,18 @@
|
||||
if (menuLink) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
try {
|
||||
const target = new URL(menuLink.href, window.location.href);
|
||||
if (window.InterceptNavPerf && typeof window.InterceptNavPerf.markStart === 'function') {
|
||||
window.InterceptNavPerf.markStart({
|
||||
targetPath: target.pathname,
|
||||
trigger: 'global-nav',
|
||||
sourceMode: document.body?.getAttribute('data-mode') || null,
|
||||
});
|
||||
}
|
||||
} catch (_) {
|
||||
// Ignore malformed link targets.
|
||||
}
|
||||
window.location.href = menuLink.href;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user