diff --git a/Projects/Foundations/Schemas/App-Schema/plugin-project.json b/Projects/Foundations/Schemas/App-Schema/plugin-project.json index ef691991e..1e17f8239 100644 --- a/Projects/Foundations/Schemas/App-Schema/plugin-project.json +++ b/Projects/Foundations/Schemas/App-Schema/plugin-project.json @@ -9,8 +9,8 @@ "iconPathOff": "configuration" }, { - "action": "Add Missing Children", - "label": "Add Missing Children", + "action": "Add Missing Plugin Types", + "label": "Add Missing Plugin Types", "relatedUiObject": "Plugins", "actionFunction": "payload.executeAction" }, @@ -100,6 +100,18 @@ { "codeName": "Ethereum", "iconName": "ethereum" + }, + { + "codeName": "TensorFlow", + "iconName": "tensorflow" + }, + { + "codeName": "Education", + "iconName": "education" + }, + { + "codeName": "Governance", + "iconName": "governance" } ] } \ No newline at end of file diff --git a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js index ebc855572..a0dc69e26 100644 --- a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js +++ b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js @@ -643,6 +643,11 @@ function newFoundationsActionSwitch() { UI.projects.foundations.functionLibraries.pluginsFunctions.addMissingPluginProjects(action.node, action.rootNodes) } break + case 'Add Missing Plugin Types': + { + UI.projects.foundations.functionLibraries.pluginsFunctions.addMissingPluginTypes(action.node, action.rootNodes) + } + break case 'Add Missing Plugin Data Mines': { UI.projects.foundations.functionLibraries.pluginsFunctions.addMissingPluginDataMines(action.node, action.rootNodes) diff --git a/Projects/Foundations/UI/Function-Libraries/PluginsFunctions.js b/Projects/Foundations/UI/Function-Libraries/PluginsFunctions.js index f5f97e440..e59549499 100644 --- a/Projects/Foundations/UI/Function-Libraries/PluginsFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/PluginsFunctions.js @@ -1,6 +1,7 @@ function newFoundationsFunctionLibraryPluginsFunctions() { let thisObject = { addMissingPluginProjects: addMissingPluginProjects, + addMissingPluginTypes: addMissingPluginTypes, addMissingPluginDataMines: addMissingPluginDataMines, addMissingPluginTradingMines: addMissingPluginTradingMines, addMissingPluginTradingSystems: addMissingPluginTradingSystems, @@ -52,6 +53,25 @@ function newFoundationsFunctionLibraryPluginsFunctions() { } } + function addMissingPluginTypes(node, rootNodes) { + for (let k = 0; k < PROJECTS_SCHEMA.length; k++) { + let projectDefinition = PROJECTS_SCHEMA[k] + + if (projectDefinition.plugins === undefined) { continue } + for (let i = 0; i < projectDefinition.plugins.length; i++) { + let pluginType = "Plugin" + " " + projectDefinition.plugins[i] + + if (UI.projects.foundations.utilities.children.isMissingChildrenByName(node, pluginType) === true) { + let child = UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Plugin Project') + child.name = project + let config = JSON.parse(child.config) + config.codeName = project + child.config = JSON.stringify(config) + } + } + } + } + function getProjectName(node) { /* Validations to see if we can do this or not. */ if (node.payload === undefined) { return } diff --git a/Projects/Foundations/UI/Utilities/NodeChildren.js b/Projects/Foundations/UI/Utilities/NodeChildren.js index 3f05eeed3..d48d04b85 100644 --- a/Projects/Foundations/UI/Utilities/NodeChildren.js +++ b/Projects/Foundations/UI/Utilities/NodeChildren.js @@ -72,6 +72,49 @@ function newFoundationsUtilitiesNodeChildren() { return true } } + + function isMissingChildrenByName(startingNode, nodeName) { + /* + This functioin scan all the children of a node and returns true or false + depending if the node has a children with a certain name. + */ + if (startingNode === undefined) { return } + + let schemaDocument = getSchemaDocument(startingNode) + if (schemaDocument === undefined) { return } + + /* We scan through this node children */ + if (schemaDocument.childrenNodesProperties !== undefined) { + for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { + let property = schemaDocument.childrenNodesProperties[i] + + switch (property.type) { + case 'node': { + let child = startingNode[property.name] + if (child !== undefined) { + if (child.name === nodeName) { + return false + } + } + } + break + case 'array': { + let startingNodePropertyArray = startingNode[property.name] + if (startingNodePropertyArray !== undefined) { + for (let m = 0; m < startingNodePropertyArray.length; m++) { + let arrayItem = startingNodePropertyArray[m] + if (arrayItem.name === nodeName) { + return false + } + } + } + break + } + } + } + return true + } + } function findChildReferencingThisNode(startingNode, checkNode) { /* @@ -198,46 +241,4 @@ function newFoundationsUtilitiesNodeChildren() { } } - function isMissingChildrenByName(startingNode, nodeName) { - /* - This functioin scan all the children of a node and returns true or false - depending if the node has a children with a certain name. - */ - if (startingNode === undefined) { return } - - let schemaDocument = getSchemaDocument(startingNode) - if (schemaDocument === undefined) { return } - - /* We scan through this node children */ - if (schemaDocument.childrenNodesProperties !== undefined) { - for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { - let property = schemaDocument.childrenNodesProperties[i] - - switch (property.type) { - case 'node': { - let child = startingNode[property.name] - if (child !== undefined) { - if (child.name === nodeName) { - return false - } - } - } - break - case 'array': { - let startingNodePropertyArray = startingNode[property.name] - if (startingNodePropertyArray !== undefined) { - for (let m = 0; m < startingNodePropertyArray.length; m++) { - let arrayItem = startingNodePropertyArray[m] - if (arrayItem.name === nodeName) { - return false - } - } - } - break - } - } - } - return true - } - } } \ No newline at end of file diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index cd9582932..85e481da7 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -853,7 +853,18 @@ } ] }, - "CL": {} + "CL": {}, + "plugins": [ + "Data Mines", + "Trading Mines", + "Learning Mines", + "Trading Systems", + "Learning Systems", + "Trading Engines", + "Learning Engines", + "Tutorials", + "API Maps" + ] }, { "name": "Ethereum", @@ -1043,7 +1054,14 @@ ] }, "TS": {}, - "CL": {} + "CL": {}, + "plugins": [ + "User Profiles", + "Pools", + "Assets", + "Features", + "Positions" + ] }, { "name": "Education",