From e3c0ba7f1cc720f5f302ebfcb424ba971b227ac0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Jan 2021 13:10:00 +0100 Subject: [PATCH 1/4] Book --- .../Docs-Books/the-docs-explained.json | 36 +++++++++++++++++++ .../Superalgos/Schemas/Docs-Nodes/style.json | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Projects/Superalgos/Schemas/Docs-Books/the-docs-explained.json diff --git a/Projects/Superalgos/Schemas/Docs-Books/the-docs-explained.json b/Projects/Superalgos/Schemas/Docs-Books/the-docs-explained.json new file mode 100644 index 000000000..0a3d1a4c7 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Books/the-docs-explained.json @@ -0,0 +1,36 @@ +{ + "type": "The Docs Explained", + "definition": { + "text": "This book will walk you through everything you need to know about the Docs.", + "updated": 1609762580891 + }, + "paragraphs": [ + { + "style": "Chapter", + "text": "Superalgos->I->Docs Basics->Read Chapter I to learn the basics concepts. They are the foundation that will let you understand the commands and styles explained later in this book.", + "updated": 1609763076399 + }, + { + "style": "Chapter", + "text": "Superalgos->II->Docs Commands->The Docs include a powerful command line interface that allows you to quickly fire commands from the search box. Dive into Chapter II to learn the details of each available command.", + "updated": 1609763122458 + }, + { + "style": "Chapter", + "text": "Superalgos->III->Docs Commands Errors" + }, + { + "style": "Chapter", + "text": "Superalgos->IV->Docs Commands Messages", + "updated": 1609783744261 + }, + { + "style": "Chapter", + "text": "Superalgos->V->Docs Paragraph Styles" + }, + { + "style": "Chapter", + "text": "Superalgos->VI->Docs Context Menu Actions" + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Nodes/style.json b/Projects/Superalgos/Schemas/Docs-Nodes/style.json index 703284d5b..3b7dda402 100644 --- a/Projects/Superalgos/Schemas/Docs-Nodes/style.json +++ b/Projects/Superalgos/Schemas/Docs-Nodes/style.json @@ -80,4 +80,4 @@ "text": "lineDash is used to turn the border into a dashed-line; the first value corresponds to the length of the dash while the second value defines the length of the space." } ] -} +} \ No newline at end of file From 0b27186d9ab68c1b75527f8d41fb5d0f39af5c09 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Jan 2021 14:03:45 +0100 Subject: [PATCH 2/4] Test Message --- Client/httpInterface.js | 11 +++++--- ...-app-error-github-credentials-missing.json | 4 +-- .../UI/Spaces/Docs-Space/CommandInterface.js | 26 +++++++++++++++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index b6b1bbf09..54c875dbf 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -527,7 +527,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE case 'Contribute': { try { const commitMessage = unescape(requestParameters[3]) - + const username = unescape(requestParameters[4]) + const token = unescape(requestParameters[5]) + contribute() async function contribute() { @@ -552,7 +554,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE async function doGithub() { - const token = "" const { Octokit } = require("@octokit/rest") const octokit = new Octokit({ @@ -562,7 +563,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE const repo = 'Superalgos' const owner = 'Superalgos' - const head = 'Luis-Fernando-Molina:in-app-documentation' + const head = username + ':in-app-documentation' const base = 'in-app-documentation' const title = 'Contribution to Superalgos' @@ -578,7 +579,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } 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 -> Params Received = ' + requestParameters[3]) + console.log('[ERROR] httpInterface -> App -> Contribute -> commitMessage = ' + commitMessage) + console.log('[ERROR] httpInterface -> App -> Contribute -> username = ' + username) + console.log('[ERROR] httpInterface -> App -> Contribute -> token = ' + token) let error = { result: 'Fail Because', diff --git a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json index 8bd36f3d2..cd3c0c072 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json @@ -3,8 +3,8 @@ "pageNumber": "2", "type": "App Error Github Credentials Missing", "definition": { - "text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository.", - "updated": 1609855182001 + "text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository. 1", + "updated": 1609937191972 }, "paragraphs": [ { diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js index a77c15753..15b6edd21 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js @@ -31,12 +31,34 @@ function newSuperalgosDocsCommmandInterface() { } if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('App.Contribute') !== 0 && UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('app.contribute') !== 0) { return } + /* Set up the commit message */ 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) + /* Find the Username and Password */ + let apisNode = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByType('APIs') + if (apisNode === undefined) { + UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing') + return true + } + if (apisNode.githubAPI === undefined) { + UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing') + return true + } + + let config = JSON.parse(apisNode.githubAPI.config) + if (config.username === undefined || config.username === "") { + UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing') + return true + } + if (config.token === undefined || config.token === "") { + UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Github Credentials Missing', 'Anchor Github Credentials Missing') + return true + } + + httpRequest(undefined, 'App/Contribute/' + message + '/' + config.username + '/' + config.token, onResponse) return true function onResponse(err, data) { From bc7c085e178248e97248d02f760cf43fd05fc1d2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Jan 2021 14:05:41 +0100 Subject: [PATCH 3/4] This is my contribution to Superalgos --- ...mands-errors-002-app-error-github-credentials-missing.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json index cd3c0c072..680bc524a 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json @@ -3,8 +3,8 @@ "pageNumber": "2", "type": "App Error Github Credentials Missing", "definition": { - "text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository. 1", - "updated": 1609937191972 + "text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository. 2", + "updated": 1609938311079 }, "paragraphs": [ { From 7e62df8f17f3a8fe82c08abc34694c45cf2bcd22 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Jan 2021 14:12:19 +0100 Subject: [PATCH 4/4] Test3 --- Client/httpInterface.js | 20 ++++++++++++------- ...-app-error-github-credentials-missing.json | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 54c875dbf..f89deb570 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -567,13 +567,19 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE const base = 'in-app-documentation' const title = 'Contribution to Superalgos' - await octokit.pulls.create({ - owner, - repo, - title, - head, - base, - }); + try { + await octokit.pulls.create({ + owner, + repo, + title, + head, + base, + }); + } catch (err) { + if (err.stack.indexOf('A pull request already exists') <0) { + throw(err) + } + } } } catch (err) { diff --git a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json index 680bc524a..30b8cfff5 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-002-app-error-github-credentials-missing.json @@ -3,8 +3,8 @@ "pageNumber": "2", "type": "App Error Github Credentials Missing", "definition": { - "text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository. 2", - "updated": 1609938311079 + "text": "In order to manage contributions from within the app, you first need to provide your Github.com credentials so that we can get authenticated when pushing your changes to the remote repository. 3", + "updated": 1609938644926 }, "paragraphs": [ {