Plugins
This commit is contained in:
1 parent
d7b9e3e682
commit
019e5644b7
7 files changed
+141
-141
No files matched your search
@@ -1,84 +0,0 @@
|
||||
function newIncludesFunctions() {
|
||||
thisObject = {
|
||||
includeMissingDataMines: includeMissingDataMines,
|
||||
includeMissingTradingMines: includeMissingTradingMines,
|
||||
includeMissingTradingSystems: includeMissingTradingSystems,
|
||||
includeMissingTradingEngines: includeMissingTradingEngines,
|
||||
includeMissingSuperScripts: includeMissingSuperScripts,
|
||||
includeMissingTutorials: includeMissingTutorials
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function getIncludedFileNames(includeType, callBack) {
|
||||
callServer(undefined, 'IncludedFileNames/' + includeType, onResponse)
|
||||
|
||||
function onResponse(err, data) {
|
||||
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
console.log('Failed to Fetch Included ' + includeType + ' from the Backend')
|
||||
return
|
||||
}
|
||||
|
||||
let includedFileNames = JSON.parse(data)
|
||||
callBack(includedFileNames)
|
||||
}
|
||||
}
|
||||
|
||||
function addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) {
|
||||
for (let i = 0; i < fileNames.length; i++) {
|
||||
let fileName = fileNames[i]
|
||||
fileName = fileName.replace('.json', '')
|
||||
if (isMissingChildrenByName(node, fileName) === true) {
|
||||
let child = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Included File')
|
||||
child.name = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function includeMissingDataMines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getIncludedFileNames('Data-Mines', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function includeMissingTradingMines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getIncludedFileNames('Trading-Mines', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function includeMissingTradingSystems(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getIncludedFileNames('Trading-Systems', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function includeMissingTradingEngines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getIncludedFileNames('Trading-Engines', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function includeMissingSuperScripts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getIncludedFileNames('Super-Scripts', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function includeMissingTutorials(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getIncludedFileNames('Tutorials', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addIncludedFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
function newPluginsFunctions() {
|
||||
thisObject = {
|
||||
pluginMissingDataMines: pluginMissingDataMines,
|
||||
pluginMissingTradingMines: pluginMissingTradingMines,
|
||||
pluginMissingTradingSystems: pluginMissingTradingSystems,
|
||||
pluginMissingTradingEngines: pluginMissingTradingEngines,
|
||||
pluginMissingSuperScripts: pluginMissingSuperScripts,
|
||||
pluginMissingTutorials: pluginMissingTutorials
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function getPluginFileNames(pluginType, callBack) {
|
||||
callServer(undefined, 'PluginFileNames/' + pluginType, onResponse)
|
||||
|
||||
function onResponse(err, data) {
|
||||
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
console.log('Failed to Fetch Plugin ' + pluginType + ' from the Backend')
|
||||
return
|
||||
}
|
||||
|
||||
let pluginFileNames = JSON.parse(data)
|
||||
callBack(pluginFileNames)
|
||||
}
|
||||
}
|
||||
|
||||
function addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes) {
|
||||
for (let i = 0; i < fileNames.length; i++) {
|
||||
let fileName = fileNames[i]
|
||||
fileName = fileName.replace('.json', '')
|
||||
if (isMissingChildrenByName(node, fileName) === true) {
|
||||
let child = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Plugin File')
|
||||
child.name = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pluginMissingDataMines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getPluginFileNames('Data-Mines', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function pluginMissingTradingMines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getPluginFileNames('Trading-Mines', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function pluginMissingTradingSystems(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getPluginFileNames('Trading-Systems', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function pluginMissingTradingEngines(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getPluginFileNames('Trading-Engines', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function pluginMissingSuperScripts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getPluginFileNames('Super-Scripts', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
|
||||
function pluginMissingTutorials(node, rootNodes, functionLibraryUiObjectsFromNodes) {
|
||||
getPluginFileNames('Tutorials', onNamesArrived)
|
||||
|
||||
function onNamesArrived(fileNames) {
|
||||
addPluginFileIfNeeded(node, fileNames, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -601,7 +601,7 @@ function newTaskFunctions() {
|
||||
|
||||
for (let m = 0; m < rootNodes.length; m++) {
|
||||
let rootNode = rootNodes[m]
|
||||
if (rootNode.type === 'Trading Engine' && rootNode.isIncluded === true) {
|
||||
if (rootNode.type === 'Trading Engine' && rootNode.isPlugin === true) {
|
||||
let tradingEngine = rootNode
|
||||
session.tradingEngineReference.payload.referenceParent = tradingEngine
|
||||
session.tradingSystemReference.payload.referenceParent = tradingSystem
|
||||
|
||||
@@ -42,66 +42,66 @@ function newUiObjectsFromNodes() {
|
||||
}
|
||||
}
|
||||
|
||||
addIncludedNodes()
|
||||
addPluginNodes()
|
||||
|
||||
function addIncludedNodes(includedNames) {
|
||||
function addPluginNodes(pluginNames) {
|
||||
let blobService = newFileStorage()
|
||||
let totalIncluded = 0
|
||||
let totalPlugin = 0
|
||||
let totalRead = 0
|
||||
|
||||
for (let i = 0; i < node.rootNodes.length; i++) {
|
||||
let rootNode = node.rootNodes[i]
|
||||
if (rootNode.type === 'Includes') {
|
||||
let includes = rootNode
|
||||
if (includes.includedDataMines !== undefined) {
|
||||
totalIncluded = totalIncluded + includes.includedDataMines.includedFiles.length
|
||||
includeAllTheseFiles(includes.includedDataMines.includedFiles, 'Data-Mines')
|
||||
if (rootNode.type === 'Plugins') {
|
||||
let plugins = rootNode
|
||||
if (plugins.pluginDataMines !== undefined) {
|
||||
totalPlugin = totalPlugin + plugins.pluginDataMines.pluginFiles.length
|
||||
pluginAllTheseFiles(plugins.pluginDataMines.pluginFiles, 'Data-Mines')
|
||||
}
|
||||
if (includes.includedTradingMines !== undefined) {
|
||||
totalIncluded = totalIncluded + includes.includedTradingMines.includedFiles.length
|
||||
includeAllTheseFiles(includes.includedTradingMines.includedFiles, 'Trading-Mines')
|
||||
if (plugins.pluginTradingMines !== undefined) {
|
||||
totalPlugin = totalPlugin + plugins.pluginTradingMines.pluginFiles.length
|
||||
pluginAllTheseFiles(plugins.pluginTradingMines.pluginFiles, 'Trading-Mines')
|
||||
}
|
||||
if (includes.includedTradingSystems !== undefined) {
|
||||
totalIncluded = totalIncluded + includes.includedTradingSystems.includedFiles.length
|
||||
includeAllTheseFiles(includes.includedTradingSystems.includedFiles, 'Trading-Systems')
|
||||
if (plugins.pluginTradingSystems !== undefined) {
|
||||
totalPlugin = totalPlugin + plugins.pluginTradingSystems.pluginFiles.length
|
||||
pluginAllTheseFiles(plugins.pluginTradingSystems.pluginFiles, 'Trading-Systems')
|
||||
}
|
||||
if (includes.includedTradingEngines !== undefined) {
|
||||
totalIncluded = totalIncluded + includes.includedTradingEngines.includedFiles.length
|
||||
includeAllTheseFiles(includes.includedTradingEngines.includedFiles, 'Trading-Engines')
|
||||
if (plugins.pluginTradingEngines !== undefined) {
|
||||
totalPlugin = totalPlugin + plugins.pluginTradingEngines.pluginFiles.length
|
||||
pluginAllTheseFiles(plugins.pluginTradingEngines.pluginFiles, 'Trading-Engines')
|
||||
}
|
||||
if (includes.includedSuperScripts !== undefined) {
|
||||
totalIncluded = totalIncluded + includes.includedSuperScripts.includedFiles.length
|
||||
includeAllTheseFiles(includes.includedSuperScripts.includedFiles, 'Super-Scripts')
|
||||
if (plugins.pluginSuperScripts !== undefined) {
|
||||
totalPlugin = totalPlugin + plugins.pluginSuperScripts.pluginFiles.length
|
||||
pluginAllTheseFiles(plugins.pluginSuperScripts.pluginFiles, 'Super-Scripts')
|
||||
}
|
||||
if (includes.includedTutorials !== undefined) {
|
||||
totalIncluded = totalIncluded + includes.includedTutorials.includedFiles.length
|
||||
includeAllTheseFiles(includes.includedTutorials.includedFiles, 'Tutorials')
|
||||
if (plugins.pluginTutorials !== undefined) {
|
||||
totalPlugin = totalPlugin + plugins.pluginTutorials.pluginFiles.length
|
||||
pluginAllTheseFiles(plugins.pluginTutorials.pluginFiles, 'Tutorials')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
If there is no Includes node at the workspace, we load it anyways here.
|
||||
If there is no Plugins node at the workspace, we load it anyways here.
|
||||
*/
|
||||
if (totalIncluded === 0) {
|
||||
if (totalPlugin === 0) {
|
||||
addUserDefinedNodes()
|
||||
}
|
||||
|
||||
function includeAllTheseFiles(includedFiles, includedType) {
|
||||
for (let i = 0; i < includedFiles.length; i++) {
|
||||
let includedFile = includedFiles[i]
|
||||
let name = includedFile.name
|
||||
blobService.getFileFromHost(includedType + '/' + name + '.json', onFileReceived, true)
|
||||
function pluginAllTheseFiles(pluginFiles, pluginType) {
|
||||
for (let i = 0; i < pluginFiles.length; i++) {
|
||||
let pluginFile = pluginFiles[i]
|
||||
let name = pluginFile.name
|
||||
blobService.getFileFromHost(pluginType + '/' + name + '.json', onFileReceived, true)
|
||||
|
||||
function onFileReceived(err, text, response) {
|
||||
|
||||
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
console.log('[WARN] Cannot load included ' + includedType + ' ' + name + '. The workspace will be loaded with this included file missing.')
|
||||
console.log('[WARN] Cannot load plugin ' + pluginType + ' ' + name + '. The workspace will be loaded with this plugin file missing.')
|
||||
} else {
|
||||
let receivedNode = JSON.parse(text)
|
||||
/*
|
||||
If the workspace already contains a root node with the id of the head of the hirierchy
|
||||
we are loading, we remove it because the included file has precedende.
|
||||
we are loading, we remove it because the plugin file has precedende.
|
||||
*/
|
||||
for (let i = 0; i < node.rootNodes.length; i++) {
|
||||
let rootNode = node.rootNodes[i]
|
||||
@@ -110,12 +110,12 @@ function newUiObjectsFromNodes() {
|
||||
break
|
||||
}
|
||||
}
|
||||
receivedNode.isIncluded = true
|
||||
receivedNode.isPlugin = true
|
||||
|
||||
if (includedFile.includedFilePosition !== undefined) {
|
||||
if (pluginFile.pluginFilePosition !== undefined) {
|
||||
let positionOffset = {
|
||||
x: includedFile.includedFilePosition.savedPayload.position.x - receivedNode.savedPayload.position.x,
|
||||
y: includedFile.includedFilePosition.savedPayload.position.y - receivedNode.savedPayload.position.y
|
||||
x: pluginFile.pluginFilePosition.savedPayload.position.x - receivedNode.savedPayload.position.x,
|
||||
y: pluginFile.pluginFilePosition.savedPayload.position.y - receivedNode.savedPayload.position.y
|
||||
}
|
||||
receivedNode.positionOffset = positionOffset
|
||||
}
|
||||
@@ -124,7 +124,7 @@ function newUiObjectsFromNodes() {
|
||||
}
|
||||
|
||||
totalRead++
|
||||
if (totalIncluded === totalRead) {
|
||||
if (totalPlugin === totalRead) {
|
||||
addUserDefinedNodes()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ function newWorkspace() {
|
||||
let functionLibraryDataStorageFunctions = newDataStorageFunctions()
|
||||
let functionLibraryChartingSpaceFunctions = newChartingSpaceFunctions()
|
||||
let functionLibraryTutorialFunctions = newTutorialFunctions()
|
||||
let functionLibraryIncludesFunctions = newIncludesFunctions()
|
||||
let functionLibraryPluginsFunctions = newPluginsFunctions()
|
||||
|
||||
thisObject.nodeChildren = newNodeChildren()
|
||||
|
||||
@@ -317,7 +317,7 @@ function newWorkspace() {
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
|
||||
if (rootNode.isIncluded !== true) {
|
||||
if (rootNode.isPlugin !== true) {
|
||||
let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true)
|
||||
stringifyReadyNodes.push(node)
|
||||
}
|
||||
@@ -418,9 +418,9 @@ function newWorkspace() {
|
||||
function replaceWorkspaceByLoadingOne(name) {
|
||||
|
||||
let webCommand
|
||||
if (name.indexOf('Included -> ') >= 0) {
|
||||
name = name.replace('Included -> ', '')
|
||||
webCommand = 'LoadIncludedWorkspace'
|
||||
if (name.indexOf('Plugin -> ') >= 0) {
|
||||
name = name.replace('Plugin -> ', '')
|
||||
webCommand = 'LoadPluginWorkspace'
|
||||
} else {
|
||||
webCommand = 'LoadWorkspace'
|
||||
}
|
||||
@@ -902,34 +902,34 @@ function newWorkspace() {
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'Include Missing Data Mines':
|
||||
case 'Add Missing Data Mines':
|
||||
{
|
||||
functionLibraryIncludesFunctions.includeMissingDataMines(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
functionLibraryPluginsFunctions.pluginMissingDataMines(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Include Missing Trading Mines':
|
||||
case 'Add Missing Trading Mines':
|
||||
{
|
||||
functionLibraryIncludesFunctions.includeMissingTradingMines(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
functionLibraryPluginsFunctions.pluginMissingTradingMines(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Include Missing Trading Systems':
|
||||
case 'Add Missing Trading Systems':
|
||||
{
|
||||
functionLibraryIncludesFunctions.includeMissingTradingSystems(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
functionLibraryPluginsFunctions.pluginMissingTradingSystems(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Include Missing Trading Engines':
|
||||
case 'Add Missing Trading Engines':
|
||||
{
|
||||
functionLibraryIncludesFunctions.includeMissingTradingEngines(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
functionLibraryPluginsFunctions.pluginMissingTradingEngines(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Include Missing Super Scripts':
|
||||
case 'Add Missing Super Scripts':
|
||||
{
|
||||
functionLibraryIncludesFunctions.includeMissingSuperScripts(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
functionLibraryPluginsFunctions.pluginMissingSuperScripts(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Include Missing Tutorials':
|
||||
case 'Add Missing Tutorials':
|
||||
{
|
||||
functionLibraryIncludesFunctions.includeMissingTutorials(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
functionLibraryPluginsFunctions.pluginMissingTutorials(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -1995,7 +1995,7 @@ function newUiObject() {
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 1
|
||||
if (thisObject.payload.node.isIncluded === true) {
|
||||
if (thisObject.payload.node.isPlugin === true) {
|
||||
browserCanvasContext.setLineDash([0, 0])
|
||||
} else {
|
||||
browserCanvasContext.setLineDash([10, 20])
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
(d) If the Work plugins a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
|
||||
Reference in new issue
Block a user