From 3a1f99ff869609d609b8a052a543a1cdf88283df Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Jun 2021 17:17:16 +0200 Subject: [PATCH] Branch Changes after new workspace is loaded, if needed, depending on Workspace Config Property --- .../UI/Spaces/Docs-Space/DocsSpace.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js index baf0f5679..42f9e9b4d 100644 --- a/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js @@ -64,8 +64,6 @@ function newEducationDocSpace() { setupSidePanelTab() setUpMenuItemsMap() setupUserLanguage() - setupCurrentBranch() - setupContributionsBranch() thisObject.searchEngine = newFoundationsDocsSearchEngine() thisObject.mainSearchPage = newFoundationsDocsMainSearchPage() @@ -83,6 +81,9 @@ function newEducationDocSpace() { thisObject.commandInterface.initialize() thisObject.contextMenu.initialize() + setupCurrentBranch() + setupContributionsBranch() + isInitialized = true UI.projects.foundations.utilities.statusBar.changeStatus("Setting up Docs Search Engine...") @@ -111,7 +112,7 @@ function newEducationDocSpace() { /* Every time this setup occurs, we will automatically change to the currentBranch of the workspace. */ - changeCurrentBranch(UI.projects.education.spaces.docsSpace.currentBranch) + changeCurrentBranch(UI.projects.education.spaces.docsSpace.currentBranch, true) /* Deleting what was is here because is not longer used... */ @@ -134,7 +135,7 @@ function newEducationDocSpace() { /* Every time this setup occurs, we will automatically change to the contributionsBranch of the workspace. */ - changeContributionsBranch(UI.projects.education.spaces.docsSpace.contributionsBranch) + changeContributionsBranch(UI.projects.education.spaces.docsSpace.contributionsBranch, true) /* Deleting what was is here because is not longer used... */ @@ -229,9 +230,11 @@ function newEducationDocSpace() { await initialize() } - function changeCurrentBranch(branch) { + function changeCurrentBranch(branch, doNotNavigate) { httpRequest(undefined, 'App/Checkout/' + branch, onResponse) - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'Switching Branches - Changing Current Branch') + if (doNotNavigate !== true) { + UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'Switching Branches - Changing Current Branch') + } function onResponse(err, data) { /* Lets check the result of the call through the http interface */ @@ -240,6 +243,8 @@ function newEducationDocSpace() { UI.projects.education.spaces.docsSpace.currentBranch = branch let workspace = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(workspace.payload, 'currentBranch', branch) + + if (doNotNavigate === true) { return } UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'Switching Branches - Current Branch Changed') } else { UI.projects.education.spaces.docsSpace.navigateTo( @@ -254,12 +259,14 @@ function newEducationDocSpace() { } } - function changeContributionsBranch(branch) { + function changeContributionsBranch(branch, doNotNavigate) { UI.projects.education.spaces.docsSpace.contributionsBranch = branch let workspace = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(workspace.payload, 'contributionsBranch', branch) - UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'Switching Branches - Contributions Branch Changed') + if (doNotNavigate !== true) { + UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'Switching Branches - Contributions Branch Changed') + } } function changeLanguage(pLanguage) {