feat(editor): Keyboard shortcuts for the log view (#15378)

This commit is contained in:
Suguru Inoue
2025-05-16 13:54:25 +02:00
committed by GitHub
parent de4c5fc716
commit 1935e62adf
40 changed files with 649 additions and 435 deletions

View File

@@ -106,6 +106,9 @@ import { useUniqueNodeName } from '@/composables/useUniqueNodeName';
import { isPresent } from '../utils/typesUtils';
import { useProjectsStore } from '@/stores/projects.store';
import type { CanvasLayoutEvent } from './useCanvasLayout';
import { chatEventBus } from '@n8n/chat/event-buses';
import { isChatNode } from '@/components/CanvasChat/utils';
import { useLogsStore } from '@/stores/logs.store';
type AddNodeData = Partial<INodeUi> & {
type: string;
@@ -147,6 +150,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
const nodeCreatorStore = useNodeCreatorStore();
const executionsStore = useExecutionsStore();
const projectsStore = useProjectsStore();
const logsStore = useLogsStore();
const i18n = useI18n();
const toast = useToast();
@@ -2031,10 +2035,14 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
return data;
}
async function toggleChatOpen(source: 'node' | 'main', isOpen?: boolean) {
function startChat(source?: 'node' | 'main') {
if (!workflowsStore.allNodes.some(isChatNode)) {
return;
}
const workflow = workflowsStore.getCurrentWorkflow();
workflowsStore.toggleLogsPanelOpen(isOpen);
logsStore.toggleOpen(true);
const payload = {
workflow_id: workflow.id,
@@ -2043,6 +2051,10 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
void externalHooks.run('nodeView.onOpenChat', payload);
telemetry.track('User clicked chat open button', payload);
setTimeout(() => {
chatEventBus.emit('focusInput');
}, 0);
}
async function importTemplate({
@@ -2121,7 +2133,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
initializeWorkspace,
resolveNodeWebhook,
openExecution,
toggleChatOpen,
startChat,
importTemplate,
tryToOpenSubworkflowInNewTab,
};