Revert keyboard shortcuts

This commit is contained in:
ivanahuckova
2025-10-13 15:08:01 +02:00
parent 862118b30b
commit f94942bf3c
-29
View File
@@ -1,4 +1,3 @@
import { toggleAssistant, isAssistantAvailable } from '@grafana/assistant';
import { LegacyGraphHoverClearEvent, SetPanelAttentionEvent, locationUtil } from '@grafana/data';
import { LocationService } from '@grafana/runtime';
import appEvents from 'app/core/app_events';
@@ -39,8 +38,6 @@ export class KeybindingSrv {
}
/** string for VizPanel key and number for panelId */
private panelId: string | number | null = null;
private assistantSubscription: { unsubscribe: () => void } | null = null;
clearAndInitGlobalBindings(route: RouteDescriptor) {
mousetrap.reset();
@@ -53,8 +50,6 @@ export class KeybindingSrv {
this.bind('g e', this.goToExplore);
this.bind('g a', this.openAlerting);
this.bind('g p', this.goToProfile);
// Conditionally bind open Assistant shortcut ('cmd .') if Assistant is available
this.bindAssistantShortcutIfAvailable();
this.bind('esc', this.exit);
this.bindGlobalEsc();
}
@@ -124,30 +119,6 @@ export class KeybindingSrv {
appEvents.publish(new ShowModalReactEvent({ component: HelpModal }));
}
private bindAssistantShortcutIfAvailable() {
// Clean up any existing subscription
if (this.assistantSubscription) {
this.assistantSubscription.unsubscribe();
}
// Subscribe to assistant availability and bind/unbind shortcut accordingly
this.assistantSubscription = isAssistantAvailable().subscribe((available) => {
if (available) {
this.bind('mod+.', this.toggleAssistant);
} else {
// Unbind the shortcut if assistant becomes unavailable
mousetrap.unbind('mod+.');
}
});
}
private toggleAssistant() {
toggleAssistant({
origin: 'grafana/keyboard-shortcut',
prompt: '',
context: [],
});
}
private exit() {
const search = this.locationService.getSearchObject();