Revert " Deconstructed store mutation data parameters for better readability"

This reverts commit 17ab16d248.
This commit is contained in:
Rupenieks 2020-09-09 14:28:13 +02:00
parent 17ab16d248
commit 33582655f2
6 changed files with 22 additions and 21 deletions

View file

@ -398,7 +398,7 @@ export default mixins(
return; return;
} }
this.$store.commit('setWorkflowName', {name: workflowName, setStateDirty: true}); this.$store.commit('setWorkflowName', {newName: workflowName, setStateDirty: true});
this.$showMessage({ this.$showMessage({
title: 'Workflow renamed', title: 'Workflow renamed',

View file

@ -31,7 +31,7 @@ export const moveNodeWorkflow = mixins(nodeIndex).extend({
const nodeViewOffsetPositionX = offsetPosition[0] + (e.pageX - this.moveLastPosition[0]); const nodeViewOffsetPositionX = offsetPosition[0] + (e.pageX - this.moveLastPosition[0]);
const nodeViewOffsetPositionY = offsetPosition[1] + (e.pageY - this.moveLastPosition[1]); const nodeViewOffsetPositionY = offsetPosition[1] + (e.pageY - this.moveLastPosition[1]);
this.$store.commit('setNodeViewOffsetPosition', {offset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY], setStateDirty: true}); this.$store.commit('setNodeViewOffsetPosition', {newOffset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY], setStateDirty: true});
// Update the last position // Update the last position
this.moveLastPosition[0] = e.pageX; this.moveLastPosition[0] = e.pageX;
@ -87,7 +87,7 @@ export const moveNodeWorkflow = mixins(nodeIndex).extend({
const offsetPosition = this.$store.getters.getNodeViewOffsetPosition; const offsetPosition = this.$store.getters.getNodeViewOffsetPosition;
const nodeViewOffsetPositionX = offsetPosition[0] - e.deltaX; const nodeViewOffsetPositionX = offsetPosition[0] - e.deltaX;
const nodeViewOffsetPositionY = offsetPosition[1] - e.deltaY; const nodeViewOffsetPositionY = offsetPosition[1] - e.deltaY;
this.$store.commit('setNodeViewOffsetPosition', {offset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY], setStateDirty: true}); this.$store.commit('setNodeViewOffsetPosition', {newOffset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY], setStateDirty: true});
}, },
}, },
}); });

View file

@ -420,7 +420,7 @@ export const workflowHelpers = mixins(
this.$store.commit('setActive', workflowData.active || false); this.$store.commit('setActive', workflowData.active || false);
this.$store.commit('setWorkflowId', workflowData.id); this.$store.commit('setWorkflowId', workflowData.id);
this.$store.commit('setWorkflowName', {name: workflowData.name, setStateDirty: false}); this.$store.commit('setWorkflowName', {newName: workflowData.name, setStateDirty: false});
this.$store.commit('setWorkflowSettings', workflowData.settings || {}); this.$store.commit('setWorkflowSettings', workflowData.settings || {});
} else { } else {
// Workflow exists already so update it // Workflow exists already so update it

View file

@ -74,7 +74,7 @@ export const workflowSave = mixins(
this.$store.commit('setActive', workflowData.active || false); this.$store.commit('setActive', workflowData.active || false);
this.$store.commit('setWorkflowId', workflowData.id); this.$store.commit('setWorkflowId', workflowData.id);
this.$store.commit('setWorkflowName', {name: workflowData.name, setStateDirty: false}); this.$store.commit('setWorkflowName', {newName: workflowData.name, setStateDirty: false});
this.$store.commit('setWorkflowSettings', workflowData.settings || {}); this.$store.commit('setWorkflowSettings', workflowData.settings || {});
} else { } else {
// Workflow exists already so update it // Workflow exists already so update it

View file

@ -183,19 +183,19 @@ export const store = new Vuex.Store({
}, },
// Connections // Connections
addConnection (state, {connection, setStateDirty}) { addConnection (state, data) {
if (connection.length !== 2) { if (data.connection.length !== 2) {
// All connections need two entries // All connections need two entries
// TODO: Check if there is an error or whatever that is supposed to be returned // TODO: Check if there is an error or whatever that is supposed to be returned
return; return;
} }
if (setStateDirty === true) { if (data.setStateDirty === true) {
state.stateIsDirty = true; state.stateIsDirty = true;
} }
const sourceData: IConnection = connection[0]; const sourceData: IConnection = data.connection[0];
const destinationData: IConnection = connection[1]; const destinationData: IConnection = data.connection[1];
// Check if source node and type exist already and if not add them // Check if source node and type exist already and if not add them
if (!state.workflow.connections.hasOwnProperty(sourceData.node)) { if (!state.workflow.connections.hasOwnProperty(sourceData.node)) {
@ -388,11 +388,11 @@ export const store = new Vuex.Store({
}, },
// Name // Name
setWorkflowName (state, {name, setStateDirty}) { setWorkflowName (state, data) {
if (setStateDirty === true) { if (data.setStateDirty === true) {
state.stateIsDirty = true; state.stateIsDirty = true;
} }
state.workflow.name = name; state.workflow.name = data.newName;
}, },
// Nodes // Nodes
@ -476,11 +476,11 @@ export const store = new Vuex.Store({
setNodeViewMoveInProgress (state, value: boolean) { setNodeViewMoveInProgress (state, value: boolean) {
state.nodeViewMoveInProgress = value; state.nodeViewMoveInProgress = value;
}, },
setNodeViewOffsetPosition (state, {offset, setStateDirty}) { setNodeViewOffsetPosition (state, data) {
if (setStateDirty === true) { if (data.setStateDirty === true) {
state.stateIsDirty = true; state.stateIsDirty = true;
} }
state.nodeViewOffsetPosition = offset; state.nodeViewOffsetPosition = data.newOffset;
}, },
// Node-Types // Node-Types

View file

@ -325,7 +325,7 @@ export default mixins(
throw new Error(`Execution with id "${executionId}" could not be found!`); throw new Error(`Execution with id "${executionId}" could not be found!`);
} }
this.$store.commit('setWorkflowName', {name: data.workflowData.name, setStateDirty: false}); this.$store.commit('setWorkflowName', {newName: data.workflowData.name, setStateDirty: false});
this.$store.commit('setWorkflowId', PLACEHOLDER_EMPTY_WORKFLOW_ID); this.$store.commit('setWorkflowId', PLACEHOLDER_EMPTY_WORKFLOW_ID);
this.$store.commit('setWorkflowExecutionData', data); this.$store.commit('setWorkflowExecutionData', data);
@ -349,7 +349,7 @@ export default mixins(
this.$store.commit('setActive', data.active || false); this.$store.commit('setActive', data.active || false);
this.$store.commit('setWorkflowId', workflowId); this.$store.commit('setWorkflowId', workflowId);
this.$store.commit('setWorkflowName', {name: data.name, setStateDirty: false}); this.$store.commit('setWorkflowName', {newName: data.name, setStateDirty: false});
this.$store.commit('setWorkflowSettings', data.settings || {}); this.$store.commit('setWorkflowSettings', data.settings || {});
await this.addNodes(data.nodes, data.connections); await this.addNodes(data.nodes, data.connections);
@ -1388,9 +1388,10 @@ export default mixins(
detachable: !this.isReadOnly, detachable: !this.isReadOnly,
}); });
} else { } else {
const connectionProperties = {connection, setStateDirty: false};
// When nodes get connected it gets saved automatically to the storage // When nodes get connected it gets saved automatically to the storage
// so if we do not connect we have to save the connection manually // so if we do not connect we have to save the connection manually
this.$store.commit('addConnection', {connection, setStateDirty: false}); this.$store.commit('addConnection', connectionProperties);
} }
}, },
__removeConnection (connection: [IConnection, IConnection], removeVisualConnection = false) { __removeConnection (connection: [IConnection, IConnection], removeVisualConnection = false) {
@ -1875,7 +1876,7 @@ export default mixins(
this.$store.commit('setActive', false); this.$store.commit('setActive', false);
this.$store.commit('setWorkflowId', PLACEHOLDER_EMPTY_WORKFLOW_ID); this.$store.commit('setWorkflowId', PLACEHOLDER_EMPTY_WORKFLOW_ID);
this.$store.commit('setWorkflowName', {name: '', setStateDirty: false}); this.$store.commit('setWorkflowName', {newName: '', setStateDirty: false});
this.$store.commit('setWorkflowSettings', {}); this.$store.commit('setWorkflowSettings', {});
this.$store.commit('setActiveExecutionId', null); this.$store.commit('setActiveExecutionId', null);
@ -1886,7 +1887,7 @@ export default mixins(
this.$store.commit('resetNodeIndex'); this.$store.commit('resetNodeIndex');
this.$store.commit('resetSelectedNodes'); this.$store.commit('resetSelectedNodes');
this.$store.commit('setNodeViewOffsetPosition', {offset: [0, 0], setStateDirty: false}); this.$store.commit('setNodeViewOffsetPosition', {newOffset: [0, 0], setStateDirty: false});
return Promise.resolve(); return Promise.resolve();
}, },