fix no schema bug, feedback from demo
This commit is contained in:
parent
21ff46f18e
commit
7ed062bf1e
|
@ -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>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const { Client } = require("pg")
|
||||
|
||||
const SCHEMA = {
|
||||
docs: "https://node-postgres.com",
|
||||
datasource: {
|
||||
host: {
|
||||
type: "string",
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue