-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Toolpad docs part 1 #859
Merged
Merged
Changes from all commits
Commits
Show all changes
128 commits
Select commit
Hold shift + click to select a range
93edd16
Add intro and quickstart docs
bytasv e11ebb6
Trying the change
siriwatknp fa17eac
Fix docs paths
bytasv e2e1164
Add query and connection docs
bytasv 82c43e9
Add fetch docs, describe postgres connection
bytasv 06125fa
Merge branch 'master' into toolpad-documentation
bytasv 7fe7093
Add data binding documentation
bytasv dda114b
Update docs/data/toolpad/connecting-to-data-sources/fetch.md
bytasv a025c12
Update docs/data/toolpad/data-binding.md
bytasv 839b85d
Update docs/data/toolpad/getting-started/introduction.md
bytasv 885af15
Minor text fixes
prakhargupta1 8149043
More minor fixes
prakhargupta1 b9c595f
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 8be5391
Merge branch 'master' into toolpad-documentation
bytasv 07061d2
Add 2x data binding image
bytasv 4bc3ac7
Add a link to documentation from docs
bytasv c9f5243
Merge branch 'master' into toolpad-documentation
bytasv e2c7eee
Add function query documentation
bytasv e8a3f88
Merge branch 'master' into toolpad-documentation
bytasv 119adad
Add google sheets connection setup
bytasv 77317d5
Add google sheets query documentation
bytasv a7324e8
Remove rest documentation
bytasv 5cbff47
Fix hero screenshot path
bytasv d4650e7
Add postgres query documentation
bytasv 9e5af85
Merge branch 'master' into toolpad-documentation
bytasv c26f154
Merge branch 'master' into toolpad-documentation
bytasv 9d50238
Update docs/README.md
bytasv 485fb2f
rename intro -> overview and fix content
bytasv b778598
Use datasource instead of type
bytasv 5396b02
Add postgres params docs
bytasv abf3e4b
Fix description punctation
bytasv 127fec3
Cleanup tutorial docs
bytasv f1a8f12
Fix datasources path
bytasv 2db048f
Add missing dots
bytasv 1e9a3aa
Fix use case
bytasv 8bd44ee
Add error handling and pre-processing examples for function datasource
bytasv b49dc62
Update deployment instructions
bytasv 3c1d220
Rename postgres to postgreSQL
bytasv e824a7f
Update terminology
bytasv 1127c70
Move terminology to overview
bytasv 2e404a0
Merge branch 'master' into toolpad-documentation
bytasv 8a90980
Replace code -> bold
bytasv 730b190
Merge branch 'master' into toolpad-documentation
bytasv 8fa01fe
Update docs after SAVE action
bytasv b635af5
Update docs/data/toolpad/connecting-to-datasources/postgreSQL.md
bytasv 0b5308b
Update docs/data/toolpad/connecting-to-datasources/postgreSQL.md
bytasv b0b76b3
Update docs/data/toolpad/connecting-to-datasources/postgreSQL.md
bytasv 945091c
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv e408e64
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv dcf0e4c
Update docs/README.md
bytasv 0998097
Update docs/README.md
bytasv 84e1269
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv b0e3eb4
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv 698e87a
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv d61ceff
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv d5a988b
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv 3bcdb0c
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv cf73a8e
Clean connections doc
bytasv d0949da
Remove we from connections
bytasv 3f866f0
Clean up overview
bytasv f1a2ec2
Cleanup quickstart
bytasv 2842b95
restore apps overview screenshot
bytasv bcd2761
Cleanup queries
bytasv b799c6d
Cleanup fetch
bytasv fb10be0
Cleanup function
bytasv adc4ee1
Cleanup google sheets
bytasv a94d00c
Cleanup postgresql
bytasv 29763b4
Cleanup data binding
bytasv 6e003c9
Fix md lint error
bytasv 9251b05
Update docs/data/toolpad/getting-started/overview.md
bytasv 12f3e7a
Update docs/data/toolpad/getting-started/overview.md
bytasv 093262d
Update docs/data/toolpad/getting-started/overview.md
bytasv c34be07
Update docs/data/toolpad/getting-started/overview.md
bytasv 4a255d2
Update docs/data/toolpad/getting-started/overview.md
bytasv b1ddd40
Update docs/data/toolpad/getting-started/overview.md
bytasv 21bc42d
Update docs/data/toolpad/getting-started/overview.md
bytasv 22152a9
Update docs/data/toolpad/getting-started/overview.md
bytasv 582bdc7
Update docs/data/toolpad/getting-started/overview.md
bytasv 20215ad
Merge branch 'master' into toolpad-documentation
bytasv fa2f327
Fix markdown lint
bytasv 908f39e
Fix overview images
bytasv 45964db
Fix queries images
bytasv 0ff649c
Fix connections images
bytasv 12bf5dc
Fix fetch images
bytasv d9c5875
Fix function images
bytasv efd45d2
Fix google sheets images
bytasv 1f91153
Fix postgres images
bytasv 58bd598
Fix databinding images
bytasv ee3af2b
Fix overview images
bytasv ed6be09
Merge branch 'master' into toolpad-documentation
bytasv 4095fb0
fix 404 link
oliviertassinari 799a3bd
add redirections for moved pages
oliviertassinari 9826092
remove duplications
oliviertassinari d2b6d07
consistent format
oliviertassinari e118af0
enforce sidenav === h1
oliviertassinari 8ca3736
images, use 1:1 display scale assuming the x2 resolution scale is cor…
oliviertassinari abe16ed
fix 404
oliviertassinari c000a38
Update docs/data/pages.ts
bytasv 7b60f7f
Update postgres urls
bytasv 8d3a211
Fix docs images paths
bytasv f029330
Merge branch 'master' into toolpad-documentation
bytasv 0be71aa
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 3b50780
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 6bf8f1b
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 0696dd1
Update docs/data/toolpad/getting-started/quickstart.md
bytasv c421eb1
Update docs/data/toolpad/getting-started/quickstart.md
bytasv f4d0a40
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 07cb121
Update docs/data/toolpad/getting-started/quickstart.md
bytasv a55beff
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 11c548b
Update docs/data/toolpad/getting-started/quickstart.md
bytasv f085113
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 1d685f4
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 8db5b30
Merge branch 'master' into toolpad-documentation
bytasv fa4c4a6
Update docs/data/toolpad/getting-started/overview.md
bytasv 78dbade
Update docs/data/toolpad/getting-started/quickstart.md
bytasv 5184b69
Update docs/data/toolpad/getting-started/overview.md
bytasv 522a623
Update docs/data/toolpad/getting-started/overview.md
bytasv 6bbc4c8
Remove versioning entry
bytasv 3fd051b
Fix markdown lint
bytasv 3916548
Update docs/data/toolpad/connecting-to-datasources/queries.md
bytasv ebe9953
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv c919a26
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv 7ce4dac
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv 4ceb100
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv b1e8e4f
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv e2e3a8f
Tweak postgres and google sheets instructions
bytasv e0746df
Update docs/data/toolpad/connecting-to-datasources/connections.md
bytasv 2019991
Merge branch 'master' into toolpad-documentation
bytasv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
docs/data/toolpad/connecting-to-datasources/connections.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,86 @@ | ||||||||||||||
# Connections | ||||||||||||||
|
||||||||||||||
<p class="description">A connection instance lets you reuse certain configuration details to create queries faster.</p> | ||||||||||||||
|
||||||||||||||
To create a new connection instance, press the **+** button in the Explorer menu on the left side of the interface: | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection.png" alt="Add connection" width="196px" /> | ||||||||||||||
|
||||||||||||||
## Connection types | ||||||||||||||
|
||||||||||||||
There are 2 kinds of data sources that do not require a connection instance: | ||||||||||||||
|
||||||||||||||
### Function | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection-function-1.png" alt="Connection function" width="730px" /> | ||||||||||||||
|
||||||||||||||
You can define secrets (key/value) that can later be accessed in the function datasource query: | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection-function-2.png" alt="Connection function" width="748px" /> | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
### Fetch | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection-fetch-1.png" alt="Connection fetch" width="723px" /> | ||||||||||||||
|
||||||||||||||
You can configure: | ||||||||||||||
|
||||||||||||||
- **base url** - url that can be shared between different queries. | ||||||||||||||
- **Headers** - pass custom headers with each request. | ||||||||||||||
- **Authentication** type - if your API is protected choose the authentication method that fits your needs: | ||||||||||||||
- **Basic** - adds authorization header and generates base64 encoded value for a given user credentials. | ||||||||||||||
- **Bearer token** - adds authorization header generates value for provided token. | ||||||||||||||
- **API key** - adds key/value header. | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
There are 2 datasources that require a connection instance: | ||||||||||||||
|
||||||||||||||
### Google Sheets | ||||||||||||||
|
||||||||||||||
**Obtain credentials** | ||||||||||||||
|
||||||||||||||
Before you create a Google Sheets connection you must first configure Toolpad app by providing Google Sheets **client ID** and **client secret**: | ||||||||||||||
|
||||||||||||||
1. Create a new Google Cloud project - [instructions](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project). | ||||||||||||||
|
||||||||||||||
2. Generate Oauth 2.0 credentials - [instructions](https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred). | ||||||||||||||
|
||||||||||||||
3. Start Toolpad with following environment variables: | ||||||||||||||
|
||||||||||||||
```sh | ||||||||||||||
TOOLPAD_EXTERNAL_URL=<YOUR_APP_URL> | ||||||||||||||
TOOLPAD_DATASOURCE_GOOGLESHEETS_CLIENT_ID= | ||||||||||||||
TOOLPAD_DATASOURCE_GOOGLESHEETS_CLIENT_SECRET= | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
where YOUR_APP_URL is the URL Toolpad is hosted on. | ||||||||||||||
|
||||||||||||||
4. Add the following URIs under Authorized Redirect URIs: | ||||||||||||||
```sh | ||||||||||||||
https://<YOUR_APP_URL>/api/dataSources/googleSheets/auth/callback</YOUR_APP_URL> | ||||||||||||||
``` | ||||||||||||||
5. Enable the Google Sheets and Google Drive APIs for the project - [instructions](https://developers.google.com/identity/protocols/oauth2/web-server#enable-apis). | ||||||||||||||
|
||||||||||||||
**Connect your google account** | ||||||||||||||
|
||||||||||||||
1. Once you create Google Sheets type connection click **CONNECT** button: | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection-sheets-1.png" alt="Connection Google Sheets" width="724px" /> | ||||||||||||||
|
||||||||||||||
1. Choose the Google account that you want to authorize. | ||||||||||||||
|
||||||||||||||
1. Grant access to your Google Drive files by clicking **Allow**. | ||||||||||||||
|
||||||||||||||
1. Once you successfully connect your account you should see a button stating the account that was connected. | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection-sheets-2.png" alt="Google Sheets connected" width="721px" /> | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
### PostgreSQL | ||||||||||||||
|
||||||||||||||
To query data from a PostgreSQL database, you must configure the connection: | ||||||||||||||
|
||||||||||||||
<img src="/static/toolpad/docs/connection-postgres-1.png" alt="Connection postgres" width="726px" /> | ||||||||||||||
|
||||||||||||||
Provide the database credentials and click **TEST CONNECTION** to verify that you're able to connect. | ||||||||||||||
|
||||||||||||||
If everything is correct, click **SAVE** to complete the connection. | ||||||||||||||
|
||||||||||||||
Learn more in the [PostgreSQL documentation](/toolpad/connecting-to-datasources/postgre-sql/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Fetch datasource | ||
|
||
<p class="description">Fetch datasource is the easiest and fastest way to load external data within Toolpad app.</p> | ||
|
||
## Working with fetch | ||
|
||
As explained in the [connections](/toolpad/connecting-to-datasources/connections/) section you can either create a reusable connection or simply create a new query and put all connection details inline: | ||
|
||
1. Choose **ADD QUERY** in the **Inspector** on the right. | ||
|
||
1. Select fetch datasource and click **CREATE QUERY**: | ||
|
||
<img src="/static/toolpad/docs/fetch-query-1.png" alt="Fetch datasource" width="478px" /> | ||
|
||
1. You can modify all the basic configuration settings as described in [queries](/toolpad/connecting-to-datasources/queries/) section. | ||
|
||
1. In addition you can configuration following properties inline: | ||
|
||
<img src="/static/toolpad/docs/fetch-query-2.png" alt="Fetch configuration" width="886px" /> | ||
<br /> | ||
|
||
- **HTTP method** - by default GET is used, but we also support POST, PUT, DELETE, PATCH and HEAD methods. | ||
- **url** - is an endpoint to which requests will be made. We also have an option to dynamically generate url by using [data binding](/toolpad/data-binding/). **Parameters** can be accessed by using **query** object inside url data binding editor. | ||
- **parameters** - allows us to use [data bound](/toolpad/data-binding/) properties which can then be used construct dynamic **url** value. | ||
|
||
<img src="/static/toolpad/docs/fetch-query-3.png" alt="Dynamic url" width="702px" /> | ||
|
||
1. Knowing that data comes in a different shapes we provide an easy way to **transform response**: | ||
|
||
- Simply enable option by checking **Transform response**. | ||
- Then modify which properties of data object should be returned as a final response. | ||
|
||
<img src="/static/toolpad/docs/fetch-query-4.png" alt="Transform response" width="431px" /> | ||
|
||
1. Once finished with configuration click **SAVE** to commit your changes and return to the canvas. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Function datasource | ||
|
||
<p class="description">Function datasource is an advanced way to make request from Toolpad app.</p> | ||
|
||
## Working with functions | ||
|
||
As explained in the [connections](/toolpad/connecting-to-datasources/connections/) section you can either create a reusable connection or simply create a new query and put all connection details inline: | ||
|
||
1. Choose **ADD QUERY** in the **Inspector** on the right. | ||
|
||
1. Select function datasource and click **CREATE QUERY**: | ||
|
||
<img src="/static/toolpad/docs/function-query-1.png" alt="Function datasource" width="476px" /> | ||
|
||
1. You can modify all the basic configuration settings as described in [queries](/toolpad/connecting-to-datasources/queries/) section. | ||
|
||
1. In addition you are now presented with a **code editor** where you can write a custom code for data fetching: | ||
|
||
<img src="/static/toolpad/docs/function-query-2.png" alt="Function configuration" width="888px" /> | ||
|
||
Supported features: | ||
|
||
- Subset of webplatform APIs: | ||
|
||
- fetch (Request, Response) | ||
- AbortController | ||
- console (.log, .debug, .info, .warn, .error) | ||
- setTimeout, clearTimeout | ||
- TextEncoder, TextDecoder | ||
- ReadableStream | ||
|
||
- Access outside variables by binding parameters fields. | ||
- Console and Network tabs for an easier debugging. | ||
|
||
Current limitations: | ||
|
||
- You can not import modules. | ||
|
||
1. Once finished with configuration click **SAVE** to commit your changes and return to the canvas. | ||
|
||
## Use cases | ||
|
||
While [function](/toolpad/connecting-to-datasources/function/) datasource can suffice for many different setups we found some advances use cases where limitations of function datasource starts surfacing and prevents us from building more complex data access queries. | ||
|
||
1. **Pre-processing** request: | ||
|
||
You can execute extra steps before doing an actual request in case you need to do some pre-processing. I.e. sending parameters as a BASE64 encoded data: | ||
|
||
<img src="/static/toolpad/docs/function-query-3.png" alt="Function pre-processing" width="790px" style="margin-bottom: 16px;" /> | ||
|
||
1. **Fetching** data from **multiple data sources** and **combining** the result: | ||
|
||
<img src="/static/toolpad/docs/function-query-4.png" alt="Function combined result" width="814px" /> | ||
|
||
1. **Chaining** multiple request: | ||
|
||
In this example you might want to fetch name of the top contributor of **mui/materual-ui** repository, in order to do that you first need to fetch a list of contributors for a given repo. Once you have a response and link to a top contributor you can do a follow up request to fetch details about specific user: | ||
|
||
<img src="/static/toolpad/docs/function-query-5.png" alt="Function chained" width="944px" /> | ||
|
||
1. **Custom error handling**: | ||
|
||
You can handle different error scenarios. I.e. if 404 error is returned you can still pass empty array so that UI does not break: | ||
|
||
<img src="/static/toolpad/docs/function-query-6.png" alt="Function error handling" width="706px" /> |
29 changes: 29 additions & 0 deletions
29
docs/data/toolpad/connecting-to-datasources/google-sheets.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Google Sheets datasource | ||
|
||
<p class="description">Google Sheets datasource allows fetching data from Google Sheets living in your Google Drive.</p> | ||
|
||
## Working with Google Sheets | ||
|
||
1. Create a new Google Sheets connection as explained in the [instructions](/toolpad/connecting-to-datasources/connections/#google-sheets). | ||
|
||
1. Once your connection is ready click on **ADD QUERY** in the **Inspector** on the right. | ||
|
||
1. Select Google Sheets datasource and click **CREATE QUERY**: | ||
|
||
<img src="/static/toolpad/docs/google-sheets-query-1.png" alt="Google Sheets type" width="595px" style="margin-bottom: 16px;" /> | ||
|
||
1. You can modify all the basic configuration settings as described in [queries](/toolpad/connecting-to-datasources/queries/) section. | ||
|
||
1. In addition you can configure following properties inline: | ||
|
||
<img src="/static/toolpad/docs/google-sheets-query-2.png" alt="Google Sheets configuration" width="1108px" /> | ||
|
||
- **Select spreadsheet** - browse for a spreadsheet that you own or that is shared with you. | ||
|
||
- **Select sheet** - choose a spreadsheet's sheet from which you want to pull the data. | ||
|
||
- **Range** - select a range of cells from which the data should be pulled. | ||
|
||
- **First row contains column headers** - enable this setting if you would like to use names defined in a header row as the name for object keys in a response. | ||
|
||
1. Once finished with configuration click **SAVE** to commit your changes and return to the canvas. |
31 changes: 31 additions & 0 deletions
31
docs/data/toolpad/connecting-to-datasources/postgre-sql.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# PostgreSQL datasource | ||
|
||
<p class="description">PostgreSQL datasource allows fetching data straight from PostgreSQL database.</p> | ||
|
||
## Working with PostgreSQL | ||
|
||
1. Create a new PostgreSQL connection as explained in the [instructions](/toolpad/connecting-to-datasources/connections/#postgresql). | ||
|
||
1. Once your connection is ready click on **ADD QUERY** in the **Inspector** on the right. | ||
|
||
1. Select PostgreSQL datasource and click **CREATE QUERY**: | ||
|
||
<img src="/static/toolpad/docs/postgres-query-1.png" alt="Postgres type" width="593px" style="margin-bottom: 16px;" /> | ||
|
||
1. You can modify all the basic configuration settings as described in [queries](/toolpad/connecting-to-datasources/queries/) section. | ||
|
||
1. In addition you can configure following properties inline: | ||
|
||
<img src="/static/toolpad/docs/postgres-query-2.png" alt="Postgres configuration" width="1120px" /> | ||
|
||
- On the left is a SQL query editor. | ||
|
||
- On the right is a table for previewing results. | ||
|
||
- Below the query editor you can configure parameters which can be used to bind page state to your SQL query. Toolpad uses [prepared statements](https://www.postgresql.org/docs/current/sql-prepare.html) under the hood to prevent SQL injection. You can use the positional parameter syntax (`$1`, `$2`, `$3`) of postgres prepared statements. Additionally it will also accept named parameters of the form `$myParameter`. | ||
|
||
<img src="/static/toolpad/docs/postgres-query-3.png" alt="Parameters configuration" width="553px" /> | ||
|
||
Like so: `SELECT * FROM "db" WHERE name = $name`. | ||
|
||
1. Once finished with configuration click **SAVE** to commit your changes and return to the canvas. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Queries | ||
|
||
<p class="description">Toolpad allows you to easily connect to external datasources and render dynamic data. The easiest way to do so is to create a new query which can be used to fetch data.</p> | ||
|
||
1. Locate **ADD QUERY** button in the **Inspector** on the right: | ||
|
||
<img src="/static/toolpad/docs/query-1.png" alt="Query" width="239px" /> | ||
|
||
2. There are currently 4 different datasources\* that can be used to fetch data: | ||
|
||
<img src="/static/toolpad/docs/query-2.png" alt="Datasources" width="476px" /> | ||
|
||
- [Function](/toolpad/connecting-to-datasources/function/) - advanced fetching methods which gives a lot of freedom by allowing to write custom fetching code. | ||
- [Fetch](/toolpad/connecting-to-datasources/fetch/) - basic, but very powerful. Just pass URL of an API endpoint and you are ready to query your data. | ||
- [Google Sheets](/toolpad/connecting-to-datasources/google-sheets/) - allows accessing data from your Google sheet document. | ||
- [PostgreSQL](/toolpad/connecting-to-datasources/postgre-sql/) - ability to hook directly into your own DB without the need to use API. | ||
|
||
\* - by default you will see only **Function** and **Fetch** datasources, for **Google Sheets** and **PostgreSQL** you will first need to create a [CONNECTION instance](/toolpad/connecting-to-datasources/connections/). | ||
|
||
3. After choosing the **QUERY** datasource and clicking **CREATE QUERY** you will be presented with a query configuration dialog (configuration settings for each individual type are documented on their respective pages). | ||
|
||
There are a few configuration options that are applicable to every query type: | ||
|
||
<img src="/static/toolpad/docs/query-3.png" alt="Query configuration" width="726px" /> | ||
|
||
- **Refetch on window focus** - execute the query every time the window is focused to make sure you always have the latest data visible. | ||
- **Refetch on network reconnect** - execute the query every time the network status changes. | ||
- **Refetch interval** - you can configure the query to run on an interval, e.g. **every 30s**. To disable this option, keep the field empty. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.