Skip to content

Commit a71f617

Browse files
authored
White labelling, approval steps and minor adjustments (windmill-labs#304)
1 parent e0b7dd7 commit a71f617

File tree

30 files changed

+209
-101
lines changed

30 files changed

+209
-101
lines changed

docs/assets/flows/approval-step.png

90.6 KB
Loading
-41.6 KB
Binary file not shown.
-125 KB
Binary file not shown.
622 KB
Loading

docs/compared_to/peers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Those frameworks are a great source of inspiration for us but we bring a more pr
3232

3333
<br/>
3434

35-
From a tech stack perspective, we rely on the ACID properties of PostgreSQL to achieve persistence and transactionality of the workflow's state. We made the simplifying assumption to be an at-least-once workflow engine, where in the exceptionally rare events of an infrastructure crash (machine shutdown, network split, etc), we will recover automatically but it is up to the application developer to implement idempotency in parts where it is critical for everything else, we support the same feature set ([retries](../flows/14_retries.md), [error handler](../flows/7_flow_error_handler.md), [suspend/sleep](../flows/15_sleep.md), [approval steps](../flows/11_flow_approval.md), [cancellation](../flows/2_early_stop.md), [inner workflows](../getting_started/9_trigger_flows/index.mdx#trigger-a-flow-from-another-flow)).
35+
From a tech stack perspective, we rely on the ACID properties of PostgreSQL to achieve persistence and transactionality of the workflow's state. We made the simplifying assumption to be an at-least-once workflow engine, where in the exceptionally rare events of an infrastructure crash (machine shutdown, network split, etc), we will recover automatically but it is up to the application developer to implement idempotency in parts where it is critical for everything else, we support the same feature set ([retries](../flows/14_retries.md), [error handler](../flows/7_flow_error_handler.md), [suspend/sleep](../flows/15_sleep.md), [approval steps](../flows/11_flow_approval.mdx), [cancellation](../flows/2_early_stop.md), [inner workflows](../getting_started/9_trigger_flows/index.mdx#trigger-a-flow-from-another-flow)).
3636

3737
<br/>
3838

docs/compared_to/retool.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ executable through [autogenerated UIs](../core_concepts/6_auto_generated_uis/ind
101101
Retool is not originally designed as a workflow engine.
102102
Its flow capabilities are geared towards non-technical users, similar to n8n.
103103
Adding steps or for loops can be frustrating.
104-
Flows will be limited without features like [approval steps](../flows/11_flow_approval.md), [early stop](../flows/2_early_stop.md), [sleep](../flows/15_sleep.md), etc.
104+
Flows will be limited without features like [approval steps](../flows/11_flow_approval.mdx), [early stop](../flows/2_early_stop.md), [sleep](../flows/15_sleep.md), etc.
105105

106106
The flow-building experience is cumbersome, as Retool has not managed to incorporate the same level
107107
of low-code simplicity found in its app builder (e.g. picking inputs from previous steps’ outputs).

docs/core_concepts/11_persistent_storage/index.md renamed to docs/core_concepts/11_persistent_storage/index.mdx

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import DocCard from '@site/src/components/DocCard';
2+
13
# Persistent Storage
24

35
Persistent storage refers to any method of storing data that remains intact and accessible even after a system is powered off, restarted, or experiences a crash.
46

5-
In the context of Windmill, the stakes are: **where to effectively store and manage the data manipulated by Windmill**? (ETL, data ingestion and preprocessing, data migration and sync etc.)
7+
In the context of Windmill, the stakes are: **where to effectively store and manage the data manipulated by Windmill** (ETL, data ingestion and preprocessing, data migration and sync etc.) ?
68

79
:::info TLDR
810

@@ -48,15 +50,17 @@ Within Windmill, you can use States and Resources as a way to store a transient
4850

4951
#### States
5052

51-
[States](../3_resources_and_types/index.mdx#states) are actually resources (but excluded from the Workspace tab for clarity). They are used by scripts to keep data persistent between runs of the same script by the same trigger (schedule or user).
53+
In Windmill, [States](../3_resources_and_types/index.mdx#states) are considered as resources, but they are excluded from the Workspace tab for clarity.
54+
They are displayed on the Resources menu, under a dedicated tab.
55+
56+
States are used by scripts to keep data persistent between runs of the same script by the same trigger (schedule or user).
5257

53-
A state is an object stored as a resource of the resource type `state` which is meant to persist across distinct executions of the same script. This is what enables Flows to watch for changes in most event watching scenarios. The pattern is as follows:
58+
A state is an object stored as a resource of the resource type `state` which is meant to persist across distinct executions of the same script.
59+
This is what enables Flows to watch for changes in most event watching scenarios. The pattern is as follows:
5460

55-
- Retrieve the last state or, if undefined, assume it is the first
56-
execution.
61+
- Retrieve the last state or, if undefined, assume it is the first execution.
5762
- Retrieve the current state in the external system you are watching, e.g. the
58-
list of users having starred your repo or the maximum ID of posts on Hacker
59-
News.
63+
list of users having starred your repo or the maximum ID of posts on Hacker News.
6064
- Calculate the difference between the current state and the last internal
6165
state. This difference is what you will want to act upon.
6266
- Set the new state as the current state so that you do not process the
@@ -66,21 +70,49 @@ A state is an object stored as a resource of the resource type `state` which is
6670
one Flow per item. This is exactly the pattern used when your Flow is in the
6771
mode of "Watching changes regularly".
6872

69-
The convenience functions do this in TypeScript are:
73+
The convenience functions do this are:
74+
75+
*TypeScript*
7076

7177
- `getState()` which retrieves an object of any type (internally a simple
7278
Resource) at a path determined by `getStatePath`, which is unique to the user
7379
currently executing the Script, the Flow in which it is currently getting
74-
called in - if any - and the path of the Script
75-
- `setState(value: any)` which sets the new state
80+
called in - if any - and the path of the Script.
81+
- `setState(value: any)` which sets the new state.
82+
83+
> Please note it requires [importing](../../advanced/6_imports/index.md) the wmill client library from Deno/Bun.
84+
85+
<br/>
86+
87+
*Python*
88+
89+
- `get_state()` which retrieves an object of any type (internally a simple
90+
Resource) at a path determined by `get_state_path`, which is unique to the user
91+
currently executing the Script, the Flow in which it is currently getting
92+
called in - if any - and the path of the Script.
93+
- `set_state(value: Any)` which sets the new state.
94+
95+
<br/>
96+
97+
> Please note it requires [importing](../../advanced/6_imports/index.md) the wmill client library from Python.
98+
99+
<br/>
100+
101+
<div class="grid grid-cols-2 gap-6 mb-4">
102+
<DocCard
103+
title="Resources and Resource Types"
104+
description="Resources are structured configurations and connections to third-party systems, with Resource Types defining the schema for each Resource."
105+
href="/docs/core_concepts/resources_and_types"
106+
/>
107+
</div>
76108

77109
#### Resources
78110

79-
States are a specific type of resource in Windmill where the type is `state` the path is automatically calculated for you based on the schedule path (if any) and the script path. In some cases, you want to set the path arbitrarily and/or use a different type than `state`. In this case, you can use the `setResource` and `getResource` functions. A same resource can be used across different scripts and flows.
111+
[States](#states) are a specific type of resource in Windmill where the type is `state` the path is automatically calculated for you based on the schedule path (if any) and the script path. In some cases, you want to set the path arbitrarily and/or use a different type than `state`. In this case, you can use the `setResource` and `getResource` functions. A same resource can be used across different scripts and flows.
80112

81113
- `setResource(value: any, path?: string, initializeToTypeIfNotExist?: string)`: which sets a resource at a given path. This is
82-
equivalent to `setState` but allows you to set an arbitrary path and chose a type other than state if wanted. [See api](https://deno.land/x/windmill/mod.ts?s=setResource)
83-
- `getResource(path: string)`: gets a resource at a given path. [See api](https://deno.land/x/windmill/mod.ts?s=getResource)
114+
equivalent to `setState` but allows you to set an arbitrary path and chose a type other than state if wanted. [See api](https://deno.land/x/windmill/mod.ts?s=setResource).
115+
- `getResource(path: string)`: gets a resource at a given path. [See api](https://deno.land/x/windmill/mod.ts?s=getResource).
84116

85117
The states can be seen in the [Resources](../3_resources_and_types/index.mdx) section with a
86118
[Resource Type](../3_resources_and_types/index.mdx#create-a-resource-type) of `state`.
@@ -116,7 +148,7 @@ Once the Shared Directory is enabled, you can use it in your flow by referencing
116148

117149
:::tip
118150

119-
Keep in mind that the contents of the `./shared` folder are not preserved across [suspends](../../flows/11_flow_approval.md) and [sleeps](../../flows/15_sleep.md). The directory is temporary and active only during the execution of the flow.
151+
Keep in mind that the contents of the `./shared` folder are not preserved across [suspends](../../flows/11_flow_approval.mdx) and [sleeps](../../flows/15_sleep.md). The directory is temporary and active only during the execution of the flow.
120152

121153
:::
122154

docs/core_concepts/16_roles_and_permissions/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Users can be given different levels of permissions:
4545
The recommended way to share scripts and flows with operators is through [auto-generated apps](../6_auto_generated_uis/index.md#automatically-generated-apps).
4646
With the second option being of sharing the script and [variables](../2_variables_and_secrets/index.mdx) it depends on (but operators won't be able to load variable directly from the UI/api, only use them within the scripts they have access to).
4747

48-
5. **Anonymous app viewers**: Anonymous app viewers are individuals who can access and view Windmill apps without being a user but by knowing the [secret URL](../../apps/0_toolbar.mdx#deploy) that allows app viewing. They do not have any editing or privileges to execute scripts and flows. The apps that they see execute the scripts and flows that are part of the app but only on behalf of the app author. The anonymous user cannot execute any of the scripts and flows part of the apps outside of the inputs authorized by the app through a policy that is automatically generated by the app.
48+
5. **Anonymous app viewers**: Anonymous app viewers are individuals who can access and view Windmill apps without being a user but by knowing the [secret URL](../../apps/0_toolbar.md#deploy) that allows app viewing. They do not have any editing or privileges to execute scripts and flows. The apps that they see execute the scripts and flows that are part of the app but only on behalf of the app author. The anonymous user cannot execute any of the scripts and flows part of the apps outside of the inputs authorized by the app through a policy that is automatically generated by the app.
4949

5050
<div class="text-xl mb-2 font-semibold"></div>
5151
<div class="grid grid-cols-2 gap-6 mb-4">

docs/core_concepts/23_instant_preview/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,4 @@ On the top bar of the app, you can either manually run all runnables of set a gi
168168

169169
<br/>
170170

171-
The [preview mode](../../apps/0_toolbar.mdx#preview-mode) of the app will run all runnables before previewing them.
171+
The [preview mode](../../apps/0_toolbar.md#preview-mode) of the app will run all runnables before previewing them.

docs/core_concepts/3_resources_and_types/index.mdx

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,62 @@ default, etc). You can also view the schema by toggling the "As JSON" option:
8686

8787
## States
8888

89-
In Windmill, states are considered as resources, but they are excluded from the Workspace tab for clarity. States are used by scripts to keep data persistent between runs of the same script by the same trigger (schedule or user).
90-
89+
In Windmill, states are considered as resources, but they are excluded from the Workspace tab for clarity.
9190
They are displayed on the Resources menu, under a dedicated tab.
9291

92+
States are used by scripts to keep data persistent between runs of the same script by the same trigger (schedule or user).
93+
94+
A state is an object stored as a resource of the resource type `state` which is meant to persist across distinct executions of the same script.
95+
This is what enables Flows to watch for changes in most event watching scenarios. The pattern is as follows:
96+
97+
- Retrieve the last state or, if undefined, assume it is the first execution.
98+
- Retrieve the current state in the external system you are watching, e.g. the
99+
list of users having starred your repo or the maximum ID of posts on Hacker News.
100+
- Calculate the difference between the current state and the last internal
101+
state. This difference is what you will want to act upon.
102+
- Set the new state as the current state so that you do not process the
103+
elements you just processed.
104+
- Return the differences calculated previously so that you can process them in
105+
the next steps. You will likely want to [forloop](../../flows/12_flow_loops.md) over the items and trigger
106+
one Flow per item. This is exactly the pattern used when your Flow is in the
107+
mode of "Watching changes regularly".
108+
109+
The convenience functions do this are:
110+
111+
*TypeScript*
112+
113+
- `getState()` which retrieves an object of any type (internally a simple
114+
Resource) at a path determined by `getStatePath`, which is unique to the user
115+
currently executing the Script, the Flow in which it is currently getting
116+
called in - if any - and the path of the Script.
117+
- `setState(value: any)` which sets the new state.
118+
119+
> Please note it requires [importing](../../advanced/6_imports/index.md) the wmill client library from Deno/Bun.
120+
121+
<br/>
122+
123+
*Python*
124+
125+
- `get_state()` which retrieves an object of any type (internally a simple
126+
Resource) at a path determined by `get_state_path`, which is unique to the user
127+
currently executing the Script, the Flow in which it is currently getting
128+
called in - if any - and the path of the Script.
129+
- `set_state(value: Any)` which sets the new state.
130+
131+
<br/>
132+
133+
> Please note it requires [importing](../../advanced/6_imports/index.md) the wmill client library from Python.
134+
135+
<br/>
136+
137+
<div class="grid grid-cols-2 gap-6 mb-4">
138+
<DocCard
139+
title="Persistent Storage"
140+
description="Ensure that your data is safely stored and easily accessible whenever required."
141+
href="/docs/core_concepts/persistent_storage"
142+
/>
143+
</div>
144+
93145
## Using Resources
94146

95147
<div class="grid grid-cols-2 gap-6 mb-4">

0 commit comments

Comments
 (0)