Merge pull request #1245 from Luis-Fernando-Molina/develop
Contribution: Big Mantainance Session: Loading of workspace reorganized, Language stored as Config Property of Workspace, removed from Browser Local Stoarage
This commit is contained in:
10 files changed
+293
-224
No files matched your search
@@ -56,100 +56,122 @@ function newEducationDocSpace() {
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
thisObject.menuLabelsMap = new Map()
|
||||
async function initialize() {
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
setupSidePanelTab()
|
||||
setUpMenuItemsMap()
|
||||
setupUserLanguage()
|
||||
setupActiveBranch()
|
||||
setupContributionsBranch()
|
||||
thisObject.menuLabelsMap = new Map()
|
||||
|
||||
thisObject.searchEngine = newFoundationsDocsSearchEngine()
|
||||
thisObject.mainSearchPage = newFoundationsDocsMainSearchPage()
|
||||
thisObject.searchResultsPage = newFoundationsDocsSearchResultsPage()
|
||||
thisObject.documentPage = newFoundationsDocsDocumentPage()
|
||||
thisObject.footer = newFoundationsDocsFooter()
|
||||
thisObject.commandInterface = newFoundationsDocsCommmandInterface()
|
||||
thisObject.contextMenu = newFoundationsDocsContextMenu()
|
||||
setupSidePanelTab()
|
||||
setUpMenuItemsMap()
|
||||
setupUserLanguage()
|
||||
setupActiveBranch()
|
||||
setupContributionsBranch()
|
||||
|
||||
thisObject.searchEngine = newFoundationsDocsSearchEngine()
|
||||
thisObject.mainSearchPage = newFoundationsDocsMainSearchPage()
|
||||
thisObject.searchResultsPage = newFoundationsDocsSearchResultsPage()
|
||||
thisObject.documentPage = newFoundationsDocsDocumentPage()
|
||||
thisObject.footer = newFoundationsDocsFooter()
|
||||
thisObject.commandInterface = newFoundationsDocsCommmandInterface()
|
||||
thisObject.contextMenu = newFoundationsDocsContextMenu()
|
||||
|
||||
thisObject.searchEngine.initialize()
|
||||
thisObject.mainSearchPage.initialize()
|
||||
thisObject.searchResultsPage.initialize()
|
||||
thisObject.documentPage.initialize()
|
||||
thisObject.footer.initialize()
|
||||
thisObject.commandInterface.initialize()
|
||||
thisObject.contextMenu.initialize()
|
||||
|
||||
isInitialized = true
|
||||
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Setting up Docs Search Engine...")
|
||||
setTimeout(setUpSearchEngine, 100)
|
||||
|
||||
thisObject.searchEngine.initialize()
|
||||
thisObject.mainSearchPage.initialize()
|
||||
thisObject.searchResultsPage.initialize()
|
||||
thisObject.documentPage.initialize()
|
||||
thisObject.footer.initialize()
|
||||
thisObject.commandInterface.initialize()
|
||||
thisObject.contextMenu.initialize()
|
||||
|
||||
isInitialized = true
|
||||
|
||||
function setupActiveBranch() {
|
||||
/*
|
||||
Getting the used preferred languague
|
||||
*/
|
||||
if (window.localStorage.getItem('Current Branch') !== null && window.localStorage.getItem('Current Branch') !== undefined && window.localStorage.getItem('Current Branch') !== 'undefined') {
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = window.localStorage.getItem('Current Branch')
|
||||
} else {
|
||||
window.localStorage.setItem('Current Branch', UI.projects.education.globals.docs.DEFAULT_CURRENT_BRANCH)
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = UI.projects.education.globals.docs.DEFAULT_CURRENT_BRANCH
|
||||
function setUpSearchEngine() {
|
||||
thisObject.searchEngine.setUpSearchEngine(whenFinished)
|
||||
function whenFinished(){
|
||||
resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupContributionsBranch() {
|
||||
/*
|
||||
Getting the used preferred languague
|
||||
*/
|
||||
if (window.localStorage.getItem('Contributions Branch') !== null && window.localStorage.getItem('Contributions Branch') !== undefined && window.localStorage.getItem('Contributions Branch') !== 'undefined') {
|
||||
UI.projects.education.spaces.docsSpace.contributionsBranch = window.localStorage.getItem('Contributions Branch')
|
||||
} else {
|
||||
window.localStorage.setItem('Contributions Branch', UI.projects.education.globals.docs.DEFAULT_CONTRIBUTIONS_BRANCH)
|
||||
UI.projects.education.spaces.docsSpace.contributionsBranch = UI.projects.education.globals.docs.DEFAULT_CONTRIBUTIONS_BRANCH
|
||||
|
||||
function setupActiveBranch() {
|
||||
/*
|
||||
Getting the used preferred languague
|
||||
*/
|
||||
if (window.localStorage.getItem('Current Branch') !== null && window.localStorage.getItem('Current Branch') !== undefined && window.localStorage.getItem('Current Branch') !== 'undefined') {
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = window.localStorage.getItem('Current Branch')
|
||||
} else {
|
||||
window.localStorage.setItem('Current Branch', UI.projects.education.globals.docs.DEFAULT_CURRENT_BRANCH)
|
||||
UI.projects.education.spaces.docsSpace.currentBranch = UI.projects.education.globals.docs.DEFAULT_CURRENT_BRANCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupUserLanguage() {
|
||||
/*
|
||||
Getting the used preferred languague
|
||||
*/
|
||||
if (window.localStorage.getItem('Docs Language') !== null && window.localStorage.getItem('Docs Language') !== undefined && window.localStorage.getItem('Docs Language') !== 'undefined') {
|
||||
UI.projects.education.spaces.docsSpace.language = window.localStorage.getItem('Docs Language')
|
||||
} else {
|
||||
window.localStorage.setItem('Docs Language', UI.projects.education.globals.docs.DEFAULT_LANGUAGE)
|
||||
UI.projects.education.spaces.docsSpace.language = UI.projects.education.globals.docs.DEFAULT_LANGUAGE
|
||||
|
||||
function setupContributionsBranch() {
|
||||
/*
|
||||
Getting the used preferred languague
|
||||
*/
|
||||
if (window.localStorage.getItem('Contributions Branch') !== null && window.localStorage.getItem('Contributions Branch') !== undefined && window.localStorage.getItem('Contributions Branch') !== 'undefined') {
|
||||
UI.projects.education.spaces.docsSpace.contributionsBranch = window.localStorage.getItem('Contributions Branch')
|
||||
} else {
|
||||
window.localStorage.setItem('Contributions Branch', UI.projects.education.globals.docs.DEFAULT_CONTRIBUTIONS_BRANCH)
|
||||
UI.projects.education.spaces.docsSpace.contributionsBranch = UI.projects.education.globals.docs.DEFAULT_CONTRIBUTIONS_BRANCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupSidePanelTab() {
|
||||
thisObject.sidePanelTab = newSidePanelTab()
|
||||
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
|
||||
thisObject.sidePanelTab.initialize('right')
|
||||
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening)
|
||||
closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing)
|
||||
|
||||
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
|
||||
}
|
||||
|
||||
function setUpMenuItemsMap() {
|
||||
/*
|
||||
Here we will put put all the menu item labels of all nodes at all
|
||||
app schemas into a single map, that will allow us to know when a phrase
|
||||
is a label of a menu and then change its style.
|
||||
*/
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
let appSchemaArray = SCHEMAS_BY_PROJECT.get(project).array.appSchema
|
||||
|
||||
for (let j = 0; j < appSchemaArray.length; j++) {
|
||||
let docsSchemaDocument = appSchemaArray[j]
|
||||
|
||||
if (docsSchemaDocument.menuItems === undefined) { continue }
|
||||
for (let k = 0; k < docsSchemaDocument.menuItems.length; k++) {
|
||||
let menuItem = docsSchemaDocument.menuItems[k]
|
||||
thisObject.menuLabelsMap.set(menuItem.label, true)
|
||||
|
||||
function setupUserLanguage() {
|
||||
/*
|
||||
Getting the used preferred languague
|
||||
*/
|
||||
let workspace = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode
|
||||
let docsLanguage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(workspace.payload, 'docsLanguage')
|
||||
|
||||
if (docsLanguage === undefined) {
|
||||
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(workspace.payload, 'docsLanguage', UI.projects.education.globals.docs.DEFAULT_LANGUAGE)
|
||||
UI.projects.education.spaces.docsSpace.language = UI.projects.education.globals.docs.DEFAULT_LANGUAGE
|
||||
} else {
|
||||
UI.projects.education.spaces.docsSpace.language = docsLanguage
|
||||
}
|
||||
/*
|
||||
Deleting was is here because is not longer used
|
||||
*/
|
||||
window.localStorage.setItem('Docs Language', undefined)
|
||||
}
|
||||
|
||||
function setupSidePanelTab() {
|
||||
thisObject.sidePanelTab = newSidePanelTab()
|
||||
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
|
||||
thisObject.sidePanelTab.initialize('right')
|
||||
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening)
|
||||
closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing)
|
||||
|
||||
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
|
||||
}
|
||||
|
||||
function setUpMenuItemsMap() {
|
||||
/*
|
||||
Here we will put put all the menu item labels of all nodes at all
|
||||
app schemas into a single map, that will allow us to know when a phrase
|
||||
is a label of a menu and then change its style.
|
||||
*/
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
let appSchemaArray = SCHEMAS_BY_PROJECT.get(project).array.appSchema
|
||||
|
||||
for (let j = 0; j < appSchemaArray.length; j++) {
|
||||
let docsSchemaDocument = appSchemaArray[j]
|
||||
|
||||
if (docsSchemaDocument.menuItems === undefined) { continue }
|
||||
for (let k = 0; k < docsSchemaDocument.menuItems.length; k++) {
|
||||
let menuItem = docsSchemaDocument.menuItems[k]
|
||||
thisObject.menuLabelsMap.set(menuItem.label, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return promise
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
@@ -180,9 +202,9 @@ function newEducationDocSpace() {
|
||||
isInitialized = false
|
||||
}
|
||||
|
||||
function reset() {
|
||||
async function reset() {
|
||||
finalize()
|
||||
initialize()
|
||||
await initialize()
|
||||
}
|
||||
|
||||
function changeCurrentBranch(branch) {
|
||||
@@ -217,9 +239,12 @@ function newEducationDocSpace() {
|
||||
|
||||
function changeLanguage(pLanguage) {
|
||||
UI.projects.education.spaces.docsSpace.language = pLanguage
|
||||
window.localStorage.setItem('Docs Language', UI.projects.education.spaces.docsSpace.language)
|
||||
let languageLabel = UI.projects.education.utilities.languages.getLaguageLabel(UI.projects.education.spaces.docsSpace.language)
|
||||
UI.projects.education.spaces.docsSpace.navigateTo('Foundations', 'Topic', 'Docs In ' + languageLabel)
|
||||
|
||||
let workspace = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode
|
||||
|
||||
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(workspace.payload, 'docsLanguage', UI.projects.education.spaces.docsSpace.language)
|
||||
}
|
||||
|
||||
function sharePage() {
|
||||
@@ -356,6 +381,7 @@ function newEducationDocSpace() {
|
||||
}
|
||||
|
||||
function getContainer(point, purpose) {
|
||||
if (thisObject.sidePanelTab === undefined) { return }
|
||||
let container
|
||||
|
||||
container = thisObject.sidePanelTab.getContainer(point, purpose)
|
||||
|
||||
@@ -17,7 +17,8 @@ function newEducationTutorialSpace() {
|
||||
draw: draw,
|
||||
getContainer: getContainer,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
finalize: finalize,
|
||||
reset: reset
|
||||
}
|
||||
|
||||
let TUTORIAL_NAME
|
||||
@@ -45,37 +46,67 @@ function newEducationTutorialSpace() {
|
||||
let tutorialDiv = document.getElementById('tutorialDiv')
|
||||
let tutorialFormDiv = document.getElementById('tutorialFormDiv')
|
||||
let htmlGif = document.createElement("IMG")
|
||||
let currentGifName = 'Never Set'
|
||||
let newGifName = 'Never Set'
|
||||
let htmlImage = document.createElement("IMG")
|
||||
let currentImageName = 'Never Set'
|
||||
let newImageName = 'Never Set'
|
||||
let newImageProject = 'Never Set'
|
||||
|
||||
let currentGifName
|
||||
let newGifName
|
||||
let currentImageName
|
||||
let newImageName
|
||||
let newImageProject
|
||||
let currentConfig
|
||||
let newConfig
|
||||
let currentDocument
|
||||
let newDocument
|
||||
let resumeModeActivated // In this mode, we skip all the node which status is 'Done'
|
||||
let lastExecutedAction = ''
|
||||
let actionCounter = 0
|
||||
let forcingFocus = false
|
||||
let currentZoomStep = 0
|
||||
let viewportCentered = false
|
||||
let repositionAtTimeMachineCounter = 0
|
||||
let positionAtNodeCounter = 0
|
||||
let timeMachineKeyPressedCounter = 0
|
||||
let keyPressedCounter = 0
|
||||
let sliderCounter = 0
|
||||
let changeNodeConfigCounter = 0
|
||||
let changeNodeConfigCounterWithEval = 0
|
||||
let documentationCounter = 0
|
||||
let batchConfigChangesCounter = 0
|
||||
let workspacesCounter = 0
|
||||
let resumeModeActivated
|
||||
let lastExecutedAction
|
||||
let actionCounter
|
||||
let forcingFocus
|
||||
let currentZoomStep
|
||||
let viewportCentered
|
||||
let repositionAtTimeMachineCounter
|
||||
let positionAtNodeCounter
|
||||
let timeMachineKeyPressedCounter
|
||||
let keyPressedCounter
|
||||
let sliderCounter
|
||||
let changeNodeConfigCounter
|
||||
let changeNodeConfigCounterWithEval
|
||||
let documentationCounter
|
||||
let batchConfigChangesCounter
|
||||
let workspacesCounter
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
|
||||
currentGifName = 'Never Set'
|
||||
newGifName = 'Never Set'
|
||||
currentImageName = 'Never Set'
|
||||
newImageName = 'Never Set'
|
||||
newImageProject = 'Never Set'
|
||||
currentConfig
|
||||
newConfig
|
||||
currentDocument
|
||||
newDocument
|
||||
resumeModeActivated // In this mode, we skip all the node which status is 'Done'
|
||||
lastExecutedAction = ''
|
||||
actionCounter = 0
|
||||
forcingFocus = false
|
||||
currentZoomStep = 0
|
||||
viewportCentered = false
|
||||
repositionAtTimeMachineCounter = 0
|
||||
positionAtNodeCounter = 0
|
||||
timeMachineKeyPressedCounter = 0
|
||||
keyPressedCounter = 0
|
||||
sliderCounter = 0
|
||||
changeNodeConfigCounter = 0
|
||||
changeNodeConfigCounterWithEval = 0
|
||||
documentationCounter = 0
|
||||
batchConfigChangesCounter = 0
|
||||
workspacesCounter = 0
|
||||
|
||||
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
|
||||
let workspace = UI.projects.foundations.spaces.designSpace.workspace
|
||||
workspace.executeAction({ name: 'Play Tutorials', project: 'Foundations' })
|
||||
isInitialized = true
|
||||
}
|
||||
|
||||
@@ -86,10 +117,11 @@ function newEducationTutorialSpace() {
|
||||
currentNode = undefined
|
||||
navigationStack = undefined
|
||||
|
||||
tutorialDiv = undefined
|
||||
tutorialFormDiv = undefined
|
||||
image = undefined
|
||||
gif = undefined
|
||||
}
|
||||
|
||||
async function reset() {
|
||||
finalize()
|
||||
initialize()
|
||||
}
|
||||
|
||||
function resize() {
|
||||
@@ -1177,7 +1209,7 @@ function newEducationTutorialSpace() {
|
||||
/* The current node is not referencing any page at the Docs */
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let schemaDocument = SCHEMAS_BY_PROJECT.get(nodeConfig.docs.project).map.docsTutorialSchema.get(nodeConfig.docs.type)
|
||||
|
||||
if (schemaDocument === undefined) {
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
"actionFunction": "UI.projects.foundations.spaces.designSpace.workspace.backup",
|
||||
"ring": 1
|
||||
},
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"dontShowAtFullscreen": true,
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add Missing Workspace Projects",
|
||||
"label": "Add Missing Projects",
|
||||
@@ -31,6 +39,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"initialValues": {
|
||||
"config": "{\"docsLanguage\": \"EN\"}"
|
||||
},
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"isTitleAllwaysVisible": true,
|
||||
"addLeftIcons": false,
|
||||
"isPinned": true,
|
||||
|
||||
@@ -32,6 +32,9 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
|
||||
learningSessionsFoundAtWorkspace = []
|
||||
tutorialsToPlay = []
|
||||
|
||||
/* Initializing the workspace config */
|
||||
if (node.config === undefined || node.config === 'undefined') { node.config = '{}' }
|
||||
|
||||
removeNullRootNodes()
|
||||
|
||||
function removeNullRootNodes() {
|
||||
|
||||
@@ -78,6 +78,7 @@ function newFoundationsChatSpace() {
|
||||
}
|
||||
|
||||
function getContainer(point, purpose) {
|
||||
if (thisObject.sidePanelTab === undefined) { return }
|
||||
let container
|
||||
|
||||
container = thisObject.sidePanelTab.getContainer(point, purpose)
|
||||
|
||||
@@ -25,42 +25,49 @@ function newFoundationsDesignSpace() {
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
loadIconCollection(onIconsReady)
|
||||
async function initialize() {
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
function onIconsReady() {
|
||||
buildIconByProjectAndTypeMap()
|
||||
thisObject.workspace = newWorkspace()
|
||||
thisObject.workspace.initialize()
|
||||
}
|
||||
loadIconCollection(onIconsReady)
|
||||
|
||||
function buildIconByProjectAndTypeMap() {
|
||||
/* Take types-icons relationships defined at the schema */
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.appSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema)
|
||||
|
||||
function addSchemaTypes(schema) {
|
||||
for (let j = 0; j < schema.length; j++) {
|
||||
let schemaDocument = schema[j]
|
||||
let iconName = schemaDocument.icon
|
||||
if (iconName === undefined) {
|
||||
iconName = schemaDocument.type.toLowerCase()
|
||||
iconName = iconName.split(" ").join("-")
|
||||
}
|
||||
let icon = thisObject.getIconByProjectAndName(project, iconName)
|
||||
if (icon !== undefined) {
|
||||
let key = project + '-' + schemaDocument.type
|
||||
thisObject.iconsByProjectAndType.set(key, icon)
|
||||
async function onIconsReady() {
|
||||
buildIconByProjectAndTypeMap()
|
||||
thisObject.workspace = newWorkspace()
|
||||
await thisObject.workspace.initialize()
|
||||
resolve()
|
||||
}
|
||||
|
||||
function buildIconByProjectAndTypeMap() {
|
||||
/* Take types-icons relationships defined at the schema */
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.appSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema)
|
||||
addSchemaTypes(SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema)
|
||||
|
||||
function addSchemaTypes(schema) {
|
||||
for (let j = 0; j < schema.length; j++) {
|
||||
let schemaDocument = schema[j]
|
||||
let iconName = schemaDocument.icon
|
||||
if (iconName === undefined) {
|
||||
iconName = schemaDocument.type.toLowerCase()
|
||||
iconName = iconName.split(" ").join("-")
|
||||
}
|
||||
let icon = thisObject.getIconByProjectAndName(project, iconName)
|
||||
if (icon !== undefined) {
|
||||
let key = project + '-' + schemaDocument.type
|
||||
thisObject.iconsByProjectAndType.set(key, icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return promise
|
||||
|
||||
}
|
||||
|
||||
function loadIconCollection(callBack) {
|
||||
|
||||
@@ -20,7 +20,7 @@ function newWorkspace() {
|
||||
getHierarchyHeads: getHierarchyHeads,
|
||||
getHierarchyHeadsById: getHierarchyHeadsById,
|
||||
getHierarchyHeadByNodeType: getHierarchyHeadByNodeType,
|
||||
getHierarchyHeadsByNodeType: getHierarchyHeadsByNodeType,
|
||||
getHierarchyHeadsByNodeType: getHierarchyHeadsByNodeType,
|
||||
getNodeThatIsOnFocus: getNodeThatIsOnFocus,
|
||||
getNodeByShortcutKey: getNodeByShortcutKey,
|
||||
getNodeById: getNodeById,
|
||||
@@ -59,78 +59,72 @@ function newWorkspace() {
|
||||
actionSwitchesByProject = undefined
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
try {
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Initializing...")
|
||||
async function initialize() {
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
/* Set up the action switches map */
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
let actionSwitch = eval('new' + project + 'ActionSwitch()')
|
||||
actionSwitchesByProject.set(project, actionSwitch)
|
||||
}
|
||||
try {
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Initializing...")
|
||||
|
||||
/* Check which was the last workspace. */
|
||||
let lastUsedWorkspace = window.localStorage.getItem('Last Used Workspace')
|
||||
/* Set up the action switches map */
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let project = PROJECTS_SCHEMA[i].name
|
||||
let actionSwitch = eval('new' + project + 'ActionSwitch()')
|
||||
actionSwitchesByProject.set(project, actionSwitch)
|
||||
}
|
||||
|
||||
if (lastUsedWorkspace !== 'undefined' && lastUsedWorkspace !== null && lastUsedWorkspace !== undefined) {
|
||||
/* Check which was the last workspace. */
|
||||
let lastUsedWorkspace = window.localStorage.getItem('Last Used Workspace')
|
||||
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Loading Workspace " + lastUsedWorkspace + "...")
|
||||
if (lastUsedWorkspace !== 'undefined' && lastUsedWorkspace !== null && lastUsedWorkspace !== undefined) {
|
||||
|
||||
httpRequest(undefined, 'LoadMyWorkspace' + '/' + lastUsedWorkspace, onFileReceived)
|
||||
function onFileReceived(err, text, response) {
|
||||
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
UI.projects.foundations.spaces.cockpitSpace.setStatus('Could not load the last Workspace used, called "' + lastUsedWorkspace + '". Will switch to the default Workspace instead.', 500, UI.projects.foundations.spaces.cockpitSpace.statusTypes.WARNING)
|
||||
thisObject.workspaceNode = getWorkspace() // This is the default workspace that comes with the system.
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Loading Workspace " + lastUsedWorkspace + "...")
|
||||
|
||||
httpRequest(undefined, 'LoadMyWorkspace' + '/' + lastUsedWorkspace, onFileReceived)
|
||||
function onFileReceived(err, text, response) {
|
||||
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
UI.projects.foundations.spaces.cockpitSpace.setStatus('Could not load the last Workspace used, called "' + lastUsedWorkspace + '". Will switch to the default Workspace instead.', 500, UI.projects.foundations.spaces.cockpitSpace.statusTypes.WARNING)
|
||||
thisObject.workspaceNode = getWorkspace() // This is the default workspace that comes with the system.
|
||||
thisObject.workspaceNode.project = 'Foundations'
|
||||
recreateWorkspace()
|
||||
return
|
||||
}
|
||||
thisObject.workspaceNode = JSON.parse(text)
|
||||
thisObject.workspaceNode.project = 'Foundations'
|
||||
recreateWorkspace()
|
||||
return
|
||||
}
|
||||
thisObject.workspaceNode = JSON.parse(text)
|
||||
} else {
|
||||
thisObject.workspaceNode = getWorkspace() // This is the default workspace that comes with the system.
|
||||
thisObject.workspaceNode.project = 'Foundations'
|
||||
recreateWorkspace()
|
||||
}
|
||||
} else {
|
||||
thisObject.workspaceNode = getWorkspace() // This is the default workspace that comes with the system.
|
||||
thisObject.workspaceNode.project = 'Foundations'
|
||||
recreateWorkspace()
|
||||
}
|
||||
|
||||
function recreateWorkspace() {
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Connecting all the workspace nodes...")
|
||||
executeAction({ node: thisObject.workspaceNode, name: 'Recreate Workspace', project: 'Foundations', callBackFunction: finishInitialization })
|
||||
}
|
||||
|
||||
function finishInitialization() {
|
||||
/*
|
||||
We will help the Docs Space finish its initialization, since it is
|
||||
waiting for the workspace to be done.
|
||||
*/
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Setting up Docs Search Engine...")
|
||||
setTimeout(theEnd, 100)
|
||||
function theEnd() {
|
||||
UI.projects.education.spaces.docsSpace.searchEngine.setUpSearchEngine(onIndexingFinished)
|
||||
|
||||
function onIndexingFinished() {
|
||||
setupEventsServerClients()
|
||||
runTasksAndSessions()
|
||||
|
||||
thisObject.enabled = true
|
||||
UI.projects.foundations.spaces.cockpitSpace.initializePosition()
|
||||
CAN_SPACES_DRAW = true
|
||||
|
||||
thisObject.isInitialized = true
|
||||
|
||||
playTutorials()
|
||||
|
||||
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Displaying the UI...")
|
||||
}
|
||||
function recreateWorkspace() {
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Connecting all the workspace nodes...")
|
||||
executeAction({ node: thisObject.workspaceNode, name: 'Recreate Workspace', project: 'Foundations', callBackFunction: finishInitialization })
|
||||
}
|
||||
|
||||
function finishInitialization() {
|
||||
|
||||
setupEventsServerClients()
|
||||
runTasksAndSessions()
|
||||
|
||||
thisObject.enabled = true
|
||||
UI.projects.foundations.spaces.cockpitSpace.initializePosition()
|
||||
CAN_SPACES_DRAW = true
|
||||
|
||||
thisObject.isInitialized = true
|
||||
|
||||
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus("Displaying the UI...")
|
||||
|
||||
resolve()
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) }
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) }
|
||||
}
|
||||
})
|
||||
|
||||
return promise
|
||||
}
|
||||
|
||||
function runTasksAndSessions() {
|
||||
@@ -139,10 +133,6 @@ function newWorkspace() {
|
||||
executeAction({ name: 'Syncronize Learning Sessions', project: 'Foundations' })
|
||||
}
|
||||
|
||||
function playTutorials() {
|
||||
executeAction({ name: 'Play Tutorials', project: 'Foundations' })
|
||||
}
|
||||
|
||||
function setupEventsServerClients() {
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
@@ -373,21 +363,15 @@ function newWorkspace() {
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
UI.projects.foundations.utilities.statusBar.changeStatus('Reindexing Search Engine...')
|
||||
setTimeout(takeAction, 100)
|
||||
workingAtTask = 0
|
||||
UI.projects.foundations.spaces.floatingSpace.inMapMode = false
|
||||
thisObject.isInitialized = true
|
||||
|
||||
await UI.projects.education.spaces.docsSpace.reset()
|
||||
await UI.projects.education.spaces.tutorialSpace.reset()
|
||||
|
||||
function takeAction() {
|
||||
UI.projects.education.spaces.docsSpace.reset()
|
||||
UI.projects.education.spaces.docsSpace.searchEngine.setUpSearchEngine(onIndexingFinished) // The docs needs to index the loaded workspace.
|
||||
function onIndexingFinished() {
|
||||
UI.projects.foundations.spaces.floatingSpace.inMapMode = false
|
||||
thisObject.isInitialized = true
|
||||
saveWorkspace()
|
||||
runTasksAndSessions()
|
||||
playTutorials()
|
||||
}
|
||||
}
|
||||
saveWorkspace()
|
||||
runTasksAndSessions()
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -411,6 +395,7 @@ function newWorkspace() {
|
||||
let workspace = {
|
||||
type: 'Workspace',
|
||||
name: thisObject.workspaceNode.name,
|
||||
config: thisObject.workspaceNode.config,
|
||||
rootNodes: stringifyReadyNodes
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ function newFoundationsSideSpace() {
|
||||
}
|
||||
|
||||
function getContainer(point, purpose) {
|
||||
if (thisObject.sidePanelTab === undefined) { return }
|
||||
let container
|
||||
|
||||
container = thisObject.sidePanelTab.getContainer(point, purpose)
|
||||
|
||||
@@ -96,7 +96,7 @@ function newGovernanceUserProfileSpace() {
|
||||
waitingForResponses++
|
||||
userProfile.payload.blockchainTokens = 0 // We need to set this value here so that the next call to BSCSCAN is not done more than once.
|
||||
setTimeout(getBlockchainTokens, timer, userProfile, blockchainAccount)
|
||||
timer = timer + 5000
|
||||
timer = timer + 6000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ function newCanvas() {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
async function initialize() {
|
||||
try {
|
||||
|
||||
browserResized()
|
||||
@@ -189,7 +189,7 @@ function newCanvas() {
|
||||
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
|
||||
let spaceInstance = spaceInitializationMap.get(j)
|
||||
if (spaceInstance !== undefined) {
|
||||
spaceInstance.initialize()
|
||||
await spaceInstance.initialize()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user