You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An app is a collection of components. An app can be used to build a dashboard, a workflow, a form, a CRM, etc. An app is made of:
17
+
18
+
-**Components**: the components are the building blocks of an app. They can be used to display data, to perform actions, to create forms, etc. The components are displayed on a grid and can be nested in containers.
19
+
-**Runnables**: the runnables are the scripts or flows that are linked to components, or ran in the background. They are used to perform actions when a component is clicked, to fetch data, etc
Copy file name to clipboardExpand all lines: docs/apps/2_app_outputs.md
+21-1Lines changed: 21 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,11 @@ The app context contains the following outputs:
18
18
- email: the email of the current user
19
19
- username: the username of the current user
20
20
- query: the query parameters of the URL
21
+
- hash: the hash parameters of the URL
21
22
22
23
### State
23
24
24
-
The app state is a client-side store that can be used to store data. The app statec can be manipulated by frontend scripts.
25
+
The app state is a client-side store that can be used to store data. The app state can be manipulated by frontend scripts.
25
26
26
27
### Component outputs
27
28
@@ -61,3 +62,22 @@ A background script is a script that runs in the background and can be used to p
61
62
### Connecting inputs
62
63
63
64
Inputs can be connected to any outputs. When connecting, you can click on the output to connect the input to the output. Note that you can select nested outputs, objects and arrays.
Copy file name to clipboardExpand all lines: docs/apps/5_app-runnable.md
+56Lines changed: 56 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,3 +8,59 @@ They are 4 types of runnables:
8
8
-**Workspace/Hub**: scripts linked to a component, but defined in the workspace or the Hub.
9
9
-**Background scripts**: scripts that are not linked to a component, but run in the background.
10
10
-**Frontend scripts**: script can be used to manipulate the client app state. They can either be linked to a component or be a background script. If they are a background script, they are not executed unless manually set to run when the app starts or reloads.
11
+
12
+
## Component runnable
13
+
14
+
A component can have a **Runnable** attached to it. The runnable is a script or flow that is executed when the component is clicked or loaded. For example, a button can have a runnable linked to it. When the button is clicked, the runnable is executed. For a table, the runnable is executed when the table is loaded.
15
+
16
+
### Triggered by
17
+
18
+
A component can be triggered by:
19
+
20
+
#### Events:
21
+
22
+
-**Click**: the runnable is executed when the component is clicked:
23
+
Three components can be triggered by a click event:
-**Start**: the runnable is executed when the component is loaded
28
+
-**Refresh**: the runnable is executed when the app is refreshed.
29
+
30
+
#### Recompute
31
+
32
+
Other component can trigger a component to recompute. For example, a button can trigger a table to recompute. When the button is clicked, the table is reloaded.
33
+
See [Recompute Others](./app-runnable#recompute-others) for more information.
34
+
35
+
#### Changes of values:
36
+
37
+
When a runnable has an input connected to an output of a component, the runnable is executed when the output value changes. See [Connections](./app-runnable#connections) for more information.
38
+
39
+
#### Background script
40
+
41
+
Background scripts are triggered upon global refresh or when their input changes. The result of a background script can be shared among many components. They are not linked to a specific component.
42
+
43
+
You can disable the automatic execution on app start and refresh by unchecking the `Run on start and app refresh` checkbox.
44
+
You may want to disable this so that the background script is only triggered by changes to other values or triggered by another computation on a button (See 'Recompute Others')
45
+
46
+
Background scripts executed on the server can also disable the automatic execution when an input value changes by checking the `do NOT recompute on input changes` checkbox.
47
+
48
+
#### Frontend script
49
+
50
+
Frontend scripts are backgroud script executed in the browser and can manipulate the app context directly.
51
+
See [Frontend scripts](./app-runnable#frontend-scripts) for more information.
52
+
53
+
:::info Frontend scripts
54
+
Dependencies for frontend scripts are not automatically detected. You need to manually add the dependencies in the `Trigger by` section.
55
+
56
+
<br/>
57
+
It is necessary to add the dependencies manually because the frontend scripts are not executed in the same context as the app. The frontend scripts are executed in the context of the browser, and the app is executed in the context of the server.
58
+
:::
59
+
60
+
### Recompute others
61
+
62
+
`Button` and `Form` components can trigger other components to recompute. For example, a button can trigger a table to recompute. When the button is clicked, the table is reloaded.
63
+
64
+
## Policy
65
+
66
+
A viewer of the app will execute the runnables of the app on behalf of the publisher avoiding the risk that a resource or script would not be available to the viewer. To guarantee tight security, a policy is computed at time of saving of the app which only allow the scripts/flows referred to in the app to be called on behalf of. Furthermore, static parameters are not overridable. Hence, users will only be able to use the app as intended by the publisher without risk for leaking resources not used in the app.
0 commit comments