1
0
Fork 0
mirror of synced 2024-09-30 17:18:14 +13:00

fix no schema bug, feedback from demo

This commit is contained in:
Martin McKeaveney 2021-01-15 17:29:46 +00:00
parent 9576f11abc
commit e3bae26510
9 changed files with 19 additions and 3 deletions

View file

@ -39,7 +39,7 @@
let config
let tab = "JSON"
let parameters
let data
let data = []
$: datasource = $backendUiStore.datasources.find(
ds => ds._id === query.datasourceId
@ -91,13 +91,20 @@
data = json || []
if (data.length === 0) {
notifier.info("Query results empty. Please execute a query with results to create your schema.")
return
}
notifier.success("Query executed successfully.")
// Assume all the fields are strings and create a basic schema
// from the first record returned by the query
fields = Object.keys(json[0]).map(field => ({
name: field,
type: "STRING",
}))
notifier.success("Query executed successfully.")
} catch (err) {
notifier.danger(`Query Error: ${err.message}`)
console.error(err)
@ -163,7 +170,7 @@
<Spacer medium />
<div class="viewer-controls">
<Button wide thin blue disabled={!data} on:click={saveQuery}>
<Button wide thin blue disabled={data.length === 0} on:click={saveQuery}>
Save
</Button>
<Button wide thin primary on:click={previewQuery}>Run</Button>

View file

@ -2,6 +2,7 @@ const Airtable = require("airtable")
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
const SCHEMA = {
docs: "https://airtable.com/api",
datasource: {
apiKey: {
type: FIELD_TYPES.STRING,

View file

@ -2,6 +2,7 @@ const PouchDB = require("pouchdb")
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
const SCHEMA = {
docs: "https://docs.couchdb.org/en/stable/",
datasource: {
url: {
type: FIELD_TYPES.STRING,

View file

@ -2,6 +2,7 @@ const AWS = require("aws-sdk")
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
const SCHEMA = {
docs: "https://github.com/dabit3/dynamodb-documentclient-cheat-sheet",
datasource: {
region: {
type: FIELD_TYPES.STRING,

View file

@ -2,6 +2,8 @@ const { Client } = require("@elastic/elasticsearch")
const { QUERY_TYPES, FIELD_TYPES } = require("./Integration")
const SCHEMA = {
docs:
"https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
datasource: {
url: {
type: "string",

View file

@ -2,6 +2,7 @@ const sqlServer = require("mssql")
const { FIELD_TYPES } = require("./Integration")
const SCHEMA = {
docs: "https://github.com/tediousjs/node-mssql",
datasource: {
user: {
type: FIELD_TYPES.STRING,

View file

@ -2,6 +2,7 @@ const { MongoClient } = require("mongodb")
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
const SCHEMA = {
docs: "https://github.com/mongodb/node-mongodb-native",
datasource: {
connectionString: {
type: FIELD_TYPES.STRING,

View file

@ -1,6 +1,7 @@
const { Client } = require("pg")
const SCHEMA = {
docs: "https://node-postgres.com",
datasource: {
host: {
type: "string",

View file

@ -1,6 +1,7 @@
const AWS = require("aws-sdk")
const SCHEMA = {
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
datasource: {
region: {
type: "string",