Data Mine Includes

This commit is contained in:
Luis Fernando Molina committed 2020-03-28 17:42:55 +01:00
1 parent b31c6da561
commit af47663ddc
7 files changed
+110 -60

No files matched your search

+14 -40
View File
@@ -713,6 +713,13 @@
"actionFunction": "payload.onMenuItemClick",
"ring": 1
},
{
"action": "Configure Workspace",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure Workspace",
"iconPathOn": "html",
"iconPathOff": "html"
},
{
"action": "Add UI Object",
"label": "Add Trading System",
@@ -731,18 +738,6 @@
"relatedUiObject": "Data Mine",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"label": "Add Crypto Ecosystem",
"relatedUiObject": "Crypto Ecosystem",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"label": "Add Charting Space",
"relatedUiObject": "Charting Space",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"label": "Add Super Scripts",
@@ -761,7 +756,13 @@
"addLeftIcons": false,
"isPinned": true,
"positionLocked": true,
"icon": "design-tool"
"icon": "design-tool",
"editors": {
"config": true
},
"initialValues": {
"code": "{ \n\"includeDataMines\": [\"Masters\", \"Sparta\", \"TradingEngines\"]\n}"
}
},
{
"type": "Situation",
@@ -4524,15 +4525,6 @@
"label": "Add Super Actions",
"relatedUiObject": "Super Actions",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete Crypto Ecosystem",
"iconPathOn": "delete",
"iconPathOff": "delete",
"actionFunction": "payload.onMenuItemClick"
}
],
"isHierarchyHead": true,
@@ -5300,15 +5292,6 @@
"label": "Add Dashboard",
"relatedUiObject": "Dashboard",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete Charting Space",
"iconPathOn": "delete",
"iconPathOff": "delete",
"actionFunction": "payload.onMenuItemClick"
}
],
"isHierarchyHead": true,
@@ -5469,15 +5452,6 @@
"iconPathOff": "html",
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete Viewport",
"iconPathOn": "delete",
"iconPathOff": "delete",
"actionFunction": "payload.onMenuItemClick"
}
],
"initialValues": {
@@ -19,26 +19,69 @@ function newUiObjectsFromNodes () {
tasksToRun = []
sessionsToRun = []
/* Create the workspace UI OBject and then continue with the root nodes. */
createUiObject(false, 'Workspace', node.name, node, undefined, undefined, 'Workspace')
if (node.rootNodes !== undefined) {
for (let i = 0; i < node.rootNodes.length; i++) {
let rootNode = node.rootNodes[i]
createUiObjectFromNode(rootNode, undefined, undefined)
addIncludedNodes()
function addIncludedNodes () {
blobService = newFileStorage()
if (node.code === undefined) {
node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"]\n}'
}
let code = JSON.parse(node.code)
let includeDataMines = code.includeDataMines
let totalIncluded = 0
for (let i = 0; i < includeDataMines.length; i++) {
let dataMine = includeDataMines[i]
blobService.getBlobToText('DataMines' + '/' + dataMine, undefined, onFileReceived, true)
function onFileReceived (err, text, response) {
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
console.log('Cannot load included Data Mine ' + dataMine + '. The workspace can not be loaded.')
return
}
let includedDataMine = JSON.parse(text)
for (let i = 0; i < node.rootNodes.length; i++) {
let rootNode = node.rootNodes[i]
if (rootNode.type === 'Data Mine') {
let code = JSON.parse(rootNode.code)
if (code.name === dataMine) {
rootNodes.splice(i, 1)
}
}
}
node.rootNodes.push(includedDataMine)
totalIncluded++
if (totalIncluded === includeDataMines.length) {
addUserDefinedNodes()
}
}
}
}
tryToConnectChildrenWithReferenceParents()
function addUserDefinedNodes () {
/* Create the workspace UI OBject and then continue with the root nodes. */
createUiObject(false, 'Workspace', node.name, node, undefined, undefined, 'Workspace')
if (node.rootNodes !== undefined) {
for (let i = 0; i < node.rootNodes.length; i++) {
let rootNode = node.rootNodes[i]
createUiObjectFromNode(rootNode, undefined, undefined)
}
}
if (replacingCurrentWorkspace === true) {
// We need to wait all tasks that were potentially running to stop
setTimeout(runTasks, 70000)
// We give a few seconds for the tasks to start
setTimeout(runSessions, 80000)
} else {
runTasks()
// We give a few seconds for the tasks to start
setTimeout(runSessions, 10000)
tryToConnectChildrenWithReferenceParents()
if (replacingCurrentWorkspace === true) {
// We need to wait all tasks that were potentially running to stop
setTimeout(runTasks, 70000)
// We give a few seconds for the tasks to start
setTimeout(runSessions, 80000)
} else {
runTasks()
// We give a few seconds for the tasks to start
setTimeout(runSessions, 10000)
}
}
}
+15 -1
View File
@@ -169,12 +169,26 @@ function newWorkspace () {
}
function stringifyWorkspace (removePersonalData) {
let code
if (thisObject.workspaceNode.code === undefined) {
thisObject.workspaceNode.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"]\n}'
}
code = JSON.parse(thisObject.workspaceNode.code)
let includeDataMines = code.includeDataMines
let stringifyReadyNodes = []
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true)
if (node) {
stringifyReadyNodes.push(node)
if (node.type !== 'Data Mine') {
stringifyReadyNodes.push(node)
} else {
code = JSON.parse(node.code)
if (includeDataMines.includes(code.codeName) === false) {
stringifyReadyNodes.push(node)
}
}
}
}
let workspace = {
+9 -1
View File
@@ -41,6 +41,9 @@ function newChartingSpace () {
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
initialSetup()
let isInitialized = false
return thisObject
function reset () {
@@ -87,6 +90,8 @@ function newChartingSpace () {
}
function initialize () {
if (isInitialized === true) { return }
let rootNodes = canvas.designSpace.workspace.workspaceNode.rootNodes
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
@@ -96,7 +101,7 @@ function newChartingSpace () {
}
if (thisObject.payload === undefined) {
if (ERROR_LOG === true) { logger.write('[WARN] initialize -> There must exist a Charting Space at the Design Space in order to enable Charts. PLease create one and refreash your browser. ') }
// if (ERROR_LOG === true) { logger.write('[WARN] initialize -> There must exist a Charting Space at the Design Space in order to enable Charts. PLease create one and refreash your browser. ') }
return
}
@@ -111,6 +116,8 @@ function newChartingSpace () {
thisObject.viewport.initialize()
canvasBrowserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
isInitialized = true
}
function getContainer (point, purpose) {
@@ -263,6 +270,7 @@ function newChartingSpace () {
}
function physics () {
initialize()
thisObjectPhysics()
if (thisObject.visible !== true) { return }
if (thisObject.viewport !== undefined) {
+6 -2
View File
@@ -29,11 +29,15 @@ function newFileStorage () {
return thisObject
async function getBlobToText (filePath, host, callBackFunction) {
async function getBlobToText (filePath, host, callBackFunction, pathComplete) {
try {
if (INFO_LOG === true) { logger.write('[INFO] getBlobToText -> Entering function.') }
callServer(undefined, 'Storage/' + filePath, (response, fileContent) => {
let folder = ''
if (pathComplete === false || pathComplete === undefined) {
folder = 'Storage/'
}
callServer(undefined, folder + filePath, (response, fileContent) => {
if (response.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, fileContent)
} else {
+1
View File
@@ -17,6 +17,7 @@ GATEWAY_ENDPOINT=https://demo-api-dev.superalgos.org/graphql
INTER_PROCESS_FILES_PATH=../Inter-Process-Files
STORAGE_PATH=../Data-Storage
PLOTTERS_PATH=../Legacy-Code
DATA_MINES_PATH=../Data-Mines
PATH_TO_WEB_SERVER =./
APP_SCHEMA_PATH=../
WORKSPACE_PATH=../
+6
View File
@@ -464,6 +464,12 @@ function onBrowserRequest (request, response) {
}
break
case 'DataMines':
{
respondWithFile(process.env.DATA_MINES_PATH + '/' + requestParameters[2] + '.json', response)
}
break
case 'Storage':
{
respondWithFile(process.env.STORAGE_PATH + '/' + request.url.substring(9), response)