simplify queries to only have one type under query verb

This commit is contained in:
Martin McKeaveney 2021-01-22 12:22:28 +00:00
parent 46a04bbf9d
commit 476d20d656
15 changed files with 110 additions and 170 deletions

View File

@ -63,7 +63,7 @@
$: config = $backendUiStore.integrations[datasourceType]?.query
$: docsLink = $backendUiStore.integrations[datasourceType]?.docs
$: shouldShowQueryConfig = config && query.queryVerb && query.queryType
$: shouldShowQueryConfig = config && query.queryVerb
function newField() {
fields = [...fields, {}]
@ -140,12 +140,9 @@
<option value={queryVerb}>{queryVerb}</option>
{/each}
</Select>
<Select thin secondary bind:value={query.queryType}>
<option value={""}>Please select an option</option>
{#each Object.keys(config[query.queryVerb]) as queryType}
<option value={queryType}>{queryType}</option>
{/each}
</Select>
<div>
{config[query.queryVerb].type}
</div>
<EditQueryParamsPopover bind:parameters={query.parameters} bindable={false} />
<Spacer medium />
<Button primary href={docsLink} target="_blank">
@ -166,7 +163,7 @@
<IntegrationQueryEditor
{query}
schema={config[query.queryVerb][query.queryType]}
schema={config[query.queryVerb]}
bind:parameters />
<Spacer medium />

View File

@ -76,9 +76,7 @@
const source = $backendUiStore.datasources.find(
ds => ds._id === query.datasourceId
).source
return $backendUiStore.integrations[source].query[query.queryVerb][
query.queryType
]
return $backendUiStore.integrations[source].query[query.queryVerb]
}
</script>

View File

@ -25,7 +25,6 @@
parameters: [],
fields: {},
queryVerb: "read",
queryType: "",
}
</script>

View File

@ -51,7 +51,6 @@
<div class="query-list-item" on:click={() => onClickQuery(query)}>
<p class="query-name">{query.name}</p>
<p>{query.queryVerb}</p>
<p>{query.queryType}</p>
<p>4000 records</p>
<p></p>
</div>

View File

@ -31,7 +31,6 @@ function generateQueryValidation() {
default: Joi.string()
})),
queryVerb: Joi.string().allow(...Object.values(QueryVerb)).required(),
queryType: Joi.string().required(),
schema: Joi.object({}).required().unknown(true)
}))
}

View File

@ -26,7 +26,6 @@ const TEST_QUERY = {
fields:{},
schema:{},
queryVerb:"read",
queryType:"Table",
}
describe("/datasources", () => {

View File

@ -26,7 +26,6 @@ const TEST_QUERY = {
fields:{},
schema:{},
queryVerb:"read",
queryType:"Table",
}
describe("/queries", () => {

View File

@ -17,7 +17,6 @@ const SCHEMA = {
},
query: {
create: {
"Airtable Record": {
type: QUERY_TYPES.FIELDS,
customisable: true,
fields: {
@ -27,9 +26,7 @@ const SCHEMA = {
},
},
},
},
read: {
Table: {
type: QUERY_TYPES.FIELDS,
fields: {
table: {
@ -42,9 +39,7 @@ const SCHEMA = {
},
},
},
},
update: {
Fields: {
type: QUERY_TYPES.FIELDS,
customisable: true,
fields: {
@ -54,13 +49,10 @@ const SCHEMA = {
},
},
},
},
delete: {
"Airtable Ids": {
type: FIELD_TYPES.JSON,
},
},
},
}
class AirtableIntegration {

View File

@ -16,22 +16,15 @@ const SCHEMA = {
},
query: {
create: {
"CouchDB DSL": {
type: QUERY_TYPES.JSON,
},
},
read: {
"CouchDB DSL": {
type: QUERY_TYPES.JSON,
},
},
update: {
"CouchDB Document": {
type: QUERY_TYPES.JSON,
},
},
delete: {
"Document ID": {
type: QUERY_TYPES.FIELDS,
fields: {
id: {
@ -41,7 +34,6 @@ const SCHEMA = {
},
},
},
},
}
class CouchDBIntegration {

View File

@ -20,7 +20,6 @@ const SCHEMA = {
},
query: {
create: {
DynamoConfig: {
type: QUERY_TYPES.FIELDS,
fields: {
table: {
@ -30,9 +29,7 @@ const SCHEMA = {
customisable: true,
},
},
},
read: {
DynamoConfig: {
type: QUERY_TYPES.FIELDS,
fields: {
table: {
@ -45,9 +42,7 @@ const SCHEMA = {
customisable: true,
},
},
},
update: {
DynamoConfig: {
type: QUERY_TYPES.FIELDS,
fields: {
table: {
@ -57,9 +52,7 @@ const SCHEMA = {
customisable: true,
},
},
},
delete: {
"Dynamo Partition Key": {
type: QUERY_TYPES.FIELDS,
fields: {
table: {
@ -73,7 +66,6 @@ const SCHEMA = {
},
},
},
},
}
class DynamoDBIntegration {

View File

@ -13,7 +13,6 @@ const SCHEMA = {
},
query: {
create: {
"ES Query DSL": {
type: QUERY_TYPES.FIELDS,
customisable: true,
fields: {
@ -23,9 +22,7 @@ const SCHEMA = {
},
},
},
},
read: {
"ES Query DSL": {
type: QUERY_TYPES.FIELDS,
customisable: true,
fields: {
@ -35,9 +32,7 @@ const SCHEMA = {
},
},
},
},
update: {
"ES Query DSL": {
type: QUERY_TYPES.FIELDS,
customisable: true,
fields: {
@ -51,9 +46,7 @@ const SCHEMA = {
},
},
},
},
delete: {
"Document ID": {
type: QUERY_TYPES.FIELDS,
fields: {
index: {
@ -67,7 +60,6 @@ const SCHEMA = {
},
},
},
},
}
class ElasticSearchIntegration {

View File

@ -24,16 +24,12 @@ const SCHEMA = {
},
query: {
create: {
SQL: {
type: "sql",
},
},
read: {
SQL: {
type: "sql",
},
},
},
}
class SqlServerIntegration {

View File

@ -20,16 +20,12 @@ const SCHEMA = {
},
query: {
create: {
JSON: {
type: QUERY_TYPES.JSON,
},
},
read: {
JSON: {
type: QUERY_TYPES.JSON,
},
},
},
}
class MongoIntegration {

View File

@ -31,26 +31,18 @@ const SCHEMA = {
},
query: {
create: {
SQL: {
type: "sql",
},
},
read: {
SQL: {
type: "sql",
},
},
update: {
SQL: {
type: "sql",
},
},
delete: {
SQL: {
type: "sql",
},
},
},
}
class PostgresIntegration {

View File

@ -19,7 +19,6 @@ const SCHEMA = {
},
query: {
read: {
Bucket: {
type: "fields",
fields: {
bucket: {
@ -29,7 +28,6 @@ const SCHEMA = {
},
},
},
},
}
class S3Integration {