input
Allow user input in a dashboard using common form components such as text, select, multiselect, combo and multicombo. Data can either be static or derived from a SQL query.
Dashboard components can depend on the value of an input within the dashboard by referring to self e.g. self.input.<input_name>.value. This allows you to pass the value of an input as an argument to a query (or any other dashboard element) to create dynamic dashboards!
Input blocks can be declared as named resources at the top level of a mod, or be declared as named blocks inside a dashboard or container, or be re-used inside a dashboard or container by using an input with base = <mod>.input.<input_resource_name>.
Example Usage
Argument Reference
Argument | Type | Optional? | Description |
---|---|---|---|
args | Map | Optional | A map of arguments to pass to the query. |
base | String | Optional | A reference to a named input resource that this input should source its definition from. title, sql, type, options and width can be overridden after sourcing via base. |
database | String | Optional | A database connection reference, connection string, or Pipes workspace to query. If not specified, the default database will be used. |
option | Block | Optional | option block to add static values to the input |
placeholder | String | Optional | Placeholder text to display. If a placeholder is set for a combo, multicombo, select or multiselect, then dependent resources will not run until a selection is made. If no placeholder is set, the first item in the list will be selected by default. |
param | Block | Optional | A param block that defines the parameters that can be passed in to the query. param blocks may only be specified for inputs that specify the sql argument. |
query | Query Reference | Optional | A reference to a query resource that defines the query to run. An input may either specify the query argument or the sql argument, but not both. |
--search-path | String | Optional | Set a comma-separated list of connections to use as a custom search path for the query |
--search-path-prefix | String | Optional | Set a comma-separated list of connections to use as a prefix to the current search path for the query. |
sql | String | Optional | An SQL string to provide data for the input. An input may either specify the query argument or the sql argument, but not both. |
title | String | Optional | A plain text title to display for this input. |
type | String | Optional | The type of the input. Can be text, combo, multicombo, select or multiselect. |
width | Number | Optional | The width as a number of grid units that this item should consume from its parent. |
Input Types
Type | Description |
---|---|
text | Enter a single line of text |
select | Select a single item from a dropdown list |
multiselect | Select one or more items from a dropdown list |
combo | Select a single item from a dropdown list, or enter a new value |
multicombo | Select one or more items from a dropdown list, or enter new values |
Common Input Properties
option
Add static options to a select or multiselect input. The block name is the value. If a label is not specified, the value will be used as the label.
Property | Type | Default | Description |
---|---|---|---|
label | String | If not specified, the value will be used as the label | The display label for this option |
Data Structure
The data structure for an input will depend on the type.
select / multiselect / combo / multicombo
label | value | tags |
---|---|---|
default | vpc-05657e5bef9676266 | null |
acme @ 10.84.0.0/16 | vpc-03656e5eef967f366 | { "account_id": "123456789012" } |
tags is an optional JSONB object of key/value pairs. Any tag values will be displayed in the list of available options, along with the selected option(s). This will allow you to identify resources across multi-account queries for example. When a user types to search in the input, the labels and tags will be searched.