Skip to content

Commit 4b4ad0b

Browse files
App doc update (windmill-labs#138)
* feat(frontend): update app editor documentation
1 parent bd60bc0 commit 4b4ad0b

16 files changed

+514
-6
lines changed

docs/apps/0_app_editor.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ Windmill's App editor allows you to build internal applications. Windmill's App
99
- [Runnable editor](./app-runnable): create, edit or manage the scripts or flows linked to components (Runnable), and background scripts.
1010
- [Settings](./app_settings): configure the components settings.
1111

12-
![App Editor](../assets/apps/0_app_editor/plain-app-editor.png)
12+
![App Editor](../assets/apps/0_app_editor/plain-app-editor.png)
1313

14-
 
15-
You will find more details in the next pages.
14+
## App
15+
16+
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

docs/apps/1_app_toolbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The app editor mode can be toggled between `Editor` and `Preview` mode. The prev
1717

1818
### Desktop/mobile mode
1919

20-
Switch the canvas mode in `Mobile` or `Desktop` layout from the toolbar.
20+
Switch the canvas mode in `Mobile` or `Desktop` layout from the toolbar. You can manually set the position and size of the components in both modes.
2121

2222
### Menu ``
2323

docs/apps/2_app_outputs.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ The app context contains the following outputs:
1818
- email: the email of the current user
1919
- username: the username of the current user
2020
- query: the query parameters of the URL
21+
- hash: the hash parameters of the URL
2122

2223
### State
2324

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.
2526

2627
### Component outputs
2728

@@ -61,3 +62,22 @@ A background script is a script that runs in the background and can be used to p
6162
### Connecting inputs
6263

6364
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.
65+
66+
<video
67+
className="border-2 rounded-xl object-cover w-full h-full"
68+
autoPlay
69+
loop
70+
controls
71+
id="main-video"
72+
src="/videos/app-connections.mp4"
73+
/>
74+
75+
Here are the steps to connect an input to an output:
76+
77+
- Click on the component input you want to connect to an output
78+
- Click the right arrow to open the connection menu
79+
- You can now navigate you app, without running any scripts
80+
- When you hover a component, the corresponding outputs are highlighted in orange
81+
- If you click on a component, the output will be pinned and stays open
82+
- You can now click on the output you want to connect to the input
83+
- The input is now connected to the output

docs/apps/5_app-runnable.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,59 @@ They are 4 types of runnables:
88
- **Workspace/Hub**: scripts linked to a component, but defined in the workspace or the Hub.
99
- **Background scripts**: scripts that are not linked to a component, but run in the background.
1010
- **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:
24+
- [Buttons](./app_component_library#button)
25+
- [Forms](./app_component_library#form)
26+
- [Modal forms](./app_component_library#form-modal)
27+
- **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

Comments
 (0)