mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-05 18:07:27 -08:00
fix(n8n Form Node): Popup does not work in some browsers (no-changelog) (#12176)
This commit is contained in:
parent
454b022305
commit
73f0c4cca9
|
@ -37,6 +37,7 @@ import { useAssistantStore } from '@/stores/assistant.store';
|
||||||
import NodeExecutionErrorMessage from '@/components/NodeExecutionErrorMessage.vue';
|
import NodeExecutionErrorMessage from '@/components/NodeExecutionErrorMessage.vue';
|
||||||
import type { IExecutionResponse } from '@/Interface';
|
import type { IExecutionResponse } from '@/Interface';
|
||||||
import { EASY_AI_WORKFLOW_JSON } from '@/constants.workflows';
|
import { EASY_AI_WORKFLOW_JSON } from '@/constants.workflows';
|
||||||
|
import { clearPopupWindowState } from '../utils/executionUtils';
|
||||||
|
|
||||||
export function usePushConnection({ router }: { router: ReturnType<typeof useRouter> }) {
|
export function usePushConnection({ router }: { router: ReturnType<typeof useRouter> }) {
|
||||||
const workflowHelpers = useWorkflowHelpers({ router });
|
const workflowHelpers = useWorkflowHelpers({ router });
|
||||||
|
@ -201,6 +202,7 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivedData.type === 'executionFinished') {
|
if (receivedData.type === 'executionFinished') {
|
||||||
|
clearPopupWindowState();
|
||||||
const workflow = workflowsStore.getWorkflowById(receivedData.data.workflowId);
|
const workflow = workflowsStore.getWorkflowById(receivedData.data.workflowId);
|
||||||
if (workflow?.meta?.templateId) {
|
if (workflow?.meta?.templateId) {
|
||||||
const isEasyAIWorkflow =
|
const isEasyAIWorkflow =
|
||||||
|
|
|
@ -85,7 +85,7 @@ import { TelemetryHelpers } from 'n8n-workflow';
|
||||||
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
|
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useSettingsStore } from './settings.store';
|
import { useSettingsStore } from './settings.store';
|
||||||
import { closeFormPopupWindow, openFormPopupWindow } from '@/utils/executionUtils';
|
import { clearPopupWindowState, openFormPopupWindow } from '@/utils/executionUtils';
|
||||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||||
import { useUsersStore } from '@/stores/users.store';
|
import { useUsersStore } from '@/stores/users.store';
|
||||||
import { updateCurrentUserSettings } from '@/api/users';
|
import { updateCurrentUserSettings } from '@/api/users';
|
||||||
|
@ -1608,7 +1608,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||||
uiStore.removeActiveAction('workflowRunning');
|
uiStore.removeActiveAction('workflowRunning');
|
||||||
workflowHelpers.setDocumentTitle(workflowName.value, 'IDLE');
|
workflowHelpers.setDocumentTitle(workflowName.value, 'IDLE');
|
||||||
|
|
||||||
closeFormPopupWindow();
|
clearPopupWindowState();
|
||||||
|
|
||||||
const runData = workflowExecutionData.value?.data?.resultData.runData ?? {};
|
const runData = workflowExecutionData.value?.data?.resultData.runData ?? {};
|
||||||
for (const nodeName in runData) {
|
for (const nodeName in runData) {
|
||||||
|
|
|
@ -82,27 +82,22 @@ export const executionFilterToQueryFilter = (
|
||||||
return queryFilter;
|
return queryFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
let formPopupWindow: Window | null = null;
|
let formPopupWindow: boolean = false;
|
||||||
|
|
||||||
export const openFormPopupWindow = (url: string) => {
|
export const openFormPopupWindow = (url: string) => {
|
||||||
if (!formPopupWindow || formPopupWindow.closed) {
|
if (!formPopupWindow) {
|
||||||
const height = 700;
|
const height = 700;
|
||||||
const width = window.innerHeight - 50;
|
const width = window.innerHeight - 50;
|
||||||
const left = (window.innerWidth - height) / 2;
|
const left = (window.innerWidth - height) / 2;
|
||||||
const top = 50;
|
const top = 50;
|
||||||
const features = `width=${height},height=${width},left=${left},top=${top},resizable=yes,scrollbars=yes`;
|
const features = `width=${height},height=${width},left=${left},top=${top},resizable=yes,scrollbars=yes`;
|
||||||
const windowName = `form-waiting-since-${Date.now()}`;
|
const windowName = `form-waiting-since-${Date.now()}`;
|
||||||
formPopupWindow = window.open(url, windowName, features);
|
window.open(url, windowName, features);
|
||||||
} else {
|
formPopupWindow = true;
|
||||||
formPopupWindow.location = url;
|
|
||||||
formPopupWindow.focus();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const closeFormPopupWindow = () => {
|
export const clearPopupWindowState = () => (formPopupWindow = false);
|
||||||
formPopupWindow?.close();
|
|
||||||
formPopupWindow = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function displayForm({
|
export function displayForm({
|
||||||
nodes,
|
nodes,
|
||||||
|
|
Loading…
Reference in a new issue