From b2bdae13dcb4d6789b53948e7e24fdd8c1cfa68e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 8 Nov 2020 15:41:43 +0100 Subject: [PATCH] Multi Project --- .../Function-Libraries/PluginsFunctions.js | 50 +++++++++-- Projects/Superalgos/Schemas/AppSchema.json | 90 +++++++++++-------- 2 files changed, 94 insertions(+), 46 deletions(-) diff --git a/Projects/Superalgos/Function-Libraries/PluginsFunctions.js b/Projects/Superalgos/Function-Libraries/PluginsFunctions.js index 045fd386b..f01254c8b 100644 --- a/Projects/Superalgos/Function-Libraries/PluginsFunctions.js +++ b/Projects/Superalgos/Function-Libraries/PluginsFunctions.js @@ -10,8 +10,8 @@ function newPluginsFunctions() { } return thisObject - function getPluginFileNames(pluginType, callBack) { - callWebServer(undefined, 'PluginFileNames/' + 'Superalgos' + '/' + pluginType, onResponse) + function getPluginFileNames(projectName, pluginType, callBack) { + callWebServer(undefined, 'PluginFileNames/' + projectName + '/' + pluginType, onResponse) function onResponse(err, data) { if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { @@ -46,13 +46,37 @@ function newPluginsFunctions() { if (UI.projects.superalgos.utilities.children.isMissingChildrenByName(node, project) === true) { let child = functionLibraryUiObjectsFromNodes.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 } + if (node.payload.uiObject === undefined) { return } + + if (node.payload.parentNode === undefined) { + node.payload.uiObject.setErrorMessage('You need to have a Plugin Project node as a parent to execute this action.') + return + } + if (node.payload.parentNode.payload === undefined) { + node.payload.uiObject.setErrorMessage('You need to have a Plugin Project node as a parent to execute this action.') + return + } + let pluginProject = node.payload.parentNode + let config = JSON.parse(pluginProject.config) + + return config.codeName + } + function pluginMissingDataMines(node, rootNodes, functionLibraryUiObjectsFromNodes) { - getPluginFileNames('Data-Mines', onNamesArrived) + let projectName = getProjectName(node) + + getPluginFileNames(projectName, 'Data-Mines', onNamesArrived) function onNamesArrived(fileNames) { addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) @@ -60,7 +84,9 @@ function newPluginsFunctions() { } function pluginMissingTradingMines(node, rootNodes, functionLibraryUiObjectsFromNodes) { - getPluginFileNames('Trading-Mines', onNamesArrived) + let projectName = getProjectName(node) + + getPluginFileNames(projectName, 'Trading-Mines', onNamesArrived) function onNamesArrived(fileNames) { addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) @@ -68,7 +94,9 @@ function newPluginsFunctions() { } function pluginMissingTradingSystems(node, rootNodes, functionLibraryUiObjectsFromNodes) { - getPluginFileNames('Trading-Systems', onNamesArrived) + let projectName = getProjectName(node) + + getPluginFileNames(projectName, 'Trading-Systems', onNamesArrived) function onNamesArrived(fileNames) { addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) @@ -76,7 +104,9 @@ function newPluginsFunctions() { } function pluginMissingTradingEngines(node, rootNodes, functionLibraryUiObjectsFromNodes) { - getPluginFileNames('Trading-Engines', onNamesArrived) + let projectName = getProjectName(node) + + getPluginFileNames(projectName, 'Trading-Engines', onNamesArrived) function onNamesArrived(fileNames) { addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) @@ -84,7 +114,9 @@ function newPluginsFunctions() { } function pluginMissingSuperScripts(node, rootNodes, functionLibraryUiObjectsFromNodes) { - getPluginFileNames('Super-Scripts', onNamesArrived) + let projectName = getProjectName(node) + + getPluginFileNames(projectName, 'Super-Scripts', onNamesArrived) function onNamesArrived(fileNames) { addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) @@ -92,7 +124,9 @@ function newPluginsFunctions() { } function pluginMissingTutorials(node, rootNodes, functionLibraryUiObjectsFromNodes) { - getPluginFileNames('Tutorials', onNamesArrived) + let projectName = getProjectName(node) + + getPluginFileNames(projectName, 'Tutorials', onNamesArrived) function onNamesArrived(fileNames) { addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) diff --git a/Projects/Superalgos/Schemas/AppSchema.json b/Projects/Superalgos/Schemas/AppSchema.json index c8de9e9c7..7a5f5d3bd 100644 --- a/Projects/Superalgos/Schemas/AppSchema.json +++ b/Projects/Superalgos/Schemas/AppSchema.json @@ -56,7 +56,7 @@ "addLeftIcons": true, "isPinned": true, "positionLocked": true, - "icon": "bitcoin" + "icon": "superalgos" }, { "type": "Workspace", @@ -80,6 +80,15 @@ "iconPathOff": "backup", "actionFunction": "UI.projects.superalgos.spaces.designSpace.workspace.backup", "ring": 1 + }, + { + "action": "Add Missing Workspace Projects", + "label": "Add Missing Projects", + "askConfirmation": true, + "confirmationLabel": "Confirm to Proceed", + "workDoneLabel": "Done", + "relatedUiObject": "Workspace", + "actionFunction": "payload.executeAction" } ], "isTitleAllwaysVisible": true, @@ -2271,8 +2280,7 @@ "autoAdd": false } ], - "propertyNameAtParent": "bot", - "icon": "bitcoin" + "propertyNameAtParent": "bot" }, { "type": "Sensor Process Instance", @@ -2483,8 +2491,7 @@ "autoAdd": false } ], - "propertyNameAtParent": "processes", - "icon": "bitcoin" + "propertyNameAtParent": "processes" }, { "type": "Backtesting Session", @@ -9251,8 +9258,7 @@ "autoAdd": true } ], - "propertyNameAtParent": "learningParameters", - "icon": "bitcoin" + "propertyNameAtParent": "learningParameters" }, { "type": "Trading System Reference", @@ -9673,8 +9679,7 @@ "chainAttachesTo": { "compatibleTypes": "->Learning Parameters->" }, - "propertyNameAtParent": "learningAlgorithm", - "icon": "bitcoin" + "propertyNameAtParent": "learningAlgorithm" }, { "type": "User Defined Parameters", @@ -10170,8 +10175,7 @@ "childType": "Social Bots" } ], - "propertyNameAtParent": "session", - "icon": "bitcoin" + "propertyNameAtParent": "session" }, { "type": "Sensor Bot Instance", @@ -10461,8 +10465,7 @@ "type": "array", "childType": "Plotter" } - ], - "icon": "bitcoin" + ] }, { "type": "Sensor Bot", @@ -11624,8 +11627,7 @@ "autoAdd": true } ], - "propertyNameAtParent": "learningBots", - "icon": "bitcoin" + "propertyNameAtParent": "learningBots" }, { "type": "Plotter", @@ -15024,8 +15026,7 @@ "compatibleTypes": "->Layer Panels->" }, "propertyNameAtParent": "layerPanels", - "properties": [ - ], + "properties": [], "icon": "bitcoin" }, { @@ -15107,8 +15108,7 @@ "compatibleTypes": "->Layer Polygons->" }, "propertyNameAtParent": "layerPolygons", - "properties": [ - ], + "properties": [], "icon": "bitcoin" }, { @@ -15478,8 +15478,7 @@ "childType": "Task Manager", "monitorChildrenRunning": true } - ], - "icon": "bitcoin" + ] }, { "type": "Market Data Tasks", @@ -15695,8 +15694,7 @@ "childType": "Learning Mine Tasks", "monitorChildrenRunning": true } - ], - "icon": "bitcoin" + ] }, { "type": "Exchange Data Tasks", @@ -15909,8 +15907,7 @@ "childType": "Market Learning Tasks", "monitorChildrenRunning": true } - ], - "icon": "bitcoin" + ] }, { "type": "Data Mining", @@ -16036,8 +16033,7 @@ "childType": "Exchange Learning Tasks", "monitorChildrenRunning": true } - ], - "icon": "bitcoin" + ] }, { "type": "Testing Environment", @@ -16357,8 +16353,7 @@ "childType": "Market Learning Products", "autoAdd": false } - ], - "icon": "bitcoin" + ] }, { "type": "Trading Mines Data", @@ -16442,8 +16437,7 @@ "type": "array", "childType": "Exchange Learning Products" } - ], - "icon": "bitcoin" + ] }, { "type": "Trading Session Reference", @@ -16573,8 +16567,7 @@ "childType": "Learning Mine Products", "autoAdd": false } - ], - "icon": "bitcoin" + ] }, { "type": "Market Data Products", @@ -16737,8 +16730,7 @@ "type": "array", "childType": "Learning Session Reference" } - ], - "icon": "bitcoin" + ] }, { "type": "Data Product", @@ -16916,8 +16908,7 @@ "childType": "Bot Products", "autoAdd": false } - ], - "icon": "bitcoin" + ] }, { "type": "Bot Products", @@ -17040,6 +17031,13 @@ { "type": "Plugin Project", "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, { "action": "Add Missing Children", "label": "Add Missing Children", @@ -17056,6 +17054,12 @@ "actionFunction": "payload.executeAction" } ], + "initialValues": { + "config": "{ \n \"codeName\": \"\"\n}" + }, + "editors": { + "config": true + }, "addLeftIcons": true, "level": 1, "propertyNameAtParent": "pluginProjects", @@ -17100,7 +17104,17 @@ "autoAdd": false } ], - "icon": "bitcoin" + "icon": "bitcoin", + "alternativeIcons": [ + { + "codeName": "Superalgos", + "iconName": "superalgos" + }, + { + "codeName": "Ethereum", + "iconName": "ethereum" + } + ] }, { "type": "Plugin Data Mines",