do not make query execution a requirement

This commit is contained in:
Martin McKeaveney 2021-06-08 14:26:06 +01:00
parent 536c2c317c
commit ba17e0bc9c
2 changed files with 5 additions and 3 deletions

View File

@ -33,7 +33,7 @@
{ label: "Datetime", value: "DATETIME" },
]
$: datasource = $datasources.list.find(ds => ds._id === query.datasourceId)
$: datasource = $datasources.list.find(ds => ds._id === query.datasourceId)
$: query.schema = fields.reduce(
(acc, next) => ({
...acc,
@ -48,6 +48,8 @@
$: integrationInfo = $integrations[datasourceType]
$: queryConfig = integrationInfo?.query
$: shouldShowQueryConfig = queryConfig && query.queryVerb
$: readQuery = query.queryVerb === "read" || query.readable
$: queryInvalid = !query.name || (readQuery && data.length === 0)
function newField() {
fields = [...fields, {}]
@ -152,7 +154,7 @@
<ButtonGroup>
<Button
cta
disabled={data.length === 0 || !query.name}
disabled={queryInvalid}
on:click={saveQuery}
>
Save Query

View File

@ -60,7 +60,7 @@ exports.save = async function (ctx) {
ctx.message = `Query ${query.name} saved successfully.`
}
async function enrichQueryFields(fields, parameters) {
async function enrichQueryFields(fields, parameters = {}) {
const enrichedQuery = {}
// enrich the fields with dynamic parameters