diff --git a/Projects/Foundations/Schemas/App-Schema/workspace.json b/Projects/Foundations/Schemas/App-Schema/workspace.json index 64eb21205..3d8838f08 100644 --- a/Projects/Foundations/Schemas/App-Schema/workspace.json +++ b/Projects/Foundations/Schemas/App-Schema/workspace.json @@ -37,6 +37,12 @@ "workDoneLabel": "Done", "relatedUiObject": "Workspace", "actionFunction": "payload.executeAction" + }, + { + "action": "Check For Missing References", + "label": "Check For Missing References", + "relatedUiObject": "Workspace", + "actionFunction": "payload.executeAction" } ], "initialValues": { diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-001-automating-actions-what-is-an-action.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-001-automating-actions-what-is-an-action.json index 6c6a36c89..dee60b16d 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-001-automating-actions-what-is-an-action.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-001-automating-actions-what-is-an-action.json @@ -14,8 +14,8 @@ }, { "style": "Text", - "text": "Maybe you realized that you are doing repetitive actions at the Design Space and you can benefit from automating them. If your actions are constrained to manipulating the nodes at the workspace, by either creating new nodes, deleting existing ones, changing nodes configs, establishing references or some other similar stuff, then you might be able to create an Action function that can automate all this. This will allow you to stop doing those repetitive tasks youself and the ones that will come after you if you contribute these changes to the project.", - "updated": 1614940379811 + "text": "Maybe you realized that you are doing repetitive actions at the Design Space and you can benefit from automating them. If your actions are constrained to manipulating the nodes at the workspace, by either creating new nodes, deleting existing ones, changing nodes configs, establishing references or something similar, then you might be able to create an Action function that can automate all this. This will allow you to complete the action with the click of a button and stop doing those repetitive tasks youself. Not to mention help make Superalgos easier to use for everyone once you contribute your action!", + "updated": 1628255167092 }, { "style": "Title", @@ -23,8 +23,8 @@ }, { "style": "Text", - "text": "New Actions are implemented as functions inside a Function Library. So the basic workflow to implement a new Action is the following:", - "updated": 1614940407806 + "text": "New Actions are implemented as functions inside a Function Library. So the basic workflow to implement a new Action is as follows:", + "updated": 1628255279553 }, { "style": "List", @@ -43,8 +43,8 @@ }, { "style": "List", - "text": "Connect Menu Item to your Code: Finally you will connect the Menu Item to that function you wrote.", - "updated": 1614940545908 + "text": "Connect Menu Item to your Code: Finally you will connect the Menu Item to the function you wrote.", + "updated": 1628255317721 } ] } \ No newline at end of file diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-002-automating-actions-adding-a-menu-item.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-002-automating-actions-adding-a-menu-item.json index ab80d8dd5..41854ab4f 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-002-automating-actions-adding-a-menu-item.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-002-automating-actions-adding-a-menu-item.json @@ -14,17 +14,18 @@ }, { "style": "Text", - "text": "Check out the page of the App Schema concept. After that, locate the App Schema file you will need to edit at the Projects folder. There is one App Schema file for Project, pick the right one and edit it with VS Code." + "text": "Check out the page of the App Schema concept. After that, locate the App Schema file you will need to edit at the Projects folder. There is one App Schema file for each Project, pick the right one and edit it with VS Code.", + "updated": 1628255380671 }, { "style": "Warning", - "text": "Be carefull not to damage anything in the App Schema file while editing it. You will get into trouble if you do so. It can not only produce the UI not to load, but it can also damage the workspace you are working at.", - "updated": 1614940590024 + "text": "Be carefull not to damage anything in the App Schema file while editing it. You will get into trouble if you do. It can not only cause the UI to not load, but also damage the workspace you are working at.", + "updated": 1628255452468 }, { "style": "Success", - "text": "If you are not sure which project a certain node belongs to, there is a trick to find it out: close the Docs tab, and make focus on the node you want to add an Action to. While on focus, use Ctrl + Shift + Alt + F12 to log in the browser console the Node object. Inspect it to see the project property. Most likely it will be a Superalgos project's node.", - "updated": 1614940654950 + "text": "If you are not sure which project a certain node belongs to, there is a trick to find it: close the Docs tab, and make focus on the node you want to add an Action to. While on focus, use Ctrl + Shift + Alt + F12 to log in the browser console the Node object. Inspect it to see the project property. Most likely it will be a Foundations project's node.", + "updated": 1628255532030 }, { "style": "Title", @@ -37,8 +38,8 @@ }, { "style": "Json", - "text": "{\n \"action\": \"Add UI Object\",\n \"actionFunction\": \"payload.executeAction\",\n \"label\": \"Add Image\",\n \"relatedUiObject\": \"Image\"\n }", - "updated": 1614789262250 + "text": "{\n \"action\": \"Add Missing Workspace Projects\",\n \"label\": \"Add Missing Projects\",\n \"relatedUiObject\": \"Workspace\",\n \"actionFunction\": \"payload.executeAction\"\n}", + "updated": 1628255951872 }, { "style": "Text", @@ -90,6 +91,11 @@ { "style": "List", "text": "propertyToCheckFor: read the previous property." + }, + { + "style": "List", + "text": "workDoneLabel: text to display when action has completed", + "updated": 1628256114205 } ] } \ No newline at end of file diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-003-automating-actions-locating-the-right-function-library.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-003-automating-actions-locating-the-right-function-library.json index 86e1ce316..4cf66c441 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-003-automating-actions-locating-the-right-function-library.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-003-automating-actions-locating-the-right-function-library.json @@ -9,18 +9,18 @@ "paragraphs": [ { "style": "Text", - "text": "The procedure to locate a suitable Function Library is very easy. Open the Projects folder, getting into the Project the Node where the action is going to be triggered at is defined. Inside that project Folder get into the UI folder and then into Function-Libraries folder.", - "updated": 1614940833232 + "text": "The procedure to locate a suitable Function Library is very easy. Open the Projects folder, then open the Project associated with the Node you are attaching your action to. Inside that project Folder open the UI folder and then you will see the Function-Libraries folder.", + "updated": 1628256668116 }, { "style": "Note", - "text": "Each file in there is a Function Library except for the one called ActionSwitch.js, which is the place where you connect the Action Function name you defined at the App Schema with the function that will host the code for the new Action.", - "updated": 1614928708817 + "text": "Each file within the Function Library folder is a set of functions. The only exception to this is ActionSwitch.js. This file is the place where you will connect the Action Function name you defined at the App Schema with the function that will host the code for the new Action.", + "updated": 1628256808055 }, { "style": "Text", - "text": "Inspect each of these files and see at their header the functions they already implement. After a quick scan over all of them you can decide which one is where your action belongs to. If you believe that your Action should be placed at a new Function Library, then you can try to add a new one and set it up at the Project Schema file, but that is out of the scope of this guide.", - "updated": 1614928780531 + "text": "Inspect each of these files and see at their header the functions they already implement. After a quick scan over all of them you can decide which one fits best with your new action. If you believe that your Action should be placed at a new Function Library, then you can try to add a new one and set it up at the Project Schema file, but that is out of the scope of this guide.", + "updated": 1628256858024 }, { "style": "Title", diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-004-automating-actions-adding-your-function.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-004-automating-actions-adding-your-function.json index 00bfbed75..68ab3d8e5 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-004-automating-actions-adding-your-function.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-004-automating-actions-adding-your-function.json @@ -3,18 +3,19 @@ "pageNumber": 4, "type": "Automating Actions - Adding your Function", "definition": { - "text": "Take a look at how other functions are implemented in the Function Library and try to follow that way.", - "updated": 1614941850917 + "text": "Take a look at how other functions are implemented in the Function Library and try to follow the same format.", + "updated": 1628257476029 }, "paragraphs": [ { "style": "Text", - "text": "The basic procedure is quite straight forward. First add the function name to the thisObject and the write you function at the most appropiate place at the Function Library. ", - "updated": 1614941084806 + "text": "The basic procedure is quite straight forward. First add the function name to the thisObject and then write your function at the most appropiate place at the Function Library.", + "updated": 1628257461177 }, { "style": "Important", - "text": "Please document your function the best you can, even if you see the other functions implemented at the same library poorly documented. See if you can make your function the best documented in the whole library." + "text": "Please document your function the best you can, even if you see other functions implemented at the same library poorly documented. See if you can make your function the best documented in the whole library.", + "updated": 1628257493687 }, { "style": "Title", diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-005-automating-actions-using-utilities.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-005-automating-actions-using-utilities.json index 827da3839..1669f4620 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-005-automating-actions-using-utilities.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-005-automating-actions-using-utilities.json @@ -9,8 +9,8 @@ "paragraphs": [ { "style": "Text", - "text": "It is a very good idea to invest some time at the Utilities folder, scaning the files in there to see what you already have available to use at your actions. You will see that other actions in Function Libraries heavily rely on utilities functions defined at one of the files at the Utilities folder.", - "updated": 1614930012933 + "text": "It is a very good idea to invest some time at the Utilities folder, scaning the files in there to see what you already have available to use at your actions. You will see that other actions in Function Libraries heavily rely on utilities functions defined at one of the files within the Utilities folder.", + "updated": 1628257595439 }, { "style": "Title", @@ -19,7 +19,8 @@ }, { "style": "Text", - "text": "At runtime, all utility objects will be already instantiated by the time your Action function code runs. You just need to get to the object that host the utility funtion you want to execute via the UI Global Object that is available to you. For exmaple:" + "text": "At runtime, all utility objects will be already instantiated by the time your Action function code runs. You just need to get to the object that hosts the utility function you want to execute via the UI Global Object that is available to you. For example:", + "updated": 1628257649169 }, { "style": "Javascript", diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-006-automating-actions-using-function-libraries.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-006-automating-actions-using-function-libraries.json index d92702bd0..11f902b85 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-006-automating-actions-using-function-libraries.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-006-automating-actions-using-function-libraries.json @@ -3,14 +3,14 @@ "pageNumber": 6, "type": "Automating Actions - Using Function Libraries", "definition": { - "text": "You might also as well other functions located at Function Libraries from within your Action Function. In order to do this, you just need to locate the instance of the Function Library Object and call any of it's functions.", - "updated": 1614942828678 + "text": "You can also utilize other functions located within the Function Libraries to help build your Action Function. In order to do this, you just need to locate the instance of the Function Library Object and call any of it's functions.", + "updated": 1628257841959 }, "paragraphs": [ { "style": "Text", - "text": "It is a very good idea to invest some time at the Function-Libraries folder, scaning the files in there to see what you already have available to use at your actions. You will see that other actions in Function Libraries heavily rely on functions defined at one of the files at the Function-Libraries folder.", - "updated": 1614942900881 + "text": "It is a very good idea to invest some time at the Function-Libraries folder, scaning the files in there to see what you already have available to use at your actions. You will see that other actions in Function Libraries heavily rely on functions defined at one of the files within the Function-Libraries folder.", + "updated": 1628257873103 }, { "style": "Title", @@ -19,8 +19,8 @@ }, { "style": "Text", - "text": "At runtime, all Funtion Library objects will be already instantiated by the time your Action function code runs. You just need to get to the object that host the Function Library funtion you want to execute via the UI Global Object that is available to you. For exmaple:", - "updated": 1614942976608 + "text": "At runtime, all Function Library objects will be already instantiated by the time your Action function code runs. You just need to get to the object that host the Function Library funtion you want to execute via the UI Global Object that is available to you. For exmaple:", + "updated": 1628257884243 }, { "style": "Javascript", @@ -48,8 +48,8 @@ }, { "style": "Text", - "text": "At your own Action Function you might likely need to execute these functions, belonging to popular actions done at Action Functions:", - "updated": 1614943932540 + "text": "At your own Action Function you will likely need to execute these or similar functions, belonging to popular actions defined within other Action Functions:", + "updated": 1628257991399 }, { "style": "Subtitle", @@ -57,7 +57,8 @@ }, { "style": "Text", - "text": "The following is an example on how to add a new children to an existing Node:" + "text": "The following is an example on how to add a new child to an existing Node:", + "updated": 1628258008587 }, { "style": "Javascript", @@ -87,13 +88,13 @@ }, { "style": "Text", - "text": "Example of how to set the Reference Parent of a Node (in this case no Function Library is needed):", - "updated": 1614944033214 + "text": "Example of how to set the Reference Parent of a Node:", + "updated": 1628258163153 }, { "style": "Javascript", - "text": "node.payload.referenceParent = baseAsset\n", - "updated": 1614943688069 + "text": "UI.projects.foundations.functionLibraries.attachDetach.referenceAttachNode(timeMachine, session)", + "updated": 1628258141256 }, { "style": "Text", diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-008-automating-actions-adding-an-action-switch-case.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-008-automating-actions-adding-an-action-switch-case.json index 8357547a3..829842bbb 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-008-automating-actions-adding-an-action-switch-case.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-008-automating-actions-adding-an-action-switch-case.json @@ -3,8 +3,8 @@ "pageNumber": 8, "type": "Automating Actions - Adding an Action Switch Case", "definition": { - "text": "This steps create the mapping betwheen the actionFunction name you defined at the Menu Item of the node that can trigger your Action, and the function you coded inside a Function Library that will execute the code for the new Action. ", - "updated": 1614941772231 + "text": "This step creates the mapping between the actionFunction name you defined at the Menu Item of the node to can trigger your Action, and the function you coded inside a Function Library that will execute the code for the new Action.", + "updated": 1628258863939 }, "paragraphs": [ { @@ -18,8 +18,8 @@ }, { "style": "Text", - "text": "Find within the list of cases some of the cases pointint to the same Function Library your new Action is hosted at, so that you can add a new case together with the rest.", - "updated": 1614937904095 + "text": "Find within the list of cases some of the cases pointing to the same Function Library your new Action is hosted at, so that you can add a new case together with the rest.", + "updated": 1628258889849 }, { "style": "Title", @@ -37,8 +37,12 @@ }, { "style": "Success", - "text": "As you can see will you most likely be sending the node and rootNodes parameters into your Action function. You might want to also send other parameters from data you might find into the action object available to you at that point.", - "updated": 1614938157839 + "text": "As you can see you will most likely be sending the node and rootNodes parameters into your Action function. However, you might want to also send other parameters with data you find available within the system at this point into the action object. ", + "updated": 1628259076042 + }, + { + "style": "Note", + "text": "Setting a breakpoint here within Chrome's devTools is a convenient way to check the system for available data. " }, { "style": "Text", diff --git a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-009-automating-actions-testing-your-action.json b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-009-automating-actions-testing-your-action.json index 4d00b6752..f811c9f56 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-009-automating-actions-testing-your-action.json +++ b/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-009-automating-actions-testing-your-action.json @@ -14,7 +14,8 @@ }, { "style": "Text", - "text": "In order to debug your action, you will need to open the developer tool, and at the Sources tab, locate the Function Library file where you added your action, place a breakpoint at the begining of your function and go and click at the node Menu Item you added." + "text": "In order to debug your action, you will need to open the developer tool, and at the Sources tab, locate the Function Library file where you added your action, place a breakpoint at the beginning of your function and go and click at the node Menu Item you added.", + "updated": 1628261072790 }, { "style": "Success", diff --git a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js index 952b5f32c..b37988487 100644 --- a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js +++ b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js @@ -735,6 +735,11 @@ function newFoundationsActionSwitch() { UI.projects.foundations.functionLibraries.workspaceFunctions.addMissingWorkspaceProjects(action.node, action.rootNodes) } break + case 'Check For Missing References': + { + UI.projects.foundations.functionLibraries.workspaceFunctions.checkForMissingReferences(action.rootNodes) + } + break case 'Switch To Forward Testing': { action.node.type = "Forward Testing Session" diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index 09e342d08..9a93e5e21 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -383,9 +383,6 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { } } } - } - if (node.payload.referenceParent === undefined) { - console.log('[WARN]' + node.type + ' ' + node.name + ' reference parent lost during re-binding phase.') } } diff --git a/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js b/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js index 977b289f3..e3576dc9c 100644 --- a/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js +++ b/Projects/Foundations/UI/Function-Libraries/WorkspaceFunctions.js @@ -1,6 +1,7 @@ function newFoundationsFunctionLibraryWorkspaceFunctions() { let thisObject = { - addMissingWorkspaceProjects: addMissingWorkspaceProjects + addMissingWorkspaceProjects: addMissingWorkspaceProjects, + checkForMissingReferences: checkForMissingReferences } return thisObject @@ -26,4 +27,28 @@ function newFoundationsFunctionLibraryWorkspaceFunctions() { } } } + + // This function scales the current workspace and highlights any nodes that have unresolved references + function checkForMissingReferences(rootNodes) { + let nodes + for (let i = 0; i < rootNodes.length; i++) { + if (rootNodes[i] !== undefined) { + nodes = UI.projects.foundations.utilities.hierarchy.getHiriarchyMap(rootNodes[i]) + for (let [key, value] of nodes) { + // Check nodes that have a saved reference parent + if (value.savedPayload.referenceParent !== undefined) { + // Highlight nodes that do not have an active reference connected to their referance parent + if (value.payload.referenceParent === undefined) { + console.log("[WARN] Reference Parent not found in the current workspace.\n Node:", value.name, " Type:", value.type, " ID:", key, " Node Object:", value) + UI.projects.foundations.spaces.floatingSpace.inMapMode = true + value.payload.uiObject.setWarningMessage('Reference Parent not found in the current workspace.', 10) + } + + } + } + + } + } + + } }