Plugins Improvement

This commit is contained in:
Luis Fernando Molina committed 2021-06-10 20:30:26 +02:00
1 parent 57e5992875
commit 6121a6d7f9
5 files changed
+102 -46

No files matched your search

@@ -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"
}
]
}
@@ -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)
@@ -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 }
@@ -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
}
}
}
+20 -2
View File
@@ -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",