From 925df2e54e14e3c9b9b945c47e39521d12851a4f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 7 Aug 2021 13:45:07 +0200 Subject: [PATCH] Governance gov.PRs command implemented at the Client --- Client/httpInterface.js | 280 +++++++++- Client/package.json | 3 +- .../User-Profiles/Luis-Fernando-Molina.json | 486 +++++++++++++----- ...1-gov-message-pull-requests-processed.json | 10 +- .../Spaces/Reports-Space/CommandInterface.js | 14 +- .../UI/Spaces/Reports-Space/FiltersHeader.js | 8 +- .../UI/Spaces/Reports-Space/ReportsSpace.js | 10 +- .../Spaces/User-Profile-Space/UserProfile.js | 4 +- 8 files changed, 661 insertions(+), 154 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 15363300d..0abf1ffa5 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -1022,20 +1022,28 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE case 'Gov': { switch (requestParameters[2]) { // switch by command case 'getGithubStars': { - getProfiles('activity', 'listStargazersForRepo') + getGithubUsernames('activity', 'listStargazersForRepo') break } case 'getGithubWatchers': { - getProfiles('activity', 'listWatchersForRepo') + getGithubUsernames('activity', 'listWatchersForRepo') break } case 'getGithubForks': { - getProfiles('repos', 'listForks') + getGithubUsernames('repos', 'listForks') + break + } + case 'PRs': { + mergeGithubPullRequests() + break + } + case 'Pay': { + payToContributors() break } } - function getProfiles(endpoint, method) { + function getGithubUsernames(endpoint, method) { try { const GITHUB_API_WAITING_TIME = 250 const repository = unescape(requestParameters[3]) @@ -1099,13 +1107,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE for (let i = 0; i < listResponse.data.length; i++) { let listItem = listResponse.data[i] - let githubUsername - switch(endpoint) { - case 'activity' : { + let githubUsername + switch (endpoint) { + case 'activity': { githubUsername = listItem.login break } - case 'repos' : { + case 'repos': { githubUsername = listItem.owner.login break } @@ -1114,8 +1122,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE githubListArray.push(githubUsername) } - console.log('[INFO] httpInterface -> Gov -> getRepoInfo -> doGithub -> getList -> ' + method + ' Page = ' + page) - console.log('[INFO] httpInterface -> Gov -> getRepoInfo -> doGithub -> getList -> ' + method + ' Received = ' + listResponse.data.length) + console.log('[INFO] httpInterface -> Gov -> getRepoInfo -> doGithub -> getList -> ' + method + ' Page = ' + page) + console.log('[INFO] httpInterface -> Gov -> getRepoInfo -> doGithub -> getList -> ' + method + ' Received = ' + listResponse.data.length) } catch (err) { console.log(err) @@ -1152,6 +1160,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE respondWithContent(JSON.stringify(error), httpResponse) } } + function respondWithDocsObject(docs, error) { if (error.message !== undefined) { @@ -1186,6 +1195,223 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE respondWithContent(JSON.stringify(customResponse), httpResponse) } + + function mergeGithubPullRequests() { + try { + let commitMessage = unescape(requestParameters[3]) + + /* Unsavping # */ + for (let i = 0; i < 10; i++) { + commitMessage = commitMessage.replace('_SLASH_', '/') + commitMessage = commitMessage.replace('_HASHTAG_', '#') + } + + const GITHUB_API_WAITING_TIME = 250 + const repository = 'Superalgos' + const username = unescape(requestParameters[4]) + const token = unescape(requestParameters[5]) + const currentBranch = unescape(requestParameters[6]) + const contributionsBranch = unescape(requestParameters[7]) + let error + let githubPrListArray = [] + + processOpenPullRequests() + + async function processOpenPullRequests() { + await doGithub() + if (error !== undefined) { + + let docs = { + project: 'Governance', + category: 'Topic', + type: 'Gov Error - Merge Pull Requests', + anchor: undefined, + placeholder: {} + } + + respondWithDocsObject(docs, error) + return + } + + respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) + } + + async function doGithub() { + try { + + const { Octokit } = require("@octokit/rest") + + const octokit = new Octokit({ + auth: token, + userAgent: 'Superalgos Beta 11' + }) + await getPrList() + await mergePrs() + + async function getPrList() { + const repo = repository + const owner = 'Superalgos' + const per_page = 100 // Max + let page = 0 + let lastPage = false + + while (lastPage === false) { + try { + page++ + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList -> Requesting Page = ' + page) + + await sleep(GITHUB_API_WAITING_TIME) + let listResponse = await octokit.rest.pulls.list({ + owner: owner, + repo: repo, + state: 'open', + head: 'develop', + base: undefined, + sort: undefined, + direction: undefined, + per_page: per_page, + page: page + }); + + if (listResponse.data.length < 100) { + lastPage = true + } + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList -> Receiving Page = ' + page) + for (let i = 0; i < listResponse.data.length; i++) { + let pullRequest = listResponse.data[i] + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList -> Pull Request "' + pullRequest.title + '" found and added to the list to validate. ') + githubPrListArray.push(pullRequest) + } + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList -> Received = ' + listResponse.data.length) + + } catch (err) { + console.log(err) + + if (err.stack.indexOf('last page') >= 0) { + return + } else { + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList ->Method call produced an error.') + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList ->err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList ->repository = ' + repository) + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList ->username = ' + username) + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList ->token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> getPrList ->token ends with = ' + '...' + token.substring(token.length - 10)) + error = err + } + } + } + } + + async function mergePrs() { + /* + In order to automatically merge a PRs we will run several validations first. + We want to automate specifically the merging of Profile File changes at the + Governance System done by the same Github user name that matches the profile + changed. We will also not do the merge if there are more than one file at the + PR. + + We will go through the list of open PRs and run the validations at each one of them. + */ + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Ready to Validate ' + githubPrListArray.length + ' pull requests. ') + + for (let i = 0; i < githubPrListArray.length; i++) { + let pullRequest = githubPrListArray[i] + /* + Lets get the files changed at this Pull Request. + */ + await sleep(GITHUB_API_WAITING_TIME) + let listResponse = await octokit.rest.pulls.listFiles({ + owner: owner, + repo: repo, + pull_number: pullRequest.number + }); + /* + Validation #1: If the PR has more than one file, then we will not automatically + merge it. + */ + if (listResponse.data.length !== 1) { + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Validation #1 Failed -> Pull Request "' + pullRequest.title + '" not merged because it contains more than 1 file. -> fileCount = ' + listResponse.data.length) + continue + } + let pullRequestFile = listResponse.data[0] + /* + Validation #2: File Name must be the same to the Github Username of the PR owner. + */ + let fileContentUrl = pullRequestFile.raw_url + let splittedURL = fileContentUrl.split('/') + let fileName = splittedURL[splittedURL.length - 1] + let splittedFileName = fileName.split('.') + fileName = splittedFileName[0] + let githubUsername = pullRequest.user.login + + if (githubUsername !== fileName) { + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Validation #2 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Github Username is not equal to the File Name. -> Github Username = ' + githubUsername + '-> fileName = ' + fileName) + continue + } + await sleep(GITHUB_API_WAITING_TIME) + let fileContent = await fetchAPIDataFile(fileContentUrl) + + let userProfile = JSON.parse(fileContent) + /* + Validation #3: The file changed at the PR is a User Profile. + */ + if (userProfile.type !== 'User Profile') { + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Validation #3 Failed -> Pull Request "' + pullRequest.title + '" not merged because the file modified is not a User Profile. -> Type = ' + userProfile.type) + continue + } + /* + Validation #4: The message signed at the config is not the Github Username. + */ + let config = JSON.parser(userProfile.config) + let messageSigned = config.signature.message + if (messageSigned !== githubUsername) { + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Validation #4 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Github Username is not equal to the Messaged Signed at the User Profile. -> Github Username = ' + githubUsername + '-> messageSigned = ' + messageSigned) + continue + } + /* + All validations passed, we will proceed an merge this Pull Request. + */ + await sleep(GITHUB_API_WAITING_TIME) + let mergeResponse = await octokit.rest.pulls.merge({ + owner: owner, + repo: repo, + pull_number: pullRequest.number, + commit_title: 'Changes in User Profile done by Profile Owner ' + githubUsername + ' automatically merged by Superalgos.' + }); + + if (mergeResponse.merged !== true) { + console.log('[WARN] httpInterface -> Gov -> mergeGithubPullRequests -> Merge Failed -> Pull Request "' + pullRequest.title + '" not merged because Github could not merge it. -> mergeResponse.message = ' + mergeResponse.message) + continue + } else { + console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Merge Succed -> Pull Request "' + pullRequest.title + '" successfully merged. -> mergeResponse.message = ' + mergeResponse.message) + } + } + } + } catch (err) { + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> doGithub -> err.stack = ' + err.stack) + } + } + + } catch (err) { + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> Method call produced an error.') + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> err.stack = ' + err.stack) + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> repository = ' + repository) + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> username = ' + username) + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> token starts with = ' + token.substring(0, 10) + '...') + console.log('[ERROR] httpInterface -> Gov -> mergeGithubPullRequests -> token ends with = ' + '...' + token.substring(token.length - 10)) + + let error = { + result: 'Fail Because', + message: err.message, + stack: err.stack + } + respondWithContent(JSON.stringify(error), httpResponse) + } + } + + function payToContributors() { + + } } break @@ -2139,4 +2365,38 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE setTimeout(resolve, ms) }) } + + async function fetchAPIDataFile(url) { + let promise = new Promise((resolve, reject) => { + + const fetch = require('node-fetch') + /* + This is how we call the API. + */ + fetch(url) + .then((response) => { + + if (response.status !== 200) { + console.log('[ERROR] fetchAPIData -> then -> url =' + url) + reject() + return + } + getResponseBody() + + function getResponseBody() { + response.text().then(body => { + resolve(body) + }) + } + }) + .catch(err => { + console.log('[ERROR] fetchAPIData -> url =' + url) + reject() + }) + + } + ) + + return promise + } } diff --git a/Client/package.json b/Client/package.json index 78c439b0f..fe63a2483 100644 --- a/Client/package.json +++ b/Client/package.json @@ -15,6 +15,7 @@ "rimraf": "^3.0.2", "simple-git": "^2.42.0", "web3": "^1.5.0", - "ws": "^7.4.6" + "ws": "^7.4.6", + "node-fetch": "2.6.1" } } diff --git a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json index ab7e9bdea..245c7569a 100644 --- a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json +++ b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json @@ -597,35 +597,51 @@ "referenceParentCombinedNodePath": [ [ "Luis-Fernando-Molina", - "User Profile" + "User Profile", + "Governance", + "148911b3-b2f3-44fb-8cb4-017991789132" ], [ "New Token Power Switch", - "Token Power Switch" + "Token Power Switch", + "Governance", + "f8182a9c-f830-4ec1-a238-ac3a5efd69e6" ], [ "New Votes And Claims Programs", - "Votes And Claims Programs" + "Votes And Claims Programs", + "Governance", + "bb390957-b8a2-4a8a-9fbf-963ea20f6eaf" ], [ "New Claims Program", - "Claims Program" + "Claims Program", + "Governance", + "796dd30f-c90d-4b8d-a63d-89867347407b" ], [ "Project Features Feature Class", - "Feature Claims Folder" + "Feature Claims Folder", + "Governance", + "f8a482c4-dee0-475a-831b-7514fd255ba6" ], [ "Superalgos Platform Feature Class", - "Feature Claims Folder" + "Feature Claims Folder", + "Governance", + "ba6b4ff8-396b-4a9d-95ba-a52d096ec9eb" ], [ "New Features Feature Class", - "Feature Claims Folder" + "Feature Claims Folder", + "Governance", + "c4815ebe-d3a8-47fd-b204-936242bd8f40" ], [ "Governance System New Features", - "Feature Contribution Claim" + "Feature Contribution Claim", + "Governance", + "92f0f22e-f631-482d-88b1-c16596bf951d" ] ] } @@ -664,35 +680,51 @@ "referenceParentCombinedNodePath": [ [ "Luis-Fernando-Molina", - "User Profile" + "User Profile", + "Governance", + "148911b3-b2f3-44fb-8cb4-017991789132" ], [ "New Token Power Switch", - "Token Power Switch" + "Token Power Switch", + "Governance", + "f8182a9c-f830-4ec1-a238-ac3a5efd69e6" ], [ "New Votes And Claims Programs", - "Votes And Claims Programs" + "Votes And Claims Programs", + "Governance", + "bb390957-b8a2-4a8a-9fbf-963ea20f6eaf" ], [ "New Claims Program", - "Claims Program" + "Claims Program", + "Governance", + "796dd30f-c90d-4b8d-a63d-89867347407b" ], [ "Project Features Feature Class", - "Feature Claims Folder" + "Feature Claims Folder", + "Governance", + "f8a482c4-dee0-475a-831b-7514fd255ba6" ], [ "Superalgos Platform Feature Class", - "Feature Claims Folder" + "Feature Claims Folder", + "Governance", + "ba6b4ff8-396b-4a9d-95ba-a52d096ec9eb" ], [ "New Features Feature Class", - "Feature Claims Folder" + "Feature Claims Folder", + "Governance", + "c4815ebe-d3a8-47fd-b204-936242bd8f40" ], [ "API Maps New Features", - "Feature Contribution Claim" + "Feature Contribution Claim", + "Governance", + "81c477e0-c9bf-4b25-a875-d265011a6136" ] ] } @@ -5264,23 +5296,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "Existing Features", - "Feature Class" + "Feature Class", + "Governance", + "b46ffee0-7c89-4155-8450-678d7cea24f8" ], [ "Charting System", - "Feature" + "Feature", + "Governance", + "992fe8ce-bd27-4857-900c-e0330b7ccc51" ] ] } @@ -5319,23 +5361,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "Existing Features", - "Feature Class" + "Feature Class", + "Governance", + "b46ffee0-7c89-4155-8450-678d7cea24f8" ], [ "Data Mining", - "Feature" + "Feature", + "Governance", + "afa546fa-799b-4c50-baa3-65c8409aaab9" ] ] } @@ -5374,23 +5426,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "Existing Features", - "Feature Class" + "Feature Class", + "Governance", + "b46ffee0-7c89-4155-8450-678d7cea24f8" ], [ "Visual Designer", - "Feature" + "Feature", + "Governance", + "b88a3b22-7060-45c8-90bd-57ec53e95c4f" ] ] } @@ -5429,23 +5491,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "Existing Features", - "Feature Class" + "Feature Class", + "Governance", + "b46ffee0-7c89-4155-8450-678d7cea24f8" ], [ "Visual Debugger", - "Feature" + "Feature", + "Governance", + "f713d118-f53a-4fc6-9b39-9e8717c4bd6f" ] ] } @@ -5481,19 +5553,27 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "Existing Features", - "Feature Class" + "Feature Class", + "Governance", + "b46ffee0-7c89-4155-8450-678d7cea24f8" ] ] } @@ -5541,23 +5621,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ], [ "Governance System", - "Feature" + "Feature", + "Governance", + "a5a7304e-155a-47d1-97f7-c50b88082000" ] ] } @@ -5596,23 +5686,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ], [ "API Maps", - "Feature" + "Feature", + "Governance", + "28c5218d-3213-4a10-8e28-11d5ae460547" ] ] } @@ -5651,23 +5751,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ], [ "User Defined Variables and Code", - "Feature" + "Feature", + "Governance", + "55e7b969-383c-4ae8-95c0-2dc18473404f" ] ] } @@ -5706,23 +5816,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ], [ "Tensor Flow Integration", - "Feature" + "Feature", + "Governance", + "68388215-3e97-4864-9804-72e91ecff02b" ] ] } @@ -5758,19 +5878,27 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ] ] } @@ -5809,15 +5937,21 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ] ] } @@ -5871,23 +6005,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Mobile App", - "Feature Class" + "Feature Class", + "Governance", + "f193b1f9-c97d-4831-87b4-defe9f6aab9a" ], [ "Needed Features", - "Feature Class" + "Feature Class", + "Governance", + "243a3f35-62a2-4193-ab19-da643accd275" ], [ "Android Mobile App", - "Feature" + "Feature", + "Governance", + "22e0864c-5a2a-40b5-a24d-fe46cde7dd64" ] ] } @@ -5926,23 +6070,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Mobile App", - "Feature Class" + "Feature Class", + "Governance", + "f193b1f9-c97d-4831-87b4-defe9f6aab9a" ], [ "Needed Features", - "Feature Class" + "Feature Class", + "Governance", + "243a3f35-62a2-4193-ab19-da643accd275" ], [ "iOS Mobile App", - "Feature" + "Feature", + "Governance", + "dc029fe2-d4f7-46a1-908d-3d3251af002e" ] ] } @@ -5981,23 +6135,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Mobile App", - "Feature Class" + "Feature Class", + "Governance", + "f193b1f9-c97d-4831-87b4-defe9f6aab9a" ], [ "Needed Features", - "Feature Class" + "Feature Class", + "Governance", + "243a3f35-62a2-4193-ab19-da643accd275" ], [ "Huawei Mobile App", - "Feature" + "Feature", + "Governance", + "198f47fc-61bd-41a1-9b2f-7bc1bea082f9" ] ] } @@ -6033,19 +6197,27 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Mobile App", - "Feature Class" + "Feature Class", + "Governance", + "f193b1f9-c97d-4831-87b4-defe9f6aab9a" ], [ "Needed Features", - "Feature Class" + "Feature Class", + "Governance", + "243a3f35-62a2-4193-ab19-da643accd275" ] ] } @@ -6084,15 +6256,21 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Mobile App", - "Feature Class" + "Feature Class", + "Governance", + "f193b1f9-c97d-4831-87b4-defe9f6aab9a" ] ] } @@ -6146,23 +6324,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos P2P Network", - "Feature Class" + "Feature Class", + "Governance", + "e205d4f2-140e-4d4b-a839-e37a6537dfa9" ], [ "Needed Features", - "Feature Class" + "Feature Class", + "Governance", + "0253c529-e28f-43b5-8b3a-a86abb38dc4a" ], [ "Node.js Implementation", - "Feature" + "Feature", + "Governance", + "bda64809-41d7-41a8-9166-792a6df000e1" ] ] } @@ -6198,19 +6386,27 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos P2P Network", - "Feature Class" + "Feature Class", + "Governance", + "e205d4f2-140e-4d4b-a839-e37a6537dfa9" ], [ "Needed Features", - "Feature Class" + "Feature Class", + "Governance", + "0253c529-e28f-43b5-8b3a-a86abb38dc4a" ] ] } @@ -6249,15 +6445,21 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos P2P Network", - "Feature Class" + "Feature Class", + "Governance", + "e205d4f2-140e-4d4b-a839-e37a6537dfa9" ] ] } @@ -6296,11 +6498,15 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ] ] } @@ -12817,23 +13023,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ], [ "Governance System", - "Feature" + "Feature", + "Governance", + "a5a7304e-155a-47d1-97f7-c50b88082000" ] ] } @@ -12872,23 +13088,33 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ], [ "API Maps", - "Feature" + "Feature", + "Governance", + "28c5218d-3213-4a10-8e28-11d5ae460547" ] ] } @@ -12923,19 +13149,27 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ], [ "New Features", - "Feature Class" + "Feature Class", + "Governance", + "372acad9-fb7b-4ac7-9620-28a66ac9c40d" ] ] } @@ -12971,15 +13205,21 @@ "referenceParentCombinedNodePath": [ [ "Superalgos", - "Features" + "Features", + "Governance", + "1d2c1985-c762-4ece-b350-15bd893bd1f4" ], [ "Project Features", - "Feature Class" + "Feature Class", + "Governance", + "136b6e7a-f042-441b-84be-395b56b65b70" ], [ "Superalgos Platform", - "Feature Class" + "Feature Class", + "Governance", + "f83a751e-ff0c-49bd-a306-8b5ab6a8cc83" ] ] } @@ -13208,7 +13448,7 @@ { "type": "Delegate Power Switch", "name": "harrellbm", - "config": "{\n \"percentage\": 20\n}", + "config": "{\n \"percentage\": 25\n}", "project": "Governance", "delegatePowerSwitch": [], "userDelegates": [], @@ -13238,7 +13478,7 @@ { "type": "Delegate Power Switch", "name": "Thomas", - "config": "{\n \"percentage\": 15\n}", + "config": "{\n \"percentage\": 20\n}", "project": "Governance", "delegatePowerSwitch": [], "userDelegates": [], @@ -13268,7 +13508,7 @@ { "type": "Delegate Power Switch", "name": "Carl", - "config": "{}", + "config": "{\n \"percentage\": 10\n}", "project": "Governance", "delegatePowerSwitch": [], "userDelegates": [], diff --git a/Projects/Governance/Schemas/Docs-Topics/G/Gov/Gov-Commands-Messages/gov-commands-messages-001-gov-message-pull-requests-processed.json b/Projects/Governance/Schemas/Docs-Topics/G/Gov/Gov-Commands-Messages/gov-commands-messages-001-gov-message-pull-requests-processed.json index c6f34197b..dbad39c4e 100644 --- a/Projects/Governance/Schemas/Docs-Topics/G/Gov/Gov-Commands-Messages/gov-commands-messages-001-gov-message-pull-requests-processed.json +++ b/Projects/Governance/Schemas/Docs-Topics/G/Gov/Gov-Commands-Messages/gov-commands-messages-001-gov-message-pull-requests-processed.json @@ -3,18 +3,16 @@ "pageNumber": "1", "type": "Gov Message - Pull Requests Processed", "definition": { - "text": "The pull requests at the main Superalgos repositoryhave been succesfully processed.", - "updated": 1611002547907, - "translations": [ - ] + "text": "The pull requests at the main Superalgos repository have been succesfully processed.", + "updated": 1628336677481, + "translations": [] }, "paragraphs": [ { "style": "Success", "text": "No further action from you is required. The PRs Processing Rules have been applied and all PRs that could be merged were merged.", "updated": 1611002626154, - "translations": [ - ] + "translations": [] } ] } \ No newline at end of file diff --git a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js index eb7356989..fbde90f88 100644 --- a/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js +++ b/Projects/Governance/UI/Spaces/Reports-Space/CommandInterface.js @@ -27,14 +27,16 @@ function newGovernanceReportsCommmandInterface() { if (checkPayCommand() === undefined) { return true } function checkPRsCommand() { - if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() === 'gov.help gov.prs') { + + let command = UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() + if (command === 'gov.help gov.prs') { UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov PRs Command') return } - if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('Gov.PRs') !== 0 && UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('gov.prs') !== 0) { return 'Not PRs Commands' } + if (command.indexOf('gov.prs') !== 0 ) { return 'Not PRs Commands' } /* Set up the commit message */ - let message = UI.projects.governance.spaces.reportsSpace.commandInterface.command.trim().substring(UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.governance.spaces.reportsSpace.commandInterface.command.length) + let message = command.trim().substring(command.indexOf(' ') + 1, command.length) if (message.toLowerCase() === 'gov.prs') { message = 'Automated PR merging process.' } @@ -96,11 +98,13 @@ function newGovernanceReportsCommmandInterface() { } function checkPayCommand() { - if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() === 'gov.help gov.pay') { + + let command = UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() + if (command === 'gov.help gov.pay') { UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Pay Command') return } - if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('Gov.Pay') !== 0 && UI.projects.governance.spaces.reportsSpace.commandInterface.command.indexOf('gov.pay') !== 0) { return 'Not Pay Commands' } + if (command.indexOf('gov.pay') !== 0) { return 'Not Pay Commands' } httpRequest(undefined, 'Gov/Pay/' + UI.projects.education.spaces.docsSpace.currentBranch, onResponse) UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Paying to Contributors') diff --git a/Projects/Governance/UI/Spaces/Reports-Space/FiltersHeader.js b/Projects/Governance/UI/Spaces/Reports-Space/FiltersHeader.js index 965e2ed32..ffe3c1aa1 100644 --- a/Projects/Governance/UI/Spaces/Reports-Space/FiltersHeader.js +++ b/Projects/Governance/UI/Spaces/Reports-Space/FiltersHeader.js @@ -55,10 +55,10 @@ function newGovernanceReportsFiltersHeader() { if (event.key === "Enter" || event.keyCode === 13) { lastFilters = element.value.trim() UI.projects.governance.spaces.reportsSpace.reportsPage.render(undefined, lastFilters) - /* - UI.projects.education.spaces.docsSpace.commandInterface.command = element.value.trim() - UI.projects.education.spaces.docsSpace.commandInterface.detectCommands() - */ + + UI.projects.governance.spaces.reportsSpace.commandInterface.command = element.value.trim() + UI.projects.governance.spaces.reportsSpace.commandInterface.detectCommands() + } }); } diff --git a/Projects/Governance/UI/Spaces/Reports-Space/ReportsSpace.js b/Projects/Governance/UI/Spaces/Reports-Space/ReportsSpace.js index 840082abe..3487a3c57 100644 --- a/Projects/Governance/UI/Spaces/Reports-Space/ReportsSpace.js +++ b/Projects/Governance/UI/Spaces/Reports-Space/ReportsSpace.js @@ -24,6 +24,7 @@ function newGobernanceReportsSpace() { positions: undefined, mining: undefined, tablesSortingOrders: undefined, + commandInterface: undefined, changeTableSortingOrder, physics: physics, draw: draw, @@ -112,6 +113,9 @@ function newGobernanceReportsSpace() { thisObject.mining.finalize() thisObject.mining = undefined + thisObject.commandInterface.finalize() + thisObject.commandInterface = undefined + isInitialized = false } @@ -129,9 +133,10 @@ function newGobernanceReportsSpace() { thisObject.container.isDraggeable = false thisObject.container.detectMouseOver = true thisObject.container.status = 'hidden' - + resize() + thisObject.commandInterface = newGovernanceReportsCommmandInterface() thisObject.reportsPage = newGovernanceReportsReportsPage() thisObject.footer = newGovernanceReportsFooter() thisObject.filtersHeader = newGovernanceReportsFiltersHeader() @@ -152,6 +157,7 @@ function newGobernanceReportsSpace() { thisObject.positions = newGovernanceReportsPositions() thisObject.mining = newGovernanceReportsMining() + thisObject.commandInterface.initialize() thisObject.reportsPage.initialize() thisObject.footer.initialize() thisObject.filtersHeader.initialize() @@ -170,7 +176,7 @@ function newGobernanceReportsSpace() { thisObject.assets.initialize() thisObject.features.initialize() thisObject.positions.initialize() - thisObject.mining.initialize() + thisObject.mining.initialize() setupSidePanelTab() diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index 43f066723..41cff0cb3 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -65,9 +65,7 @@ function newGovernanceUserProfileSpace() { return } - - - requestStars() + //requestStars() function requestStars() { httpRequest(