How to Automate Actions Part 1

This commit is contained in:
Luis Fernando Molina committed 2021-03-04 08:33:52 +01:00
1 parent 42c2beae66
commit d8a8d33815
13 files changed
+515

No files matched your search

@@ -0,0 +1,13 @@
{
"type": "Action",
"definition": {
"text": "An Action is somthing that users of the system can triggeer via the UI, usually by clicking on a Menu Item of a Node. Actions can also be triggered by other actions enabling a resulable set of functionality to be available to users of the Design Space. Once triggered the action executes pre-defined code.",
"updated": 1614784762410
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,247 @@
{
"type": "App Schema",
"definition": {
"text": "A set of low level definitions placed at a JSON file that defines which types of nodes are made available by a certain Project to be used at the Design Space.",
"updated": 1614784939148
},
"paragraphs": [
{
"style": "Text",
"text": "The App Schema file is an array of objects, each objec defines a certain node type.",
"updated": 1614785082978
},
{
"style": "Title",
"text": "Example"
},
{
"style": "Json",
"text": " {\n \"type\": \"Plotter Panel\",\n \"level\": 4,\n \"propertyNameAtParent\": \"panels\",\n \"attachingRules\": {\n \"compatibleTypes\": \"->Plotter Module->\"\n },\n \"childrenNodesProperties\": [\n {\n \"name\": \"plotterPanelJavascriptCode\",\n \"type\": \"node\",\n \"childType\": \"Plotter Panel Javascript Code\"\n },\n {\n \"name\": \"panelData\",\n \"type\": \"array\",\n \"childType\": \"Panel Data\",\n \"autoAdd\": true\n }\n ],\n \"menuItems\": [\n {\n \"action\": \"Add UI Object\",\n \"disableIfPropertyIsDefined\": true,\n \"propertyToCheckFor\": \"plotterPanelJavascriptCode\",\n \"actionFunction\": \"payload.executeAction\",\n \"label\": \"Add Javascript Code\",\n \"relatedUiObject\": \"Plotter Panel Javascript Code\"\n },\n {\n \"action\": \"Add UI Object\",\n \"actionFunction\": \"payload.executeAction\",\n \"label\": \"Add Panel Data\",\n \"relatedUiObject\": \"Panel Data\"\n },\n {\n \"action\": \"Delete UI Object\",\n \"askConfirmation\": true,\n \"confirmationLabel\": \"Confirm to Delete\",\n \"actionFunction\": \"payload.executeAction\",\n \"label\": \"Delete\",\n \"iconPathOn\": \"delete-entity\",\n \"iconPathOff\": \"delete-entity\"\n }\n ],\n \"addLeftIcons\": true\n }",
"updated": 1614785173292
},
{
"style": "Title",
"text": "Properties",
"updated": 1614785297833
},
{
"style": "Text",
"text": "Each object can have a pre-defined set of properties, which you can see here:"
},
{
"style": "Subtitle",
"text": "type"
},
{
"style": "Text",
"text": "The Type of the node is the key by which each node is identified within the context of a certain Project. The naming convention here is that all words must be capitalized.",
"updated": 1614785486944
},
{
"style": "Subtitle",
"text": "level"
},
{
"style": "Text",
"text": "It is an integer from 0 to 5, representing the importance of this type of node. 0 is the most important. The more important the node type, the bigger is rendered at the Design Space. The difference between level is barely noticable.",
"updated": 1614785595122
},
{
"style": "Subtitle",
"text": "propertyNameAtParent"
},
{
"style": "Text",
"text": "Nodes are usually child of other nodes. Each Node might also have children. At runtime children references are stored at some property of the Node object, but that property is not unique or pre-defined. Instead, each Node Type declares at its own definition at the App Schema, which will be the name of the property that will host it's own reference at it's parent node. "
},
{
"style": "Subtitle",
"text": "childrenNodesProperties",
"updated": 1614785903518
},
{
"style": "Text",
"text": "Nodes also declare an array of property names that will be used to define which type of children the node can have. For example:",
"updated": 1614786054299
},
{
"style": "Json",
"text": "\"childrenNodesProperties\": [\n {\n \"name\": \"dataFormula\",\n \"type\": \"node\",\n \"childType\": \"Data Formula\",\n \"autoAdd\": true\n },\n {\n \"name\": \"textStyle\",\n \"type\": \"node\",\n \"childType\": \"Text Style\",\n \"autoAdd\": true\n }\n ]",
"updated": 1614786383043
},
{
"style": "Text",
"text": "Each array item represent one type of children node this node can have. ",
"updated": 1614786149174
},
{
"style": "Text",
"text": "Each object can have 4 properties:"
},
{
"style": "List",
"text": "name: means name of the property that will hold the reference to the child node at runtime.",
"updated": 1614786293774
},
{
"style": "List",
"text": "type: possible values are node or array. See details below.",
"updated": 1614786239139
},
{
"style": "List",
"text": "childType: means the type of the child node."
},
{
"style": "List",
"text": "autoAdd: optional, menas if one instance of this children will be automatically created when this Node type is created."
},
{
"style": "Text",
"text": "The type property, can either be node or array, meaning:",
"updated": 1614786331079
},
{
"style": "List",
"text": "node: means that can have only one instance of this type of children."
},
{
"style": "List",
"text": "array: means that it can have more than one instance of this type of children."
},
{
"style": "Subtitle",
"text": "attachingRules"
},
{
"style": "Text",
"text": "This property defines to which nodes the current one being defined can attach to, considering those nodes as possible parents. The values are expresed in a string with a list of Node Types like in the following example:"
},
{
"style": "Json",
"text": "\"attachingRules\": {\n \"compatibleTypes\": \"->Procedure Initialization->Procedure Loop->\"\n }",
"updated": 1614786517182
},
{
"style": "Note",
"text": "incompatibleTypes property can also be used to explicitly define which nodes can not be parents.",
"updated": 1614786596412
},
{
"style": "Subtitle",
"text": "referencingRules"
},
{
"style": "Text",
"text": "This property defines to which nodes the current one being defined can reference to, considering those nodes as possible reference parents. The values are expresed in a string with a list of Node Types like in the following example:",
"updated": 1614786699311
},
{
"style": "Json",
"text": "\"referencingRules\": {\n \"compatibleTypes\": \"->Dashboard->Data Mines Data->Trading Mines Data->Data Tasks->Testing Trading Tasks->Production Trading Tasks->\"\n }",
"updated": 1614786660155
},
{
"style": "Note",
"text": "incompatibleTypes property can also be used to explicitly define which nodes can not be parents.",
"updated": 1614786714357
},
{
"style": "Subtitle",
"text": "menuItems"
},
{
"style": "Text",
"text": "This property allow you to define the menu of this Node Type at the Design Space. This menu will be an array of Menu Items objects like in the example below:"
},
{
"style": "Json",
"text": "\"menuItems\": [\n {\n \"action\": \"Configure\",\n \"label\": \"Configure\",\n \"iconPathOn\": \"configuration\",\n \"iconPathOff\": \"configuration\",\n \"actionFunction\": \"uiObject.configEditor.activate\"\n },\n {\n \"action\": \"Run Super Action\",\n \"label\": \"Run\",\n \"askConfirmation\": true,\n \"confirmationLabel\": \"Confirm to Run\",\n \"workDoneLabel\": \"Super Action Executed\",\n \"iconPathOn\": \"run\",\n \"iconPathOff\": \"run\",\n \"actionFunction\": \"payload.executeAction\"\n },\n {\n \"action\": \"Delete UI Object\",\n \"askConfirmation\": true,\n \"confirmationLabel\": \"Confirm to Delete\",\n \"label\": \"Delete\",\n \"iconPathOn\": \"delete-entity\",\n \"iconPathOff\": \"delete-entity\",\n \"actionFunction\": \"payload.executeAction\"\n }\n ]",
"updated": 1614787632953
},
{
"style": "Text",
"text": "Although you are free to add any menu item you like, there are a few that have already become standarized. These standard Menu Items are also placed at a certain position within the menu for consistency.",
"updated": 1614787035329
},
{
"style": "List",
"text": "configure: always go as the first item"
},
{
"style": "List",
"text": "run: after the configure if there is one"
},
{
"style": "List",
"text": "delete: it is always the last one"
},
{
"style": "Text",
"text": ""
},
{
"style": "Subtitle",
"text": "initialValues"
},
{
"style": "Text",
"text": "This property is needed when the Node Type being defined will have a configuration. In those cases this property will set the initial value for that config. Example:"
},
{
"style": "Json",
"text": "\"initialValues\": {\n \"config\": \"{ \\n\\\"username\\\": \\\"\\\", \\n\\\"token\\\": \\\"\\\"\\n}\"\n }",
"updated": 1614787265306
},
{
"style": "Subtitle",
"text": "editors"
},
{
"style": "Text",
"text": "This property will tell the system which editor will be available for this type of node. Example:"
},
{
"style": "Json",
"text": "\"editors\": {\n \"config\": true\n }",
"updated": 1614787433867
},
{
"style": "Text",
"text": "There are a few existing editors:"
},
{
"style": "List",
"text": "config: editor for node configurations."
},
{
"style": "List",
"text": "code: editor for javascript code."
},
{
"style": "List",
"text": "formula: formulas expressed in javascript."
},
{
"style": "List",
"text": "condition: conditions editor.",
"updated": 1614787624722
},
{
"style": "Note",
"text": "In order for the user to actually be able to open the editor configured here, there must be a Menu Item than has an action = \"Configure\"."
},
{
"style": "Text",
"text": ""
},
{
"style": "Text",
"text": ""
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,31 @@
{
"type": "Function Library",
"definition": {
"text": "It is a collection of functions related to a single topic. The topic is usuarlly expressed at the Function Libray's name.",
"updated": 1614787845534
},
"paragraphs": [
{
"style": "Text",
"text": "Each integrated project might have Function Libraries at the 3 different levels possible: Client, TS, and UI. In the case of Superalgos, at the UI it features, for instance, these Function Libraries:",
"updated": 1614788012945
},
{
"style": "List",
"text": "Charting Space Functions"
},
{
"style": "List",
"text": "Crypto Ecosystem Functions"
},
{
"style": "List",
"text": "Plugins Functions",
"updated": 1614788024303
},
{
"style": "Note",
"text": "Function Libraries are stateless by definition. "
}
]
}
@@ -0,0 +1,13 @@
{
"type": "Menu Item",
"definition": {
"text": "A Menu Item is each of the items listed at any given Node's menu.",
"updated": 1614784829380
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,36 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "1",
"type": "Automating Actions - What is an Action?",
"definition": {
"text": "An Action is what is executed when users picks something from the menu of a Node.",
"updated": 1614788525702
},
"paragraphs": [
{
"style": "Text",
"text": "These actions are implemented as functions inside a Function Library. So the basic workflow to implement a new action is the following:",
"updated": 1614788734425
},
{
"style": "List",
"text": "Add Menu Item: First you need to add a Menu Item for the node type that will allow the user to execute your action.",
"updated": 1614790023220
},
{
"style": "List",
"text": "Locate Function Library: Then you will need to locate the Function Library that is better suited to host the function that is going to be executed once the action is triggered.",
"updated": 1614790037292
},
{
"style": "List",
"text": "Add your Code: Then you will write the code for that function.",
"updated": 1614790047291
},
{
"style": "List",
"text": "Connect Menu Item to your Code: Finally you will connect the Menu Item to that function.",
"updated": 1614790060302
}
]
}
@@ -0,0 +1,77 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "2",
"type": "Automating Actions - Adding a Menu Item",
"definition": {
"text": "You need to add a new Menu Item at the node definition at the App Schema.",
"updated": 1614788860135
},
"paragraphs": [
{
"style": "Text",
"text": "Check out the page of the App Schema concept. After that, locate the App Schema file of the Projects folder. There is one App Schema file for Project, pick the right one and edit it with VS Code.",
"updated": 1614788974626
},
{
"style": "Warning",
"text": "Be carefull not to damage anything in there while editing. 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": 1614789073656
},
{
"style": "Text",
"text": "Locate inside the file, the definition of the Node Type you want to add the new Action to. Once localted add a menu item object to the menuItems array, like in the following example:",
"updated": 1614789152442
},
{
"style": "Json",
"text": "{\n \"action\": \"Add UI Object\",\n \"actionFunction\": \"payload.executeAction\",\n \"label\": \"Add Image\",\n \"relatedUiObject\": \"Image\"\n }",
"updated": 1614789262250
},
{
"style": "Text",
"text": "The example above is most likely what you need to add. For completeness, this is the list of properties this object can have:",
"updated": 1614789977840
},
{
"style": "List",
"text": "action: define a name for your action. Capitalize each first letter please."
},
{
"style": "List",
"text": "actionFunction: use the standard \"payload.executeAction\" unless you are familiar with the system and would like to do some custom stuff."
},
{
"style": "List",
"text": "label: this is what is going to be read by the user at the Node's menu."
},
{
"style": "List",
"text": "relatedUiObject: optional. You can define here a Node Type. The system will use for the Menu Item icon, the image associated to the Node Type you define here."
},
{
"style": "List",
"text": "askConfirmation: true if you want the user to confirm with an extra click."
},
{
"style": "List",
"text": "confirmationLabel: the text the user will read when asked to confirm."
},
{
"style": "List",
"text": "iconPathOn: the name of the image to render when this Menu Item is ON (in cases that works as a toggle)"
},
{
"style": "List",
"text": "iconPathOff: the name of the image to render when this Menu Item is OFF (in cases that works as a toggle)"
},
{
"style": "List",
"text": "disableIfPropertyIsDefined: true when you want the Menu Item to be disabled if a certain property of the Node object is defined at runtime. This is used in conbination with the property propertyToCheckFor in the special situation that the Menu Item is used to create a child for this Node that is not part of a array of children and there can only be one child of that type.",
"updated": 1614789912636
},
{
"style": "List",
"text": "propertyToCheckFor: read the previous property."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "3",
"type": "Automating Actions - Adding a Children Node Property",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "4",
"type": "Automating Actions - Locating the Right Function Library",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "5",
"type": "Automating Actions - Adding your Function",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "6",
"type": "Automating Actions - Using Utilities",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "7",
"type": "Automating Actions - Using the Workspace",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "8",
"type": "Automating Actions - Adding an Action Switch Case",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}
@@ -0,0 +1,14 @@
{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": "9",
"type": "Automating Actions - Testing your Action",
"definition": {
"text": "Write a summary for this topic page."
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. Then you can use doscs.save to save your changes and app.contribute to send it to the main repository."
}
]
}