diff --git a/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js b/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js index 9d5f920aa..d0f91677a 100644 --- a/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js +++ b/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js @@ -152,6 +152,7 @@ function newNodeCloning() { arrangementStyle: (node.payload.floatingObject.arrangementStyle) }, uiObject: { + isPlaying: node.payload.uiObject.isPlaying, isRunning: node.payload.uiObject.isRunning, shortcutKey: node.payload.uiObject.shortcutKey } diff --git a/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js index 2e5803fa6..04c7bf1cb 100644 --- a/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -162,6 +162,7 @@ function newProtocolNode() { arrangementStyle: (node.payload.floatingObject.arrangementStyle) }, uiObject: { + isPlaying: node.payload.uiObject.isPlaying, isRunning: node.payload.uiObject.isRunning, shortcutKey: node.payload.uiObject.shortcutKey } diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 5bf1c7389..c3f52c5a9 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -2,6 +2,7 @@ function newUiObjectsFromNodes() { thisObject = { runTasks: runTasks, runSessions: runSessions, + playTutorials: playTutorials, recreateWorkspace: recreateWorkspace, getNodeById: getNodeById, tryToConnectChildrenWithReferenceParents: tryToConnectChildrenWithReferenceParents, @@ -14,6 +15,7 @@ function newUiObjectsFromNodes() { let mapOfNodes let tasksToRun let sessionsToRun + let tutorialsToPlay return thisObject @@ -25,6 +27,7 @@ function newUiObjectsFromNodes() { mapOfNodes = new Map() tasksToRun = [] sessionsToRun = [] + tutorialsToPlay = [] removeNullRootNodes() @@ -163,6 +166,14 @@ function newUiObjectsFromNodes() { sessionsToRun = undefined } + function playTutorials() { + for (let i = 0; i < tutorialsToPlay.length; i++) { + let node = tutorialsToPlay[i] + node.payload.uiObject.menu.internalClick('Play Tutorial') + } + tutorialsToPlay = undefined + } + function tryToConnectChildrenWithReferenceParents() { /* We reconstruct here the reference relationships. */ for (const [key, node] of mapOfNodes) { @@ -637,5 +648,16 @@ function newUiObjectsFromNodes() { } } } + + /* Check if there are tutorials to play */ + if (userAddingNew === false && node.savedPayload !== undefined) { + if (uiObjectType === 'Tutorial') { + if (node.savedPayload.uiObject.isPlaying === true) { + if (tutorialsToPlay !== undefined) { // it might be undefined when you are spawning a tutorial that was playing while backed up + tutorialsToPlay.push(node) + } + } + } + } } } diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 0701507c5..bdf92afb8 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -140,10 +140,14 @@ function newWorkspace() { setTimeout(functionLibraryUiObjectsFromNodes.runTasks, 70000) // We give a few seconds for the tasks to start setTimeout(functionLibraryUiObjectsFromNodes.runSessions, 80000) + // We give a few seconds + setTimeout(functionLibraryUiObjectsFromNodes.playTutorials, 3000) } else { functionLibraryUiObjectsFromNodes.runTasks() // We give a few seconds for the tasks to start setTimeout(functionLibraryUiObjectsFromNodes.runSessions, 10000) + // We give a few seconds + setTimeout(functionLibraryUiObjectsFromNodes.playTutorials, 1000) } } @@ -412,7 +416,7 @@ function newWorkspace() { function replaceWorkspaceByLoadingOne(name) { - let webCommand + let webCommand if (name.indexOf('Included -> ') >= 0) { name = name.replace('Included -> ', '') webCommand = 'LoadIncludedWorkspace' @@ -420,7 +424,7 @@ function newWorkspace() { webCommand = 'LoadWorkspace' } - let blobService = newFileStorage() + let blobService = newFileStorage() blobService.getFileFromHost(webCommand + '/' + name, onFileReceived, true) function onFileReceived(err, text, response) { if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 3dab07426..e492442f9 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -21,6 +21,7 @@ function newUiObject() { uiObjectTitle: undefined, circularProgressBar: undefined, isRunning: undefined, + isPlaying: undefined, shortcutKey: undefined, isShowing: undefined, hasError: undefined, diff --git a/Spaces/TutorialSpace.js b/Spaces/TutorialSpace.js index 76863cd51..e2e25e3ba 100644 --- a/Spaces/TutorialSpace.js +++ b/Spaces/TutorialSpace.js @@ -300,6 +300,7 @@ function newTutorialSpace() { } function playTutorial(node) { + node.payload.uiObject.isPlaying = true tutorialRootNode = node currentNode = node currentStatus = 'Playing Tutorial' @@ -307,6 +308,7 @@ function newTutorialSpace() { } function resumeTutorial(node) { + node.payload.uiObject.isPlaying = true tutorialRootNode = node currentNode = node currentStatus = 'Playing Tutorial' @@ -315,6 +317,7 @@ function newTutorialSpace() { } function stop() { + tutorialRootNode.payload.uiObject.isPlaying = false tutorialRootNode = undefined currentStatus = 'Stopped' }