App Command Interface with app.contribute implemented
This commit is contained in:
1 parent
ec476b2b40
commit
0a6cb07b63
5 files changed
+54
-20
No files matched your search
@@ -522,9 +522,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
}
|
||||
break
|
||||
|
||||
case 'Git': {
|
||||
case 'App': {
|
||||
switch (requestParameters[2]) { // switch by command
|
||||
case 'Commit': {
|
||||
case 'Contribute': {
|
||||
const simpleGit = require('simple-git');
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
@@ -532,9 +532,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
maxConcurrentProcesses: 6,
|
||||
}
|
||||
const git = simpleGit(options)
|
||||
console.log('baseDir = ' + process.cwd())
|
||||
const commitMessage = unescape(requestParameters[3])
|
||||
console.log('baseDir = ' + process.cwd(), commitMessage)
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'LegacyPlotter.js':
|
||||
{
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"topic": "App Commands Errors",
|
||||
"pageNumber": "1",
|
||||
"type": "App Error Contribution Not Sent",
|
||||
"definition": {
|
||||
"text": "Write here a summary for this topic page."
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode."
|
||||
}
|
||||
]
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"topic": "App Commands Messages",
|
||||
"pageNumber": "1",
|
||||
"type": "App Message Contribution Succeed",
|
||||
"definition": {
|
||||
"text": "Write here a summary for this topic page."
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,7 +9,8 @@
|
||||
{
|
||||
"language": "ES",
|
||||
"text": "Si bien la documentación esta originalmente escrita en Inglés, el sistema permite a cualquier usuario buscar contenido en su idioma nativo, siempre y cuando otros usuarios hayan contribuído traducciones de los artículos existentes escritos en el idioma por defecto que es el idioma Inglés.",
|
||||
"updated": 1609831843644
|
||||
"updated": 1609831843644,
|
||||
"style": "Definition"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -22,7 +23,8 @@
|
||||
{
|
||||
"language": "ES",
|
||||
"text": "Es importante notar que por mas que uno seleccione un idioma, el contenido se mostrará en ingles en cada sitio donde todavía no ha sido traducido. El sistema permite a cualquier usuario contribuir traducciones con una granularidad a nivel de párrafos. Esto significa que si una página cualquiera pudiera tener todos, algunos o nigún párrafo traducido. Esto solo depende de cuales hayan sido traducidos previamente por miembros de la comunidad.",
|
||||
"updated": 1609831884941
|
||||
"updated": 1609831884941,
|
||||
"style": "Text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -34,7 +36,8 @@
|
||||
{
|
||||
"language": "ES",
|
||||
"text": "Para cambiar de un idioma a otro se debe usar los links en el pie de cada página.",
|
||||
"updated": 1609831898619
|
||||
"updated": 1609831898619,
|
||||
"style": "Success"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,36 +17,35 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
}
|
||||
|
||||
function detectCommands() {
|
||||
detectAppCommands()
|
||||
if (detectAppCommands() === true) {return}
|
||||
detectDocsCommands()
|
||||
}
|
||||
|
||||
function detectAppCommands() {
|
||||
if (checkContributeCommand() === undefined) { return }
|
||||
if (checkContributeCommand() === undefined) { return } else { return true }
|
||||
|
||||
function checkContributeCommand() {
|
||||
if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.toLowerCase() === 'app.help app.contribute') {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Contribute Command')
|
||||
return
|
||||
}
|
||||
if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('App.Contribute') !== 0 && UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('app.contribute') !== 0) { return 'Not Save Command' }
|
||||
if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('App.Contribute') !== 0 && UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('app.contribute') !== 0) { return }
|
||||
|
||||
httpRequest(JSON.stringify(docsSchema), 'App/Contribute/' + message, onResponse)
|
||||
let message = UI.projects.superalgos.spaces.docsSpace.commandInterface.command.trim().substring(UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf(' ') + 1, UI.projects.superalgos.spaces.docsSpace.commandInterface.command.length)
|
||||
if (message.toLowerCase() === 'app.contribute') {
|
||||
message = 'This is my contribution to Superalgos'
|
||||
}
|
||||
|
||||
httpRequest(undefined, 'App/Contribute/' + message, onResponse)
|
||||
return true
|
||||
|
||||
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) {
|
||||
okResponses++
|
||||
}
|
||||
responseCount++
|
||||
|
||||
if (responseCount === requestsSent) {
|
||||
if (responseCount === okResponses) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message Saving Succeed')
|
||||
} else {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error Changes Not Saved', 'Anchor Changes Not Saved')
|
||||
}
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Contribution Not Sent', 'Anchor Contribution Not Sent')
|
||||
} else {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message Contribution Succeed')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user