refactor(editor): create ndv store (#4409)

* refactor ndv module out

* update active node in root state

* simplify

* fix conflict

* fix dragging
This commit is contained in:
Mutasem Aldmour
2022-10-24 11:35:03 +02:00
committed by GitHub
parent f6733cff9d
commit 127f988400
38 changed files with 331 additions and 308 deletions

View File

@@ -52,7 +52,7 @@ export default mixins(
const executedWorkflow: IExecutionResponse | null = this.$store.getters.getWorkflowExecution;
const workflow = this.getCurrentWorkflow();
const activeNode: INodeUi | null = this.$store.getters.activeNode;
const activeNode: INodeUi | null = this.$store.getters['ndv/activeNode'];
const parentNode = workflow.getParentNodes(activeNode!.name, inputName, 1);
const nodeConnection = workflow.getNodeConnectionIndexes(activeNode!.name, parentNode[0]) || {
sourceIndex: 0,

View File

@@ -206,7 +206,7 @@ export const jsonFieldCompletions = (Vue as CodeNodeEditorMixin).extend({
getInputNodeName() {
try {
const activeNode = this.$store.getters.activeNode;
const activeNode = this.$store.getters['ndv/activeNode'];
const workflow = this.getCurrentWorkflow();
const input = workflow.connectionsByDestinationNode[activeNode.name];

View File

@@ -95,7 +95,7 @@ export default mixins(
});
},
node (): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
// Returns all the options which did not get added already
parameterOptions (): Array<INodePropertyOptions | INodeProperties> {

View File

@@ -195,7 +195,7 @@ export default mixins(restApi).extend({
},
documentationUrl(): string {
const type = this.credentialType as ICredentialType;
const activeNode = this.$store.getters.activeNode;
const activeNode = this.$store.getters['ndv/activeNode'];
const isCommunityNode = activeNode ? isCommunityPackageName(activeNode.type) : false;
if (!type || !type.documentationUrl) {

View File

@@ -236,7 +236,7 @@ export default mixins(showMessage, nodeHelpers).extend({
this.$externalHooks().run('credentialsEdit.credentialModalOpened', {
credentialType: this.credentialTypeName,
isEditingCredential: this.mode === 'edit',
activeNode: this.$store.getters.activeNode,
activeNode: this.$store.getters['ndv/activeNode'],
});
setTimeout(() => {
@@ -561,7 +561,7 @@ export default mixins(showMessage, nodeHelpers).extend({
this.activeTab = tab;
const tabName: string = tab.replaceAll('coming-soon/', '');
const credType: string = this.credentialType ? this.credentialType.name : '';
const activeNode: INode | null = this.$store.getters.activeNode;
const activeNode: INode | null = this.$store.getters['ndv/activeNode'];
this.$telemetry.track('User viewed credential tab', {
credential_type: credType,
@@ -777,8 +777,8 @@ export default mixins(showMessage, nodeHelpers).extend({
trackProperties.is_valid = !!this.testedSuccessfully;
}
if (this.$store.getters.activeNode) {
trackProperties.node_type = this.$store.getters.activeNode.type;
if (this.$store.getters['ndv/activeNode']) {
trackProperties.node_type = this.$store.getters['ndv/activeNode'].type;
}
if (this.authError && this.authError !== '') {

View File

@@ -67,10 +67,10 @@ export default Vue.extend({
},
computed: {
canDrop(): boolean {
return this.$store.getters['ui/canDraggableDrop'];
return this.$store.getters['ndv/canDraggableDrop'];
},
stickyPosition(): XYPosition | null {
return this.$store.getters['ui/draggableStickyPos'];
return this.$store.getters['ndv/draggableStickyPos'];
},
},
methods: {
@@ -111,7 +111,7 @@ export default Vue.extend({
this.isDragging = true;
const data = this.targetDataKey && this.draggingEl ? this.draggingEl.dataset.value : (this.data || '');
this.$store.commit('ui/draggableStartDragging', {type: this.type, data });
this.$store.commit('ndv/draggableStartDragging', {type: this.type, data });
this.$emit('dragstart', this.draggingEl);
document.body.style.cursor = 'grabbing';
@@ -141,7 +141,7 @@ export default Vue.extend({
this.$emit('dragend', this.draggingEl);
this.isDragging = false;
this.draggingEl = null;
this.$store.commit('ui/draggableStopDragging');
this.$store.commit('ndv/draggableStopDragging');
}, 0);
},
},

View File

@@ -38,10 +38,10 @@ export default Vue.extend({
},
computed: {
isDragging(): boolean {
return this.$store.getters['ui/isDraggableDragging'];
return this.$store.getters['ndv/isDraggableDragging'];
},
draggableType(): string {
return this.$store.getters['ui/draggableType'];
return this.$store.getters['ndv/draggableType'];
},
droppable(): boolean {
return !this.disabled && this.isDragging && this.draggableType === this.type;
@@ -60,20 +60,20 @@ export default Vue.extend({
this.hovering = e.clientX >= dim.left && e.clientX <= dim.right && e.clientY >= dim.top && e.clientY <= dim.bottom;
if (!this.disabled && this.sticky && this.hovering) {
this.$store.commit('ui/setDraggableStickyPos', [dim.left + this.stickyOffset, dim.top + this.stickyOffset]);
this.$store.commit('ndv/setDraggableStickyPos', [dim.left + this.stickyOffset, dim.top + this.stickyOffset]);
}
}
},
onMouseUp(e: MouseEvent) {
if (this.activeDrop) {
const data = this.$store.getters['ui/draggableData'];
const data = this.$store.getters['ndv/draggableData'];
this.$emit('drop', data);
}
},
},
watch: {
activeDrop(active) {
this.$store.commit('ui/setDraggableCanDrop', active);
this.$store.commit('ndv/setDraggableCanDrop', active);
},
},
});

View File

@@ -126,7 +126,7 @@ export default mixins(
return JSON.stringify(this.error.cause).length < MAX_DISPLAY_DATA_SIZE;
},
parameters (): INodeProperties[] {
const node = this.$store.getters.activeNode;
const node = this.$store.getters['ndv/activeNode'];
if (!node) {
return [];
}

View File

@@ -120,11 +120,11 @@ export default mixins(
node_name: string;
} = {
event_version: '2',
node_type_dest: this.$store.getters.activeNode.type,
node_type_dest: this.$store.getters['ndv/activeNode'].type,
parameter_name_dest: this.parameter.displayName,
is_immediate_input: false,
variable_expression: eventData.variable,
node_name: this.$store.getters.activeNode.name,
node_name: this.$store.getters['ndv/activeNode'].name,
};
if (eventData.variable) {
@@ -144,7 +144,7 @@ export default mixins(
const sourceNodeName = splitVar[0].split('"')[1];
trackProperties.node_type_source = this.$store.getters.getNodeByName(sourceNodeName).type;
const nodeConnections: Array<Array<{ node: string }>> = this.$store.getters.outgoingConnectionsByNodeName(sourceNodeName).main;
trackProperties.is_immediate_input = (nodeConnections && nodeConnections[0] && !!nodeConnections[0].find(({ node }) => node === this.$store.getters.activeNode.name)) ? true : false;
trackProperties.is_immediate_input = (nodeConnections && nodeConnections[0] && !!nodeConnections[0].find(({ node }) => node === this.$store.getters['ndv/activeNode'].name)) ? true : false;
if (splitVar[1].startsWith('parameter')) {
trackProperties.parameter_name_source = splitVar[1].split('"')[1];
@@ -175,7 +175,7 @@ export default mixins(
empty_expression: (this.value === '=') || (this.value === '={{}}') || !this.value,
workflow_id: this.$store.getters.workflowId,
source: this.eventSource,
session_id: this.$store.getters['ui/ndvSessionId'],
session_id: this.$store.getters['ndv/ndvSessionId'],
has_parameter: this.value.includes('$parameter'),
has_mapping: hasExpressionMapping(this.value),
};

View File

@@ -65,7 +65,7 @@ export default mixins(showMessage).extend({
},
computed: {
node(): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
},
methods: {

View File

@@ -112,7 +112,7 @@ export default mixins(
},
computed: {
focusedMappableInput(): string {
return this.$store.getters['ui/focusedMappableInput'];
return this.$store.getters['ndv/focusedMappableInput'];
},
isUserOnboarded(): boolean {
return window.localStorage.getItem(LOCAL_STORAGE_MAPPING_FLAG) === 'true';
@@ -147,7 +147,7 @@ export default mixins(
return this.workflow as Workflow;
},
activeNode (): INodeUi | null {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
currentNode (): INodeUi | null {
return this.$store.getters.getNodeByName(this.currentNodeName);

View File

@@ -37,7 +37,7 @@ export default mixins(
return this.$route.name === VIEWS.EXECUTION;
},
activeNode (): INodeUi | null {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
hideMenuBar(): boolean {
return Boolean(this.activeNode && this.activeNode.type !== STICKY_NODE_TYPE);

View File

@@ -121,7 +121,7 @@ export default mixins(debounceHelper).extend({
relativeLeft: number,
relativeRight: number
} {
return this.$store.getters['ui/mainPanelDimensions'](this.currentNodePaneType);
return this.$store.getters['ndv/mainPanelDimensions'](this.currentNodePaneType);
},
supportedResizeDirections() {
const supportedDirections = ['right'];
@@ -244,7 +244,7 @@ export default mixins(debounceHelper).extend({
setMainPanelWidth(relativeWidth?: number) {
const mainPanelRelativeWidth = relativeWidth || this.pxToRelativeWidth(initialMainPanelWidth[this.currentNodePaneType]);
this.$store.commit('ui/setMainPanelDimensions', {
this.$store.commit('ndv/setMainPanelDimensions', {
panelType: this.currentNodePaneType,
dimensions: {
relativeWidth: mainPanelRelativeWidth,
@@ -260,7 +260,7 @@ export default mixins(debounceHelper).extend({
const isInputless = this.currentNodePaneType === 'inputless';
if(isMinLeft) {
this.$store.commit('ui/setMainPanelDimensions', {
this.$store.commit('ndv/setMainPanelDimensions', {
panelType: this.currentNodePaneType,
dimensions: {
relativeLeft: this.minimumLeftPosition,
@@ -271,7 +271,7 @@ export default mixins(debounceHelper).extend({
}
if(isMaxRight) {
this.$store.commit('ui/setMainPanelDimensions', {
this.$store.commit('ndv/setMainPanelDimensions', {
panelType: this.currentNodePaneType,
dimensions: {
relativeLeft: 1 - this.mainPanelDimensions.relativeWidth - this.maximumRightPosition,
@@ -281,7 +281,7 @@ export default mixins(debounceHelper).extend({
return;
}
this.$store.commit('ui/setMainPanelDimensions', {
this.$store.commit('ndv/setMainPanelDimensions', {
panelType: this.currentNodePaneType,
dimensions: {
relativeLeft: isInputless ? this.minimumLeftPosition : mainPanelRelativeLeft,

View File

@@ -442,7 +442,7 @@ export default mixins(
},
setNodeActive () {
this.$store.commit('setActiveNode', this.data.name);
this.$store.commit('ndv/setActiveNodeName', this.data.name);
this.pinDataDiscoveryTooltipVisible = false;
},
touchStart () {

View File

@@ -177,7 +177,7 @@ export default mixins(
};
},
mounted() {
this.$store.commit('ui/setNDVSessionId');
this.$store.commit('ndv/setNDVSessionId');
dataPinningEventBus.$on('data-pinning-discovery', ({ isTooltipVisible }: { isTooltipVisible: boolean }) => {
this.pinDataDiscoveryTooltipVisible = isTooltipVisible;
@@ -189,7 +189,7 @@ export default mixins(
computed: {
...mapGetters(['executionWaitingForWebhook']),
sessionId(): string {
return this.$store.getters['ui/ndvSessionId'];
return this.$store.getters['ndv/ndvSessionId'];
},
workflowRunning(): boolean {
return this.$store.getters.isActionActive('workflowRunning');
@@ -204,7 +204,7 @@ export default mixins(
);
},
activeNode(): INodeUi | null {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
inputNodeName(): string | undefined {
return this.selectedInput || this.parentNode;
@@ -256,7 +256,7 @@ export default mixins(
},
isActiveStickyNode(): boolean {
return (
!!this.$store.getters.activeNode && this.$store.getters.activeNode.type === STICKY_NODE_TYPE
!!this.$store.getters['ndv/activeNode'] && this.$store.getters['ndv/activeNode'].type === STICKY_NODE_TYPE
);
},
workflowExecution(): IExecutionResponse | null {
@@ -339,7 +339,7 @@ export default mixins(
return `${BASE_NODE_SURVEY_URL}${this.activeNodeType.name}`;
},
outputPanelEditMode(): { enabled: boolean; value: string; } {
return this.$store.getters['ui/outputPanelEditMode'];
return this.$store.getters['ndv/outputPanelEditMode'];
},
},
watch: {
@@ -354,7 +354,7 @@ export default mixins(
this.avgInputRowHeight = 0;
setTimeout(() => {
this.$store.commit('ui/setNDVSessionId');
this.$store.commit('ndv/setNDVSessionId');
}, 0);
this.$externalHooks().run('dataDisplay.nodeTypeChanged', {
nodeSubtitle: this.getNodeSubtitle(node, this.activeNodeType, this.getCurrentWorkflow()),
@@ -375,8 +375,8 @@ export default mixins(
output_first_connector_runs: this.maxOutputRun,
selected_view_inputs: this.isTriggerNode
? 'trigger'
: this.$store.getters['ui/inputPanelDisplayMode'],
selected_view_outputs: this.$store.getters['ui/outputPanelDisplayMode'],
: this.$store.getters['ndv/inputPanelDisplayMode'],
selected_view_outputs: this.$store.getters['ndv/outputPanelDisplayMode'],
input_connectors: this.parentNodes.length,
output_connectors:
outogingConnections && outogingConnections.main && outogingConnections.main.length,
@@ -401,12 +401,12 @@ export default mixins(
},
inputNodeName(nodeName: string | undefined) {
setTimeout(() => {
this.$store.commit('ui/setInputNodeName', nodeName);
this.$store.commit('ndv/setInputNodeName', nodeName);
}, 0);
},
inputRun() {
setTimeout(() => {
this.$store.commit('ui/setInputRunIndex', this.inputRun);
this.$store.commit('ndv/setInputRunIndex', this.inputRun);
}, 0);
},
},
@@ -416,7 +416,7 @@ export default mixins(
return;
}
if (e === null) {
this.$store.commit('ui/setHoveringItem', null);
this.$store.commit('ndv/setHoveringItem', null);
return;
}
@@ -426,11 +426,11 @@ export default mixins(
outputIndex: e.outputIndex,
itemIndex: e.itemIndex,
};
this.$store.commit('ui/setHoveringItem', item);
this.$store.commit('ndv/setHoveringItem', item);
},
onOutputItemHover(e: {itemIndex: number, outputIndex: number} | null) {
if (e === null || !this.activeNode) {
this.$store.commit('ui/setHoveringItem', null);
this.$store.commit('ndv/setHoveringItem', null);
return;
}
@@ -440,7 +440,7 @@ export default mixins(
outputIndex: e.outputIndex,
itemIndex: e.itemIndex,
};
this.$store.commit('ui/setHoveringItem', item);
this.$store.commit('ndv/setHoveringItem', item);
},
onInputTableMounted(e: { avgRowHeight: number }) {
this.avgInputRowHeight = e.avgRowHeight;
@@ -449,7 +449,7 @@ export default mixins(
this.avgOutputRowHeight = e.avgRowHeight;
},
onWorkflowActivate() {
this.$store.commit('setActiveNode', null);
this.$store.commit('ndv/setActiveNodeName', null);
setTimeout(() => {
this.activateCurrentWorkflow('ndv');
}, 1000);
@@ -558,7 +558,7 @@ export default mixins(
this.$store.commit('pinData', { node: this.activeNode, data: jsonParse(value) });
}
this.$store.commit('ui/setOutputPanelEditModeEnabled', false);
this.$store.commit('ndv/setOutputPanelEditModeEnabled', false);
}
this.$externalHooks().run('dataDisplay.nodeEditingFinished');
@@ -568,8 +568,8 @@ export default mixins(
workflow_id: this.$store.getters.workflowId,
});
this.triggerWaitingWarningEnabled = false;
this.$store.commit('setActiveNode', null);
this.$store.commit('ui/resetNDVSessionId');
this.$store.commit('ndv/setActiveNodeName', null);
this.$store.commit('ndv/resetNDVSessionId');
},
onRunOutputIndexChange(run: number) {
this.runOutputIndex = run;

View File

@@ -111,7 +111,7 @@ export default mixins(
}
if (this.isTriggerNode && this.hasIssues) {
if (this.$store.getters.activeNode && this.$store.getters.activeNode.name !== this.nodeName) {
if (this.$store.getters['ndv/activeNode'] && this.$store.getters['ndv/activeNode'].name !== this.nodeName) {
return this.$locale.baseText('ndv.execute.fixPrevious');
}

View File

@@ -198,7 +198,7 @@ export default mixins(externalHooks, genericHelpers, nodeHelpers).extend({
};
},
node(): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
parametersSetting(): INodeProperties[] {
return this.parameters.filter((item) => {
@@ -218,7 +218,7 @@ export default mixins(externalHooks, genericHelpers, nodeHelpers).extend({
return this.nodeType.properties;
},
outputPanelEditMode(): { enabled: boolean; value: string } {
return this.$store.getters['ui/outputPanelEditMode'];
return this.$store.getters['ndv/outputPanelEditMode'];
},
isCommunityNode(): boolean {
return isCommunityPackageName(this.node.type);

View File

@@ -27,7 +27,7 @@ export default mixins(
},
computed: {
activeNode(): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
documentationUrl (): string {
const nodeType = this.nodeType as INodeTypeDescription | null;

View File

@@ -112,7 +112,7 @@ export default mixins(
},
computed: {
node(): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
nodeType (): INodeTypeDescription | null {
if (this.node) {
@@ -202,7 +202,7 @@ export default mixins(
return updatedAt > runAt;
},
outputPanelEditMode(): { enabled: boolean; value: string; } {
return this.$store.getters['ui/outputPanelEditMode'];
return this.$store.getters['ndv/outputPanelEditMode'];
},
canPinData(): boolean {
return this.isPinDataNodeType && !this.isReadOnly;

View File

@@ -497,7 +497,7 @@ export default mixins(
}
// Get the resolved parameter values of the current node
const currentNodeParameters = this.$store.getters.activeNode.parameters;
const currentNodeParameters = this.$store.getters['ndv/activeNode'].parameters;
try {
const resolvedNodeParameters = this.resolveParameter(currentNodeParameters);
@@ -512,7 +512,7 @@ export default mixins(
}
},
node (): INodeUi | null {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
displayTitle (): string {
const interpolation = { interpolate: { shortPath: this.shortPath } };
@@ -782,7 +782,7 @@ export default mixins(
// Get the resolved parameter values of the current node
try {
const currentNodeParameters = (this.$store.getters.activeNode as INodeUi).parameters;
const currentNodeParameters = (this.$store.getters['ndv/activeNode'] as INodeUi).parameters;
const resolvedNodeParameters = this.resolveParameter(currentNodeParameters) as INodeParameters;
const loadOptionsMethod = this.getArgument('loadOptionsMethod') as string | undefined;
const loadOptions = this.getArgument('loadOptions') as ILoadOptions | undefined;
@@ -826,7 +826,7 @@ export default mixins(
parameter_field_type: this.parameter.type,
new_expression: !this.isValueExpression,
workflow_id: this.$store.getters.workflowId,
session_id: this.$store.getters['ui/ndvSessionId'],
session_id: this.$store.getters['ndv/ndvSessionId'],
source: this.eventSource || 'ndv',
});
}
@@ -958,7 +958,7 @@ export default mixins(
node_type: this.node && this.node.type,
resource: this.node && this.node.parameters.resource,
is_custom: value === CUSTOM_API_CALL_KEY,
session_id: this.$store.getters['ui/ndvSessionId'],
session_id: this.$store.getters['ndv/ndvSessionId'],
parameter: this.parameter.name,
});
}

View File

@@ -121,7 +121,7 @@ export default mixins(
},
computed: {
node (): INodeUi | null {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
hint (): string | null {
return this.$locale.nodeText().hint(this.parameter, this.path);
@@ -136,10 +136,10 @@ export default mixins(
return this.isResourceLocator ? !hasOnlyListMode(this.parameter): true;
},
isInputDataEmpty (): boolean {
return this.$store.getters['ui/getNDVDataIsEmpty']('input');
return this.$store.getters['ndv/getNDVDataIsEmpty']('input');
},
displayMode(): IRunDataDisplayMode {
return this.$store.getters['ui/inputPanelDisplayMode'];
return this.$store.getters['ndv/inputPanelDisplayMode'];
},
showMappingTooltip (): boolean {
return this.focused && !this.isInputDataEmpty && window.localStorage.getItem(LOCAL_STORAGE_MAPPING_FLAG) !== 'true';
@@ -149,13 +149,13 @@ export default mixins(
onFocus() {
this.focused = true;
if (!this.parameter.noDataExpression) {
this.$store.commit('ui/setMappableNDVInputFocus', this.parameter.displayName);
this.$store.commit('ndv/setMappableNDVInputFocus', this.parameter.displayName);
}
},
onBlur() {
this.focused = false;
if (!this.parameter.noDataExpression) {
this.$store.commit('ui/setMappableNDVInputFocus', '');
this.$store.commit('ndv/setMappableNDVInputFocus', '');
}
},
onMenuExpanded(expanded: boolean) {
@@ -232,7 +232,7 @@ export default mixins(
window.localStorage.setItem(LOCAL_STORAGE_MAPPING_FLAG, 'true');
}
this.$store.commit('ui/setMappingTelemetry', {
this.$store.commit('ndv/setMappingTelemetry', {
dest_node_type: this.node.type,
dest_parameter: this.path,
dest_parameter_mode: typeof prevValue === 'string' && prevValue.startsWith('=')? 'expression': 'fixed',

View File

@@ -157,7 +157,7 @@ export default mixins(
return this.filteredParameters.map(parameter => parameter.name);
},
node (): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
indexToShowSlotAt (): number {
let index = 0;
@@ -320,7 +320,7 @@ export default mixins(
if (!newValue.includes(parameter)) {
const parameterData = {
name: `${this.path}.${parameter}`,
node: this.$store.getters.activeNode.name,
node: this.$store.getters['ndv/activeNode'].name,
value: undefined,
};
this.$emit('valueChanged', parameterData);

View File

@@ -104,7 +104,7 @@ export default mixins(
return isValueExpression(this.parameter, this.value);
},
activeNode(): INodeUi | null {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
selectedRLMode(): INodePropertyMode | undefined {
if (typeof this.value !== 'object' ||this.parameter.type !== 'resourceLocator' || !isResourceLocatorValue(this.value)) {
@@ -129,17 +129,17 @@ export default mixins(
return this.hint;
},
targetItem(): TargetItem | null {
return this.$store.getters['ui/hoveringItem'];
return this.$store.getters['ndv/hoveringItem'];
},
expressionValueComputed (): string | null {
const inputNodeName: string | undefined = this.$store.getters['ui/ndvInputNodeName'];
const inputNodeName: string | undefined = this.$store.getters['ndv/ndvInputNodeName'];
const value = isResourceLocatorValue(this.value)? this.value.value: this.value;
if (this.activeNode === null || !this.isValueExpression || typeof value !== 'string') {
return null;
}
const inputRunIndex: number | undefined = this.$store.getters['ui/ndvInputRunIndex'];
const inputBranchIndex: number | undefined = this.$store.getters['ui/ndvInputBranchIndex'];
const inputRunIndex: number | undefined = this.$store.getters['ndv/ndvInputRunIndex'];
const inputBranchIndex: number | undefined = this.$store.getters['ndv/ndvInputBranchIndex'];
let computedValue: NodeParameterValue;
try {
@@ -160,7 +160,7 @@ export default mixins(
},
expressionOutput(): string | null {
if (this.isValueExpression && this.expressionValueComputed) {
const inputData = this.$store.getters['ui/ndvInputData'];
const inputData = this.$store.getters['ndv/ndvInputData'];
if (!inputData || (inputData && inputData.length <= 1)) {
return this.expressionValueComputed;
}

View File

@@ -279,7 +279,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
return this.selectedMode === 'list';
},
hasCredential(): boolean {
const node = this.$store.getters.activeNode as INodeUi | null;
const node = this.$store.getters['ndv/activeNode'] as INodeUi | null;
if (!node) {
return false;
}
@@ -440,7 +440,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
},
setWidthOnMainPanelResize(mutation: { type: string }) {
// Update the width when main panel dimension change
if(mutation.type === 'ui/setMainPanelDimensions') this.setWidth();
if(mutation.type === 'ndv/setMainPanelDimensions') this.setWidth();
},
getLinkAlt(entity: string) {
if (this.selectedMode === 'list' && entity) {
@@ -479,7 +479,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
return parameter.typeOptions[argumentName];
},
openCredential(): void {
const node = this.$store.getters.activeNode as INodeUi | null;
const node = this.$store.getters['ndv/activeNode'] as INodeUi | null;
if (!node || !node.credentials) {
return;
}

View File

@@ -145,7 +145,7 @@
:value="editMode.value"
:options="{ scrollBeyondLastLine: false }"
type="json"
@input="$store.commit('ui/setOutputPanelEditModeValue', $event)"
@input="$store.commit('ndv/setOutputPanelEditModeValue', $event)"
/>
</div>
<div :class="$style['edit-mode-footer']">
@@ -470,7 +470,7 @@ export default mixins(
this.showPinDataDiscoveryTooltip(this.jsonData);
}
}
this.$store.commit('ui/setNDVBranchIndex', {
this.$store.commit('ndv/setNDVBranchIndex', {
pane: this.paneType,
branchIndex: this.currentOutputIndex,
});
@@ -482,7 +482,7 @@ export default mixins(
},
computed: {
activeNode(): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
dataPinningDocsUrl(): string {
return DATA_PINNING_DOCS_URL;
@@ -491,7 +491,7 @@ export default mixins(
return DATA_EDITING_DOCS_URL;
},
displayMode(): IRunDataDisplayMode {
return this.$store.getters['ui/getPanelDisplayMode'](this.paneType);
return this.$store.getters['ndv/getPanelDisplayMode'](this.paneType);
},
node(): INodeUi | null {
return (this.nodeUi as INodeUi | null) || null;
@@ -675,7 +675,7 @@ export default mixins(
editMode(): { enabled: boolean; value: string; } {
return this.isPaneTypeInput
? { enabled: false, value: '' }
: this.$store.getters['ui/outputPanelEditMode'];
: this.$store.getters['ndv/outputPanelEditMode'];
},
isPaneTypeInput(): boolean {
return this.paneType === 'input';
@@ -737,8 +737,8 @@ export default mixins(
? inputData
: TEST_PIN_DATA;
this.$store.commit('ui/setOutputPanelEditModeEnabled', true);
this.$store.commit('ui/setOutputPanelEditModeValue', JSON.stringify(data, null, 2));
this.$store.commit('ndv/setOutputPanelEditModeEnabled', true);
this.$store.commit('ndv/setOutputPanelEditModeValue', JSON.stringify(data, null, 2));
this.$telemetry.track('User opened ndv edit state', {
node_type: this.activeNode.type,
@@ -751,8 +751,8 @@ export default mixins(
});
},
onClickCancelEdit() {
this.$store.commit('ui/setOutputPanelEditModeEnabled', false);
this.$store.commit('ui/setOutputPanelEditModeValue', '');
this.$store.commit('ndv/setOutputPanelEditModeEnabled', false);
this.$store.commit('ndv/setOutputPanelEditModeValue', '');
this.onExitEditMode({ type: 'cancel' });
},
onClickSaveEdit() {
@@ -770,7 +770,7 @@ export default mixins(
return;
}
this.$store.commit('ui/setOutputPanelEditModeEnabled', false);
this.$store.commit('ndv/setOutputPanelEditModeEnabled', false);
this.$store.commit('pinData', { node: this.node, data: clearJsonKey(value) });
this.onDataPinningSuccess({ source: 'save-edit' });
@@ -935,7 +935,7 @@ export default mixins(
},
onDisplayModeChange(displayMode: IRunDataDisplayMode) {
const previous = this.displayMode;
this.$store.commit('ui/setPanelDisplayMode', {pane: this.paneType, mode: displayMode});
this.$store.commit('ndv/setPanelDisplayMode', {pane: this.paneType, mode: displayMode});
const dataContainer = this.$refs.dataContainer;
if (dataContainer) {
@@ -1007,10 +1007,10 @@ export default mixins(
this.refreshDataSize();
this.closeBinaryDataDisplay();
if (this.binaryData.length > 0) {
this.$store.commit('ui/setPanelDisplayMode', {pane: this.paneType, mode: 'binary'});
this.$store.commit('ndv/setPanelDisplayMode', {pane: this.paneType, mode: 'binary'});
}
else if (this.displayMode === 'binary') {
this.$store.commit('ui/setPanelDisplayMode', {pane: this.paneType, mode: 'table'});
this.$store.commit('ndv/setPanelDisplayMode', {pane: this.paneType, mode: 'table'});
}
},
closeBinaryDataDisplay () {
@@ -1096,7 +1096,7 @@ export default mixins(
},
goToErroredNode() {
if (this.node) {
this.$store.commit('setActiveNode', this.node.name);
this.$store.commit('ndv/setActiveNodeName', this.node.name);
}
},
},
@@ -1107,7 +1107,7 @@ export default mixins(
inputData:{
handler(data: INodeExecutionData[]) {
if(this.paneType && data){
this.$store.commit('ui/setNDVPanelDataIsEmpty', { panel: this.paneType, isEmpty: data.every(item => isEmpty(item.json)) });
this.$store.commit('ndv/setNDVPanelDataIsEmpty', { panel: this.paneType, isEmpty: data.every(item => isEmpty(item.json)) });
}
},
immediate: true,
@@ -1130,7 +1130,7 @@ export default mixins(
}
},
currentOutputIndex(branchIndex: number) {
this.$store.commit('ui/setNDVBranchIndex', {
this.$store.commit('ndv/setNDVBranchIndex', {
pane: this.paneType,
branchIndex,
});

View File

@@ -165,13 +165,13 @@ export default mixins(externalHooks).extend({
this.draggingPath = el.dataset.path;
}
this.$store.commit('ui/resetMappingTelemetry');
this.$store.commit('ndv/resetMappingTelemetry');
},
onDragEnd(el: HTMLElement) {
this.draggingPath = null;
setTimeout(() => {
const mappingTelemetry = this.$store.getters['ui/mappingTelemetry'];
const mappingTelemetry = this.$store.getters['ndv/mappingTelemetry'];
const telemetryPayload = {
src_node_type: this.node.type,
src_field_name: el.dataset.name || '',

View File

@@ -84,7 +84,7 @@ export default mixins(
},
computed: {
activeNode(): INodeUi {
return this.$store.getters.activeNode;
return this.$store.getters['ndv/activeNode'];
},
normalisedJsonPath(): string {
const isNotSelected = this.selectedJsonPath === nonExistingJsonPath;

View File

@@ -140,7 +140,7 @@
<script lang="ts">
/* eslint-disable prefer-spread */
import { INodeUi, IRootState, ITableData, IUiState } from '@/Interface';
import { INodeUi, IRootState, ITableData, IUiState, NDVState } from '@/Interface';
import { getPairedItemId } from '@/pairedItemUtils';
import Vue, { PropType } from 'vue';
import mixins from 'vue-typed-mixins';
@@ -202,8 +202,8 @@ export default mixins(externalHooks).extend({
}
},
computed: {
hoveringItem(): IUiState['ndv']['hoveringItem'] {
return this.$store.getters['ui/hoveringItem'];
hoveringItem(): NDVState['ndv']['hoveringItem'] {
return this.$store.getters['ndv/hoveringItem'];
},
pairedItemMappings(): IRootState['workflowExecutionPairedItemMappings'] {
return this.$store.getters['workflowExecutionPairedItemMappings'];
@@ -346,7 +346,7 @@ export default mixins(externalHooks).extend({
onDragStart() {
this.draggedColumn = true;
this.$store.commit('ui/resetMappingTelemetry');
this.$store.commit('ndv/resetMappingTelemetry');
},
onCellDragStart(el: HTMLElement) {
if (el && el.dataset.value) {
@@ -369,7 +369,7 @@ export default mixins(externalHooks).extend({
},
onDragEnd(column: string, src: string, depth = '0') {
setTimeout(() => {
const mappingTelemetry = this.$store.getters['ui/mappingTelemetry'];
const mappingTelemetry = this.$store.getters['ndv/mappingTelemetry'];
const telemetryPayload = {
src_node_type: this.node.type,
src_field_name: column,

View File

@@ -142,10 +142,10 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext
},
onEdit(edit: boolean) {
if (edit && !this.isActive && this.node) {
this.$store.commit('setActiveNode', this.node.name);
this.$store.commit('ndv/setActiveNodeName', this.node.name);
}
else if (this.isActive && !edit) {
this.$store.commit('setActiveNode', null);
this.$store.commit('ndv/setActiveNodeName', null);
}
},
onMarkdownClick ( link:HTMLAnchorElement, event: Event ) {

View File

@@ -369,7 +369,7 @@ export default mixins(workflowHelpers, copyPaste, showMessage).extend({
pane: 'input',
type: 'open-executions-log',
});
this.$store.commit('setActiveNode', null);
this.$store.commit('ndv/setActiveNodeName', null);
this.$store.dispatch('ui/openModal', EXECUTIONS_MODAL_KEY);
} else if (target.dataset.key === 'settings') {
this.$store.dispatch('ui/openModal', WORKFLOW_SETTINGS_MODAL_KEY);

View File

@@ -406,7 +406,7 @@ export default mixins(
const runIndex = 0;
const returnData: IVariableSelectorOption[] = [];
const activeNode: INodeUi | null = this.$store.getters.activeNode;
const activeNode: INodeUi | null = this.$store.getters['ndv/activeNode'];
if (activeNode === null) {
return returnData;
@@ -486,7 +486,7 @@ export default mixins(
getFilterResults (filterText: string, itemIndex: number): IVariableSelectorOption[] {
const inputName = 'main';
const activeNode: INodeUi | null = this.$store.getters.activeNode;
const activeNode: INodeUi | null = this.$store.getters['ndv/activeNode'];
if (activeNode === null) {
return [];

View File

@@ -534,7 +534,7 @@ export const workflowHelpers = mixins(
let itemIndex = opts?.targetItem?.itemIndex || 0;
const inputName = 'main';
const activeNode = this.$store.getters.activeNode;
const activeNode = this.$store.getters['ndv/activeNode'];
const workflow = this.getCurrentWorkflow();
const workflowRunData = this.$store.getters.getWorkflowRunData as IRunData | null;
let parentNode = workflow.getParentNodes(activeNode.name, inputName, 1);