More on plugins

This commit is contained in:
Luis Fernando Molina committed 2021-06-10 20:46:09 +02:00
1 parent cbdb422398
commit 914920d2dd
4 files changed
+246 -6

No files matched your search

@@ -61,12 +61,8 @@ function newFoundationsFunctionLibraryPluginsFunctions() {
for (let i = 0; i < projectDefinition.plugins.length; i++) {
let pluginType = "Plugin" + " " + projectDefinition.plugins[i]
if (UI.projects.foundations.utilities.children.isMissingChildrenByName(node, pluginType) === true) {
let child = UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Plugin Project')
child.name = project
let config = JSON.parse(child.config)
config.codeName = project
child.config = JSON.stringify(config)
if (UI.projects.foundations.utilities.children.isMissingChildrenByType(node, pluginType) === true) {
UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(node, pluginType)
}
}
}
@@ -0,0 +1,37 @@
{
"type": "Plugin Data Mines",
"menuItems": [
{
"action": "Add Missing Plugin Data Mines",
"label": "Add Missing Data Mines",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Data Mine",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"addLeftIcons": true,
"level": 1,
"propertyNameAtParent": "pluginDataMines",
"attachingRules": {
"compatibleTypes": "->Plugin Project->"
},
"childrenNodesProperties": [
{
"name": "pluginFiles",
"type": "array",
"childType": "Plugin File",
"autoAdd": false
}
]
}
@@ -0,0 +1,202 @@
function newGovernanceFunctionLibraryPluginsFunctions() {
let thisObject = {
addMissingPluginDataMines: addMissingPluginDataMines,
addMissingPluginTradingMines: addMissingPluginTradingMines,
addMissingPluginTradingSystems: addMissingPluginTradingSystems,
addMissingPluginTradingEngines: addMissingPluginTradingEngines,
addMissingPluginLearningMines: addMissingPluginLearningMines,
addMissingPluginLearningSystems: addMissingPluginLearningSystems,
addMissingPluginLearningEngines: addMissingPluginLearningEngines,
addMissingPluginTutorials: addMissingPluginTutorials,
addMissingPluginApiMaps: addMissingPluginApiMaps
}
return thisObject
function getPluginFileNames(projectName, pluginType, callBack) {
httpRequest(undefined, 'PluginFileNames/' + projectName + '/' + pluginType, onResponse)
function onResponse(err, data) {
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
console.log('Failed to Fetch Plugin ' + pluginType + ' from the Client')
return
}
let pluginFileNames = JSON.parse(data)
callBack(pluginFileNames)
}
}
function addPluginFileIfNeeded(node, fileNames) {
for (let i = 0; i < fileNames.length; i++) {
let fileName = fileNames[i]
fileName = fileName.replace('.json', '')
if (UI.projects.foundations.utilities.children.isMissingChildrenByName(node, fileName) === true) {
let child = UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Plugin File')
child.name = fileName
}
}
}
function getProjectName(node) {
/* Validations to see if we can do this or not. */
if (node.payload === undefined) { return }
if (node.payload.uiObject === undefined) { return }
if (node.payload.parentNode === undefined) {
node.payload.uiObject.setErrorMessage('You need to have a Plugin Project node as a parent to execute this action.')
return
}
if (node.payload.parentNode.payload === undefined) {
node.payload.uiObject.setErrorMessage('You need to have a Plugin Project node as a parent to execute this action.')
return
}
let pluginProject = node.payload.parentNode
let config = JSON.parse(pluginProject.config)
return config.codeName
}
function addMissingPluginDataMines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Data-Mines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginTradingMines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Trading-Mines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginTradingSystems(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Trading-Systems', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginTradingEngines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Trading-Engines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginLearningMines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Learning-Mines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginLearningSystems(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Learning-Systems', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginLearningEngines(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Learning-Engines', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginTutorials(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'Tutorials', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
function addMissingPluginApiMaps(node, rootNodes) {
let projectName = getProjectName(node)
if (projectName === "" || projectName === undefined) {
if (node.payload.parentNode !== undefined) {
node.payload.parentNode.payload.uiObject.setErrorMessage("Config codeName must have the name of the project.")
return
}
}
getPluginFileNames(projectName, 'API-Maps', onNamesArrived)
function onNamesArrived(fileNames) {
addPluginFileIfNeeded(node, fileNames)
}
}
}
+5
View File
@@ -982,6 +982,11 @@
"name": "Distribution Process",
"propertyName": "distributionProcess",
"functionName": "newGovernanceFunctionLibraryDistributionProcess"
},
{
"name": "Plugins Functions",
"propertyName": "pluginsFunctions",
"functionName": "newGovernanceFunctionLibraryPluginsFunctions"
}
],
"utilities": [],