From 6f474fd959e4dbfb0033e86b82f0f1e7edb830ac Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 3 Sep 2020 14:30:26 +0200 Subject: [PATCH] Intgrading the docs --- AppSchema.json | 172 +++++++++++++++--- BackendServers/WebServer/AppLoader.js | 7 +- BackendServers/WebServer/AppPreLoader.js | 140 ++++++--------- BackendServers/WebServer/index.html | 8 +- CanvasApp/Canvas.js | 49 ++++- CanvasApp/DesignSpace/Workspace/Workspace.js | 3 +- CanvasApp/FloatingSpace/UiObject.js | 4 +- CanvasApp/SideSpace/SidePanelTab.js | 123 +++++++++++-- CanvasApp/Spaces/DesignSpace.js | 18 +- CanvasApp/Spaces/DocSpace.js | 178 +++++++++++++++++++ CanvasApp/Spaces/SideSpace.js | 2 +- CanvasApp/Spaces/TopSpace.js | 2 +- CanvasApp/SplashScreen.js | 2 +- 13 files changed, 546 insertions(+), 162 deletions(-) create mode 100644 CanvasApp/Spaces/DocSpace.js diff --git a/AppSchema.json b/AppSchema.json index eca0de787..8c4e829b7 100644 --- a/AppSchema.json +++ b/AppSchema.json @@ -554,9 +554,9 @@ }, "menuItems": [ { - "action": "Edit Formula", + "action": "Edit", "actionFunction": "uiObject.formulaEditor.activate", - "label": "Edit Formula", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -589,9 +589,9 @@ }, "menuItems": [ { - "action": "Edit Code", + "action": "Edit", "actionFunction": "uiObject.codeEditor.activate", - "label": "Edit Code", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -649,7 +649,6 @@ "icon": "chart-point", "level": 4, "propertyNameAtParent": "points", - "isReferenceParent": true, "chainAttachesTo": { "compatibleTypes": "->Chart Points->" }, @@ -699,9 +698,9 @@ }, "menuItems": [ { - "action": "Edit Formula", + "action": "Edit", "actionFunction": "uiObject.formulaEditor.activate", - "label": "Edit Formula", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -798,9 +797,9 @@ "properties": [], "menuItems": [ { - "action": "Edit Condition", + "action": "Edit", "actionFunction": "uiObject.codeEditor.activate", - "label": "Edit Condition", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -987,9 +986,9 @@ "properties": [], "menuItems": [ { - "action": "Edit Condition", + "action": "Edit", "actionFunction": "uiObject.codeEditor.activate", - "label": "Edit Condition", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -1062,9 +1061,9 @@ }, "menuItems": [ { - "action": "Edit Formula", + "action": "Edit", "actionFunction": "uiObject.formulaEditor.activate", - "label": "Edit Formula", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -1175,9 +1174,9 @@ "properties": [], "menuItems": [ { - "action": "Edit Condition", + "action": "Edit", "actionFunction": "uiObject.codeEditor.activate", - "label": "Edit Condition", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -1316,9 +1315,9 @@ ], "menuItems": [ { - "action": "Edit Condition", + "action": "Edit", "actionFunction": "uiObject.codeEditor.activate", - "label": "Edit Condition", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html" }, @@ -1417,6 +1416,13 @@ "actionFunction": "payload.onMenuItemClick", "ring": 1 }, + { + "action": "Share Workspace", + "iconPathOn": "menu-share", + "iconPathOff": "menu-share", + "actionFunction": "payload.onMenuItemClick", + "ring": 1 + }, { "action": "Backup Workspace", "iconPathOn": "menu-backup", @@ -1462,10 +1468,9 @@ "actionFunction": "payload.onMenuItemClick" }, { - "action": "Share Workspace", - "label": "Share", - "iconPathOn": "menu-share", - "iconPathOff": "menu-share", + "action": "Add UI Object", + "label": "Add Tutorial", + "relatedUiObject": "Tutorial", "actionFunction": "payload.onMenuItemClick" } ], @@ -1532,9 +1537,9 @@ "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#condition", "menuItems": [ { - "action": "Edit Condition", + "action": "Edit", "actionFunction": "uiObject.conditionEditor.activate", - "label": "Edit Condition", + "label": "Edit", "relatedUiObject": "Condition" }, { @@ -9700,8 +9705,8 @@ "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#formula", "menuItems": [ { - "action": "Edit Formula", - "label": "Edit Formula", + "action": "Edit", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html", "dontShowAtFullscreen": true, @@ -9735,8 +9740,8 @@ "type": "Announcement Formula", "menuItems": [ { - "action": "Edit Formula", - "label": "Edit Formula", + "action": "Edit", + "label": "Edit", "iconPathOn": "html", "iconPathOff": "html", "dontShowAtFullscreen": true, @@ -14088,5 +14093,118 @@ "autoAdd": false } ] + }, + { + "type": "Tutorial", + "menuItems": [ + { + "action": "Play Tutorial", + "label": "Play", + "relatedUiObject": "Tutorial", + "actionFunction": "payload.onMenuItemClick" + }, + { + "action": "Resume Tutorial", + "label": "Resume", + "relatedUiObject": "Tutorial", + "actionFunction": "payload.onMenuItemClick" + }, + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "html", + "iconPathOff": "html" + }, + { + "action": "Add UI Object", + "label": "Add Tutorial Step", + "relatedUiObject": "Tutorial Step", + "actionFunction": "payload.onMenuItemClick" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.onMenuItemClick" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{ \n}" + }, + "isTitleAllwaysVisible": true, + "isHierarchyHead": true, + "addLeftIcons": true, + "level": 0, + "icon": "approve", + "propertyNameAtParent": "tutorials", + "properties": [ + { + "name": "tutorialSteps", + "type": "array", + "childType": "Tutorial Step", + "autoAdd": false + } + ] + }, + { + "type": "Tutorial Step", + "menuItems": [ + { + "action": "Play Tutorial Step", + "label": "Play", + "relatedUiObject": "Tutorial", + "actionFunction": "payload.onMenuItemClick" + }, + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "html", + "iconPathOff": "html" + }, + { + "action": "Add UI Object", + "label": "Add Tutorial Step", + "relatedUiObject": "Tutorial Step", + "actionFunction": "payload.onMenuItemClick" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.onMenuItemClick" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{ \n\"paragraphs\": \n[\n\"\",\n\"\",\n\"\" \n], \n\"done\": false\n}" + }, + "referenceAttachesTo": { + "compatibleTypes": "->*Any Node*->" + }, + "addLeftIcons": true, + "level": 1, + "icon": "cardano", + "propertyNameAtParent": "tutorials", + "properties": [ + { + "name": "tutorialSteps", + "type": "array", + "childType": "Tutorial Step", + "autoAdd": false + } + ] } ] \ No newline at end of file diff --git a/BackendServers/WebServer/AppLoader.js b/BackendServers/WebServer/AppLoader.js index 5068070ed..3657bf68a 100644 --- a/BackendServers/WebServer/AppLoader.js +++ b/BackendServers/WebServer/AppLoader.js @@ -88,6 +88,7 @@ function newAppLoader() { 'Spaces/FloatingSpace.js', 'Spaces/DesignSpace.js', 'Spaces/SideSpace.js', + 'Spaces/DocSpace.js', 'Files/SingleFile.js', 'Files/FileCloud.js', @@ -154,13 +155,9 @@ function newAppLoader() { modulesArray = modulesArray.concat(plotters) let downloadedCounter = 0 - let versionParam = window.canvasApp.version - if (versionParam === undefined) { versionParam = '' } else { - versionParam = '?' + versionParam - } for (let i = 0; i < modulesArray.length; i++) { - let path = window.canvasApp.urlPrefix + modulesArray[i] + versionParam + let path = modulesArray[i] REQUIREJS([path], onRequired) diff --git a/BackendServers/WebServer/AppPreLoader.js b/BackendServers/WebServer/AppPreLoader.js index ea66a7c19..07238ef7b 100644 --- a/BackendServers/WebServer/AppPreLoader.js +++ b/BackendServers/WebServer/AppPreLoader.js @@ -39,109 +39,83 @@ function loadSuperalgos() { const MODULE_NAME = "App Pre-Loader"; const INFO_LOG = false; - const ERROR_LOG = true; - if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] loadSuperalgos -> Entering function."); } + setupHTMLTextArea() + setupHTMLInput() + setupHTMLCanvas() + loadDebugModule() - /* The first thing to do here is to add the canvas where all the action is going to happen. */ + function setupHTMLTextArea() { + let textArea = document.createElement('textarea'); + textArea.id = "textArea"; + textArea.spellcheck = false; + textArea.style = 'resize: none;' + + ' border: none;' + + ' outline: none;' + + 'box-shadow: none;' + + 'overflow:hidden;' + + 'font-family: ' + 'Saira' + ';' + + 'font-size: 12px;' + + 'background-color: rgb(255, 255, 255);' + + 'color:rgb(255, 255, 255);' + + 'width: ' + 600 + 'px;' + + 'height: ' + 400 + 'px' + let textAreaDiv = document.getElementById('textAreaDiv'); + textAreaDiv.appendChild(textArea); + textAreaDiv.style = 'position:fixed; top:' + -1500 + 'px; left:' + 500 + 'px; z-index:10; ' + } - let textArea = document.createElement('textarea'); - textArea.id = "textArea"; - textArea.spellcheck = false; - textArea.style = 'resize: none;' + - ' border: none;' + - ' outline: none;' + - 'box-shadow: none;' + - 'overflow:hidden;' + - 'font-family: ' + 'Saira' + ';' + - 'font-size: 12px;' + - 'background-color: rgb(255, 255, 255);' + - 'color:rgb(255, 255, 255);' + - 'width: ' + 600 + 'px;' + - 'height: ' + 400 + 'px' + function setupHTMLInput() { + let input = document.createElement('input'); + input.id = "input"; + input.spellcheck = false; + input.style = "border: none; outline: none; box-shadow: none; overflow:hidden; width: 0px; height: 0px;"; - let textAreaDiv = document.getElementById('textAreaDiv'); - textAreaDiv.appendChild(textArea); - textAreaDiv.style = 'position:fixed; top:' + -1500 + 'px; left:' + 500 + 'px; z-index:10; ' + let inputDiv = document.getElementById('inputDiv'); + inputDiv.appendChild(input); + } - let input = document.createElement('input'); - input.id = "input"; - input.spellcheck = false; - input.style = "border: none; outline: none; box-shadow: none; overflow:hidden; width: 0px; height: 0px;"; + function setupHTMLCanvas() { + let canvas = document.createElement('canvas'); - let inputDiv = document.getElementById('inputDiv'); - inputDiv.appendChild(input); + canvas.id = "canvas"; + canvas.width = 1400; + canvas.height = 600; + canvas.style.border = "0"; + canvas.style = "position:absolute; top:0px; left:0px; z-index:1"; + let canvasApp = document.getElementById('canvasApp'); + canvasApp.appendChild(canvas); - let canvas = document.createElement('canvas'); + browserCanvas = document.getElementById('canvas'); - canvas.id = "canvas"; - canvas.width = 1400; - canvas.height = 600; - canvas.style.border = "0"; - canvas.style = "position:absolute; top:0px; left:0px; z-index:1"; + browserCanvas.width = window.innerWidth; + browserCanvas.height = window.innerHeight; + browserCanvas.style.border = "none"; - let canvasApp = document.getElementById('canvasApp'); - canvasApp.appendChild(canvas); - - browserCanvas = document.getElementById('canvas'); - - browserCanvas.width = window.innerWidth; - browserCanvas.height = window.innerHeight - window.canvasApp.topMargin; - browserCanvas.style.border = "none"; - - browserCanvas.style.top = window.canvasApp.topMargin + 'px'; - - - - loadDebugModule(); + browserCanvas.style.top = 0 + 'px'; + } function loadDebugModule() { + let path = "WebDebugLog.js"; + REQUIREJS([path], onRequired); - try { - if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] loadDebugModule -> Entering function."); } - - let path = window.canvasApp.urlPrefix + "WebDebugLog.js"; - - REQUIREJS([path], onRequired); - - function onRequired(pModule) { - - if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); } - - loadModules(); - - } - } - catch (err) { - console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] loadDebugModule --> " + path + " --> err = " + err.stack); + function onRequired(pModule) { + if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); } + loadModules(); } } /* And Finally, we start loading all the scripts we will inmediatelly need. */ - function loadModules() { + let path = "WebServer/AppLoader.js"; + REQUIREJS([path], onRequired); - try { - - if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] loadModules -> Entering function."); } - - let path = window.canvasApp.urlPrefix + "WebServer/AppLoader.js"; - - REQUIREJS([path], onRequired); - - function onRequired(pModule) { - - if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); } - - let APP_LOADER_MODULE = newAppLoader(); - APP_LOADER_MODULE.loadModules(); - - } - } - catch (err) { - console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] loadModules --> " + path + " --> err = " + err.stack); + function onRequired(pModule) { + if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); } + let APP_LOADER_MODULE = newAppLoader(); + APP_LOADER_MODULE.loadModules(); } } } diff --git a/BackendServers/WebServer/index.html b/BackendServers/WebServer/index.html index 5dff45d57..eacbeb5b2 100644 --- a/BackendServers/WebServer/index.html +++ b/BackendServers/WebServer/index.html @@ -12,10 +12,6 @@