fix no schema bug, feedback from demo
This commit is contained in:
parent
21ff46f18e
commit
7ed062bf1e
|
@ -39,7 +39,7 @@
|
||||||
let config
|
let config
|
||||||
let tab = "JSON"
|
let tab = "JSON"
|
||||||
let parameters
|
let parameters
|
||||||
let data
|
let data = []
|
||||||
|
|
||||||
$: datasource = $backendUiStore.datasources.find(
|
$: datasource = $backendUiStore.datasources.find(
|
||||||
ds => ds._id === query.datasourceId
|
ds => ds._id === query.datasourceId
|
||||||
|
@ -91,13 +91,20 @@
|
||||||
|
|
||||||
data = json || []
|
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
|
// Assume all the fields are strings and create a basic schema
|
||||||
// from the first record returned by the query
|
// from the first record returned by the query
|
||||||
fields = Object.keys(json[0]).map(field => ({
|
fields = Object.keys(json[0]).map(field => ({
|
||||||
name: field,
|
name: field,
|
||||||
type: "STRING",
|
type: "STRING",
|
||||||
}))
|
}))
|
||||||
notifier.success("Query executed successfully.")
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifier.danger(`Query Error: ${err.message}`)
|
notifier.danger(`Query Error: ${err.message}`)
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
@ -163,7 +170,7 @@
|
||||||
<Spacer medium />
|
<Spacer medium />
|
||||||
|
|
||||||
<div class="viewer-controls">
|
<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
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button wide thin primary on:click={previewQuery}>Run</Button>
|
<Button wide thin primary on:click={previewQuery}>Run</Button>
|
||||||
|
|
|
@ -2,6 +2,7 @@ const Airtable = require("airtable")
|
||||||
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://airtable.com/api",
|
||||||
datasource: {
|
datasource: {
|
||||||
apiKey: {
|
apiKey: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
|
|
|
@ -2,6 +2,7 @@ const PouchDB = require("pouchdb")
|
||||||
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://docs.couchdb.org/en/stable/",
|
||||||
datasource: {
|
datasource: {
|
||||||
url: {
|
url: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
|
|
|
@ -2,6 +2,7 @@ const AWS = require("aws-sdk")
|
||||||
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://github.com/dabit3/dynamodb-documentclient-cheat-sheet",
|
||||||
datasource: {
|
datasource: {
|
||||||
region: {
|
region: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
|
|
|
@ -2,6 +2,8 @@ const { Client } = require("@elastic/elasticsearch")
|
||||||
const { QUERY_TYPES, FIELD_TYPES } = require("./Integration")
|
const { QUERY_TYPES, FIELD_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs:
|
||||||
|
"https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
|
||||||
datasource: {
|
datasource: {
|
||||||
url: {
|
url: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|
|
@ -2,6 +2,7 @@ const sqlServer = require("mssql")
|
||||||
const { FIELD_TYPES } = require("./Integration")
|
const { FIELD_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://github.com/tediousjs/node-mssql",
|
||||||
datasource: {
|
datasource: {
|
||||||
user: {
|
user: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
|
|
|
@ -2,6 +2,7 @@ const { MongoClient } = require("mongodb")
|
||||||
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
const { FIELD_TYPES, QUERY_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://github.com/mongodb/node-mongodb-native",
|
||||||
datasource: {
|
datasource: {
|
||||||
connectionString: {
|
connectionString: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { Client } = require("pg")
|
const { Client } = require("pg")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://node-postgres.com",
|
||||||
datasource: {
|
datasource: {
|
||||||
host: {
|
host: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const AWS = require("aws-sdk")
|
const AWS = require("aws-sdk")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
|
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
|
||||||
datasource: {
|
datasource: {
|
||||||
region: {
|
region: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|
Loading…
Reference in New Issue