Current Branch being asked to Git, removed from Workspace Config and Browser Local Storage
This commit is contained in:
1 parent
268d5eba7c
commit
a64dd3ccd8
3 files changed
+162
-17
No files matched your search
+56
-6
@@ -833,9 +833,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> token = ' + token)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
@@ -892,9 +889,62 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> token = ' + token)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err.message,
|
||||
stack: err.stack
|
||||
}
|
||||
respondWithContent(JSON.stringify(error), httpResponse)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
case 'Branch': {
|
||||
try {
|
||||
branch()
|
||||
|
||||
async function branch() {
|
||||
let result = await doGit()
|
||||
|
||||
if (result.error === undefined) {
|
||||
let customResponse = {
|
||||
result: global.CUSTOM_OK_RESPONSE.result,
|
||||
message: result
|
||||
}
|
||||
respondWithContent(JSON.stringify(customResponse), httpResponse)
|
||||
} else {
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'App Error - Could Not Get Current Branch',
|
||||
anchor: undefined,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
respondWithDocsObject(docs, error)
|
||||
}
|
||||
}
|
||||
|
||||
async function doGit() {
|
||||
const simpleGit = require('simple-git');
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
maxConcurrentProcesses: 6,
|
||||
}
|
||||
const git = simpleGit(options)
|
||||
try {
|
||||
return await git.branch()
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Error reading current branch.')
|
||||
console.log(err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
|
||||
@@ -101,22 +101,32 @@ function newEducationDocSpace() {
|
||||
Getting the currentBranch
|
||||
*/
|
||||
let workspace = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode
|
||||
let currentBranch = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(workspace.payload, 'currentBranch')
|
||||
let currentBranch
|
||||
|
||||
if (currentBranch === undefined) {
|
||||
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(workspace.payload, 'currentBranch', UI.projects.education.globals.docs.DEFAULT_CURRENT_BRANCH)
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = UI.projects.education.globals.docs.DEFAULT_CURRENT_BRANCH
|
||||
} else {
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = currentBranch
|
||||
}
|
||||
/*
|
||||
Every time this setup occurs, we will automatically change to the currentBranch of the workspace.
|
||||
*/
|
||||
//changeCurrentBranch(UI.projects.education.spaces.docsSpace.currentBranch, true)
|
||||
httpRequest(undefined, 'App/Branch', onResponse)
|
||||
/*
|
||||
Deleting what was is here because is not longer used...
|
||||
*/
|
||||
window.localStorage.removeItem('Current Branch')
|
||||
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(workspace.payload, 'currentBranch', undefined)
|
||||
|
||||
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) {
|
||||
let currentBranch = data.message.current
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = currentBranch
|
||||
} else {
|
||||
UI.projects.education.spaces.docsSpace.navigateTo(
|
||||
data.docs.project,
|
||||
data.docs.category,
|
||||
data.docs.type,
|
||||
data.docs.anchor,
|
||||
undefined,
|
||||
data.docs.placeholder
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupContributionsBranch() {
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"topic": "App Commands Errors",
|
||||
"pageNumber": "3",
|
||||
"type": "App Error - Could Not Get Current Branch",
|
||||
"definition": {
|
||||
"text": "There was a problem trying to get the Current Branch. 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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user