do not make query execution a requirement

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

View File

@ -48,6 +48,8 @@
$: integrationInfo = $integrations[datasourceType] $: integrationInfo = $integrations[datasourceType]
$: queryConfig = integrationInfo?.query $: queryConfig = integrationInfo?.query
$: shouldShowQueryConfig = queryConfig && query.queryVerb $: shouldShowQueryConfig = queryConfig && query.queryVerb
$: readQuery = query.queryVerb === "read" || query.readable
$: queryInvalid = !query.name || (readQuery && data.length === 0)
function newField() { function newField() {
fields = [...fields, {}] fields = [...fields, {}]
@ -152,7 +154,7 @@
<ButtonGroup> <ButtonGroup>
<Button <Button
cta cta
disabled={data.length === 0 || !query.name} disabled={queryInvalid}
on:click={saveQuery} on:click={saveQuery}
> >
Save Query Save Query

View File

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