mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(editor): Add types for dataPinningEventBus (no-changelog) (#10499)
This commit is contained in:
@@ -160,6 +160,7 @@ import {
|
|||||||
STICKY_NODE_TYPE,
|
STICKY_NODE_TYPE,
|
||||||
} from '@/constants';
|
} from '@/constants';
|
||||||
import { useWorkflowActivate } from '@/composables/useWorkflowActivate';
|
import { useWorkflowActivate } from '@/composables/useWorkflowActivate';
|
||||||
|
import type { DataPinningDiscoveryEvent } from '@/event-bus';
|
||||||
import { dataPinningEventBus } from '@/event-bus';
|
import { dataPinningEventBus } from '@/event-bus';
|
||||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||||
import { useNDVStore } from '@/stores/ndv.store';
|
import { useNDVStore } from '@/stores/ndv.store';
|
||||||
@@ -238,7 +239,7 @@ const activeNodeType = computed(() => {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const workflowRunning = computed(() => uiStore.isActionActive['workflowRunning']);
|
const workflowRunning = computed(() => uiStore.isActionActive.workflowRunning);
|
||||||
|
|
||||||
const showTriggerWaitingWarning = computed(
|
const showTriggerWaitingWarning = computed(
|
||||||
() =>
|
() =>
|
||||||
@@ -428,7 +429,7 @@ const featureRequestUrl = computed(() => {
|
|||||||
|
|
||||||
const outputPanelEditMode = computed(() => ndvStore.outputPanelEditMode);
|
const outputPanelEditMode = computed(() => ndvStore.outputPanelEditMode);
|
||||||
|
|
||||||
const isWorkflowRunning = computed(() => uiStore.isActionActive['workflowRunning']);
|
const isWorkflowRunning = computed(() => uiStore.isActionActive.workflowRunning);
|
||||||
|
|
||||||
const isExecutionWaitingForWebhook = computed(() => workflowsStore.executionWaitingForWebhook);
|
const isExecutionWaitingForWebhook = computed(() => workflowsStore.executionWaitingForWebhook);
|
||||||
|
|
||||||
@@ -458,7 +459,7 @@ const hasForeignCredential = computed(() => foreignCredentials.value.length > 0)
|
|||||||
|
|
||||||
//methods
|
//methods
|
||||||
|
|
||||||
const setIsTooltipVisible = ({ isTooltipVisible }: { isTooltipVisible: boolean }) => {
|
const setIsTooltipVisible = ({ isTooltipVisible }: DataPinningDiscoveryEvent) => {
|
||||||
pinDataDiscoveryTooltipVisible.value = isTooltipVisible;
|
pinDataDiscoveryTooltipVisible.value = isTooltipVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import { useCanvasStore } from '@/stores/canvas.store';
|
|||||||
import { getEndpointScope } from '@/utils/nodeViewUtils';
|
import { getEndpointScope } from '@/utils/nodeViewUtils';
|
||||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||||
import { getConnectionInfo } from '@/utils/canvasUtils';
|
import { getConnectionInfo } from '@/utils/canvasUtils';
|
||||||
|
import type { UnpinNodeDataEvent } from '@/event-bus/data-pinning';
|
||||||
|
|
||||||
declare namespace HttpRequestNode {
|
declare namespace HttpRequestNode {
|
||||||
namespace V2 {
|
namespace V2 {
|
||||||
@@ -992,8 +993,8 @@ export function useNodeHelpers() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function removePinDataConnections(pinData: IPinData) {
|
function removePinDataConnections(event: UnpinNodeDataEvent) {
|
||||||
Object.keys(pinData).forEach((nodeName) => {
|
for (const nodeName of event.nodeNames) {
|
||||||
const node = workflowsStore.getNodeByName(nodeName);
|
const node = workflowsStore.getNodeByName(nodeName);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return;
|
return;
|
||||||
@@ -1015,7 +1016,7 @@ export function useNodeHelpers() {
|
|||||||
canvasStore.jsPlumbInstance.setSuspendDrawing(true);
|
canvasStore.jsPlumbInstance.setSuspendDrawing(true);
|
||||||
connectionsArray.forEach(NodeViewUtils.resetConnection);
|
connectionsArray.forEach(NodeViewUtils.resetConnection);
|
||||||
canvasStore.jsPlumbInstance.setSuspendDrawing(false, true);
|
canvasStore.jsPlumbInstance.setSuspendDrawing(false, true);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOutputEndpointUUID(
|
function getOutputEndpointUUID(
|
||||||
|
|||||||
@@ -1,3 +1,23 @@
|
|||||||
import { createEventBus } from 'n8n-design-system/utils';
|
import { createEventBus } from 'n8n-design-system/utils';
|
||||||
|
import type { IPinData } from 'n8n-workflow';
|
||||||
|
|
||||||
export const dataPinningEventBus = createEventBus();
|
export type DataPinningDiscoveryEvent = {
|
||||||
|
isTooltipVisible: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UnpinNodeDataEvent = {
|
||||||
|
nodeNames: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface DataPinningEventBusEvents {
|
||||||
|
/** Command to show or hide the data pinning discovery tooltip */
|
||||||
|
'data-pinning-discovery': DataPinningDiscoveryEvent;
|
||||||
|
|
||||||
|
/** Event that data has been pinned for workflow */
|
||||||
|
'pin-data': IPinData;
|
||||||
|
|
||||||
|
/** Event that data has been unpinned for specific nodes */
|
||||||
|
'unpin-data': UnpinNodeDataEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dataPinningEventBus = createEventBus<DataPinningEventBusEvents>();
|
||||||
|
|||||||
@@ -669,14 +669,14 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWorkflowPinData(pinData: IPinData) {
|
function setWorkflowPinData(pinData?: IPinData) {
|
||||||
workflow.value = {
|
workflow.value = {
|
||||||
...workflow.value,
|
...workflow.value,
|
||||||
pinData: pinData || {},
|
pinData: pinData ?? {},
|
||||||
};
|
};
|
||||||
updateCachedWorkflow();
|
updateCachedWorkflow();
|
||||||
|
|
||||||
dataPinningEventBus.emit('pin-data', pinData || {});
|
dataPinningEventBus.emit('pin-data', pinData ?? {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWorkflowTagIds(tags: string[]) {
|
function setWorkflowTagIds(tags: string[]) {
|
||||||
@@ -768,7 +768,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
|||||||
uiStore.stateIsDirty = true;
|
uiStore.stateIsDirty = true;
|
||||||
updateCachedWorkflow();
|
updateCachedWorkflow();
|
||||||
|
|
||||||
dataPinningEventBus.emit('unpin-data', { [payload.node.name]: undefined });
|
dataPinningEventBus.emit('unpin-data', {
|
||||||
|
nodeNames: [payload.node.name],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addConnection(data: { connection: IConnection[] }): void {
|
function addConnection(data: { connection: IConnection[] }): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user