diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 9dcef15a7..fc78aada2 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -1139,22 +1139,24 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE fs.readdir(dirPath, onDirRead) function onDirRead(err, fileList) { + let updatedFileList = [] + if (err) { - console.log('[WARN] Error reading a directory content. filePath = ' + dirPath) - respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse) - return + /* + If we have a problem reading this folder we will assume that it is + because this project does not need this folder and that's it. + */ + //console.log('[WARN] Error reading a directory content. filePath = ' + dirPath) } else { - let updatedFileList = [] for (let i = 0; i < fileList.length; i++) { let name = 'Plugin \u2192 ' + fileList[i] updatedFileList.push([project, name]) } - allWorkspaces = allWorkspaces.concat(updatedFileList) - projectsCount++ - if (projectsCount === projects.length) { - readMyWorkspaces() - } - return + } + allWorkspaces = allWorkspaces.concat(updatedFileList) + projectsCount++ + if (projectsCount === projects.length) { + readMyWorkspaces() } } } catch (err) { @@ -1441,21 +1443,23 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE fs.readdir(dirPath, onDirRead) function onDirRead(err, fileList) { + let updatedFileList = [] if (err) { - console.log('[WARN] Error reading a directory content. filePath = ' + dirPath) - return + /* + If we have a problem reading this folder we will assume that it is + because this project does not need this folder and that's it. + */ + // console.log('[WARN] Error reading a directory content. filePath = ' + dirPath) } else { - let updatedFileList = [] for (let i = 0; i < fileList.length; i++) { let name = fileList[i] updatedFileList.push([project, name]) } - allLibraries = allLibraries.concat(updatedFileList) - projectsCount++ - if (projectsCount === projects.length) { - respondWithContent(JSON.stringify(allLibraries), httpResponse) - } - return + } + allLibraries = allLibraries.concat(updatedFileList) + projectsCount++ + if (projectsCount === projects.length) { + respondWithContent(JSON.stringify(allLibraries), httpResponse) } } } catch (err) { @@ -1722,9 +1726,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } function getDirectories(path) { - const fs = require('fs') - return fs.readdirSync(path).filter(function (file) { - return fs.statSync(path + '/' + file).isDirectory(); - }); + try { + const fs = require('fs') + return fs.readdirSync(path).filter(function (file) { + return fs.statSync(path + '/' + file).isDirectory(); + }); + } catch (err) { + return [] + } } } \ No newline at end of file diff --git a/Projects/.DS_Store b/Projects/.DS_Store deleted file mode 100644 index 331427e84..000000000 Binary files a/Projects/.DS_Store and /dev/null differ diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index 78c9944b7..5d9f0f0f0 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -914,5 +914,15 @@ }, "TS": {}, "CL": {} + }, + { + "name": "TensorFlow", + "propertyName": "tensorflow", + "UI": { + "globals": [], + "functionLibraries": [], + "utilities": [], + "spaces": [] + } } ] \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/AppSchema.json b/Projects/Superalgos/Schemas/AppSchema.json index 9ffb5f052..59d1d2b4a 100644 --- a/Projects/Superalgos/Schemas/AppSchema.json +++ b/Projects/Superalgos/Schemas/AppSchema.json @@ -12684,6 +12684,11 @@ "name": "trainingData", "type": "array", "childType": "Training Data" + }, + { + "name": "machineLearningLibrary", + "type": "node", + "childType": "TensorFlow Library" } ] }, diff --git a/Projects/TensorFlow/Icons/tensorflow.png b/Projects/TensorFlow/Icons/tensorflow.png new file mode 100644 index 000000000..9b3b41696 Binary files /dev/null and b/Projects/TensorFlow/Icons/tensorflow.png differ diff --git a/Projects/TensorFlow/Schemas/AppSchema.json b/Projects/TensorFlow/Schemas/AppSchema.json new file mode 100644 index 000000000..e3494a604 --- /dev/null +++ b/Projects/TensorFlow/Schemas/AppSchema.json @@ -0,0 +1,90 @@ +[ + { + "type": "TensorFlow Project", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add TensorFlow", + "relatedUiObject": "TensorFlow", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "actionFunction": "payload.executeAction", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity" + } + ], + "isProjectHead": true, + "isTitleAllwaysVisible": false, + "addLeftIcons": true, + "isPinned": true, + "positionLocked": true, + "childrenNodesProperties": [ + { + "name": "projectDefinition", + "type": "node", + "childType": "Project Definition", + "project": "Superalgos", + "autoAdd": true + } + ], + "icon": "tensorflow" + }, + { + "type": "TensorFlow", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Library", + "relatedUiObject": "TensorFlow Library", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "isHierarchyHead": true, + "addLeftIcons": true, + "level": 0, + "childrenNodesProperties": [ + { + "name": "machineLearningLibrary", + "type": "node", + "childType": "TensorFlow Library", + "autoAdd": true + } + ], + "icon": "tensorflow" + }, + { + "type": "TensorFlow Library", + "menuItems": [ + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "addLeftIcons": true, + "level": 3, + "attachingRules": { + "compatibleTypes": "->Learning System->" + }, + "propertyNameAtParent": "machineLearningLibrary", + "icon": "tensorflow" + } +] \ No newline at end of file diff --git a/Projects/TensorFlow/UI/Function-Libraries/ActionSwitch.js b/Projects/TensorFlow/UI/Function-Libraries/ActionSwitch.js new file mode 100644 index 000000000..c235bee72 --- /dev/null +++ b/Projects/TensorFlow/UI/Function-Libraries/ActionSwitch.js @@ -0,0 +1,30 @@ +function newTensorFlowActionSwitch() { + + let thisObject = { + executeAction: executeAction, + initialize: initialize, + finalize: finalize + } + + + return thisObject + + function finalize() { + + } + + function initialize() { + /* Nothing to initialize since a Function Library does not hold any state. */ + } + + async function executeAction(action) { + switch (action.name) { + /* + case 'Create Wallet Account': { + UI.projects.ethereum.functionLibraries.accounts.createWalletAccount(action.node) + break + } + */ + } + } +}