Skip to content

Commit 916fc4c

Browse files
authored
Doc improvements following demo workspace update (windmill-labs#438)
* Doc improvement on resources * Doc improvements following demo workspace update
1 parent 19cc3d8 commit 916fc4c

35 files changed

+367
-3
lines changed

docs/advanced/10_browser_automation/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Browser automation
1+
# Browser Automation
22

33
Windmill makes it easy to perform browser automation tasks, such as testing or web scraping.
44

@@ -37,7 +37,7 @@ export async function main() {
3737
headless: "new",
3838
executablePath: "/usr/bin/chromium",
3939
args: ["--no-sandbox"],
40-
//userDataDir: "./user-data", // this is only required when windmill is running with nsjail where you don't have access to the default user data dir
40+
//userDataDir: "./user-data", // this is only required when Windmill is running with nsjail where you don't have access to the default user data dir
4141
});
4242

4343
const page = await browser.newPage();

docs/apps/0_toolbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Hub Compatible JSON: View the JSON / YAML representation of the app in a format
5757

5858
The app inputs menu displays a list of all the inputs of each component. A toggle allows you to display only resources inputs, enabling you to easily configure your third-party resources for an app imported from the Hub, for example:
5959

60-
![App Inputs Configuration](../assets/apps/1_app_toolbar/app-inputs-configuration.png.webp 'App Inputs Configuration')
60+
![App Inputs Configuration](../assets/apps/1_app_toolbar/app-inputs-configuration.png 'App Inputs Configuration')
6161

6262
### Diff
6363

Loading
Binary file not shown.
Binary file not shown.

docs/core_concepts/3_resources_and_types/index.mdx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import DocCard from '@site/src/components/DocCard';
2+
import Tabs from '@theme/Tabs';
3+
import TabItem from '@theme/TabItem';
24

35
# Resources and Resource Types
46

@@ -168,6 +170,78 @@ _Python_
168170

169171
## Using Resources
170172

173+
Resources can be used [passed as script parameters](#passing-resources-as-parameters-to-scripts-preferred) or [directly fetched](#fetching-them-from-within-a-script-by-using-the-wmill-client-in-the-respective-language) within code.
174+
175+
<video
176+
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
177+
controls
178+
src="/videos/add_resources_variables.mp4"
179+
/>
180+
181+
### Passing resources as parameters to scripts (preferred)
182+
183+
Resources can be passed using the [auto-generated UI](../6_auto_generated_uis/index.mdx).
184+
185+
Provided you have the right permissions and the resource type exists in the workspace, you can access resource types from scripts, flows and apps using the Windmill client or [TypedDict](https://mypy.readthedocs.io/en/stable/typed_dict.html) in Python.
186+
187+
From the code editor's toolbar, click on the `+ Type` button and pick the right resource type. For example, to access the `u/user/my_postgresql` resource of the `posgtgresql` Resource Type we would create a script:
188+
189+
<Tabs className="unique-tabs">
190+
<TabItem value="TypeScript" label="TypeScript" attributes={{className: "text-xs p-4 !mt-0 !ml-0"}}>
191+
192+
```typescript
193+
type Postgresql = object;
194+
// OR one can fully type it
195+
type Postgresql = {
196+
host: string;
197+
port: number;
198+
user: string;
199+
dbname: string;
200+
sslmode: string;
201+
password: string;
202+
root_certificate_pem: string;
203+
};
204+
205+
export async function main(postgres: Postgresql) {
206+
// Use Resource...
207+
}
208+
```
209+
210+
</TabItem>
211+
<TabItem value="Python" label="Python" attributes={{className: "text-xs p-4 !mt-0 !ml-0"}}>
212+
213+
```python
214+
from typing import TypedDict
215+
216+
class postgresql(TypedDict):
217+
host: str
218+
port: int
219+
user: str
220+
dbname: str
221+
sslmode: str
222+
password: str
223+
root_certificate_pem: str
224+
225+
def main(selected_postgres: postgresql):
226+
# Use Resource...
227+
```
228+
229+
</TabItem>
230+
</Tabs>
231+
232+
<br/>
233+
234+
And then select the Resource in the arguments section on the right:
235+
236+
![Select resource](../3_resources_and_types/select_resource.png)
237+
238+
:::tip
239+
240+
You can also edit the Resource or even create a new one right from the Code
241+
editor.
242+
243+
:::
244+
171245
All details on the [Add Resources and Variables to Code Editor](../../code_editor/add_variables_resources.mdx) page:
172246

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

docs/integrations/airtable.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ Now specify Airtable which databse and table you want to interact with:
4242

4343
<br/><br/>
4444

45+
Your resource can be used [passed as parameters](../core_concepts/3_resources_and_types/index.mdx#passing-resources-as-parameters-to-scripts-preferred) or [directly fetched](../core_concepts/3_resources_and_types/index.mdx#fetching-them-from-within-a-script-by-using-the-wmill-client-in-the-respective-language) within [scripts](../script_editor/index.mdx), [flows](../flows/1_flow_editor.mdx) and [apps](../apps/0_app_editor/index.mdx).
46+
47+
<video
48+
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
49+
controls
50+
src="/videos/add_resources_variables.mp4"
51+
/>
52+
53+
<br/>
54+
4555
:::tip
4656

4757
Find some pre-set interactions with Airtable on the [Hub](https://hub.windmill.dev/integrations/airtable).

docs/integrations/aws-s3.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ To integrate Amazon S3 to Windmill, you need to save the following elements as a
4242

4343
<br/><br/>
4444

45+
Your resource can be used [passed as parameters](../core_concepts/3_resources_and_types/index.mdx#passing-resources-as-parameters-to-scripts-preferred) or [directly fetched](../core_concepts/3_resources_and_types/index.mdx#fetching-them-from-within-a-script-by-using-the-wmill-client-in-the-respective-language) within [scripts](../script_editor/index.mdx), [flows](../flows/1_flow_editor.mdx) and [apps](../apps/0_app_editor/index.mdx).
46+
47+
<video
48+
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
49+
controls
50+
src="/videos/add_resources_variables.mp4"
51+
/>
52+
53+
<br/>
54+
4555
:::tip
4656

4757
Find some pre-set interactions with S3 on the [Hub](https://hub.windmill.dev/integrations/s3).

docs/integrations/aws.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ If you're looking for a way to self-host Windmill using AWS, see [Self-Host Wind
1818

1919
<br/><br/>
2020

21+
Your resource can be used [passed as parameters](../core_concepts/3_resources_and_types/index.mdx#passing-resources-as-parameters-to-scripts-preferred) or [directly fetched](../core_concepts/3_resources_and_types/index.mdx#fetching-them-from-within-a-script-by-using-the-wmill-client-in-the-respective-language) within [scripts](../script_editor/index.mdx), [flows](../flows/1_flow_editor.mdx) and [apps](../apps/0_app_editor/index.mdx).
22+
23+
<video
24+
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
25+
controls
26+
src="/videos/add_resources_variables.mp4"
27+
/>
28+
29+
<br/>
30+
2131
:::tip
2232

2333
Find some pre-set interactions with AWS on the [Hub](https://hub.windmill.dev/integrations/aws_ecr).

docs/integrations/clickhouse.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ To integrate [ClickHouse](https://clickhouse.com/) to Windmill, you need to save
1212

1313
<br/><br/>
1414

15+
Your resource can be used [passed as parameters](../core_concepts/3_resources_and_types/index.mdx#passing-resources-as-parameters-to-scripts-preferred) or [directly fetched](../core_concepts/3_resources_and_types/index.mdx#fetching-them-from-within-a-script-by-using-the-wmill-client-in-the-respective-language) within [scripts](../script_editor/index.mdx), [flows](../flows/1_flow_editor.mdx) and [apps](../apps/0_app_editor/index.mdx).
16+
17+
<video
18+
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
19+
controls
20+
src="/videos/add_resources_variables.mp4"
21+
/>
22+
23+
<br/>
24+
1525
:::tip
1626

1727
Find some pre-set interactions with ClickHouse on the [Hub](https://hub.windmill.dev/integrations/clickhouse).

0 commit comments

Comments
 (0)