tidy up
This commit is contained in:
parent
648d45a373
commit
c40e88eb32
|
@ -11,22 +11,22 @@
|
|||
let loading = false
|
||||
let error = false
|
||||
|
||||
async function fetchData() {
|
||||
try {
|
||||
loading = true
|
||||
const response = await api.fetchDataForQuery(
|
||||
$params.selectedDatasource,
|
||||
query._id
|
||||
)
|
||||
data = response.rows || []
|
||||
error = false
|
||||
} catch (err) {
|
||||
error = `${query}: Query error. (${err.message}). This could be a problem with your datasource configuration.`
|
||||
notifier.danger(error)
|
||||
} finally {
|
||||
loading = false
|
||||
}
|
||||
}
|
||||
// async function fetchData() {
|
||||
// try {
|
||||
// loading = true
|
||||
// const response = await api.fetchDataForQuery(
|
||||
// $params.selectedDatasource,
|
||||
// query._id
|
||||
// )
|
||||
// data = response.rows || []
|
||||
// error = false
|
||||
// } catch (err) {
|
||||
// error = `${query}: Query error. (${err.message}). This could be a problem with your datasource configuration.`
|
||||
// notifier.danger(error)
|
||||
// } finally {
|
||||
// loading = false
|
||||
// }
|
||||
// }
|
||||
|
||||
// Fetch rows for specified query
|
||||
// $: query && fetchData()
|
||||
|
|
|
@ -30,15 +30,3 @@ export async function fetchDataForView(view) {
|
|||
}
|
||||
return json
|
||||
}
|
||||
|
||||
export async function fetchDataForQuery(datasourceId, queryId) {
|
||||
const FETCH_QUERY_URL = `/api/queries/${queryId}`
|
||||
|
||||
const response = await api.get(FETCH_QUERY_URL)
|
||||
const json = await response.json()
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error(json.message)
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
$: datasource = $backendUiStore.datasources.find(
|
||||
ds => ds._id === parameters.datasourceId
|
||||
)
|
||||
// TODO: binding needs a significant refactor and needs to
|
||||
// be centralised
|
||||
// TODO: binding needs to be centralised
|
||||
$: bindableProperties = fetchBindableProperties({
|
||||
componentInstanceId: $store.selectedComponentId,
|
||||
components: $store.components,
|
||||
|
@ -51,7 +50,6 @@
|
|||
|
||||
<Spacer medium />
|
||||
|
||||
<!-- TODO: Need to render defaults, but allow interpolation of frontend values -->
|
||||
{#if query}
|
||||
<ParameterBuilder
|
||||
bind:customParams={parameters.queryParams}
|
||||
|
|
|
@ -17,7 +17,7 @@ const SCHEMA = {
|
|||
query: {
|
||||
create: {
|
||||
"Airtable Record": {
|
||||
type: "fields",
|
||||
type: QUERY_TYPES.FIELDS,
|
||||
customisable: true,
|
||||
fields: {
|
||||
table: {
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
const PouchDB = require("pouchdb")
|
||||
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
||||
|
||||
const SCHEMA = {
|
||||
datasource: {
|
||||
url: {
|
||||
type: "string",
|
||||
type: FIELD_TYPES.STRING,
|
||||
required: true,
|
||||
default: "localhost",
|
||||
},
|
||||
database: {
|
||||
type: "string",
|
||||
type: FIELD_TYPES.STRING,
|
||||
required: true,
|
||||
},
|
||||
view: {
|
||||
type: "string",
|
||||
type: FIELD_TYPES.STRING,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
query: {
|
||||
json: {
|
||||
type: "json",
|
||||
type: QUERY_TYPES.JSON,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
const { MongoClient } = require("mongodb")
|
||||
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
||||
|
||||
const SCHEMA = {
|
||||
datasource: {
|
||||
connectionString: {
|
||||
type: "string",
|
||||
type: FIELD_TYPES.STRING,
|
||||
required: true,
|
||||
default: "localhost",
|
||||
},
|
||||
db: {
|
||||
type: "string",
|
||||
type: FIELD_TYPES.STRING,
|
||||
required: true,
|
||||
},
|
||||
collection: {
|
||||
type: "string",
|
||||
type: FIELD_TYPES.STRING,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
query: {
|
||||
create: {
|
||||
JSON: {
|
||||
type: "json",
|
||||
type: QUERY_TYPES.JSON,
|
||||
},
|
||||
},
|
||||
read: {
|
||||
JSON: {
|
||||
type: "json",
|
||||
type: QUERY_TYPES.JSON,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue