Improve editor-UI dirty checking

This commit is contained in:
Jan Oberhauser 2020-11-04 13:04:40 +01:00
parent d80d486e59
commit 9465653fab
4 changed files with 8 additions and 23 deletions

View file

@ -33,7 +33,7 @@ export const moveNodeWorkflow = mixins(
const nodeViewOffsetPositionX = offsetPosition[0] + (position.x - this.moveLastPosition[0]); const nodeViewOffsetPositionX = offsetPosition[0] + (position.x - this.moveLastPosition[0]);
const nodeViewOffsetPositionY = offsetPosition[1] + (position.y - this.moveLastPosition[1]); const nodeViewOffsetPositionY = offsetPosition[1] + (position.y - this.moveLastPosition[1]);
this.$store.commit('setNodeViewOffsetPosition', {newOffset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY], setStateDirty: true}); this.$store.commit('setNodeViewOffsetPosition', {newOffset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY]});
// Update the last position // Update the last position
this.moveLastPosition[0] = position.x; this.moveLastPosition[0] = position.x;
@ -101,7 +101,7 @@ export const moveNodeWorkflow = mixins(
const offsetPosition = this.$store.getters.getNodeViewOffsetPosition; const offsetPosition = this.$store.getters.getNodeViewOffsetPosition;
const nodeViewOffsetPositionX = offsetPosition[0] - normalized.pixelX; const nodeViewOffsetPositionX = offsetPosition[0] - normalized.pixelX;
const nodeViewOffsetPositionY = offsetPosition[1] - normalized.pixelY; const nodeViewOffsetPositionY = offsetPosition[1] - normalized.pixelY;
this.$store.commit('setNodeViewOffsetPosition', {newOffset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY], setStateDirty: true}); this.$store.commit('setNodeViewOffsetPosition', {newOffset: [nodeViewOffsetPositionX, nodeViewOffsetPositionY]});
}, },
}, },
}); });

View file

@ -29,7 +29,6 @@ export const workflowRun = mixins(
// because then it can not receive the data as it executes. // because then it can not receive the data as it executes.
throw new Error('No active connection to server. It is maybe down.'); throw new Error('No active connection to server. It is maybe down.');
} }
const workflow = this.getWorkflow();
this.$store.commit('addActiveAction', 'workflowRunning'); this.$store.commit('addActiveAction', 'workflowRunning');

View file

@ -96,7 +96,6 @@ export const store = new Vuex.Store({
// Active Executions // Active Executions
addActiveExecution (state, newActiveExecution: IExecutionsCurrentSummaryExtended) { addActiveExecution (state, newActiveExecution: IExecutionsCurrentSummaryExtended) {
state.stateIsDirty = true;
// Check if the execution exists already // Check if the execution exists already
const activeExecution = state.activeExecutions.find(execution => { const activeExecution = state.activeExecutions.find(execution => {
return execution.idActive === newActiveExecution.idActive; return execution.idActive === newActiveExecution.idActive;
@ -113,7 +112,6 @@ export const store = new Vuex.Store({
state.activeExecutions.unshift(newActiveExecution); state.activeExecutions.unshift(newActiveExecution);
}, },
finishActiveExecution (state, finishedActiveExecution: IPushDataExecutionFinished) { finishActiveExecution (state, finishedActiveExecution: IPushDataExecutionFinished) {
state.stateIsDirty = true;
// Find the execution to set to finished // Find the execution to set to finished
const activeExecution = state.activeExecutions.find(execution => { const activeExecution = state.activeExecutions.find(execution => {
return execution.idActive === finishedActiveExecution.executionIdActive; return execution.idActive === finishedActiveExecution.executionIdActive;
@ -132,7 +130,6 @@ export const store = new Vuex.Store({
Vue.set(activeExecution, 'stoppedAt', finishedActiveExecution.data.stoppedAt); Vue.set(activeExecution, 'stoppedAt', finishedActiveExecution.data.stoppedAt);
}, },
setActiveExecutions (state, newActiveExecutions: IExecutionsCurrentSummaryExtended[]) { setActiveExecutions (state, newActiveExecutions: IExecutionsCurrentSummaryExtended[]) {
state.stateIsDirty = true;
Vue.set(state, 'activeExecutions', newActiveExecutions); Vue.set(state, 'activeExecutions', newActiveExecutions);
}, },
@ -165,7 +162,6 @@ export const store = new Vuex.Store({
state.selectedNodes.push(node); state.selectedNodes.push(node);
}, },
removeNodeFromSelection (state, node: INodeUi) { removeNodeFromSelection (state, node: INodeUi) {
state.stateIsDirty = true;
let index; let index;
for (index in state.selectedNodes) { for (index in state.selectedNodes) {
if (state.selectedNodes[index].name === node.name) { if (state.selectedNodes[index].name === node.name) {
@ -377,7 +373,6 @@ export const store = new Vuex.Store({
// Set/Overwrite the value // Set/Overwrite the value
Vue.set(node.issues!, nodeIssueData.type, nodeIssueData.value); Vue.set(node.issues!, nodeIssueData.type, nodeIssueData.value);
state.stateIsDirty = true;
} }
return true; return true;
@ -466,7 +461,6 @@ export const store = new Vuex.Store({
state.nodeIndex.push(nodeName); state.nodeIndex.push(nodeName);
}, },
setNodeIndex (state, newData: { index: number, name: string | null}) { setNodeIndex (state, newData: { index: number, name: string | null}) {
state.stateIsDirty = true;
state.nodeIndex[newData.index] = newData.name; state.nodeIndex[newData.index] = newData.name;
}, },
resetNodeIndex (state) { resetNodeIndex (state) {
@ -478,9 +472,6 @@ export const store = new Vuex.Store({
state.nodeViewMoveInProgress = value; state.nodeViewMoveInProgress = value;
}, },
setNodeViewOffsetPosition (state, data) { setNodeViewOffsetPosition (state, data) {
if (data.setStateDirty === true) {
state.stateIsDirty = true;
}
state.nodeViewOffsetPosition = data.newOffset; state.nodeViewOffsetPosition = data.newOffset;
}, },
@ -541,16 +532,6 @@ export const store = new Vuex.Store({
Vue.set(state, 'oauthCallbackUrls', urls); Vue.set(state, 'oauthCallbackUrls', urls);
}, },
addNodeType (state, typeData: INodeTypeDescription) {
if (!typeData.hasOwnProperty('name')) {
// All node-types have to have a name
// TODO: Check if there is an error or whatever that is supposed to be returned
return;
}
state.stateIsDirty = true;
state.nodeTypes.push(typeData);
},
setActiveNode (state, nodeName: string) { setActiveNode (state, nodeName: string) {
state.activeNode = nodeName; state.activeNode = nodeName;
}, },
@ -573,7 +554,6 @@ export const store = new Vuex.Store({
if (state.workflowExecutionData.data.resultData.runData[pushData.nodeName] === undefined) { if (state.workflowExecutionData.data.resultData.runData[pushData.nodeName] === undefined) {
Vue.set(state.workflowExecutionData.data.resultData.runData, pushData.nodeName, []); Vue.set(state.workflowExecutionData.data.resultData.runData, pushData.nodeName, []);
} }
state.stateIsDirty = true;
state.workflowExecutionData.data.resultData.runData[pushData.nodeName].push(pushData.data); state.workflowExecutionData.data.resultData.runData[pushData.nodeName].push(pushData.data);
}, },

View file

@ -1006,6 +1006,8 @@ export default mixins(
await this.addNodes([newNodeData]); await this.addNodes([newNodeData]);
this.$store.commit('setStateDirty', true);
// Automatically deselect all nodes and select the current one and also active // Automatically deselect all nodes and select the current one and also active
// current node // current node
this.deselectAllNodes(); this.deselectAllNodes();
@ -1500,6 +1502,8 @@ export default mixins(
await this.addNodes([newNodeData]); await this.addNodes([newNodeData]);
this.$store.commit('setStateDirty', true);
// Automatically deselect all nodes and select the current one and also active // Automatically deselect all nodes and select the current one and also active
// current node // current node
this.deselectAllNodes(); this.deselectAllNodes();
@ -1834,6 +1838,8 @@ export default mixins(
// Add the nodes with the changed node names, expressions and connections // Add the nodes with the changed node names, expressions and connections
await this.addNodes(Object.values(tempWorkflow.nodes), tempWorkflow.connectionsBySourceNode); await this.addNodes(Object.values(tempWorkflow.nodes), tempWorkflow.connectionsBySourceNode);
this.$store.commit('setStateDirty', true);
return { return {
nodes: Object.values(tempWorkflow.nodes), nodes: Object.values(tempWorkflow.nodes),
connections: tempWorkflow.connectionsBySourceNode, connections: tempWorkflow.connectionsBySourceNode,