refactor(editor): Move nodeTypes into store module (#3799)

*  Refactor `nodeTypes` into store module

*  Fix condition

* 🔥 Remove leftovers

*  Move `getNodeTranslationHeaders`, `getNodesInformation`, `getNodeParameterOptions`

*  Move leftover call

*  Correct excess prefix

* 🚚 Rename `nodeType` to `getNodeType`

* 🚚 Move logic to `getFullNodesProperties`

*  Simplify `getNodeType`

*  Refactor `nodeTypes` mutations

*  Refactor `Vue.set` call

*  Simplify check

* 🚚 Move export to bottom

* 📘 Simplify typing

* 🔥 Remove unused interface

* 👕 Add `void`

* 🚚 Fix naming

* 🔥 Remove logging

*  Simplify `updateNodeTypes`

* 🚚 Move `omit` to utils

* 🐛 Update `rootGetters` call

* 🐛 Fix `allNodeTypes` call in `nativelyNumberSuffixedDefaults`

* 🔥 Remove unused method

* 🔥 Remove excess namespace

Co-authored-by: Mutasem <mutdmour@gmail.com>
This commit is contained in:
Iván Ovejero
2022-08-01 22:43:50 +02:00
committed by GitHub
parent 231cfaa24d
commit 2c17e6f3ca
29 changed files with 244 additions and 140 deletions

View File

@@ -272,7 +272,7 @@ export const pushConnection = mixins(
const execution = this.$store.getters.getWorkflowExecution;
if (execution && execution.executedNode) {
const node = this.$store.getters.getNodeByName(execution.executedNode);
const nodeType = node && this.$store.getters.nodeType(node.type, node.typeVersion);
const nodeType = node && this.$store.getters['nodeTypes/getNodeType'](node.type, node.typeVersion);
const nodeOutput = execution && execution.executedNode && execution.data && execution.data.resultData && execution.data.resultData.runData && execution.data.resultData.runData[execution.executedNode];
if (node && nodeType && !nodeOutput) {
this.$showMessage({
@@ -370,19 +370,7 @@ export const pushConnection = mixins(
this.processWaitingPushMessages();
} else if (receivedData.type === 'reloadNodeType') {
const pushData = receivedData.data;
const nodesToBeFetched: INodeTypeNameVersion[] = [pushData];
// Force reload of all credential types
this.$store.dispatch('credentials/fetchCredentialTypes', true)
.then(() => {
// Get the data of the node and update in internal storage
return this.restApi().getNodesInformation(nodesToBeFetched);
})
.then((nodesInfo) => {
this.$store.commit('updateNodeTypes', nodesInfo);
});
this.$store.dispatch('nodeTypes/getFullNodesProperties', [receivedData.data]);
} else if (receivedData.type === 'removeNodeType') {
const pushData = receivedData.data;
@@ -391,7 +379,7 @@ export const pushConnection = mixins(
// Force reload of all credential types
this.$store.dispatch('credentials/fetchCredentialTypes')
.then(() => {
this.$store.commit('removeNodeTypes', nodesToBeRemoved);
this.$store.commit('nodeTypes/removeNodeTypes', nodesToBeRemoved);
});
}
return true;