|
3040 | 3040 | ] |
3041 | 3041 | }, |
3042 | 3042 | "FilterInput": { |
| 3043 | + "description": "A drop-down filter on a dashboard. Depending on type, filters can either broadcast\nselected value(s) to every tile (isBroadcastEnabled), expose selected\nvalues as a variable (isVariableEnabled) or both. Typically a filter should\ndo just one of these things.\n", |
| 3044 | + "oneOf": [ |
| 3045 | + { |
| 3046 | + "$ref": "#/components/schemas/QueryExpressionFilterInput" |
| 3047 | + }, |
| 3048 | + { |
| 3049 | + "$ref": "#/components/schemas/StaticListFilterInput" |
| 3050 | + } |
| 3051 | + ], |
| 3052 | + "discriminator": { |
| 3053 | + "propertyName": "type", |
| 3054 | + "mapping": { |
| 3055 | + "QUERY_EXPRESSION": "#/components/schemas/QueryExpressionFilterInput", |
| 3056 | + "STATIC_LIST": "#/components/schemas/StaticListFilterInput" |
| 3057 | + } |
| 3058 | + } |
| 3059 | + }, |
| 3060 | + "QueryExpressionFilterInput": { |
3043 | 3061 | "type": "object", |
3044 | | - "description": "A drop-down filter on a dashboard. Every filter can either broadcast its\nselected value(s) to every tile (isBroadcastEnabled), expose its selected\nvalue as a variable (isVariableEnabled) or both. Typically a filter should\ndo just one of these things.\n", |
| 3062 | + "description": "A filter whose dropdown values are queried from ClickHouse: \"expression\"\nnames the column and \"sourceId\" the source to read them from. Its\nselection can be broadcast into matching tiles' WHERE clauses.\n", |
3045 | 3063 | "required": [ |
3046 | 3064 | "type", |
3047 | 3065 | "name", |
|
3054 | 3072 | "enum": [ |
3055 | 3073 | "QUERY_EXPRESSION" |
3056 | 3074 | ], |
3057 | | - "description": "Filter type. Must be \"QUERY_EXPRESSION\".", |
| 3075 | + "description": "Filter type discriminator. Must be \"QUERY_EXPRESSION\".", |
3058 | 3076 | "example": "QUERY_EXPRESSION" |
3059 | 3077 | }, |
3060 | 3078 | "name": { |
|
3132 | 3150 | } |
3133 | 3151 | } |
3134 | 3152 | }, |
| 3153 | + "StaticListFilterInput": { |
| 3154 | + "type": "object", |
| 3155 | + "description": "A filter whose dropdown offers a static custom \"options\" list. It carries no\nexpression, so it cannot be broadcast, and supports only variable mode.\n", |
| 3156 | + "required": [ |
| 3157 | + "type", |
| 3158 | + "name", |
| 3159 | + "options" |
| 3160 | + ], |
| 3161 | + "properties": { |
| 3162 | + "type": { |
| 3163 | + "type": "string", |
| 3164 | + "enum": [ |
| 3165 | + "STATIC_LIST" |
| 3166 | + ], |
| 3167 | + "description": "Discriminator. Must be \"STATIC_LIST\".", |
| 3168 | + "example": "STATIC_LIST" |
| 3169 | + }, |
| 3170 | + "name": { |
| 3171 | + "type": "string", |
| 3172 | + "minLength": 1, |
| 3173 | + "description": "Display name for the dashboard filter key", |
| 3174 | + "example": "Environment" |
| 3175 | + }, |
| 3176 | + "options": { |
| 3177 | + "type": "array", |
| 3178 | + "minItems": 1, |
| 3179 | + "maxItems": 1000, |
| 3180 | + "items": { |
| 3181 | + "type": "string", |
| 3182 | + "minLength": 1, |
| 3183 | + "maxLength": 10000 |
| 3184 | + }, |
| 3185 | + "description": "The values this filter's dropdown offers. Must be non-empty and\nfree of duplicates.\n", |
| 3186 | + "example": [ |
| 3187 | + "prod", |
| 3188 | + "staging", |
| 3189 | + "dev" |
| 3190 | + ] |
| 3191 | + }, |
| 3192 | + "isBroadcastEnabled": { |
| 3193 | + "type": "boolean", |
| 3194 | + "enum": [ |
| 3195 | + false |
| 3196 | + ], |
| 3197 | + "default": false, |
| 3198 | + "description": "Must be false — there is no expression to broadcast. Omit it and it\nis false.\n", |
| 3199 | + "example": false |
| 3200 | + }, |
| 3201 | + "isVariableEnabled": { |
| 3202 | + "type": "boolean", |
| 3203 | + "enum": [ |
| 3204 | + true |
| 3205 | + ], |
| 3206 | + "default": true, |
| 3207 | + "description": "Must be true if provided, and is true when omitted. Tiles reference\nthe selection as `$variableName`, or with the `$__filter(<expression>, $<variableName>)`\nand `$__conditionalAll(<condition>, $<variableName>)` macros. The\none-argument `$__filter($<variableName>)` form renders the filter's\nown expression, which this kind of filter does not have, so it\nreports that the expression must be passed explicitly.\n", |
| 3208 | + "example": true |
| 3209 | + }, |
| 3210 | + "variableName": { |
| 3211 | + "type": "string", |
| 3212 | + "maxLength": 64, |
| 3213 | + "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$", |
| 3214 | + "description": "Token tiles reference this filter's selected value by, as\n`$variableName`. Must start with a letter and may contain only\nletters, numbers, and underscores. Defaults to the display name with\nwhitespace replaced by underscores and remaining illegal characters\nremoved, so a variable-enabled filter whose name derives nothing\nusable must send this field explicitly. Variable names must be unique\nacross a dashboard's variable-enabled filters. Names the variable\nonly, so the field is rejected when isVariableEnabled is not true, and\nis omitted from responses for such a filter.\n", |
| 3215 | + "example": "environment" |
| 3216 | + } |
| 3217 | + } |
| 3218 | + }, |
3135 | 3219 | "Filter": { |
3136 | 3220 | "allOf": [ |
3137 | 3221 | { |
|
6147 | 6231 | "name": "Service", |
6148 | 6232 | "expression": "service_name", |
6149 | 6233 | "sourceId": "65f5e4a3b9e77c001a111111" |
| 6234 | + }, |
| 6235 | + { |
| 6236 | + "type": "STATIC_LIST", |
| 6237 | + "name": "Environment", |
| 6238 | + "options": [ |
| 6239 | + "prod", |
| 6240 | + "staging", |
| 6241 | + "dev" |
| 6242 | + ], |
| 6243 | + "isBroadcastEnabled": false, |
| 6244 | + "isVariableEnabled": true, |
| 6245 | + "variableName": "env" |
6150 | 6246 | } |
6151 | 6247 | ] |
6152 | 6248 | } |
|
0 commit comments