From b5528072083e6c7c701865f1af76a06ef102ce5f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 15 Oct 2020 18:52:12 +0200 Subject: [PATCH] Pluging Multi Project --- .../FunctionLibraries/PluginsFunctions.js | 2 +- .../FunctionLibraries/UiObjectsFromNodes.js | 4 ++-- DesignSpace/Workspace/Workspace.js | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/PluginsFunctions.js b/DesignSpace/Workspace/FunctionLibraries/PluginsFunctions.js index cf265bd83..79e222652 100644 --- a/DesignSpace/Workspace/FunctionLibraries/PluginsFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/PluginsFunctions.js @@ -10,7 +10,7 @@ function newPluginsFunctions() { return thisObject function getPluginFileNames(pluginType, callBack) { - callWebServer(undefined, 'PluginFileNames/' + pluginType, onResponse) + callWebServer(undefined, 'PluginFileNames/' + 'Superalgos' + '/' + pluginType, onResponse) function onResponse(err, data) { if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index d515b67eb..fb2b054b2 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -91,12 +91,12 @@ function newUiObjectsFromNodes() { for (let i = 0; i < pluginFiles.length; i++) { let pluginFile = pluginFiles[i] let name = pluginFile.name - blobService.getFileFromHost(pluginType + '/' + name + '.json', onFileReceived, true) + callWebServer(undefined, 'LoadPlugin' + '/' + 'Superalgos' + '/' + pluginType + '/' + name + '.json', onFileReceived) function onFileReceived(err, text, response) { if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { - console.log('[WARN] Cannot load plugin ' + pluginType + ' ' + name + '. The workspace will be loaded with this plugin 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) /* diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 4c7e2ff84..99557e7ff 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -100,8 +100,7 @@ function newWorkspace() { let lastUsedWorkspace = window.localStorage.getItem('Last Used Workspace') if (lastUsedWorkspace !== 'undefined' && lastUsedWorkspace !== null && lastUsedWorkspace !== undefined) { - let blobService = newFileStorage() - blobService.getFileFromHost('LoadWorkspace' + '/' + lastUsedWorkspace, onFileReceived, true) + callWebServer(undefined, 'LoadMyWorkspace' + '/' + lastUsedWorkspace, onFileReceived) function onFileReceived(err, text, response) { if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { canvas.cockpitSpace.setStatus('Could not load the last Workspace used, called "' + lastUsedWorkspace + '". Will switch to the default Workspace instead.', 500, canvas.cockpitSpace.statusTypes.WARNING) @@ -142,9 +141,9 @@ function newWorkspace() { functionLibraryUiObjectsFromNodes.syncronizeTasksFoundAtWorkspaceWithBackEnd(functionLibraryTaskFunctions) functionLibraryUiObjectsFromNodes.syncronizeSessionsFoundAtWorkspaceWithBackEnd(functionLibrarySessionFunctions) - + setTimeout(functionLibraryUiObjectsFromNodes.playTutorials, 1000) - + } function setupEventsServerClients() { @@ -417,13 +416,12 @@ function newWorkspace() { let webCommand if (name.indexOf('Plugin \u2192 ') >= 0) { name = name.replace('Plugin \u2192 ', '') - webCommand = 'LoadPluginWorkspace' + webCommand = 'LoadPlugin' + '/' + 'Superalgos' + '/' + 'Workspaces' + '/' + name + '.json' } else { - webCommand = 'LoadWorkspace' + webCommand = 'LoadMyWorkspace' + '/' + name } - let blobService = newFileStorage() - blobService.getFileFromHost(webCommand + '/' + name, onFileReceived, true) + callWebServer(undefined, webCommand, onFileReceived) function onFileReceived(err, text, response) { if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { canvas.cockpitSpace.setStatus('Could not load the Workspace called "' + name + '". ', 500, canvas.cockpitSpace.statusTypes.WARNING)