From 39443539fc5518810a008eed79d75bb553fa0aa7 Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Sat, 23 Oct 2021 02:41:01 +0300 Subject: [PATCH 01/11] install product in available trading mines --- .../Schemas/App-Schema/product-definition.json | 11 +++++++++++ .../Foundations/UI/Function-Libraries/ActionSwitch.js | 5 +++++ Projects/ProjectsSchema.json | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/Projects/Foundations/Schemas/App-Schema/product-definition.json b/Projects/Foundations/Schemas/App-Schema/product-definition.json index 4efc22367..ccb455e73 100644 --- a/Projects/Foundations/Schemas/App-Schema/product-definition.json +++ b/Projects/Foundations/Schemas/App-Schema/product-definition.json @@ -9,6 +9,17 @@ "dontShowAtFullscreen": true, "actionFunction": "uiObject.configEditor.activate" }, + { + "action": "Install Product", + "label": "Install Product", + "askConfirmation": true, + "confirmationLabel": "Confirm to Proceed", + "workDoneLabel": "Done", + "relatedUiObject": "Product Definition", + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Foundations" + }, + { "action": "Add UI Object", "disableIfPropertyIsDefined": true, diff --git a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js index 2bff88d79..bf8f2f205 100644 --- a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js +++ b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js @@ -446,6 +446,11 @@ function newFoundationsActionSwitch() { UI.projects.foundations.spaces.floatingSpace.moveFloatingObject(action.node.payload.position) } break + case 'Install Product': + { + UI.projects.foundations.functionLibraries.productFunctions.installProduct(action.node, action.rootNodes) + } + break default: { console.log("[WARN] Action sent to Foundations Action Switch does not belong here. Verify at the App Schema file of the node that triggered this action that the actionProject is pointing to the right project. -> Action = " + action.name + " -> Action Node Name = " + action.node.name) diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index c1d5710cf..69f7e03c6 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -371,6 +371,11 @@ "propertyName": "cryptoEcosystemFunctions", "functionName": "newFoundationsFunctionLibraryCryptoEcosystemFunctions" }, + { + "name": "Product Functions", + "propertyName": "productFunctions", + "functionName": "newFoundationsFunctionLibraryProductFunctions" + }, { "name": "Data Storage Functions", "propertyName": "dataStorageFunctions", From 01bc9ccba29f8e033ddbb275ff6276185f34c847 Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Sat, 23 Oct 2021 21:59:25 +0300 Subject: [PATCH 02/11] install product into trading mine --- .../UI/Function-Libraries/ProductFunctions.js | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Projects/Foundations/UI/Function-Libraries/ProductFunctions.js diff --git a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js new file mode 100644 index 000000000..2dfe66979 --- /dev/null +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -0,0 +1,81 @@ +function newFoundationsFunctionLibraryProductFunctions() { + let thisObject = { + installProduct: installProduct, + + } + + return thisObject + + function installProduct( + node, + rootNodes + ) { + + let product = node + let productIndicatorBot = product.payload.parentNode + let productDataMineParent = productIndicatorBot.payload.parentNode + + + + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === 'Trading Mine') { + installInTradingMine(rootNode) + } + } + + function installInTradingMine(tradingMine) { + + for (let j = 0; j < tradingMine.tradingBots.length; j++) { + let tradingBotNode = tradingMine.tradingBots[j] + installInTradingBotNode(tradingBotNode) + } + + function installInTradingBotNode(tradingBot) { + + for (let k = 0; k < tradingBot.processes.length; k++) { + let process = tradingBot.processes[k] + installInProcessDefinitionDependencies(process) + } + + function installInProcessDefinitionDependencies(process) { + + /** + * In case the data mine is not referenced at all, we must add it + */ + + let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(process.processDependencies, 'Data Mine Data Dependencies', productDataMineParent) + + let botDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, true, true, false, false) + + /** + * If Bot Data Dependency exists add Data Dependencies + * Otherwise create the Bot Data Dependency and add Data Dependencies to newly created Bot Data Dependency + */ + if (botDataDependencies !== undefined) { + addAllDataDependencies(botDataDependencies) + } else { + dataMineDependency.payload.uiObject.menu.internalClick('Add UI Object') + /** + * Find newly created bot data dependency and change his name to match Indicat Bot name + */ + let newBotDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, 'New Bot Data Dependencies', true, true, false, false) + newBotDataDependencies.name = productIndicatorBot.name + addAllDataDependencies(newBotDataDependencies) + } + + + function addAllDataDependencies(botDataDependencies) { + for (let l = 0; l < product.datasets.length; l++) { + let dataset = product.datasets[l] + UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botDataDependencies, 'Data Dependency', dataset) + } + } + + } + } + + } + + } +} \ No newline at end of file From 180a0ff84e558f5131889579ed69453546914178 Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Mon, 25 Oct 2021 02:32:33 +0300 Subject: [PATCH 03/11] refactor trading mine and data mine install; added data task install --- .../UI/Function-Libraries/ProductFunctions.js | 193 +++++++++++++++--- 1 file changed, 170 insertions(+), 23 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js index 2dfe66979..e9e314603 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -6,6 +6,13 @@ function newFoundationsFunctionLibraryProductFunctions() { return thisObject + /** + * + * This function will install the product into : + * Available Trading Mines as process dependency for the trading bot + * Previously installed Markets + */ + function installProduct( node, rootNodes @@ -15,30 +22,171 @@ function newFoundationsFunctionLibraryProductFunctions() { let productIndicatorBot = product.payload.parentNode let productDataMineParent = productIndicatorBot.payload.parentNode + node.payload.uiObject.setInfoMessage('This product is being installed. This might take a couple of seconds. Please hold on while we connect all the dots for you. ') + setTimeout(startInstalling, 500) - for (let i = 0; i < rootNodes.length; i++) { - let rootNode = rootNodes[i] - if (rootNode.type === 'Trading Mine') { - installInTradingMine(rootNode) + function startInstalling() { + + for (let i = 0; i < rootNodes.length; i++) { + + let rootNode = rootNodes[i] + + if (rootNode.type === 'Trading Mine') { + installInTradingMine(rootNode) + } else if (rootNode.type === 'LAN Network') { + installInNetworkNodes(rootNode) + } } + + function installInNetworkNodes(lanNetwork) { + + for (let j = 0; j < lanNetwork.lanNetworkNodes.length; j++) { + let lanNetworkNode = lanNetwork.lanNetworkNodes[j] + installInDataMinesData(lanNetworkNode) + installInDataTasks(lanNetworkNode) + } + + + /** + * + * We will add data mine tasks of the product only to existing Market Data Tasks + * If no Market Data Tasks are available, product task will not be installed into this branch + * Market Data can be installed by using Install Market Script. + */ + function installInDataTasks(lanNetworkNode) { + let dataTasks = UI.projects.visualScripting.utilities.branches.findInBranch(lanNetworkNode, 'Data Tasks', product, true) + + // Install in each existing Project Data Task + for (let j = 0; j < dataTasks.projectDataTasks.length; j++) { + let projectDataTask = dataTasks.projectDataTasks[j] + + // Install in each existing Exchange + for (let k = 0; k < projectDataTask.exchangeDataTasks.length; k++) { + let exchangeDataTask = projectDataTask.exchangeDataTasks[k] + + // Install in each existing Market Data + for (let l = 0; l < exchangeDataTask.marketDataTasks.length; l++) { + let marketDataTask = exchangeDataTask.marketDataTasks[l] + + // If Data Mine is not installed we are going to create it, otherwise we use the existing one + let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(marketDataTask, 'Data Mine Tasks', productDataMineParent) + + if (dataMineDependency.taskManagers.length > 0) { + //We will add the task and indicator bot into first task manager we find + let task = findOrCreateTask(dataMineDependency.taskManagers[0]) + let indicatorBot = findOrCreateIndicatorBot(task) + + findOrCreateIndicatorProcessInstance(indicatorBot) + } else { + //Let's create a new task manager as none exists + let newTaskManager = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Task Manager') + newTaskManager.name = productDataMineParent.name + + let task = findOrCreateTask(newTaskManager) + let indicatorBot = findOrCreateIndicatorBot(task) + + findOrCreateIndicatorProcessInstance(indicatorBot) + + } + + } + } + } + + + function findOrCreateTask(taskManager) { + let task = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(taskManager, undefined, productIndicatorBot.name, false, true, false, false) + if (task === undefined) { + let newTask = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(taskManager, 'Task') + newTask.name = productIndicatorBot.name + + return newTask + } + return task; + } + + function findOrCreateIndicatorBot(task) { + let botInstance = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(task, 'Indicator Bot Instance', undefined, false, true, false, false) + if (botInstance === undefined) { + let newBotInstance = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(task, 'Indicator Bot Instance') + newBotInstance.name = productIndicatorBot.name + + return newBotInstance + } + return botInstance + } + + function findOrCreateIndicatorProcessInstance(indicatorBot) { + for (m = 0; m < productIndicatorBot.processes.length; m++) { + let processDefinition = productIndicatorBot.processes[m] + UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(indicatorBot, 'Indicator Process Instance', processDefinition) + } + } + + + + } + + /** + * + * We will add Data Product to Market Data Products only if there is at least one Exchange and Market installed + * We will not create the entire hierarchy for the Exchange as this is a job for Install Market script + * + */ + function installInDataMinesData(lanNetworkNode) { + + let dataMinesData = UI.projects.visualScripting.utilities.branches.findInBranch(lanNetworkNode, 'Data Mines Data', product, true) + + + for (let j = 0; j < dataMinesData.projectDataProducts.length; j++) { + let projectDataProduct = dataMinesData.projectDataProducts[j] + + for (let k = 0; k < projectDataProduct.exchangeDataProducts.length; k++) { + let exchangeDataProduct = projectDataProduct.exchangeDataProducts[k] + + for (let l = 0; l < exchangeDataProduct.marketDataProducts.length; l++) { + let marketDataProduct = exchangeDataProduct.marketDataProducts[l] + + let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(marketDataProduct, 'Data Mine Products', productDataMineParent) + let botProductDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, false, true, false, false) + + /** + * If Bot Product Dependency exists add Data Product + * Otherwise create the Bot Product Dependency and addData Product to newly created Bot Product Dependency + */ + if (botProductDependencies !== undefined) { + addDataProduct(botProductDependencies) + } else { + let newBotProductDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Bot Products') + newBotProductDependencies.name = productIndicatorBot.name + addDataProduct(newBotProductDependencies) + } + + function addDataProduct(botProductDependencies) { + UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botProductDependencies, 'Data Product', product) + } + } + + } + } + + + } + + } + } + + function installInTradingMine(tradingMine) { for (let j = 0; j < tradingMine.tradingBots.length; j++) { let tradingBotNode = tradingMine.tradingBots[j] - installInTradingBotNode(tradingBotNode) - } - function installInTradingBotNode(tradingBot) { - - for (let k = 0; k < tradingBot.processes.length; k++) { - let process = tradingBot.processes[k] - installInProcessDefinitionDependencies(process) - } - - function installInProcessDefinitionDependencies(process) { + for (let k = 0; k < tradingBotNode.processes.length; k++) { + let process = tradingBotNode.processes[k] /** * In case the data mine is not referenced at all, we must add it @@ -46,7 +194,7 @@ function newFoundationsFunctionLibraryProductFunctions() { let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(process.processDependencies, 'Data Mine Data Dependencies', productDataMineParent) - let botDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, true, true, false, false) + let botDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, false, true, false, false) /** * If Bot Data Dependency exists add Data Dependencies @@ -55,11 +203,7 @@ function newFoundationsFunctionLibraryProductFunctions() { if (botDataDependencies !== undefined) { addAllDataDependencies(botDataDependencies) } else { - dataMineDependency.payload.uiObject.menu.internalClick('Add UI Object') - /** - * Find newly created bot data dependency and change his name to match Indicat Bot name - */ - let newBotDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, 'New Bot Data Dependencies', true, true, false, false) + let newBotDataDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Bot Data Dependencies') newBotDataDependencies.name = productIndicatorBot.name addAllDataDependencies(newBotDataDependencies) } @@ -71,11 +215,14 @@ function newFoundationsFunctionLibraryProductFunctions() { UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botDataDependencies, 'Data Dependency', dataset) } } - } } - } + } } -} \ No newline at end of file + +} + + + From af35bf32e09c9941b696e2e569bbaafb4e0fd8cf Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Mon, 25 Oct 2021 02:40:04 +0300 Subject: [PATCH 04/11] identified charting space in workspace --- .../UI/Function-Libraries/ProductFunctions.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js index e9e314603..69dd65f47 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -36,6 +36,8 @@ function newFoundationsFunctionLibraryProductFunctions() { installInTradingMine(rootNode) } else if (rootNode.type === 'LAN Network') { installInNetworkNodes(rootNode) + } else if (rootNode.type === 'Charting Space') { + installInChartingSpace(rootNode) } } @@ -220,6 +222,24 @@ function newFoundationsFunctionLibraryProductFunctions() { } + + function installInChartingSpace(chartingSpace) { + + for (let j = 0; j < chartingSpace.projectDashboards.length; j++) { + let projectDashboard = chartingSpace.projectDashboards[j] + + for (k = 0; k < projectDashboard.dashboards.length; k++) { + let dashboard = projectDashboard.dashboards[k] + + for (l = 0; l < dashboard.timeMachines.length; l++) { + timeMachine = dashboard.timeMachines[l] + + + } + } + } + + } } } From f142fec0c1173c9b50d52b8339d63010a0ff5ffd Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Mon, 25 Oct 2021 21:55:05 +0300 Subject: [PATCH 05/11] install product in charting space --- .../UI/Function-Libraries/ProductFunctions.js | 94 ++++++++++++++----- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js index 69dd65f47..3ce174ff8 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -7,10 +7,12 @@ function newFoundationsFunctionLibraryProductFunctions() { return thisObject /** - * - * This function will install the product into : + * + * This function will install the product in : * Available Trading Mines as process dependency for the trading bot * Previously installed Markets + * Data Tasks for all markets + * Charting Space for all dashboards */ function installProduct( @@ -21,6 +23,8 @@ function newFoundationsFunctionLibraryProductFunctions() { let product = node let productIndicatorBot = product.payload.parentNode let productDataMineParent = productIndicatorBot.payload.parentNode + let dataMineProduct + let dataProduct node.payload.uiObject.setInfoMessage('This product is being installed. This might take a couple of seconds. Please hold on while we connect all the dots for you. ') @@ -37,6 +41,7 @@ function newFoundationsFunctionLibraryProductFunctions() { } else if (rootNode.type === 'LAN Network') { installInNetworkNodes(rootNode) } else if (rootNode.type === 'Charting Space') { + // Installing in charting space can be done only after we make sure the Data products are installed installInChartingSpace(rootNode) } } @@ -51,7 +56,7 @@ function newFoundationsFunctionLibraryProductFunctions() { /** - * + * * We will add data mine tasks of the product only to existing Market Data Tasks * If no Market Data Tasks are available, product task will not be installed into this branch * Market Data can be installed by using Install Market Script. @@ -126,15 +131,13 @@ function newFoundationsFunctionLibraryProductFunctions() { } } - - } /** - * - * We will add Data Product to Market Data Products only if there is at least one Exchange and Market installed + * + * We will add Data Product to Market Data Products only if there is at least one Exchange and Market installed * We will not create the entire hierarchy for the Exchange as this is a job for Install Market script - * + * */ function installInDataMinesData(lanNetworkNode) { @@ -150,30 +153,29 @@ function newFoundationsFunctionLibraryProductFunctions() { for (let l = 0; l < exchangeDataProduct.marketDataProducts.length; l++) { let marketDataProduct = exchangeDataProduct.marketDataProducts[l] - let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(marketDataProduct, 'Data Mine Products', productDataMineParent) - let botProductDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, false, true, false, false) + dataMineProduct = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(marketDataProduct, 'Data Mine Products', productDataMineParent) + let botProductDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineProduct, undefined, productIndicatorBot.name, false, true, false, false) /** - * If Bot Product Dependency exists add Data Product - * Otherwise create the Bot Product Dependency and addData Product to newly created Bot Product Dependency - */ + * If Bot Product Dependency exists add Data Product + * Otherwise create the Bot Product Dependency and addData Product to newly created Bot Product Dependency + */ if (botProductDependencies !== undefined) { addDataProduct(botProductDependencies) } else { - let newBotProductDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Bot Products') + let newBotProductDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineProduct, 'Bot Products') newBotProductDependencies.name = productIndicatorBot.name addDataProduct(newBotProductDependencies) } function addDataProduct(botProductDependencies) { - UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botProductDependencies, 'Data Product', product) + dataProduct = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botProductDependencies, 'Data Product', product) } } } } - } } @@ -181,7 +183,6 @@ function newFoundationsFunctionLibraryProductFunctions() { } - function installInTradingMine(tradingMine) { for (let j = 0; j < tradingMine.tradingBots.length; j++) { @@ -228,13 +229,64 @@ function newFoundationsFunctionLibraryProductFunctions() { for (let j = 0; j < chartingSpace.projectDashboards.length; j++) { let projectDashboard = chartingSpace.projectDashboards[j] - for (k = 0; k < projectDashboard.dashboards.length; k++) { + for (let k = 0; k < projectDashboard.dashboards.length; k++) { let dashboard = projectDashboard.dashboards[k] - for (l = 0; l < dashboard.timeMachines.length; l++) { - timeMachine = dashboard.timeMachines[l] + for (let l = 0; l < dashboard.timeMachines.length; l++) { + let timeMachine = dashboard.timeMachines[l] - + if (timeMachine.timelineCharts.length > 0) { + let existingTimelineChartUpdated = false + /** + * We first search the existing timeline charts for a Layer Manager children that references our product data mine parent, to reuse it + * If none found we will create a new timeline chart with all branches + */ + for (let m = 0; m < timeMachine.timelineCharts.length; m++) { + let currentTimelineChart = timeMachine.timelineCharts[m] + + let referencedLayerManager = UI.projects.visualScripting.utilities.nodeChildren.findChildReferencingThisNode(currentTimelineChart, dataMineProduct) + console.log(referencedLayerManager) + if (referencedLayerManager !== undefined) { + // We have found a timeline chart that references our product data mine, let's check if our product is installed, otherwise we install it + + let botLayer = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(referencedLayerManager, undefined, productIndicatorBot.name, false, true, false, false) + + if (botLayer === undefined) { + let newBotLayer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(referencedLayerManager, 'Bot Layers') + newBotLayer.name = productIndicatorBot.name + botLayer = newBotLayer + } + + UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botLayer, 'Layer', dataProduct) + existingTimelineChartUpdated = true + } + + } + // None of the existing timeline charts are referencing our data mine, so let's create it + if (existingTimelineChartUpdated === false) { + createTimelineChartWithAllBranches(timeMachine) + } + } else { + //No timeline chart exists at all, so let's create one for our data mine + createTimelineChartWithAllBranches(timeMachine) + } + + function createTimelineChartWithAllBranches(timeMachine) { + let newTimelineChart = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart') + newTimelineChart.name = productDataMineParent.name + + console.log(dataMineProduct) + let layerManager = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(newTimelineChart, 'Layer Manager') + UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(layerManager, dataMineProduct) + + + let botLayer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(layerManager, 'Bot Layers') + botLayer.name = productIndicatorBot.name + + let layer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(botLayer, 'Layer') + UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(layer, dataProduct) + + } } } } From 6b1b973eccc29349d9a2ea8353586a35239c5c8a Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Tue, 26 Oct 2021 15:22:01 +0300 Subject: [PATCH 06/11] refactored the way the installing procedure is being executed; refactored function names to be more relevant; added install in charting space logic; added save trading mine plugin logic --- .../UI/Function-Libraries/ProductFunctions.js | 243 ++++++++++-------- 1 file changed, 142 insertions(+), 101 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js index 3ce174ff8..5192beef7 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -33,19 +33,28 @@ function newFoundationsFunctionLibraryProductFunctions() { function startInstalling() { for (let i = 0; i < rootNodes.length; i++) { - let rootNode = rootNodes[i] - if (rootNode.type === 'Trading Mine') { installInTradingMine(rootNode) - } else if (rootNode.type === 'LAN Network') { + } + } + + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === 'LAN Network') { installInNetworkNodes(rootNode) - } else if (rootNode.type === 'Charting Space') { - // Installing in charting space can be done only after we make sure the Data products are installed + } + } + + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === 'Charting Space') { installInChartingSpace(rootNode) } } + node.payload.uiObject.setInfoMessage('Product installation is complete.') + function installInNetworkNodes(lanNetwork) { for (let j = 0; j < lanNetwork.lanNetworkNodes.length; j++) { @@ -59,7 +68,7 @@ function newFoundationsFunctionLibraryProductFunctions() { * * We will add data mine tasks of the product only to existing Market Data Tasks * If no Market Data Tasks are available, product task will not be installed into this branch - * Market Data can be installed by using Install Market Script. + * Market Data can be installed by using Install Market script. */ function installInDataTasks(lanNetworkNode) { let dataTasks = UI.projects.visualScripting.utilities.branches.findInBranch(lanNetworkNode, 'Data Tasks', product, true) @@ -81,19 +90,19 @@ function newFoundationsFunctionLibraryProductFunctions() { if (dataMineDependency.taskManagers.length > 0) { //We will add the task and indicator bot into first task manager we find - let task = findOrCreateTask(dataMineDependency.taskManagers[0]) - let indicatorBot = findOrCreateIndicatorBot(task) + let task = ceateTaskIfNotPresent(dataMineDependency.taskManagers[0]) + let indicatorBot = createIndicatorBotIfNotPresent(task) - findOrCreateIndicatorProcessInstance(indicatorBot) + createIndicatorProcessInstanceIfNotPresent(indicatorBot) } else { //Let's create a new task manager as none exists let newTaskManager = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Task Manager') newTaskManager.name = productDataMineParent.name - let task = findOrCreateTask(newTaskManager) - let indicatorBot = findOrCreateIndicatorBot(task) + let task = ceateTaskIfNotPresent(newTaskManager) + let indicatorBot = createIndicatorBotIfNotPresent(task) - findOrCreateIndicatorProcessInstance(indicatorBot) + createIndicatorProcessInstanceIfNotPresent(indicatorBot) } @@ -102,7 +111,7 @@ function newFoundationsFunctionLibraryProductFunctions() { } - function findOrCreateTask(taskManager) { + function ceateTaskIfNotPresent(taskManager) { let task = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(taskManager, undefined, productIndicatorBot.name, false, true, false, false) if (task === undefined) { let newTask = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(taskManager, 'Task') @@ -113,7 +122,7 @@ function newFoundationsFunctionLibraryProductFunctions() { return task; } - function findOrCreateIndicatorBot(task) { + function createIndicatorBotIfNotPresent(task) { let botInstance = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(task, 'Indicator Bot Instance', undefined, false, true, false, false) if (botInstance === undefined) { let newBotInstance = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(task, 'Indicator Bot Instance') @@ -124,8 +133,8 @@ function newFoundationsFunctionLibraryProductFunctions() { return botInstance } - function findOrCreateIndicatorProcessInstance(indicatorBot) { - for (m = 0; m < productIndicatorBot.processes.length; m++) { + function createIndicatorProcessInstanceIfNotPresent(indicatorBot) { + for (let m = 0; m < productIndicatorBot.processes.length; m++) { let processDefinition = productIndicatorBot.processes[m] UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(indicatorBot, 'Indicator Process Instance', processDefinition) } @@ -161,14 +170,14 @@ function newFoundationsFunctionLibraryProductFunctions() { * Otherwise create the Bot Product Dependency and addData Product to newly created Bot Product Dependency */ if (botProductDependencies !== undefined) { - addDataProduct(botProductDependencies) + createDataProductIfNotPresent(botProductDependencies) } else { let newBotProductDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineProduct, 'Bot Products') newBotProductDependencies.name = productIndicatorBot.name - addDataProduct(newBotProductDependencies) + createDataProductIfNotPresent(newBotProductDependencies) } - function addDataProduct(botProductDependencies) { + function createDataProductIfNotPresent(botProductDependencies) { dataProduct = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botProductDependencies, 'Data Product', product) } } @@ -180,118 +189,150 @@ function newFoundationsFunctionLibraryProductFunctions() { } - } + function installInTradingMine(tradingMine) { + let savePlugin = false + for (let j = 0; j < tradingMine.tradingBots.length; j++) { + let tradingBotNode = tradingMine.tradingBots[j] + + for (let k = 0; k < tradingBotNode.processes.length; k++) { + let process = tradingBotNode.processes[k] + + /** + * In case the data mine is not referenced at all, we must add it + */ + + let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(process.processDependencies, 'Data Mine Data Dependencies', productDataMineParent) + + let botDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, false, true, false, false) + + /** + * If Bot Data Dependency exists add Data Dependencies + * Otherwise create the Bot Data Dependency and add Data Dependencies to newly created Bot Data + */ + if (botDataDependencies !== undefined) { + addAllDataDependenciesIfNotExists(botDataDependencies) + } else { + let newBotDataDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Bot Data Dependencies') + newBotDataDependencies.name = productIndicatorBot.name + addAllDataDependenciesIfNotExists(newBotDataDependencies) + } - function installInTradingMine(tradingMine) { + function addAllDataDependenciesIfNotExists(botDataDependencies) { + for (let l = 0; l < product.datasets.length; l++) { + let dataset = product.datasets[l] - for (let j = 0; j < tradingMine.tradingBots.length; j++) { - let tradingBotNode = tradingMine.tradingBots[j] - - for (let k = 0; k < tradingBotNode.processes.length; k++) { - let process = tradingBotNode.processes[k] - - /** - * In case the data mine is not referenced at all, we must add it - */ - - let dataMineDependency = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(process.processDependencies, 'Data Mine Data Dependencies', productDataMineParent) - - let botDataDependencies = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(dataMineDependency, undefined, productIndicatorBot.name, false, true, false, false) - - /** - * If Bot Data Dependency exists add Data Dependencies - * Otherwise create the Bot Data Dependency and add Data Dependencies to newly created Bot Data Dependency - */ - if (botDataDependencies !== undefined) { - addAllDataDependencies(botDataDependencies) - } else { - let newBotDataDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineDependency, 'Bot Data Dependencies') - newBotDataDependencies.name = productIndicatorBot.name - addAllDataDependencies(newBotDataDependencies) - } - - - function addAllDataDependencies(botDataDependencies) { - for (let l = 0; l < product.datasets.length; l++) { - let dataset = product.datasets[l] - UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botDataDependencies, 'Data Dependency', dataset) + // Explicit check is needed so we know if we have to save the plugin or not + if (UI.projects.visualScripting.utilities.nodeChildren.isMissingChildrenById(botDataDependencies, dataset, true) === true) { + savePlugin = true + let dataDependency = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(botDataDependencies, 'Data Dependency') + UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(dataDependency, dataset) + } + } } } } + /** + * There is no reason to save the plugin if no modifications have been made to the hierarchy + * We will save the plugin only if we get to the point were we have to add the data dependencies + * + */ + if (savePlugin) { + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === 'Plugins') { + let tradingMinePlugin = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(rootNode, 'Plugin Trading Mines', undefined, false, true, false, false) + + for (let j = 0; j < tradingMinePlugin.pluginFiles.length; j++) { + pluginFile = tradingMinePlugin.pluginFiles[j] + + UI.projects.communityPlugins.functionLibraries.pluginsFunctions.savePlugin(pluginFile) + } + } + } + + } + } + /** + * This function will install the product into existing Charting Space + * It is mandatory to have at least a dashboard which contains at least one time machine + * + */ + function installInChartingSpace(chartingSpace) { - } + for (let j = 0; j < chartingSpace.projectDashboards.length; j++) { + let projectDashboard = chartingSpace.projectDashboards[j] - function installInChartingSpace(chartingSpace) { + for (let k = 0; k < projectDashboard.dashboards.length; k++) { + let dashboard = projectDashboard.dashboards[k] - for (let j = 0; j < chartingSpace.projectDashboards.length; j++) { - let projectDashboard = chartingSpace.projectDashboards[j] + for (let l = 0; l < dashboard.timeMachines.length; l++) { + let timeMachine = dashboard.timeMachines[l] - for (let k = 0; k < projectDashboard.dashboards.length; k++) { - let dashboard = projectDashboard.dashboards[k] + if (timeMachine.timelineCharts.length > 0) { + let existingTimelineChartUpdated = false + /** + * We first search the existing timeline charts for a Layer Manager children that references our product data mine parent, to reuse it + * If none found we will create a new timeline chart with all branches + */ + for (let m = 0; m < timeMachine.timelineCharts.length; m++) { + let currentTimelineChart = timeMachine.timelineCharts[m] - for (let l = 0; l < dashboard.timeMachines.length; l++) { - let timeMachine = dashboard.timeMachines[l] - - if (timeMachine.timelineCharts.length > 0) { - let existingTimelineChartUpdated = false - /** - * We first search the existing timeline charts for a Layer Manager children that references our product data mine parent, to reuse it - * If none found we will create a new timeline chart with all branches - */ - for (let m = 0; m < timeMachine.timelineCharts.length; m++) { - let currentTimelineChart = timeMachine.timelineCharts[m] - - let referencedLayerManager = UI.projects.visualScripting.utilities.nodeChildren.findChildReferencingThisNode(currentTimelineChart, dataMineProduct) - console.log(referencedLayerManager) - if (referencedLayerManager !== undefined) { - // We have found a timeline chart that references our product data mine, let's check if our product is installed, otherwise we install it - - let botLayer = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(referencedLayerManager, undefined, productIndicatorBot.name, false, true, false, false) - - if (botLayer === undefined) { - let newBotLayer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(referencedLayerManager, 'Bot Layers') - newBotLayer.name = productIndicatorBot.name - botLayer = newBotLayer + let referencedLayerManager = UI.projects.visualScripting.utilities.nodeChildren.findChildReferencingThisNode(currentTimelineChart, dataMineProduct) + if (referencedLayerManager !== undefined) { + // We have found a timeline chart that references our product data mine, let's check if our product is installed, otherwise we install it + let botLayer = createBotLayerIfNotPresent(referencedLayerManager) + createLayerIfNotPresent(botLayer) + existingTimelineChartUpdated = true } - UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botLayer, 'Layer', dataProduct) - existingTimelineChartUpdated = true } - - } - // None of the existing timeline charts are referencing our data mine, so let's create it - if (existingTimelineChartUpdated === false) { + // None of the existing timeline charts are referencing our data mine, so let's create it + if (existingTimelineChartUpdated === false) { + createTimelineChartWithAllBranches(timeMachine) + } + } else { + //No timeline chart exists at all, so let's create one for our data mine createTimelineChartWithAllBranches(timeMachine) } - } else { - //No timeline chart exists at all, so let's create one for our data mine - createTimelineChartWithAllBranches(timeMachine) - } - function createTimelineChartWithAllBranches(timeMachine) { - let newTimelineChart = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart') - newTimelineChart.name = productDataMineParent.name + function createTimelineChartWithAllBranches(timeMachine) { + let newTimelineChart = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart') + newTimelineChart.name = productDataMineParent.name - console.log(dataMineProduct) - let layerManager = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(newTimelineChart, 'Layer Manager') - UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(layerManager, dataMineProduct) + let layerManager = newTimelineChart.layerManager + UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(layerManager, dataMineProduct) + let botLayer = createBotLayerIfNotPresent(layerManager) + createLayerIfNotPresent(botLayer) - let botLayer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(layerManager, 'Bot Layers') - botLayer.name = productIndicatorBot.name + } - let layer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(botLayer, 'Layer') - UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(layer, dataProduct) + function createBotLayerIfNotPresent(layerManager) { + let botLayer = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(layerManager, undefined, productIndicatorBot.name, false, true, false, false) + if (botLayer === undefined) { + let newBotLayer = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(layerManager, 'Bot Layers') + newBotLayer.name = productIndicatorBot.name + return newBotLayer + } + return botLayer + } + + function createLayerIfNotPresent(botLayer) { + UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botLayer, 'Layer', dataProduct) + } } } } + } } + + } } From 6a3e7bea73abb1cf9e92328b22372975246d6d9d Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Tue, 26 Oct 2021 15:52:50 +0300 Subject: [PATCH 07/11] global variable 'pluginFile' --- Projects/Foundations/UI/Function-Libraries/ProductFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js index 5192beef7..a5a34fd60 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -244,7 +244,7 @@ function newFoundationsFunctionLibraryProductFunctions() { let tradingMinePlugin = UI.projects.visualScripting.utilities.meshes.findNodeInNodeMesh(rootNode, 'Plugin Trading Mines', undefined, false, true, false, false) for (let j = 0; j < tradingMinePlugin.pluginFiles.length; j++) { - pluginFile = tradingMinePlugin.pluginFiles[j] + let pluginFile = tradingMinePlugin.pluginFiles[j] UI.projects.communityPlugins.functionLibraries.pluginsFunctions.savePlugin(pluginFile) } From 3a79d2fb55e1b90332bc405cb58f02b0798e17f1 Mon Sep 17 00:00:00 2001 From: Tentacule23 Date: Tue, 26 Oct 2021 13:02:44 -0400 Subject: [PATCH 08/11] app.contributeuserprofile --- Platform/Client/httpInterface.js | 343 +++++++++--------- .../UI/Spaces/Docs-Space/CommandInterface.js | 70 ---- .../Spaces/Reports-Space/CommandInterface.js | 84 +++++ 3 files changed, 261 insertions(+), 236 deletions(-) diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index cda5924b7..91a672e98 100644 --- a/Platform/Client/httpInterface.js +++ b/Platform/Client/httpInterface.js @@ -862,172 +862,6 @@ exports.newHttpInterface = function newHttpInterface() { break } - case 'UserUpdate': { - try { - let commitMessage = unescape(requestPath[3]) - const username = unescape(requestPath[4]) - const token = unescape(requestPath[5]) - const currentBranch = unescape(requestPath[6]) - const contributionsBranch = unescape(requestPath[7]) - let error - - /* Unsaving # */ - for (let i = 0; i < 10; i++) { - commitMessage = commitMessage.replace('_SLASH_', '/') - commitMessage = commitMessage.replace('_HASHTAG_', '#') - } - - updateUser() - - async function updateUser() { - - await doGithub() - if (error !== undefined) { - - let docs = { - project: 'Foundations', - category: 'Topic', - type: 'App Error - Contribution Not Sent', - anchor: undefined, - placeholder: {} - } - console.log('respond with docs ') - - respondWithDocsObject(docs, error) - return - } - SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) - - } - - async function doGithub() { - - const { Octokit } = SA.nodeModules.octokit - - const octokit = new Octokit({ - auth: token, - userAgent: 'Superalgos Beta 12' - }) - - const repo = 'Superalgos' - const owner = 'Superalgos' - const head = username + ':' + contributionsBranch - const base = currentBranch - const title = 'Contribution: ' + commitMessage - const path = 'Projects/Governance/Plugins/User-Profiles/' + username + '.json' ; - - const sha = await getSHA(path, octokit); - let file = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent( - 'Governance', - 'User-Profiles', - username + '.json' - ) - - let buff = new Buffer.from(file, 'utf-8'); - let encodedFile = buff.toString('base64'); - - try { - await octokit.repos.createOrUpdateFileContents({ - owner: username, - repo: "Superalgos", - path, - message: title, - content: encodedFile, - sha, - branch: base - }); - } catch (err) { - if (err.stack.indexOf('Error User Commit') >= 0) { - return - } else { - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.') - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch) - error = err - } - } - - try { - await octokit.pulls.create({ - owner, - repo, - title, - head, - base, - }); - } catch (err) { - if (err.stack.indexOf('A pull request already exists') >= 0) { - return - } else { - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.') - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch) - error = err - } - - } - } - - async function getSHA(path, octokit) { - let sha = '' - try{ - const result = await octokit.repos.getContent({ - owner: username, - repo: "Superalgos", - path, - ref: currentBranch - }); - sha = result.data.sha - return sha - - } catch (err) { - if (err.message === 'Not Found') { - console.log("[User Not Found] -> Creating new user") - return sha - } else { - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.') - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch) - console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch) - return sha - } - } - } - - } catch (err) { - console.log('[ERROR] httpInterface -> App -> Contribute -> Method call produced an error.') - console.log('[ERROR] httpInterface -> App -> Contribute -> err.stack = ' + err.stack) - console.log('[ERROR] httpInterface -> App -> Contribute -> commitMessage = ' + commitMessage) - console.log('[ERROR] httpInterface -> App -> Contribute -> username = ' + username) - console.log('[ERROR] httpInterface -> App -> Contribute -> token starts with = ' + token.substring(0, 10) + '...') - console.log('[ERROR] httpInterface -> App -> Contribute -> token ends with = ' + '...' + token.substring(token.length - 10)) - console.log('[ERROR] httpInterface -> App -> Contribute -> currentBranch = ' + currentBranch) - console.log('[ERROR] httpInterface -> App -> Contribute -> contributionsBranch = ' + contributionsBranch) - - let error = { - result: 'Fail Because', - message: err.message, - stack: err.stack - } - SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse) - } - break - } - case 'Checkout': { try { const currentBranch = unescape(requestPath[3]) @@ -1439,6 +1273,183 @@ exports.newHttpInterface = function newHttpInterface() { return } + + case 'contributeUserProfile': { + try { + + let commitMessage = params.message + const username = params.username + const token = params.token + const currentBranch = params.currentBranch + const contributionsBranch = params.contributionsBranch + + /* + let commitMessage = unescape(requestPath[3]) + const username = unescape(requestPath[4]) + const token = unescape(requestPath[5]) + const currentBranch = unescape(requestPath[6]) + const contributionsBranch = unescape(requestPath[7]) + */ + + let error + + /* Unsaving # */ + for (let i = 0; i < 10; i++) { + commitMessage = commitMessage.replace('_SLASH_', '/') + commitMessage = commitMessage.replace('_HASHTAG_', '#') + } + + await updateUser() + + async function updateUser() { + + await doGithub() + if (error !== undefined) { + + let docs = { + project: 'Governance', + category: 'Topic', + type: 'Gov Error - Contribution Not Sent', + anchor: undefined, + placeholder: {} + } + console.log('respond with docs ') + + respondWithDocsObject(docs, error) + return + } + SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) + + } + + async function doGithub() { + + const { Octokit } = SA.nodeModules.octokit + + const octokit = new Octokit({ + auth: token, + userAgent: 'Superalgos Beta 12' + }) + + const repo = 'Superalgos' + const owner = 'Superalgos' + const head = username + ':' + contributionsBranch + const base = currentBranch + const title = 'Contribution: ' + commitMessage + const path = 'Projects/Governance/Plugins/User-Profiles/' + username + '.json' ; + + const sha = await getSHA(path, octokit); + let file = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent( + 'Governance', + 'User-Profiles', + username + '.json' + ) + + let buff = new Buffer.from(file, 'utf-8'); + let encodedFile = buff.toString('base64'); + + try { + await octokit.repos.createOrUpdateFileContents({ + owner: username, + repo: "Superalgos", + path, + message: title, + content: encodedFile, + sha, + branch: base + }); + } catch (err) { + if (err.stack.indexOf('Error User Commit') >= 0) { + return + } else { + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.') + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch) + error = err + } + } + + try { + await octokit.pulls.create({ + owner, + repo, + title, + head, + base, + }); + } catch (err) { + if (err.stack.indexOf('A pull request already exists') >= 0) { + return + } else { + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.') + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch) + error = err + } + + } + } + + async function getSHA(path, octokit) { + let sha = '' + try{ + const result = await octokit.repos.getContent({ + owner: username, + repo: "Superalgos", + path, + ref: currentBranch + }); + sha = result.data.sha + return sha + + } catch (err) { + if (err.message === 'Not Found') { + console.log("[User Not Found] -> Creating new user") + return sha + } else { + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.') + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch) + return sha + } + } + } + + } catch (err) { + console.log('[ERROR] httpInterface -> App -> Contribute -> Method call produced an error.') + console.log('[ERROR] httpInterface -> App -> Contribute -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> App -> Contribute -> commitMessage = ' + commitMessage) + console.log('[ERROR] httpInterface -> App -> Contribute -> username = ' + username) + console.log('[ERROR] httpInterface -> App -> Contribute -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> App -> Contribute -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> App -> Contribute -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> App -> Contribute -> contributionsBranch = ' + contributionsBranch) + + let error = { + result: 'Fail Because', + message: err.message, + stack: err.stack + } + SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse) + } + break + } + case 'payContributors': { console.log('----------------------------------------------------------------------------------------------') console.log('DISTRIBUTION PROCESS STARTED') diff --git a/Projects/Education/UI/Spaces/Docs-Space/CommandInterface.js b/Projects/Education/UI/Spaces/Docs-Space/CommandInterface.js index c7c425b19..37b0a6dd4 100644 --- a/Projects/Education/UI/Spaces/Docs-Space/CommandInterface.js +++ b/Projects/Education/UI/Spaces/Docs-Space/CommandInterface.js @@ -26,7 +26,6 @@ function newFoundationsDocsCommmandInterface() { function detectAppCommands() { if (checkContributeCommand() === undefined) { return true } - if (checkUserUpdateCommand() === undefined) { return true } if (checkUpdateCommand() === undefined) { return true } if (fixAppSchema() === undefined) { return true } @@ -99,75 +98,6 @@ function newFoundationsDocsCommmandInterface() { } } - function checkUserUpdateCommand() { - if (UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase() === 'app.help app.userupdate') { - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Userupdate Command') - return - } - if (UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('App.UserUpdate') !== 0 && UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('app.userupdate') !== 0) { return 'Not Contribute Commands' } - - /* Set up the commit message */ - let message = UI.projects.education.spaces.docsSpace.commandInterface.command.trim().substring(UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.education.spaces.docsSpace.commandInterface.command.length) - if (message.toLowerCase() === 'app.userupdate') { - message = 'This is my UserUpdate to Superalgos' - } - - /* Find the Username and Password */ - let apisNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadByNodeType('APIs') - if (apisNode === undefined) { - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Error - Github Credentials Missing', 'Anchor Github Credentials Missing') - return - } - if (apisNode.githubAPI === undefined) { - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Error - Github Credentials Missing', 'Anchor Github Credentials Missing') - return - } - - let config = JSON.parse(apisNode.githubAPI.config) - if (config.username === undefined || config.username === "") { - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Error - Github Credentials Missing', 'Anchor Github Credentials Missing') - return - } - if (config.token === undefined || config.token === "") { - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Error - Github Credentials Missing', 'Anchor Github Credentials Missing') - return - } - - message = message.replaceAll('#', '_HASHTAG_') - message = message.replaceAll('/', '_SLASH_') - - httpRequest( - undefined, - 'App/UserUpdate/' + - message + '/' + - config.username + '/' + - config.token + '/' + - UI.projects.education.spaces.docsSpace.currentBranch + '/' + - UI.projects.education.spaces.docsSpace.contributionsBranch - , onResponse) - - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Message - UserUpdate Request') - - return - - function onResponse(err, data) { - /* Lets check the result of the call through the http interface */ - data = JSON.parse(data) - if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Message - UserUpdate Done') - } else { - UI.projects.education.spaces.docsSpace.navigateTo( - data.docs.project, - data.docs.category, - data.docs.type, - data.docs.anchor, - undefined, - data.docs.placeholder - ) - } - } - } - function checkUpdateCommand() { if (UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase() === 'app.help app.update') { UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'App Update Command') diff --git a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js index 0cbb3d063..de3694b11 100644 --- a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js +++ b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js @@ -24,6 +24,7 @@ function newGovernanceReportsCommmandInterface() { function detectGovCommands() { if (checkPRsCommand() === undefined) { return true } + if (checkUserUpdateCommand() === undefined) { return true } if (checkPayCommand() === undefined) { return true } function checkPRsCommand() { @@ -118,6 +119,89 @@ function newGovernanceReportsCommmandInterface() { } } + function checkUserUpdateCommand() { + if (UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase() === 'gov.help gov.contributeUserProfile') { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Contribute User Profile Command') + return + } + if (UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('gov.contributeUserProfile') !== 0 && UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('gov.contributeuserprofile') !== 0) { return 'Not Contribute Commands' } + + /* Set up the commit message */ + let message = UI.projects.education.spaces.docsSpace.commandInterface.command.trim().substring(UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.education.spaces.docsSpace.commandInterface.command.length) + if (message.toLowerCase() === 'gov.contributeuserprofile') { + message = 'This is my Contribute User Profile to Superalgos' + } + + UI.projects.governance.spaces.reportsSpace.sidePanelTab.close() + UI.projects.education.spaces.docsSpace.sidePanelTab.open() + + /* Find the Username and Password */ + let apisNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadByNodeType('APIs') + if (apisNode === undefined) { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing') + return + } + if (apisNode.githubAPI === undefined) { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing') + return + } + + let config = JSON.parse(apisNode.githubAPI.config) + if (config.username === undefined || config.username === "") { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing') + return + } + if (config.token === undefined || config.token === "") { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing') + return + } + + message = message.replaceAll('#', '_HASHTAG_') + message = message.replaceAll('/', '_SLASH_') + + let params = { + method: 'contributeUserProfile', + commitMessage: message, + username: config.username, + token: config.token, + currentBranch: UI.projects.education.spaces.docsSpace.currentBranch, + contributionsBranch: UI.projects.education.spaces.docsSpace.contributionsBranch + } + + let url = 'GOV' // We will access the default Client GOV endpoint. + + httpRequest(JSON.stringify(params), url, onResponse) +/* + httpRequest( + undefined, + 'App/contributeUserProfile/' + + message + '/' + + config.username + '/' + + config.token + '/' + + UI.projects.education.spaces.docsSpace.currentBranch + '/' + + UI.projects.education.spaces.docsSpace.contributionsBranch + , onResponse) + + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'App Message - Contribute User Profile Request') +*/ + function onResponse(err, data) { + /* Lets check the result of the call through the http interface */ + data = JSON.parse(data) + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Contribute User Profile Done') + } else { + UI.projects.education.spaces.docsSpace.navigateTo( + data.docs.project, + data.docs.category, + data.docs.type, + data.docs.anchor, + undefined, + data.docs.placeholder + ) + } + } + } + function checkPayCommand() { let command = UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() From a907a112520e2eb0b599c8c2e4f10dca1f3776f2 Mon Sep 17 00:00:00 2001 From: Tentacule23 Date: Tue, 26 Oct 2021 13:12:24 -0400 Subject: [PATCH 09/11] app.contributeuserprofile --- .../UI/Spaces/Reports-Space/CommandInterface.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js index de3694b11..4fb090822 100644 --- a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js +++ b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js @@ -171,19 +171,7 @@ function newGovernanceReportsCommmandInterface() { let url = 'GOV' // We will access the default Client GOV endpoint. httpRequest(JSON.stringify(params), url, onResponse) -/* - httpRequest( - undefined, - 'App/contributeUserProfile/' + - message + '/' + - config.username + '/' + - config.token + '/' + - UI.projects.education.spaces.docsSpace.currentBranch + '/' + - UI.projects.education.spaces.docsSpace.contributionsBranch - , onResponse) - UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'App Message - Contribute User Profile Request') -*/ function onResponse(err, data) { /* Lets check the result of the call through the http interface */ data = JSON.parse(data) From 276d26d5c1446559830c23c7931927abd5d8ef63 Mon Sep 17 00:00:00 2001 From: GustavoH Date: Tue, 26 Oct 2021 19:51:57 +0200 Subject: [PATCH 10/11] This is my contribution to Superalgos --- .../User-Profiles/gustavohcorradi.json | 160 ++++++++++++------ 1 file changed, 105 insertions(+), 55 deletions(-) diff --git a/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json b/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json index a0cd30e43..5f6db5998 100644 --- a/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json +++ b/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json @@ -26,12 +26,12 @@ "id": "2cd3a742-6540-4326-a3f5-8ad8da177ee6", "savedPayload": { "position": { - "x": 35150, - "y": 17470.577136594 + "x": 5634, + "y": 45050.577136594 }, "targetPosition": { - "x": 35300, - "y": 17730.384757729335 + "x": 5784, + "y": 45310.384757729335 }, "floatingObject": { "isPinned": false, @@ -49,12 +49,12 @@ "id": "ee0124d9-1e12-4819-9dd9-bb1ca8840483", "savedPayload": { "position": { - "x": 35300, - "y": 17730.384757729335 + "x": 5784, + "y": 45310.384757729335 }, "targetPosition": { - "x": 35450, - "y": 17990.192378864667 + "x": 5934, + "y": 45570.19237886467 }, "floatingObject": { "isPinned": false, @@ -81,12 +81,12 @@ "id": "49472434-c0b7-4561-adac-4c7709f79ac5", "savedPayload": { "position": { - "x": 36050, - "y": 17990.192378864667 + "x": 6534, + "y": 45570.19237886467 }, "targetPosition": { - "x": 35750, - "y": 17990.192378864667 + "x": 6234, + "y": 45570.19237886467 }, "floatingObject": { "isPinned": false, @@ -104,12 +104,12 @@ "id": "d83ff511-36ab-484d-a481-12118e29204f", "savedPayload": { "position": { - "x": 35750, - "y": 17990.192378864667 + "x": 6234, + "y": 45570.19237886467 }, "targetPosition": { - "x": 35450, - "y": 17990.192378864667 + "x": 5934, + "y": 45570.19237886467 }, "floatingObject": { "isPinned": false, @@ -127,12 +127,12 @@ "id": "1cd251c3-5a87-435e-a262-42323aed0bc4", "savedPayload": { "position": { - "x": 35450, - "y": 17990.192378864667 + "x": 5934, + "y": 45570.19237886467 }, "targetPosition": { - "x": 35300, - "y": 18250 + "x": 5784, + "y": 45830 }, "floatingObject": { "isPinned": false, @@ -160,18 +160,18 @@ "userReferrers": [ { "type": "User Referrer", - "name": "", + "name": "gustavohcorradi", "config": "{}", "project": "Governance", "id": "979ab0fb-ca96-4d93-876a-fb2499bf8aa6", "savedPayload": { "position": { - "x": 35859.80762113533, - "y": 18619.615242270665 + "x": 6284.739181907657, + "y": 46126.671794627444 }, "targetPosition": { - "x": 35600, - "y": 18769.615242270665 + "x": 6084, + "y": 46349.615242270665 }, "floatingObject": { "isPinned": false, @@ -183,7 +183,57 @@ }, "uiObject": { "isRunning": false - } + }, + "referenceParent": { + "type": "User Profile", + "name": "gustavohcorradi", + "id": "96ccf2bc-e544-4b27-aa23-a7a734798fb4" + }, + "referenceParentCombinedNodePath": [ + [ + "gustavohcorradi", + "User Profile" + ] + ] + } + }, + { + "type": "User Referrer", + "name": "EvaMaria70", + "config": "{}", + "project": "Governance", + "id": "487a8367-b662-4192-b053-4335d6be8089", + "savedPayload": { + "position": { + "x": 6358.06363729278, + "y": 46471.63623519341 + }, + "targetPosition": { + "x": 6084, + "y": 46349.615242270665 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 1, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + }, + "referenceParent": { + "type": "User Profile", + "name": "EvaMaria70", + "id": "75a78d74-93f3-44c5-a96a-5b2b9f730afe" + }, + "referenceParentCombinedNodePath": [ + [ + "EvaMaria70", + "User Profile" + ] + ] } } ], @@ -194,12 +244,12 @@ "id": "0ab1e6ee-9db2-463f-a347-71940500475e", "savedPayload": { "position": { - "x": 35750, - "y": 19029.422863406 + "x": 6052.641461019704, + "y": 46647.97181088115 }, "targetPosition": { - "x": 35600, - "y": 18769.615242270665 + "x": 6084, + "y": 46349.615242270665 }, "floatingObject": { "isPinned": false, @@ -221,12 +271,12 @@ "id": "f93b30b2-f600-43be-875a-86407b7b573f", "savedPayload": { "position": { - "x": 35340.19237886467, - "y": 18919.615242270665 + "x": 5790.555719779858, + "y": 46411.98874951599 }, "targetPosition": { - "x": 35600, - "y": 18769.615242270665 + "x": 6084, + "y": 46349.615242270665 }, "floatingObject": { "isPinned": false, @@ -244,12 +294,12 @@ "id": "889d794d-6a98-4ae2-b81c-b1786ee37b35", "savedPayload": { "position": { - "x": 35600, - "y": 18769.615242270665 + "x": 6084, + "y": 46349.615242270665 }, "targetPosition": { - "x": 35450, - "y": 18509.807621135333 + "x": 5934, + "y": 46089.80762113533 }, "floatingObject": { "isPinned": false, @@ -267,12 +317,12 @@ "id": "b7c934fd-8031-4615-bf9c-94280e452511", "savedPayload": { "position": { - "x": 35450, - "y": 18509.807621135333 + "x": 5934, + "y": 46089.80762113533 }, "targetPosition": { - "x": 35300, - "y": 18250 + "x": 5784, + "y": 45830 }, "floatingObject": { "isPinned": false, @@ -290,12 +340,12 @@ "id": "b70247f5-4442-4433-b35f-aa64a2f7c174", "savedPayload": { "position": { - "x": 35300, - "y": 18250 + "x": 5784, + "y": 45830 }, "targetPosition": { - "x": 35000, - "y": 18250 + "x": 5484, + "y": 45830 }, "floatingObject": { "isPinned": false, @@ -317,12 +367,12 @@ "id": "899f92f8-5e00-42a0-8316-10c95dd2a6b1", "savedPayload": { "position": { - "x": 34700, - "y": 18250 + "x": 5184, + "y": 45830 }, "targetPosition": { - "x": 35000, - "y": 18250 + "x": 5484, + "y": 45830 }, "floatingObject": { "isPinned": false, @@ -340,15 +390,15 @@ "id": "96ccf2bc-e544-4b27-aa23-a7a734798fb4", "savedPayload": { "position": { - "x": 35000, - "y": 18250 + "x": 5484, + "y": 45830 }, "targetPosition": { - "x": 35000, - "y": 18250 + "x": 5484, + "y": 45830 }, "floatingObject": { - "isPinned": false, + "isPinned": true, "isFrozen": false, "isCollapsed": false, "angleToParent": 1, From dff8824b1a3bc6589a8266cc116b7e89ed79f107 Mon Sep 17 00:00:00 2001 From: GustavoH Date: Tue, 26 Oct 2021 20:34:41 +0200 Subject: [PATCH 11/11] update3 user profile plugin --- .../User-Profiles/gustavohcorradi.json | 203 +++++++++++++----- 1 file changed, 145 insertions(+), 58 deletions(-) diff --git a/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json b/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json index 5f6db5998..d2046c9a1 100644 --- a/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json +++ b/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json @@ -26,12 +26,12 @@ "id": "2cd3a742-6540-4326-a3f5-8ad8da177ee6", "savedPayload": { "position": { - "x": 5634, - "y": 45050.577136594 + "x": 18900, + "y": 32420.577136594 }, "targetPosition": { - "x": 5784, - "y": 45310.384757729335 + "x": 19050, + "y": 32680.384757729335 }, "floatingObject": { "isPinned": false, @@ -49,12 +49,12 @@ "id": "ee0124d9-1e12-4819-9dd9-bb1ca8840483", "savedPayload": { "position": { - "x": 5784, - "y": 45310.384757729335 + "x": 19050, + "y": 32680.384757729335 }, "targetPosition": { - "x": 5934, - "y": 45570.19237886467 + "x": 19200, + "y": 32940.19237886467 }, "floatingObject": { "isPinned": false, @@ -81,12 +81,12 @@ "id": "49472434-c0b7-4561-adac-4c7709f79ac5", "savedPayload": { "position": { - "x": 6534, - "y": 45570.19237886467 + "x": 19800, + "y": 32940.19237886467 }, "targetPosition": { - "x": 6234, - "y": 45570.19237886467 + "x": 19500, + "y": 32940.19237886467 }, "floatingObject": { "isPinned": false, @@ -104,12 +104,12 @@ "id": "d83ff511-36ab-484d-a481-12118e29204f", "savedPayload": { "position": { - "x": 6234, - "y": 45570.19237886467 + "x": 19500, + "y": 32940.19237886467 }, "targetPosition": { - "x": 5934, - "y": 45570.19237886467 + "x": 19200, + "y": 32940.19237886467 }, "floatingObject": { "isPinned": false, @@ -127,12 +127,12 @@ "id": "1cd251c3-5a87-435e-a262-42323aed0bc4", "savedPayload": { "position": { - "x": 5934, - "y": 45570.19237886467 + "x": 19200, + "y": 32940.19237886467 }, "targetPosition": { - "x": 5784, - "y": 45830 + "x": 19050, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -166,12 +166,12 @@ "id": "979ab0fb-ca96-4d93-876a-fb2499bf8aa6", "savedPayload": { "position": { - "x": 6284.739181907657, - "y": 46126.671794627444 + "x": 19407.294901687517, + "y": 33174.490666246784 }, "targetPosition": { - "x": 6084, - "y": 46349.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -192,7 +192,9 @@ "referenceParentCombinedNodePath": [ [ "gustavohcorradi", - "User Profile" + "User Profile", + "Governance", + "96ccf2bc-e544-4b27-aa23-a7a734798fb4" ] ] } @@ -205,12 +207,12 @@ "id": "487a8367-b662-4192-b053-4335d6be8089", "savedPayload": { "position": { - "x": 6358.06363729278, - "y": 46471.63623519341 + "x": 19742.705098312483, + "y": 33283.47204544759 }, "targetPosition": { - "x": 6084, - "y": 46349.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -231,7 +233,9 @@ "referenceParentCombinedNodePath": [ [ "EvaMaria70", - "User Profile" + "User Profile", + "Governance", + "75a78d74-93f3-44c5-a96a-5b2b9f730afe" ] ] } @@ -244,12 +248,12 @@ "id": "0ab1e6ee-9db2-463f-a347-71940500475e", "savedPayload": { "position": { - "x": 6052.641461019704, - "y": 46647.97181088115 + "x": 19742.705098312483, + "y": 33636.143196823075 }, "targetPosition": { - "x": 6084, - "y": 46349.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -271,12 +275,12 @@ "id": "f93b30b2-f600-43be-875a-86407b7b573f", "savedPayload": { "position": { - "x": 5790.555719779858, - "y": 46411.98874951599 + "x": 19407.294901687517, + "y": 33745.12457602388 }, "targetPosition": { - "x": 6084, - "y": 46349.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -294,12 +298,95 @@ "id": "889d794d-6a98-4ae2-b81c-b1786ee37b35", "savedPayload": { "position": { - "x": 6084, - "y": 46349.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "targetPosition": { - "x": 5934, - "y": 46089.80762113533 + "x": 19200, + "y": 33459.80762113533 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 1, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + }, + "supportProgram": { + "type": "Support Program", + "name": "New Support Program", + "config": "{}", + "project": "Governance", + "userSupporters": [], + "tokensAwarded": { + "type": "Tokens Awarded", + "name": "New Tokens Awarded", + "project": "Governance", + "id": "de8ab30a-7777-420e-80ff-fa4a3fc37e75", + "savedPayload": { + "position": { + "x": 19200, + "y": 33979.422863406 + }, + "targetPosition": { + "x": 19050, + "y": 33719.615242270665 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 1, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + }, + "tokensBonus": { + "type": "Tokens Bonus", + "name": "New Tokens Bonus", + "project": "Governance", + "id": "c6bc8cb9-1d39-431e-a462-7965a54df591", + "savedPayload": { + "position": { + "x": 18750, + "y": 33719.615242270665 + }, + "targetPosition": { + "x": 19050, + "y": 33719.615242270665 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 1, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + }, + "id": "7c573389-95d7-4b3f-88aa-35fd61f474f6", + "savedPayload": { + "position": { + "x": 19050, + "y": 33719.615242270665 + }, + "targetPosition": { + "x": 19200, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -317,12 +404,12 @@ "id": "b7c934fd-8031-4615-bf9c-94280e452511", "savedPayload": { "position": { - "x": 5934, - "y": 46089.80762113533 + "x": 19200, + "y": 33459.80762113533 }, "targetPosition": { - "x": 5784, - "y": 45830 + "x": 19050, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -340,12 +427,12 @@ "id": "b70247f5-4442-4433-b35f-aa64a2f7c174", "savedPayload": { "position": { - "x": 5784, - "y": 45830 + "x": 19050, + "y": 33200 }, "targetPosition": { - "x": 5484, - "y": 45830 + "x": 18750, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -367,12 +454,12 @@ "id": "899f92f8-5e00-42a0-8316-10c95dd2a6b1", "savedPayload": { "position": { - "x": 5184, - "y": 45830 + "x": 18450, + "y": 33200 }, "targetPosition": { - "x": 5484, - "y": 45830 + "x": 18750, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -390,12 +477,12 @@ "id": "96ccf2bc-e544-4b27-aa23-a7a734798fb4", "savedPayload": { "position": { - "x": 5484, - "y": 45830 + "x": 18750, + "y": 33200 }, "targetPosition": { - "x": 5484, - "y": 45830 + "x": 18750, + "y": 33200 }, "floatingObject": { "isPinned": true,