diff --git a/Docker/README.md b/Docker/README.md index 257ac96b6..151d21f8e 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -111,9 +111,9 @@ docker run \ --user $(id -u):$(id -g) \ -p 18041:18041 \ -p 34248:34248 \ - -v $(pwd)/Data-Storage:/app/Data-Storage \ - -v $(pwd)/Log-Files:/app/Log-Files \ - -v $(pwd)/My-Workspaces:/app/My-Workspaces \ + -v $(pwd)/Data-Storage:/app/Platform/Data-Storage \ + -v $(pwd)/Log-Files:/app/Platform/Log-Files \ + -v $(pwd)/My-Workspaces:/app/Platform/My-Workspaces \ ghcr.io/superalgos/superalgos:latest ``` @@ -135,9 +135,9 @@ docker run \ --user $(id -u):$(id -g) \ -p 18041:18041 \ -p 34248:34248 \ - -v $(pwd)/Data-Storage:/app/Data-Storage \ - -v $(pwd)/Log-Files:/app/Log-Files \ - -v $(pwd)/My-Workspaces:/app/My-Workspaces \ + -v $(pwd)/Data-Storage:/app/Platform/Data-Storage \ + -v $(pwd)/Log-Files:/app/Platform/Log-Files \ + -v $(pwd)/My-Workspaces:/app/Platform/My-Workspaces \ ghcr.io/superalgos/superalgos:latest ``` @@ -169,9 +169,9 @@ services: - '34248:34248' - '18041:18041' volumes: - - ./Data-Storage:/app/Data-Storage - - ./Log-Files:/app/Log-Files - - ./My-Workspaces:/app/My-Workspaces + - ./Data-Storage:/app/Platform/Data-Storage + - ./Log-Files:/app/Platform/Log-Files + - ./My-Workspaces:/app/Platform/My-Workspaces restart: on-failure ``` diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index cda5924b7..d90b5ad8a 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,169 @@ exports.newHttpInterface = function newHttpInterface() { return } + + case 'UserProfile': { + try { + + let mess = unescape(params.commitMessage) + const username = unescape(params.username) + const token = unescape(params.token) + const currentBranch = unescape(params.currentBranch) + const contributionsBranch = unescape(params.contributionsBranch) + + let error + + await updateUser() + + async function updateUser() { + + await doGithubUser() + 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 doGithubUser() { + + 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: ' + mess + 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 -> Gov -> contributeUserProfile -> doGithub -> Method call produced an error.') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> commitMessage = ' + mess) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> username = ' + username) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> 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 -> Gov -> contributeUserProfile -> doGithub -> Method call produced an error.') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> commitMessage = ' + mess) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> username = ' + username) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> 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 -> Gov -> contributeUserProfile -> doGithub -> Method call produced an error.') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> commitMessage = ' + mess) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> username = ' + username) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> doGithub -> contributionsBranch = ' + contributionsBranch) + return sha + } + } + } + + } catch (err) { + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> Method call produced an error.') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> commitMessage = ' + mess) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> username = ' + username) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> token ends with = ' + '...' + token.substring(token.length - 10)) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> currentBranch = ' + currentBranch) + console.log('[ERROR] httpInterface -> Gov -> contributeUserProfile -> 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/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/Foundations/UI/Function-Libraries/ProductFunctions.js b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js new file mode 100644 index 000000000..a5a34fd60 --- /dev/null +++ b/Projects/Foundations/UI/Function-Libraries/ProductFunctions.js @@ -0,0 +1,341 @@ +function newFoundationsFunctionLibraryProductFunctions() { + let thisObject = { + installProduct: installProduct, + + } + + return thisObject + + /** + * + * 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( + node, + rootNodes + ) { + + 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. ') + + setTimeout(startInstalling, 500) + + function startInstalling() { + + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === 'Trading Mine') { + installInTradingMine(rootNode) + } + } + + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.type === 'LAN Network') { + installInNetworkNodes(rootNode) + } + } + + 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++) { + 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 = ceateTaskIfNotPresent(dataMineDependency.taskManagers[0]) + let indicatorBot = createIndicatorBotIfNotPresent(task) + + 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 = ceateTaskIfNotPresent(newTaskManager) + let indicatorBot = createIndicatorBotIfNotPresent(task) + + createIndicatorProcessInstanceIfNotPresent(indicatorBot) + + } + + } + } + } + + + 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') + newTask.name = productIndicatorBot.name + + return newTask + } + return 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') + newBotInstance.name = productIndicatorBot.name + + return newBotInstance + } + return botInstance + } + + 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) + } + } + + } + + /** + * + * 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] + + 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 (botProductDependencies !== undefined) { + createDataProductIfNotPresent(botProductDependencies) + } else { + let newBotProductDependencies = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(dataMineProduct, 'Bot Products') + newBotProductDependencies.name = productIndicatorBot.name + createDataProductIfNotPresent(newBotProductDependencies) + } + + function createDataProductIfNotPresent(botProductDependencies) { + dataProduct = UI.projects.visualScripting.utilities.nodeChildren.findOrCreateChildWithReference(botProductDependencies, 'Data Product', product) + } + } + + } + } + + } + + } + + 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 addAllDataDependenciesIfNotExists(botDataDependencies) { + for (let l = 0; l < product.datasets.length; l++) { + let dataset = product.datasets[l] + + // 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++) { + let 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] + + for (let k = 0; k < projectDashboard.dashboards.length; k++) { + let dashboard = projectDashboard.dashboards[k] + + 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) + 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 + } + + } + // 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 + + let layerManager = newTimelineChart.layerManager + UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(layerManager, dataMineProduct) + + let botLayer = createBotLayerIfNotPresent(layerManager) + createLayerIfNotPresent(botLayer) + + } + + 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) + } + } + } + } + + } + + } + + + } + +} + + + diff --git a/Projects/Governance/Plugins/User-Profiles/Barrypair.json b/Projects/Governance/Plugins/User-Profiles/Barrypair.json index 3564f9f92..14e28f8ab 100644 --- a/Projects/Governance/Plugins/User-Profiles/Barrypair.json +++ b/Projects/Governance/Plugins/User-Profiles/Barrypair.json @@ -1,7 +1,7 @@ { "type": "User Profile", "name": "Barrypair", - "config": "{\n \"signature\": {\n \"message\": \"Barrypair\",\n \"messageHash\": \"0x0ecb1ac0ac1e562c992030442ebfd224a28cc4d1c37c87f3b4ecaaae543049d6\",\n \"v\": \"0x1b\",\n \"r\": \"0x6f38aba8879d6e46e48030c49e5714e5ffb36da28be92c324b3bdc94271dc9d6\",\n \"s\": \"0x3cfa1f0de3f3239565e35c094bf51728b39a84c52d0b5f2e6a6f52414bc37774\",\n \"signature\": \"0x6f38aba8879d6e46e48030c49e5714e5ffb36da28be92c324b3bdc94271dc9d63cfa1f0de3f3239565e35c094bf51728b39a84c52d0b5f2e6a6f52414bc377741b\"\n }\n}", + "config": "{\n \"signature\": {\n \"message\": \"Barrypair\",\n \"messageHash\": \"0x0ecb1ac0ac1e562c992030442ebfd224a28cc4d1c37c87f3b4ecaaae543049d6\",\n \"v\": \"0x1b\",\n \"r\": \"0x6f38aba8879d6e46e48030c49e5714e5ffb36da28be92c324b3bdc94271dc9d6\",\n \"s\": \"0x3cfa1f0de3f3239565e35c094bf51728b39a84c52d0b5f2e6a6f52414bc37774\",\n \"signature\": \"0x6f38aba8879d6e46e48030c49e5714e5ffb36da28be92c324b3bdc94271dc9d63cfa1f0de3f3239565e35c094bf51728b39a84c52d0b5f2e6a6f52414bc377741b\"\n },\n \"codeName\": \"Barrypair\"\n}", "project": "Governance", "tokenPowerSwitch": { "type": "Token Power Switch", @@ -26,12 +26,12 @@ "id": "8ba512e1-0a27-4096-aa10-8a95691ba19d", "savedPayload": { "position": { - "x": 23749.38475772933, - "y": 24748 + "x": 8603.914169494044, + "y": 37400 }, "targetPosition": { - "x": 24009.192378864664, - "y": 24898 + "x": 8863.721790629375, + "y": 37550 }, "floatingObject": { "isPinned": false, @@ -49,12 +49,12 @@ "id": "0ff2bdaf-c589-46fa-8637-c340abd900d1", "savedPayload": { "position": { - "x": 24009.192378864664, - "y": 24898 + "x": 8863.721790629375, + "y": 37550 }, "targetPosition": { - "x": 24268.999999999996, - "y": 25048 + "x": 9123.529411764706, + "y": 37700 }, "floatingObject": { "isPinned": false, @@ -72,7 +72,7 @@ "githubProgram": { "type": "Github Program", "name": "New Github Program", - "config": "{\n \"username\": \"Barrypair\",\n \"token\": \"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\"\n}", + "config": "{\n \"username\": \"Barrypair\",\n \"token\": \"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\"\n}", "project": "Governance", "tokensAwarded": { "type": "Tokens Awarded", @@ -81,12 +81,12 @@ "id": "62a6efdc-2726-47f4-98dc-17824ac8ebe0", "savedPayload": { "position": { - "x": 24788.615242270662, - "y": 24748 + "x": 9643.144654035368, + "y": 37400 }, "targetPosition": { - "x": 24528.80762113533, - "y": 24898 + "x": 9383.337032900037, + "y": 37550 }, "floatingObject": { "isPinned": false, @@ -104,12 +104,12 @@ "id": "7a3603dd-07af-4491-b214-0e3475de4287", "savedPayload": { "position": { - "x": 24528.80762113533, - "y": 24898 + "x": 9383.337032900037, + "y": 37550 }, "targetPosition": { - "x": 24268.999999999996, - "y": 25048 + "x": 9123.529411764706, + "y": 37700 }, "floatingObject": { "isPinned": false, @@ -127,12 +127,12 @@ "id": "a1b78940-f1ec-4e19-8486-8c792798be91", "savedPayload": { "position": { - "x": 24268.999999999996, - "y": 25048 + "x": 9123.529411764706, + "y": 37700 }, "targetPosition": { - "x": 24268.999999999996, - "y": 25348 + "x": 9123.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -166,12 +166,12 @@ "id": "222d1751-bf6b-40df-a7eb-ff307b6c0ac1", "savedPayload": { "position": { - "x": 24268.999999999996, - "y": 25048 + "x": 9123.529411764706, + "y": 37700 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25048 + "x": 9423.529411764706, + "y": 37700 }, "floatingObject": { "isPinned": false, @@ -207,12 +207,12 @@ "id": "b61ae0d0-86b4-4738-906e-00b08db88ab0", "savedPayload": { "position": { - "x": 24568.999999999996, - "y": 24748 + "x": 9423.529411764706, + "y": 37400 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25048 + "x": 9423.529411764706, + "y": 37700 }, "floatingObject": { "isPinned": false, @@ -238,8 +238,8 @@ "y": 25634.615242270662 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25048 + "x": 9423.529411764706, + "y": 37700 }, "floatingObject": { "isPinned": true, @@ -257,12 +257,12 @@ "id": "79381140-de0d-4b79-801e-b0377bdb1677", "savedPayload": { "position": { - "x": 24568.999999999996, - "y": 25048 + "x": 9423.529411764706, + "y": 37700 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25348 + "x": 9423.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -295,8 +295,8 @@ "y": 25778.615242270662 }, "targetPosition": { - "x": 24868.999999999996, - "y": 25348 + "x": 9723.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": true, @@ -332,12 +332,12 @@ "id": "4e9a955b-e97a-409c-b50e-34cc68dea1a5", "savedPayload": { "position": { - "x": 25168.999999999996, - "y": 25348 + "x": 10023.529411764706, + "y": 38000 }, "targetPosition": { - "x": 24868.999999999996, - "y": 25348 + "x": 9723.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -363,8 +363,8 @@ "y": 25994.615242270662 }, "targetPosition": { - "x": 24868.999999999996, - "y": 25348 + "x": 9723.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": true, @@ -382,12 +382,12 @@ "id": "9c974ddc-c9b9-486e-908d-0ddf787d079b", "savedPayload": { "position": { - "x": 24868.999999999996, - "y": 25348 + "x": 9723.529411764706, + "y": 38000 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25348 + "x": 9423.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -416,12 +416,12 @@ "id": "37be08da-377c-4f2c-95c4-9ac090d61543", "savedPayload": { "position": { - "x": 24868.999999999996, - "y": 25648 + "x": 9723.529411764706, + "y": 38300 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25648 + "x": 9423.529411764706, + "y": 38300 }, "floatingObject": { "isPinned": false, @@ -457,12 +457,12 @@ "id": "994b4c49-04cb-484f-b9f5-63382deb8213", "savedPayload": { "position": { - "x": 24568.999999999996, - "y": 25948 + "x": 9423.529411764706, + "y": 38600 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25648 + "x": 9423.529411764706, + "y": 38300 }, "floatingObject": { "isPinned": false, @@ -488,8 +488,8 @@ "y": 25706 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25648 + "x": 9423.529411764706, + "y": 38300 }, "floatingObject": { "isPinned": true, @@ -507,12 +507,12 @@ "id": "f0ed57dd-284d-4fad-bd9e-3f05bd5c3674", "savedPayload": { "position": { - "x": 24568.999999999996, - "y": 25648 + "x": 9423.529411764706, + "y": 38300 }, "targetPosition": { - "x": 24568.999999999996, - "y": 25348 + "x": 9423.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -530,12 +530,12 @@ "id": "29fb441b-7e97-4ea1-91ea-61e386477b76", "savedPayload": { "position": { - "x": 24568.999999999996, - "y": 25348 + "x": 9423.529411764706, + "y": 38000 }, "targetPosition": { - "x": 24268.999999999996, - "y": 25348 + "x": 9123.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -558,12 +558,12 @@ "id": "0f1aaa78-85f6-420c-a4e1-e425b33dc206", "savedPayload": { "position": { - "x": 24268.999999999996, - "y": 25648 + "x": 9123.529411764706, + "y": 38300 }, "targetPosition": { - "x": 24268.999999999996, - "y": 25348 + "x": 9123.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -581,12 +581,12 @@ "id": "b3560d24-9916-46c6-93d2-85d0eb47b2eb", "savedPayload": { "position": { - "x": 24268.999999999996, - "y": 25348 + "x": 9123.529411764706, + "y": 38000 }, "targetPosition": { - "x": 23968.999999999996, - "y": 25348 + "x": 8823.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -608,17 +608,17 @@ "id": "2eb9915f-6d47-45f5-9d9c-58d5cd685455", "savedPayload": { "position": { - "x": 23668.999999999996, - "y": 25348 + "x": 8523.529411764706, + "y": 38000 }, "targetPosition": { - "x": 23968.999999999996, - "y": 25348 + "x": 8823.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, "isFrozen": false, - "isCollapsed": true, + "isCollapsed": false, "angleToParent": 1, "distanceToParent": 3, "arrangementStyle": 0 @@ -631,12 +631,12 @@ "id": "33095088-c43b-4a78-bf60-9dff8a6c14a8", "savedPayload": { "position": { - "x": 23968.999999999996, - "y": 25348 + "x": 8823.529411764706, + "y": 38000 }, "targetPosition": { - "x": 23968.999999999996, - "y": 25348 + "x": 8823.529411764706, + "y": 38000 }, "floatingObject": { "isPinned": false, @@ -650,4 +650,4 @@ "isRunning": false } } -} +} \ No newline at end of file diff --git a/Projects/Governance/Plugins/User-Profiles/Tentacule23.json b/Projects/Governance/Plugins/User-Profiles/Tentacule23.json index d8cc85eeb..c56c692ce 100644 --- a/Projects/Governance/Plugins/User-Profiles/Tentacule23.json +++ b/Projects/Governance/Plugins/User-Profiles/Tentacule23.json @@ -26,12 +26,12 @@ "id": "deaea400-fa7f-48fd-a3fe-653b1bd18650", "savedPayload": { "position": { - "x": 4448.90800640108, - "y": 32513.204681296134 + "x": 26903.112030456607, + "y": 23040.192378864667 }, "targetPosition": { - "x": 4671.8514540442975, - "y": 32713.943863203793 + "x": 27162.91965159194, + "y": 23190.192378864667 }, "floatingObject": { "isPinned": false, @@ -49,12 +49,12 @@ "id": "97ae26ad-542d-4373-806a-593e979e1a1b", "savedPayload": { "position": { - "x": 4671.8514540442975, - "y": 32713.943863203793 + "x": 27162.91965159194, + "y": 23190.192378864667 }, "targetPosition": { - "x": 4894.794901687515, - "y": 32914.68304511145 + "x": 27422.727272727272, + "y": 23340.192378864667 }, "floatingObject": { "isPinned": false, @@ -81,12 +81,12 @@ "id": "54a2fcd6-e80c-4a30-84c0-d80ae9d197e9", "savedPayload": { "position": { - "x": 5019.541916178172, - "y": 32327.79448467117 + "x": 27422.727272727272, + "y": 22740.192378864667 }, "targetPosition": { - "x": 4957.168408932844, - "y": 32621.23876489131 + "x": 27422.727272727272, + "y": 23040.192378864667 }, "floatingObject": { "isPinned": false, @@ -104,12 +104,12 @@ "id": "786e62d1-6b32-49d9-8046-9c8577dbcd87", "savedPayload": { "position": { - "x": 4957.168408932844, - "y": 32621.23876489131 + "x": 27422.727272727272, + "y": 23040.192378864667 }, "targetPosition": { - "x": 4894.794901687515, - "y": 32914.68304511145 + "x": 27422.727272727272, + "y": 23340.192378864667 }, "floatingObject": { "isPinned": false, @@ -127,12 +127,12 @@ "id": "7e7f3e6e-30f4-400d-a1f6-b3611498b7bf", "savedPayload": { "position": { - "x": 4894.794901687515, - "y": 32914.68304511145 + "x": 27422.727272727272, + "y": 23340.192378864667 }, "targetPosition": { - "x": 4987.5, - "y": 33200 + "x": 27572.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -160,7 +160,7 @@ "userReferrers": [ { "type": "User Referrer", - "name": "PLuv", + "name": "", "config": "{}", "project": "Governance", "id": "bdf5f1d1-8441-4171-859f-d6e13f56ebd5", @@ -201,7 +201,7 @@ }, { "type": "User Referrer", - "name": "harrellbm", + "name": "", "config": "{}", "project": "Governance", "id": "67c981c9-f18b-4476-911e-9761b375386a", @@ -283,7 +283,7 @@ }, { "type": "User Referrer", - "name": "Julian-Molina", + "name": "", "config": "{}", "project": "Governance", "id": "b53f989c-8771-4000-81f3-aef821170101", @@ -315,7 +315,9 @@ "referenceParentCombinedNodePath": [ [ "Julian-Molina", - "User Profile" + "User Profile", + "Governance", + "b85aaac1-0708-4aec-97f9-bc3cc70e530a" ] ] } @@ -406,7 +408,7 @@ "userMentors": [ { "type": "User Mentor", - "name": "harrellbm", + "name": "", "config": "{}", "project": "Governance", "id": "41d5d8d6-8562-4fb6-a56d-4953ec7ba2db", @@ -526,12 +528,12 @@ "id": "db99bd94-cded-4ef0-bfb2-979cac295f7f", "savedPayload": { "position": { - "x": 5558.133909777092, - "y": 33014.589803375035 + "x": 28092.342514997934, + "y": 23300 }, "targetPosition": { - "x": 4987.5, - "y": 33200 + "x": 27572.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -576,12 +578,12 @@ "id": "008b3b69-cc01-4e09-9122-ec885a882d76", "savedPayload": { "position": { - "x": 6524.472195592687, - "y": 32643.27984087776 + "x": 28862.43870443027, + "y": 22595.577136594 }, "targetPosition": { - "x": 6190.057024127859, - "y": 32944.38861373925 + "x": 28637.43870443027, + "y": 22985.288568297 }, "floatingObject": { "isPinned": false, @@ -602,12 +604,12 @@ "id": "fb7f7b7e-a2fb-421f-8158-faa5006f4636", "savedPayload": { "position": { - "x": 6190.057024127859, - "y": 32944.38861373925 + "x": 28637.43870443027, + "y": 22985.288568297 }, "targetPosition": { - "x": 5855.641852663031, - "y": 33245.497386600735 + "x": 28412.43870443027, + "y": 23375 }, "floatingObject": { "isPinned": false, @@ -630,12 +632,12 @@ "id": "2bc7d2be-bd4a-47b8-966f-349202f799bf", "savedPayload": { "position": { - "x": 6283.61728499585, - "y": 33384.55503406946 + "x": 28862.43870443027, + "y": 23375 }, "targetPosition": { - "x": 5855.641852663031, - "y": 33245.497386600735 + "x": 28412.43870443027, + "y": 23375 }, "floatingObject": { "isPinned": false, @@ -653,12 +655,12 @@ "id": "f16e524c-4e32-4a6e-840b-bfdd6080f20c", "savedPayload": { "position": { - "x": 5855.641852663031, - "y": 33245.497386600735 + "x": 28412.43870443027, + "y": 23375 }, "targetPosition": { - "x": 5415.475432332819, - "y": 33339.057647468726 + "x": 28022.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -695,12 +697,12 @@ "id": "d7c5da08-3757-46b4-8175-bc9a7b02359f", "savedPayload": { "position": { - "x": 6892.281898350884, - "y": 33257.13643010531 + "x": 29401.938637175394, + "y": 23065.729997001305 }, "targetPosition": { - "x": 6390.659141153643, - "y": 33708.79958939754 + "x": 29064.438637175394, + "y": 23650.2971445558 }, "floatingObject": { "isPinned": false, @@ -754,12 +756,12 @@ "id": "5d6b30bc-4f05-4001-87ba-45cba35fe1ce", "savedPayload": { "position": { - "x": 7064.73407711298, - "y": 33744.126359861526 + "x": 29716.438569920516, + "y": 23475.5942891116 }, "targetPosition": { - "x": 6390.659141153643, - "y": 33708.79958939754 + "x": 29064.438637175394, + "y": 23650.2971445558 }, "floatingObject": { "isPinned": false, @@ -813,12 +815,12 @@ "id": "faa99198-6c04-4722-bbc2-f4dd4f9d297f", "savedPayload": { "position": { - "x": 6842.322300445872, - "y": 34210.42234659478 + "x": 29649.00578472989, + "y": 23987.7971445558 }, "targetPosition": { - "x": 6390.659141153643, - "y": 33708.79958939754 + "x": 29064.438637175394, + "y": 23650.2971445558 }, "floatingObject": { "isPinned": false, @@ -868,12 +870,12 @@ "id": "eb425c2c-6b7c-460d-a74e-650691f52fc7", "savedPayload": { "position": { - "x": 6390.659141153643, - "y": 33708.79958939754 + "x": 29064.438637175394, + "y": 23650.2971445558 }, "targetPosition": { - "x": 5716.5842051943055, - "y": 33673.47281893355 + "x": 28412.43870443027, + "y": 23825 }, "floatingObject": { "isPinned": false, @@ -905,12 +907,12 @@ "id": "9c74a2a8-4bcf-42b7-b53d-7ba68f3acfc2", "savedPayload": { "position": { - "x": 6318.801750917279, - "y": 34342.3031618632 + "x": 29191.86156783627, + "y": 24275 }, "targetPosition": { - "x": 6017.692978055792, - "y": 34007.887990398376 + "x": 28802.15013613327, + "y": 24050 }, "floatingObject": { "isPinned": false, @@ -960,12 +962,12 @@ "id": "be3ab259-2505-4200-a8cc-a373874aedb0", "savedPayload": { "position": { - "x": 6017.692978055792, - "y": 34007.887990398376 + "x": 28802.15013613327, + "y": 24050 }, "targetPosition": { - "x": 5716.5842051943055, - "y": 33673.47281893355 + "x": 28412.43870443027, + "y": 23825 }, "floatingObject": { "isPinned": false, @@ -988,12 +990,12 @@ "id": "9673136d-ac9a-40b7-bd6f-6c8c3fbbb384", "savedPayload": { "position": { - "x": 5693.0330248849805, - "y": 34122.856109573106 + "x": 28528.907274726407, + "y": 24259.66662183008 }, "targetPosition": { - "x": 5716.5842051943055, - "y": 33673.47281893355 + "x": 28412.43870443027, + "y": 23825 }, "floatingObject": { "isPinned": false, @@ -1011,12 +1013,12 @@ "id": "cce1f59a-bb5d-4700-abf8-ab8d2932ff6a", "savedPayload": { "position": { - "x": 5716.5842051943055, - "y": 33673.47281893355 + "x": 28412.43870443027, + "y": 23825 }, "targetPosition": { - "x": 5415.475432332819, - "y": 33339.057647468726 + "x": 28022.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -1034,12 +1036,12 @@ "id": "705bfab3-e851-4469-ab70-ac972950de6c", "savedPayload": { "position": { - "x": 5415.475432332819, - "y": 33339.057647468726 + "x": 28022.727272727272, + "y": 23600 }, "targetPosition": { - "x": 4987.5, - "y": 33200 + "x": 27572.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -1059,61 +1061,6 @@ "name": "New Financial Programs", "config": "{}", "project": "Governance", - "liquidityProgram": { - "type": "Liquidity Program", - "name": "New Liquidity Program", - "config": "{}", - "project": "Governance", - "tokensAwarded": { - "type": "Tokens Awarded", - "name": "New Tokens Awarded", - "project": "Governance", - "id": "bf4385e4-36b4-46b9-980f-40040b9bbd5c", - "savedPayload": { - "position": { - "x": 5371.842302750968, - "y": 34264.82039324994 - }, - "targetPosition": { - "x": 5107.338939219355, - "y": 33900.76274578121 - }, - "floatingObject": { - "isPinned": false, - "isFrozen": false, - "isCollapsed": false, - "angleToParent": 2, - "distanceToParent": 3, - "arrangementStyle": 0 - }, - "uiObject": { - "isRunning": false - } - } - }, - "id": "304d9993-0a02-4532-a8ce-6a1a0d13f571", - "savedPayload": { - "position": { - "x": 5107.338939219355, - "y": 33900.76274578121 - }, - "targetPosition": { - "x": 4842.835575687742, - "y": 33536.70509831249 - }, - "floatingObject": { - "isPinned": false, - "isFrozen": false, - "isCollapsed": false, - "angleToParent": 2, - "distanceToParent": 3, - "arrangementStyle": 0 - }, - "uiObject": { - "isRunning": false - } - } - }, "id": "d120d972-5bec-4e8a-9811-3a51b8bd70b4", "savedPayload": { "position": { @@ -1121,8 +1068,8 @@ "y": 33536.70509831249 }, "targetPosition": { - "x": 4987.5, - "y": 33200 + "x": 27572.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": true, @@ -1137,15 +1084,100 @@ } } }, + "liquidityPrograms": { + "type": "Liquidity Programs", + "name": "New Liquidity Programs", + "config": "{}", + "project": "Governance", + "liquidityProgram": [ + { + "type": "Liquidity Program", + "name": "New Liquidity Program", + "config": "{\n\"asset\": \"BTCB\"\n}", + "project": "Governance", + "tokensAwarded": { + "type": "Tokens Awarded", + "name": "New Tokens Awarded", + "project": "Governance", + "id": "9d22ff3c-eff9-42de-8824-81fee7a51a9d", + "savedPayload": { + "position": { + "x": 28641.477272727272, + "y": 25451.129300589237 + }, + "targetPosition": { + "x": 28135.227272727272, + "y": 24574.278579257494 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 2, + "distanceToParent": 4, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + }, + "id": "b8658ca8-482a-4dda-9101-43c22a45caad", + "savedPayload": { + "position": { + "x": 28135.227272727272, + "y": 24574.278579257494 + }, + "targetPosition": { + "x": 27797.727272727272, + "y": 23989.711431703 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 2, + "distanceToParent": 4, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + } + ], + "id": "a46bb98a-4ee4-4801-a0ff-60bc1c7eb1cd", + "savedPayload": { + "position": { + "x": 27797.727272727272, + "y": 23989.711431703 + }, + "targetPosition": { + "x": 27572.727272727272, + "y": 23600 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 2, + "distanceToParent": 4, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + }, "id": "5683e2bf-45ca-4dd6-9ade-53b4cad76ed0", "savedPayload": { "position": { - "x": 4987.5, - "y": 33200 + "x": 27572.727272727272, + "y": 23600 }, "targetPosition": { - "x": 4687.5, - "y": 33200 + "x": 27272.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -1167,12 +1199,12 @@ "id": "96f1c595-f94e-4207-9828-4199c74c4bfd", "savedPayload": { "position": { - "x": 4387.5, - "y": 33200 + "x": 26972.727272727272, + "y": 23600 }, "targetPosition": { - "x": 4687.5, - "y": 33200 + "x": 27272.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, @@ -1190,12 +1222,12 @@ "id": "7af21baa-ebc0-436f-94a7-a1746209418e", "savedPayload": { "position": { - "x": 4687.5, - "y": 33200 + "x": 27272.727272727272, + "y": 23600 }, "targetPosition": { - "x": 4687.5, - "y": 33200 + "x": 27272.727272727272, + "y": 23600 }, "floatingObject": { "isPinned": false, diff --git a/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json b/Projects/Governance/Plugins/User-Profiles/gustavohcorradi.json index a0cd30e43..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": 35150, - "y": 17470.577136594 + "x": 18900, + "y": 32420.577136594 }, "targetPosition": { - "x": 35300, - "y": 17730.384757729335 + "x": 19050, + "y": 32680.384757729335 }, "floatingObject": { "isPinned": false, @@ -49,12 +49,12 @@ "id": "ee0124d9-1e12-4819-9dd9-bb1ca8840483", "savedPayload": { "position": { - "x": 35300, - "y": 17730.384757729335 + "x": 19050, + "y": 32680.384757729335 }, "targetPosition": { - "x": 35450, - "y": 17990.192378864667 + "x": 19200, + "y": 32940.19237886467 }, "floatingObject": { "isPinned": false, @@ -81,12 +81,12 @@ "id": "49472434-c0b7-4561-adac-4c7709f79ac5", "savedPayload": { "position": { - "x": 36050, - "y": 17990.192378864667 + "x": 19800, + "y": 32940.19237886467 }, "targetPosition": { - "x": 35750, - "y": 17990.192378864667 + "x": 19500, + "y": 32940.19237886467 }, "floatingObject": { "isPinned": false, @@ -104,12 +104,12 @@ "id": "d83ff511-36ab-484d-a481-12118e29204f", "savedPayload": { "position": { - "x": 35750, - "y": 17990.192378864667 + "x": 19500, + "y": 32940.19237886467 }, "targetPosition": { - "x": 35450, - "y": 17990.192378864667 + "x": 19200, + "y": 32940.19237886467 }, "floatingObject": { "isPinned": false, @@ -127,12 +127,12 @@ "id": "1cd251c3-5a87-435e-a262-42323aed0bc4", "savedPayload": { "position": { - "x": 35450, - "y": 17990.192378864667 + "x": 19200, + "y": 32940.19237886467 }, "targetPosition": { - "x": 35300, - "y": 18250 + "x": 19050, + "y": 33200 }, "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": 19407.294901687517, + "y": 33174.490666246784 }, "targetPosition": { - "x": 35600, - "y": 18769.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -183,7 +183,61 @@ }, "uiObject": { "isRunning": false - } + }, + "referenceParent": { + "type": "User Profile", + "name": "gustavohcorradi", + "id": "96ccf2bc-e544-4b27-aa23-a7a734798fb4" + }, + "referenceParentCombinedNodePath": [ + [ + "gustavohcorradi", + "User Profile", + "Governance", + "96ccf2bc-e544-4b27-aa23-a7a734798fb4" + ] + ] + } + }, + { + "type": "User Referrer", + "name": "EvaMaria70", + "config": "{}", + "project": "Governance", + "id": "487a8367-b662-4192-b053-4335d6be8089", + "savedPayload": { + "position": { + "x": 19742.705098312483, + "y": 33283.47204544759 + }, + "targetPosition": { + "x": 19500, + "y": 33459.80762113533 + }, + "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", + "Governance", + "75a78d74-93f3-44c5-a96a-5b2b9f730afe" + ] + ] } } ], @@ -194,12 +248,12 @@ "id": "0ab1e6ee-9db2-463f-a347-71940500475e", "savedPayload": { "position": { - "x": 35750, - "y": 19029.422863406 + "x": 19742.705098312483, + "y": 33636.143196823075 }, "targetPosition": { - "x": 35600, - "y": 18769.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -221,12 +275,12 @@ "id": "f93b30b2-f600-43be-875a-86407b7b573f", "savedPayload": { "position": { - "x": 35340.19237886467, - "y": 18919.615242270665 + "x": 19407.294901687517, + "y": 33745.12457602388 }, "targetPosition": { - "x": 35600, - "y": 18769.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "floatingObject": { "isPinned": false, @@ -244,12 +298,95 @@ "id": "889d794d-6a98-4ae2-b81c-b1786ee37b35", "savedPayload": { "position": { - "x": 35600, - "y": 18769.615242270665 + "x": 19500, + "y": 33459.80762113533 }, "targetPosition": { - "x": 35450, - "y": 18509.807621135333 + "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, @@ -267,12 +404,12 @@ "id": "b7c934fd-8031-4615-bf9c-94280e452511", "savedPayload": { "position": { - "x": 35450, - "y": 18509.807621135333 + "x": 19200, + "y": 33459.80762113533 }, "targetPosition": { - "x": 35300, - "y": 18250 + "x": 19050, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -290,12 +427,12 @@ "id": "b70247f5-4442-4433-b35f-aa64a2f7c174", "savedPayload": { "position": { - "x": 35300, - "y": 18250 + "x": 19050, + "y": 33200 }, "targetPosition": { - "x": 35000, - "y": 18250 + "x": 18750, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -317,12 +454,12 @@ "id": "899f92f8-5e00-42a0-8316-10c95dd2a6b1", "savedPayload": { "position": { - "x": 34700, - "y": 18250 + "x": 18450, + "y": 33200 }, "targetPosition": { - "x": 35000, - "y": 18250 + "x": 18750, + "y": 33200 }, "floatingObject": { "isPinned": false, @@ -340,15 +477,15 @@ "id": "96ccf2bc-e544-4b27-aa23-a7a734798fb4", "savedPayload": { "position": { - "x": 35000, - "y": 18250 + "x": 18750, + "y": 33200 }, "targetPosition": { - "x": 35000, - "y": 18250 + "x": 18750, + "y": 33200 }, "floatingObject": { - "isPinned": false, + "isPinned": true, "isFrozen": false, "isCollapsed": false, "angleToParent": 1, diff --git a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js index 0cbb3d063..c38ba481d 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,80 @@ function newGovernanceReportsCommmandInterface() { } } + function checkUserUpdateCommand() { + + let command = UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() + + if (command === 'gov.help gov.userprofile') { + UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Contribute User Profile Command') + return + } + if (command.indexOf('gov.userprofile') !== 0 ) { return 'Not User Contribute Commands' } + + /* Set up the commit message */ + let message = command.trim().substring(command.indexOf(' ') + 1, command.length) + if (message.toLowerCase() === 'gov.userprofile') { + message = 'Automated Userprofile contribute process.' + } + + 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: 'UserProfile', + 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) + + 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() diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index e280fe033..8952ce848 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -372,6 +372,11 @@ "propertyName": "cryptoEcosystemFunctions", "functionName": "newFoundationsFunctionLibraryCryptoEcosystemFunctions" }, + { + "name": "Product Functions", + "propertyName": "productFunctions", + "functionName": "newFoundationsFunctionLibraryProductFunctions" + }, { "name": "Data Storage Functions", "propertyName": "dataStorageFunctions",