Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop
This commit is contained in:
commit
7ab1ad3e40
6 files changed
+89
-93
No files matched your search
@@ -162,10 +162,10 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
|
||||
if (i < node.rootNodes.length) {
|
||||
rootNode = node.rootNodes[i]
|
||||
UI.projects.superalgos.utilities.creditsPage.changeStatus("Connecting children nodes from " + rootNode.name + " - " + rootNode.type + "...")
|
||||
setTimeout(loopBody, 0)
|
||||
setTimeout(loopBody, 100)
|
||||
} else {
|
||||
UI.projects.superalgos.utilities.creditsPage.changeStatus("Setting up the Docs Search Engine Index...")
|
||||
setTimeout(endLoop)
|
||||
setTimeout(endLoop, 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,8 +111,14 @@ function newWorkspace() {
|
||||
thisObject.enabled = true
|
||||
UI.projects.superalgos.spaces.cockpitSpace.initializePosition()
|
||||
CAN_SPACES_DRAW = true
|
||||
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
|
||||
|
||||
/*
|
||||
We will help the Docs Space finish its initialization, since it is
|
||||
waiting for the workspace to be done.
|
||||
*/
|
||||
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine()
|
||||
thisObject.isInitialized = true
|
||||
savingWorkspaceIntervalId = setInterval(saveWorkspace, 60000)
|
||||
UI.projects.superalgos.utilities.creditsPage.changeStatus("Displaying the UI...")
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@@ -452,7 +452,6 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
setTimeout(startReindexingProcess, 100)
|
||||
|
||||
function startReindexingProcess() {
|
||||
UI.projects.superalgos.spaces.docsSpace.setUpWorkspaceSchemas()
|
||||
UI.projects.superalgos.spaces.docsSpace.searchEngine.setUpSearchEngine()
|
||||
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Message - Reindexing Succeed')
|
||||
|
||||
@@ -20,7 +20,6 @@ function newSuperalgosDocSpace() {
|
||||
currentBookBeingRendered: undefined,
|
||||
paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept, Topics, Tutorials or Books Schema in order to find it when we need to update them.
|
||||
textArea: undefined,
|
||||
setUpWorkspaceSchemas: setUpWorkspaceSchemas,
|
||||
changeLanguage: changeLanguage,
|
||||
changeActiveBranch: changeActiveBranch,
|
||||
changeContributionsBranch: changeContributionsBranch,
|
||||
@@ -256,73 +255,6 @@ function newSuperalgosDocSpace() {
|
||||
}
|
||||
}
|
||||
|
||||
function setUpWorkspaceSchemas() {
|
||||
/*
|
||||
We will scan the whole workspace and create an array with all of its nodes.
|
||||
*/
|
||||
let rootNodes = UI.projects.superalgos.spaces.designSpace.workspace.workspaceNode.rootNodes
|
||||
let allNodesFound = []
|
||||
for (let i = 0; i < rootNodes.length; i++) {
|
||||
let rootNode = rootNodes[i]
|
||||
if (rootNode !== null) {
|
||||
let nodeArray = UI.projects.superalgos.utilities.branches.nodeBranchToArray(rootNode)
|
||||
allNodesFound = allNodesFound.concat(nodeArray)
|
||||
}
|
||||
}
|
||||
/*
|
||||
We will create a document for each node, so that can later be indexed into the search engine.
|
||||
*/
|
||||
for (let j = 0; j < PROJECTS_ARRAY.length; j++) {
|
||||
let project = PROJECTS_ARRAY[j]
|
||||
SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema = []
|
||||
SCHEMAS_BY_PROJECT.get(project).map.workspaceSchema = new Map()
|
||||
|
||||
for (let i = 0; i < allNodesFound.length; i++) {
|
||||
let node = allNodesFound[i]
|
||||
|
||||
if (node.project === project) {
|
||||
let nodeNameTypePath = UI.projects.superalgos.utilities.hierarchy.getNodeNameTypePath(node)
|
||||
|
||||
let docsSchemaDocument = {
|
||||
nodeId: node.id,
|
||||
nodeNameTypePath: nodeNameTypePath,
|
||||
type: node.type,
|
||||
definition: { text: node.name },
|
||||
paragraphs: []
|
||||
}
|
||||
if (node.config !== undefined) {
|
||||
let paragraph
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "Config"
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
paragraph = {
|
||||
style: "Json",
|
||||
text: node.config
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
}
|
||||
if (node.code !== undefined) {
|
||||
let paragraph
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "Code"
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
paragraph = {
|
||||
style: "Javascript",
|
||||
text: node.code
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
}
|
||||
SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema.push(docsSchemaDocument)
|
||||
SCHEMAS_BY_PROJECT.get(project).map.workspaceSchema.set(node.id, docsSchemaDocument)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onClosing() {
|
||||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered = undefined
|
||||
thisObject.isVisible = false
|
||||
@@ -422,7 +354,6 @@ function newSuperalgosDocSpace() {
|
||||
function physics() {
|
||||
thisObject.sidePanelTab.physics()
|
||||
docsAppDivPhysics()
|
||||
finishInitializePhysics()
|
||||
|
||||
function docsAppDivPhysics() {
|
||||
let docsSpaceDiv = document.getElementById('docs-space-div')
|
||||
@@ -439,16 +370,6 @@ function newSuperalgosDocSpace() {
|
||||
'width: ' + thisObject.container.frame.width + 'px;' +
|
||||
'height: ' + thisObject.container.frame.height + 'px'
|
||||
}
|
||||
|
||||
function finishInitializePhysics() {
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return }
|
||||
if (UI.projects.superalgos.spaces.designSpace.workspace.isInitialized === false) { return }
|
||||
|
||||
if (thisObject.searchEngine && thisObject.searchEngine.docsIndex && thisObject.searchEngine.docsIndex.length === 0) {
|
||||
setUpWorkspaceSchemas()
|
||||
thisObject.searchEngine.setUpSearchEngine()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function draw() {
|
||||
|
||||
@@ -17,6 +17,8 @@ function newSuperalgosDocsSearchEngine() {
|
||||
}
|
||||
|
||||
function setUpSearchEngine() {
|
||||
|
||||
setUpWorkspaceSchemas()
|
||||
thisObject.docsIndex = []
|
||||
|
||||
for (let j = 0; j < PROJECTS_ARRAY.length; j++) {
|
||||
@@ -189,4 +191,71 @@ function newSuperalgosDocsSearchEngine() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setUpWorkspaceSchemas() {
|
||||
/*
|
||||
We will scan the whole workspace and create an array with all of its nodes.
|
||||
*/
|
||||
let rootNodes = UI.projects.superalgos.spaces.designSpace.workspace.workspaceNode.rootNodes
|
||||
let allNodesFound = []
|
||||
for (let i = 0; i < rootNodes.length; i++) {
|
||||
let rootNode = rootNodes[i]
|
||||
if (rootNode !== null) {
|
||||
let nodeArray = UI.projects.superalgos.utilities.branches.nodeBranchToArray(rootNode)
|
||||
allNodesFound = allNodesFound.concat(nodeArray)
|
||||
}
|
||||
}
|
||||
/*
|
||||
We will create a document for each node, so that can later be indexed into the search engine.
|
||||
*/
|
||||
for (let j = 0; j < PROJECTS_ARRAY.length; j++) {
|
||||
let project = PROJECTS_ARRAY[j]
|
||||
SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema = []
|
||||
SCHEMAS_BY_PROJECT.get(project).map.workspaceSchema = new Map()
|
||||
|
||||
for (let i = 0; i < allNodesFound.length; i++) {
|
||||
let node = allNodesFound[i]
|
||||
|
||||
if (node.project === project) {
|
||||
let nodeNameTypePath = UI.projects.superalgos.utilities.hierarchy.getNodeNameTypePath(node)
|
||||
|
||||
let docsSchemaDocument = {
|
||||
nodeId: node.id,
|
||||
nodeNameTypePath: nodeNameTypePath,
|
||||
type: node.type,
|
||||
definition: { text: node.name },
|
||||
paragraphs: []
|
||||
}
|
||||
if (node.config !== undefined) {
|
||||
let paragraph
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "Config"
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
paragraph = {
|
||||
style: "Json",
|
||||
text: node.config
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
}
|
||||
if (node.code !== undefined) {
|
||||
let paragraph
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "Code"
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
paragraph = {
|
||||
style: "Javascript",
|
||||
text: node.code
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(paragraph)
|
||||
}
|
||||
SCHEMAS_BY_PROJECT.get(project).array.workspaceSchema.push(docsSchemaDocument)
|
||||
SCHEMAS_BY_PROJECT.get(project).map.workspaceSchema.set(node.id, docsSchemaDocument)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-10
@@ -18,16 +18,17 @@ function dynamicDecimals(value, minDecimals) {
|
||||
minDecimals = 0
|
||||
}
|
||||
let decimals = 0
|
||||
if (value < 1) { decimals = 2 }
|
||||
|
||||
if (Math.abs(Math.trunc(value * 10)) < 1) { decimals = 4 }
|
||||
if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 5 }
|
||||
if (Math.abs(Math.trunc(value * 1000)) < 1) { decimals = 6 }
|
||||
if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 7 }
|
||||
if (Math.abs(Math.trunc(value * 100000)) < 1) { decimals = 8 }
|
||||
if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 9 }
|
||||
if (Math.abs(Math.trunc(value * 10000000)) < 1) { decimals = 10 }
|
||||
if (Math.abs(Math.trunc(value * 100000000000)) < 1) { value = 0; decimals = 0 }
|
||||
if (value < 1) { decimals = 3 }
|
||||
else if (value < 10) { decimals = 2 }
|
||||
else if (value < 100) { decimals = 1 }
|
||||
else if (Math.abs(Math.trunc(value * 10)) < 1) { decimals = 4 }
|
||||
else if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 5 }
|
||||
else if (Math.abs(Math.trunc(value * 1000)) < 1) { decimals = 6 }
|
||||
else if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 7 }
|
||||
else if (Math.abs(Math.trunc(value * 100000)) < 1) { decimals = 8 }
|
||||
else if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 9 }
|
||||
else if (Math.abs(Math.trunc(value * 10000000)) < 1) { decimals = 10 }
|
||||
else if (Math.abs(Math.trunc(value * 100000000000)) < 1) { value = 0; decimals = 0 }
|
||||
|
||||
if (decimals < minDecimals) { decimals = minDecimals }
|
||||
|
||||
|
||||
Reference in new issue
Block a user