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;
}
this.$store.commit('setWorkflowName', {name: workflowName, setStateDirty: true});
this.$store.commit('setWorkflowName', {newName: workflowName, setStateDirty: true});
this.$showMessage({
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 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
this.moveLastPosition[0] = e.pageX;
@ -87,7 +87,7 @@ export const moveNodeWorkflow = mixins(nodeIndex).extend({
const offsetPosition = this.$store.getters.getNodeViewOffsetPosition;
const nodeViewOffsetPositionX = offsetPosition[0] - e.deltaX;
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('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 || {});
} else {
// 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('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 || {});
} else {
// Workflow exists already so update it

View file

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

View file

@ -325,7 +325,7 @@ export default mixins(
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('setWorkflowExecutionData', data);
@ -349,7 +349,7 @@ export default mixins(
this.$store.commit('setActive', data.active || false);
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 || {});
await this.addNodes(data.nodes, data.connections);
@ -1388,9 +1388,10 @@ export default mixins(
detachable: !this.isReadOnly,
});
} else {
const connectionProperties = {connection, setStateDirty: false};
// When nodes get connected it gets saved automatically to the storage
// 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) {
@ -1875,7 +1876,7 @@ export default mixins(
this.$store.commit('setActive', false);
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('setActiveExecutionId', null);
@ -1886,7 +1887,7 @@ export default mixins(
this.$store.commit('resetNodeIndex');
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();
},