Refactoring Active for Current Branch

This commit is contained in:
Luis Fernando Molina committed 2021-01-13 12:59:04 +01:00
1 parent 8b247f7af9
commit 76a0a8c764
7 files changed
+24 -24

No files matched your search

+6 -6
View File
@@ -533,7 +533,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
const commitMessage = unescape(requestParameters[3])
const username = unescape(requestParameters[4])
const token = unescape(requestParameters[5])
const activeBranch = unescape(requestParameters[6])
const currentBranch = unescape(requestParameters[6])
const contributionsBranch = unescape(requestParameters[7])
contribute()
@@ -570,7 +570,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
const repo = 'Superalgos'
const owner = 'Superalgos'
const head = username + ':' + contributionsBranch
const base = activeBranch
const base = currentBranch
const title = 'Contribution: ' + commitMessage
try {
@@ -606,7 +606,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
case 'Update': {
try {
const activeBranch = unescape(requestParameters[3])
const currentBranch = unescape(requestParameters[3])
update()
async function update() {
@@ -628,7 +628,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
const git = simpleGit(options)
return await git.pull('upstream', activeBranch)
return await git.pull('upstream', currentBranch)
}
} catch (err) {
@@ -650,7 +650,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
case 'Checkout': {
try {
const activeBranch = unescape(requestParameters[3])
const currentBranch = unescape(requestParameters[3])
checkout()
async function checkout() {
@@ -672,7 +672,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
const git = simpleGit(options)
return await git.checkoutBranch(activeBranch)
return await git.checkoutBranch(currentBranch)
}
} catch (err) {
@@ -1,7 +1,7 @@
{
"topic": "Branches Management Messages",
"pageNumber": "1",
"type": "Switching Branches - Changing Active Branch",
"type": "Switching Branches - Changing Current Branch",
"definition": {
"text": "Write here a summary for this topic page."
},
@@ -1,7 +1,7 @@
{
"topic": "Branches Management Messages",
"pageNumber": "2",
"type": "Switching Branches - Active Branch Changed",
"type": "Switching Branches - Current Branch Changed",
"definition": {
"text": "Write here a summary for this topic page."
},
@@ -1,7 +1,7 @@
{
"topic": "Branches Management Messages",
"pageNumber": "4",
"type": "Switching Branches - Active Branch Not Changed",
"type": "Switching Branches - Current Branch Not Changed",
"definition": {
"text": "Write here a summary for this topic page."
},
@@ -68,7 +68,7 @@ function newSuperalgosDocsCommmandInterface() {
message + '/' +
config.username + '/' +
config.token + '/' +
UI.projects.superalgos.spaces.docsSpace.activeBranch + '/' +
UI.projects.superalgos.spaces.docsSpace.currentBranch + '/' +
UI.projects.superalgos.spaces.docsSpace.contributionBranch
, onResponse)
@@ -121,7 +121,7 @@ function newSuperalgosDocsCommmandInterface() {
return
}
httpRequest(undefined, 'App/Update/' + UI.projects.superalgos.spaces.docsSpace.activeBranch, onResponse)
httpRequest(undefined, 'App/Update/' + UI.projects.superalgos.spaces.docsSpace.currentBranch, onResponse)
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message - Updating Your Local App')
return
@@ -12,7 +12,7 @@ function newSuperalgosDocSpace() {
commandInterface: undefined,
contextMenu: undefined,
language: undefined,
activeBranch: undefined,
currentBranch: undefined,
contributionsBranch: undefined,
menuLabelsMap: undefined,
currentDocumentBeingRendered: undefined,
@@ -86,11 +86,11 @@ function newSuperalgosDocSpace() {
/*
Getting the used preferred languague
*/
if (window.localStorage.getItem('Active Branch') !== null && window.localStorage.getItem('Active Branch') !== undefined && window.localStorage.getItem('Active Branch') !== 'undefined') {
UI.projects.superalgos.spaces.docsSpace.activeBranch = window.localStorage.getItem('Active Branch')
if (window.localStorage.getItem('Current Branch') !== null && window.localStorage.getItem('Current Branch') !== undefined && window.localStorage.getItem('Current Branch') !== 'undefined') {
UI.projects.superalgos.spaces.docsSpace.currentBranch = window.localStorage.getItem('Current Branch')
} else {
window.localStorage.setItem('Active Branch', UI.projects.superalgos.globals.docs.DEFAULT_ACTIVE_BRANCH)
UI.projects.superalgos.spaces.docsSpace.activeBranch = UI.projects.superalgos.globals.docs.DEFAULT_ACTIVE_BRANCH
window.localStorage.setItem('Current Branch', UI.projects.superalgos.globals.docs.DEFAULT_ACTIVE_BRANCH)
UI.projects.superalgos.spaces.docsSpace.currentBranch = UI.projects.superalgos.globals.docs.DEFAULT_ACTIVE_BRANCH
}
}
@@ -185,18 +185,18 @@ function newSuperalgosDocSpace() {
}
function changeActiveBranch(branch) {
window.localStorage.setItem('Active Branch', UI.projects.superalgos.spaces.docsSpace.activeBranch)
httpRequest(undefined, 'App/Checkout/' + UI.projects.superalgos.spaces.docsSpace.activeBranch, onResponse)
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Changing Active Branch')
window.localStorage.setItem('Current Branch', UI.projects.superalgos.spaces.docsSpace.currentBranch)
httpRequest(undefined, 'App/Checkout/' + UI.projects.superalgos.spaces.docsSpace.currentBranch, onResponse)
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Changing Current Branch')
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) {
UI.projects.superalgos.spaces.docsSpace.activeBranch = branch
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Active Branch Changed')
UI.projects.superalgos.spaces.docsSpace.currentBranch = branch
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Current Branch Changed')
} else {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Active Branch Not Changed')
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Current Branch Not Changed')
}
}
}
@@ -94,8 +94,8 @@ function newSuperalgosDocsFooter() {
HTML = HTML + '</div>'
HTML = HTML + '<div class="docs-footer-cell">'
HTML = HTML + '<h4>Choose the Active Branch</h4>'
HTML = HTML + 'You are currently running on the <code class="docs-footer-code">' + UI.projects.superalgos.utilities.gitBranches.getBranchLabel(UI.projects.superalgos.spaces.docsSpace.activeBranch) + '</code> branch. Switch to:'
HTML = HTML + '<h4>Choose the Current Branch</h4>'
HTML = HTML + 'You are currently running on the <code class="docs-footer-code">' + UI.projects.superalgos.utilities.gitBranches.getBranchLabel(UI.projects.superalgos.spaces.docsSpace.currentBranch) + '</code> branch. Switch to:'
HTML = HTML + '<ul>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.superalgos.spaces.docsSpace.changeActiveBranch(\'master\')">Master</a></li>'
HTML = HTML + '<li><a href="#" onClick="UI.projects.superalgos.spaces.docsSpace.changeActiveBranch(\'develop\')">Develop</a></li>'