Gov Command Interface UI and Docs partly implemented

This commit is contained in:
Luis Fernando Molina committed 2021-07-25 11:01:27 +02:00
1 parent 924a4cf19e
commit 3118275cda
11 files changed
+533

No files matched your search

@@ -0,0 +1,85 @@
{
"topic": "Gov Commands Errors",
"pageNumber": "1",
"type": "Gov Error - Pull Requests Not Processed",
"definition": {
"text": "There was a problem trying to process the pull requests at the Superalgos repository",
"updated": 1611129378492
},
"paragraphs": [
{
"style": "Text",
"text": "Check the following section for details on what may have happened. After you fix the issue that prevented the Gov PRs Command to run, you may try again.",
"updated": 1611152997869
},
{
"style": "Title",
"text": "Error Info",
"updated": 1611154606702
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Note",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611153032408
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorMessage"
},
{
"style": "Subtitle",
"text": "Error Stack"
},
{
"style": "Text",
"text": "The following is the Error Stack of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details",
"updated": 1611154543778
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the Client:",
"updated": 1611154675224
},
{
"style": "Placeholder",
"text": "errorDetails",
"updated": 1611154555419
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,82 @@
{
"topic": "Gov Commands Errors",
"pageNumber": "2",
"type": "Gov Error - Github Credentials Missing",
"definition": {
"text": "To manage pull requests from within the app, you must first provide your Github.com credentials so that the Client can get you authenticated when while accessing Github.com.",
"updated": 1611129104270
},
"paragraphs": [
{
"style": "Anchor",
"text": "Anchor Github Credentials Missing",
"updated": 1609855373585
},
{
"style": "Error",
"text": "Github Credentials are Missing. Please solve this issue and try again.",
"updated": 1620591786589
},
{
"style": "Text",
"text": "To solve this issue follow the following instructions on how to set up your GitHub.com credentials so that the system can automate the tasks needed to submit your contributions to the main repository of the Superalgos project.",
"updated": 1609945787577
},
{
"style": "Anchor",
"text": "Anchor Hierarchy APIs Not Found"
},
{
"style": "Error",
"text": "Github Credentials are Missing. The Hierarchy APIs was not found at your workspace. Please create it following the guide below and try again.",
"updated": 1620591795457
},
{
"style": "Anchor",
"text": "Anchor Github API Node Not Found",
"updated": 1610559802944
},
{
"style": "Error",
"text": "Github Credentials are Missing. The Hierarchy APIs does not have a child of type Github API. Please create it following the guide below and try again.",
"updated": 1620591802895
},
{
"style": "Anchor",
"text": "Anchor Config Property Username Not Found",
"updated": 1610559852624
},
{
"style": "Error",
"text": "Github Credentials are Missing. The property username is missing or empty. Please create it following the guide below and try again.",
"updated": 1620591810613
},
{
"style": "Anchor",
"text": "Anchor Config Property Token Not Found",
"updated": 1610559914327
},
{
"style": "Error",
"text": "Github Crendentials are Missing. The property token is missing or empty. Please create it following the guide below and try again.",
"updated": 1610559900470
},
{
"style": "Text",
"text": ""
},
{
"style": "Title",
"text": "Applies to"
},
{
"style": "List",
"text": "Gov PRs Command"
},
{
"style": "Include",
"text": "Foundations->Topic->App Contribute Command->Block Authentication",
"updated": 1609945833844
}
]
}
@@ -0,0 +1,85 @@
{
"topic": "Gov Commands Errors",
"pageNumber": "3",
"type": "Gov Error - Pay Failed",
"definition": {
"text": "There was a problem trying to pay to contributors from the Treasury Account. Check the console for errors.",
"updated": 1611129344277
},
"paragraphs": [
{
"style": "Success",
"text": "Check for the following section for details on what may have happened. After you fix the issue, you may try again.",
"updated": 1611152967185
},
{
"style": "Title",
"text": "Error Info",
"updated": 1611154641024
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Note",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611151375974
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the Client:",
"updated": 1611151299633
},
{
"style": "Placeholder",
"text": "errorMessage"
},
{
"style": "Subtitle",
"text": "Error Stack"
},
{
"style": "Text",
"text": "The following is the Error Stack of the Exception that occured at the Client:",
"updated": 1611151427220
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the Client:",
"updated": 1611151443562
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the Client:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,20 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "1",
"type": "Gov Message - Pull Requests Processed",
"definition": {
"text": "The pull requests at the main Superalgos repositoryhave been succesfully processed.",
"updated": 1611002547907,
"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": [
]
}
]
}
@@ -0,0 +1,27 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "2",
"type": "Gov Message - Processing Pull Requests",
"definition": {
"text": "Hold on while this process checks all the open PRs at the Superalgos repository at GitHub.com and merges all the ones that can be merged accorfing to the PRs Processing Rules. You will get a new message when the operation is complete.",
"updated": 1611002766659,
"translations": [
]
},
"paragraphs": [
{
"style": "Title",
"text": "What's next?",
"updated": 1609940971059,
"translations": [
]
},
{
"style": "Text",
"text": "No further action from you is required. In a few seconds / minutes you should be able to see the result of this process.",
"updated": 1611128895749,
"translations": [
]
}
]
}
@@ -0,0 +1,17 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "3",
"type": "Gov Message - Paying Contributors",
"definition": {
"text": "The process to pay contributors has been started. Hold on!",
"translations": []
},
"paragraphs": [
{
"style": "Success",
"text": "You will soon get a notice informing you whether the process succeed to pay all contributors or not.",
"translations": [],
"updated": 1627203557237
}
]
}
@@ -0,0 +1,20 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "4",
"type": "Gov Message - All Payments Were Sent",
"definition": {
"text": "The pay process finished successfully. Payments to all contributors were sent.",
"updated": 1611003042937,
"translations": [
]
},
"paragraphs": [
{
"style": "Success",
"text": "The process to pay contributors was fully successfull and all payments have been sent.",
"updated": 1616081292001,
"translations": [
]
}
]
}
@@ -0,0 +1,20 @@
{
"topic": "Gov Commands Messages",
"pageNumber": "5",
"type": "Gov Message - Not All Payments Were Sent",
"definition": {
"text": "The update pay run but no all the payments were sent. You need to check the process output to fix it and proably run it again.",
"updated": 1615458687718,
"translations": [
]
},
"paragraphs": [
{
"style": "Success",
"text": "You are up-to-date. No need to reboot the Client or refresh the UI page.",
"updated": 1610454271911,
"translations": [
]
}
]
}
@@ -0,0 +1,16 @@
{
"topic": "App Commands",
"pageNumber": "1",
"type": "App PRs Command",
"definition": {
"text": "This command allows you to check all existing PRs and automatically close the ones that do not comply with PRs Rules or merge the ones they do. It also leaves untouched the PRs that are out of the scope of the PRs Rules.",
"updated": 1610909304702
},
"paragraphs": [
{
"style": "Text",
"text": "Add more text here.",
"updated": 1622028842412
}
]
}
@@ -0,0 +1,29 @@
{
"topic": "App Commands",
"pageNumber": "2",
"type": "App Pay Command",
"definition": {
"text": "Use this command to pay to contributors using the Trasury Blockchain Account to do so. If you are not in charge of the Treasury Account you can still run this command to generate the output file of the Pay process.",
"updated": 1610449365984
},
"paragraphs": [
{
"style": "Title",
"text": "Syntax",
"updated": 1610449451990
},
{
"style": "Json",
"text": "gov.pay",
"updated": 1615612258411
},
{
"style": "Title",
"text": "Examples"
},
{
"style": "Json",
"text": "gov.pay"
}
]
}
@@ -0,0 +1,132 @@
function newGovernanceReportsCommmandInterface() {
let thisObject = {
command: undefined,
detectCommands: detectCommands,
initialize: initialize,
finalize: finalize
}
return thisObject
function initialize() {
}
function finalize() {
}
function detectCommands() {
if (detectGovCommands() === true) { return }
/* If we can not detect any gov or docs commands, then we assume the users is typing a filter */
}
function detectGovCommands() {
if (checkPRsCommand() === undefined) { return true }
if (checkPayCommand() === undefined) { return true }
function checkPRsCommand() {
if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() === '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' }
/* 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)
if (message.toLowerCase() === 'gov.prs') {
message = 'Automated PR merging process.'
}
/* 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_')
httpRequest(
undefined,
'Gov/PRs/' +
message + '/' +
config.username + '/' +
config.token + '/' +
UI.projects.education.spaces.docsSpace.currentBranch + '/' +
UI.projects.education.spaces.docsSpace.contributionsBranch
, onResponse)
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Processing Pull Requests')
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('Governance', 'Topic', 'Gov Message - Pull Requests Processed')
} 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() {
if (UI.projects.governance.spaces.reportsSpace.commandInterface.command.toLowerCase() === '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' }
httpRequest(undefined, 'Gov/Pay/' + UI.projects.education.spaces.docsSpace.currentBranch, onResponse)
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Paying to Contributors')
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.CUSTOM_OK_RESPONSE.result) {
if (data.message.summary.changes + data.message.summary.deletions + data.message.summary.insertions > 0) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pay Done')
} else {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pay Failed')
}
} else {
UI.projects.education.spaces.docsSpace.navigateTo(
data.docs.project,
data.docs.category,
data.docs.type,
data.docs.anchor,
undefined,
data.docs.placeholder
)
}
}
}
}
}