fix(n8n Form Node): Popup does not work in some browsers (no-changelog) (#12176)

This commit is contained in:
Michael Kret 2024-12-12 14:49:50 +02:00 committed by GitHub
parent 454b022305
commit 73f0c4cca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 12 deletions

View file

@ -37,6 +37,7 @@ import { useAssistantStore } from '@/stores/assistant.store';
import NodeExecutionErrorMessage from '@/components/NodeExecutionErrorMessage.vue';
import type { IExecutionResponse } from '@/Interface';
import { EASY_AI_WORKFLOW_JSON } from '@/constants.workflows';
import { clearPopupWindowState } from '../utils/executionUtils';
export function usePushConnection({ router }: { router: ReturnType<typeof useRouter> }) {
const workflowHelpers = useWorkflowHelpers({ router });
@ -201,6 +202,7 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
}
if (receivedData.type === 'executionFinished') {
clearPopupWindowState();
const workflow = workflowsStore.getWorkflowById(receivedData.data.workflowId);
if (workflow?.meta?.templateId) {
const isEasyAIWorkflow =

View file

@ -85,7 +85,7 @@ import { TelemetryHelpers } from 'n8n-workflow';
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
import { useRouter } from 'vue-router';
import { useSettingsStore } from './settings.store';
import { closeFormPopupWindow, openFormPopupWindow } from '@/utils/executionUtils';
import { clearPopupWindowState, openFormPopupWindow } from '@/utils/executionUtils';
import { useNodeHelpers } from '@/composables/useNodeHelpers';
import { useUsersStore } from '@/stores/users.store';
import { updateCurrentUserSettings } from '@/api/users';
@ -1608,7 +1608,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
uiStore.removeActiveAction('workflowRunning');
workflowHelpers.setDocumentTitle(workflowName.value, 'IDLE');
closeFormPopupWindow();
clearPopupWindowState();
const runData = workflowExecutionData.value?.data?.resultData.runData ?? {};
for (const nodeName in runData) {

View file

@ -82,27 +82,22 @@ export const executionFilterToQueryFilter = (
return queryFilter;
};
let formPopupWindow: Window | null = null;
let formPopupWindow: boolean = false;
export const openFormPopupWindow = (url: string) => {
if (!formPopupWindow || formPopupWindow.closed) {
if (!formPopupWindow) {
const height = 700;
const width = window.innerHeight - 50;
const left = (window.innerWidth - height) / 2;
const top = 50;
const features = `width=${height},height=${width},left=${left},top=${top},resizable=yes,scrollbars=yes`;
const windowName = `form-waiting-since-${Date.now()}`;
formPopupWindow = window.open(url, windowName, features);
} else {
formPopupWindow.location = url;
formPopupWindow.focus();
window.open(url, windowName, features);
formPopupWindow = true;
}
};
export const closeFormPopupWindow = () => {
formPopupWindow?.close();
formPopupWindow = null;
};
export const clearPopupWindowState = () => (formPopupWindow = false);
export function displayForm({
nodes,