Merge pull request #2227 from Tentacule23/develop

Contribution: app.contributeuserprofile
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-10-26 14:56:59 -04:00
commit 3e2e454530
3 files changed
+249 -236

No files matched your search

@@ -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')
@@ -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,77 @@ function newGovernanceReportsCommmandInterface() {
}
}
function checkUserUpdateCommand() {
if (UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase() === 'gov.help gov.contributeUserProfile') {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Contribute User Profile Command')
return
}
if (UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('gov.contributeUserProfile') !== 0 && UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf('gov.contributeuserprofile') !== 0) { return 'Not Contribute Commands' }
/* Set up the commit message */
let message = UI.projects.education.spaces.docsSpace.commandInterface.command.trim().substring(UI.projects.education.spaces.docsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.education.spaces.docsSpace.commandInterface.command.length)
if (message.toLowerCase() === 'gov.contributeuserprofile') {
message = 'This is my Contribute User Profile to Superalgos'
}
UI.projects.governance.spaces.reportsSpace.sidePanelTab.close()
UI.projects.education.spaces.docsSpace.sidePanelTab.open()
/* Find the Username and Password */
let apisNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadByNodeType('APIs')
if (apisNode === undefined) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
if (apisNode.githubAPI === undefined) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
let config = JSON.parse(apisNode.githubAPI.config)
if (config.username === undefined || config.username === "") {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
if (config.token === undefined || config.token === "") {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Error - Github Credentials Missing', 'Anchor Github Credentials Missing')
return
}
message = message.replaceAll('#', '_HASHTAG_')
message = message.replaceAll('/', '_SLASH_')
let params = {
method: 'contributeUserProfile',
commitMessage: message,
username: config.username,
token: config.token,
currentBranch: UI.projects.education.spaces.docsSpace.currentBranch,
contributionsBranch: UI.projects.education.spaces.docsSpace.contributionsBranch
}
let url = 'GOV' // We will access the default Client GOV endpoint.
httpRequest(JSON.stringify(params), url, onResponse)
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()