Simplify integration features
This commit is contained in:
parent
0c97f61cc8
commit
237cda064c
|
@ -8,6 +8,7 @@
|
||||||
saveDatasource as save,
|
saveDatasource as save,
|
||||||
validateDatasourceConfig,
|
validateDatasourceConfig,
|
||||||
} from "builderStore/datasource"
|
} from "builderStore/datasource"
|
||||||
|
import { DatasourceFeature } from "@budibase/types"
|
||||||
|
|
||||||
export let integration
|
export let integration
|
||||||
export let modal
|
export let modal
|
||||||
|
@ -36,10 +37,8 @@
|
||||||
return connected
|
return connected
|
||||||
}
|
}
|
||||||
|
|
||||||
$: shouldValidate = integration.features?.find(f => f === "connection")
|
|
||||||
|
|
||||||
async function saveDatasource() {
|
async function saveDatasource() {
|
||||||
if (shouldValidate) {
|
if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) {
|
||||||
const valid = await validateConfig()
|
const valid = await validateConfig()
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false
|
return false
|
||||||
|
@ -64,11 +63,7 @@
|
||||||
title={`Connect to ${name}`}
|
title={`Connect to ${name}`}
|
||||||
onConfirm={() => saveDatasource()}
|
onConfirm={() => saveDatasource()}
|
||||||
onCancel={() => modal.show()}
|
onCancel={() => modal.show()}
|
||||||
confirmText={datasource.plus
|
confirmText={datasource.plus ? "Connect" : "Save and continue to query"}
|
||||||
? shouldValidate
|
|
||||||
? "Connect"
|
|
||||||
: "Save and continue"
|
|
||||||
: "Save and continue to query"}
|
|
||||||
cancelText="Back"
|
cancelText="Back"
|
||||||
showSecondaryButton={datasource.plus}
|
showSecondaryButton={datasource.plus}
|
||||||
size="L"
|
size="L"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte"
|
import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
|
import { DatasourceFeature } from "@budibase/types"
|
||||||
|
|
||||||
const querySchema = {
|
const querySchema = {
|
||||||
name: {},
|
name: {},
|
||||||
|
@ -64,9 +65,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveDatasource = async () => {
|
const saveDatasource = async () => {
|
||||||
const valid = await validateConfig()
|
if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) {
|
||||||
if (!valid) {
|
const valid = await validateConfig()
|
||||||
return false
|
if (!valid) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Create datasource
|
// Create datasource
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { licensing } from "./licensing"
|
import { licensing } from "./licensing"
|
||||||
import { ConfigType } from "../../../../types/src/documents"
|
import { ConfigType } from "@budibase/types"
|
||||||
|
|
||||||
export const createFeatureStore = () => {
|
export const createFeatureStore = () => {
|
||||||
const internalStore = writable({
|
const internalStore = writable({
|
||||||
|
|
|
@ -20,7 +20,9 @@ const SCHEMA: Integration = {
|
||||||
"Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
|
"Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
|
||||||
friendlyName: "Airtable",
|
friendlyName: "Airtable",
|
||||||
type: "Spreadsheet",
|
type: "Spreadsheet",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
apiKey: {
|
apiKey: {
|
||||||
type: DatasourceFieldType.PASSWORD,
|
type: DatasourceFieldType.PASSWORD,
|
||||||
|
|
|
@ -23,7 +23,9 @@ const SCHEMA: Integration = {
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
description:
|
description:
|
||||||
"ArangoDB is a scalable open-source multi-model database natively supporting graph, document and search. All supported data models & access patterns can be combined in queries allowing for maximal flexibility. ",
|
"ArangoDB is a scalable open-source multi-model database natively supporting graph, document and search. All supported data models & access patterns can be combined in queries allowing for maximal flexibility. ",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
url: {
|
url: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -20,7 +20,9 @@ const SCHEMA: Integration = {
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
description:
|
description:
|
||||||
"Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
"Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
url: {
|
url: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -25,7 +25,9 @@ const SCHEMA: Integration = {
|
||||||
"Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale.",
|
"Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale.",
|
||||||
friendlyName: "DynamoDB",
|
friendlyName: "DynamoDB",
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
region: {
|
region: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -22,7 +22,9 @@ const SCHEMA: Integration = {
|
||||||
"Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
|
"Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
|
||||||
friendlyName: "ElasticSearch",
|
friendlyName: "ElasticSearch",
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
url: {
|
url: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -20,7 +20,9 @@ const SCHEMA: Integration = {
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
description:
|
description:
|
||||||
"Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
"Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
email: {
|
email: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -66,10 +66,10 @@ const SCHEMA: Integration = {
|
||||||
"Create and collaborate on online spreadsheets in real-time and from any device.",
|
"Create and collaborate on online spreadsheets in real-time and from any device.",
|
||||||
friendlyName: "Google Sheets",
|
friendlyName: "Google Sheets",
|
||||||
type: "Spreadsheet",
|
type: "Spreadsheet",
|
||||||
features: [
|
features: {
|
||||||
DatasourceFeature.CONNECTION_CHECKING,
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
DatasourceFeature.FETCH_TABLE_NAMES,
|
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
|
||||||
],
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
spreadsheetId: {
|
spreadsheetId: {
|
||||||
display: "Google Sheet URL",
|
display: "Google Sheet URL",
|
||||||
|
|
|
@ -40,10 +40,10 @@ const SCHEMA: Integration = {
|
||||||
"Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
"Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
||||||
friendlyName: "MS SQL Server",
|
friendlyName: "MS SQL Server",
|
||||||
type: "Relational",
|
type: "Relational",
|
||||||
features: [
|
features: {
|
||||||
DatasourceFeature.CONNECTION_CHECKING,
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
DatasourceFeature.FETCH_TABLE_NAMES,
|
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
|
||||||
],
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
user: {
|
user: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -40,7 +40,9 @@ const getSchema = () => {
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
description:
|
description:
|
||||||
"MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
"MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
connectionString: {
|
connectionString: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -36,10 +36,10 @@ const SCHEMA: Integration = {
|
||||||
type: "Relational",
|
type: "Relational",
|
||||||
description:
|
description:
|
||||||
"MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
|
"MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
|
||||||
features: [
|
features: {
|
||||||
DatasourceFeature.CONNECTION_CHECKING,
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
DatasourceFeature.FETCH_TABLE_NAMES,
|
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
|
||||||
],
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
host: {
|
host: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -50,10 +50,10 @@ const SCHEMA: Integration = {
|
||||||
type: "Relational",
|
type: "Relational",
|
||||||
description:
|
description:
|
||||||
"Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
"Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
||||||
features: [
|
features: {
|
||||||
DatasourceFeature.CONNECTION_CHECKING,
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
DatasourceFeature.FETCH_TABLE_NAMES,
|
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
|
||||||
],
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
host: {
|
host: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -52,10 +52,10 @@ const SCHEMA: Integration = {
|
||||||
type: "Relational",
|
type: "Relational",
|
||||||
description:
|
description:
|
||||||
"PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
"PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
||||||
features: [
|
features: {
|
||||||
DatasourceFeature.CONNECTION_CHECKING,
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
DatasourceFeature.FETCH_TABLE_NAMES,
|
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
|
||||||
],
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
host: {
|
host: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
|
|
@ -21,7 +21,9 @@ const SCHEMA: Integration = {
|
||||||
"Redis is a caching tool, providing powerful key-value store capabilities.",
|
"Redis is a caching tool, providing powerful key-value store capabilities.",
|
||||||
friendlyName: "Redis",
|
friendlyName: "Redis",
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
host: {
|
host: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|
|
@ -24,7 +24,9 @@ const SCHEMA: Integration = {
|
||||||
"Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
"Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
||||||
friendlyName: "Amazon S3",
|
friendlyName: "Amazon S3",
|
||||||
type: "Object store",
|
type: "Object store",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
region: {
|
region: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|
|
@ -22,7 +22,9 @@ const SCHEMA: Integration = {
|
||||||
"Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
|
"Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
|
||||||
friendlyName: "Snowflake",
|
friendlyName: "Snowflake",
|
||||||
type: "Relational",
|
type: "Relational",
|
||||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
features: {
|
||||||
|
[DatasourceFeature.CONNECTION_CHECKING]: true,
|
||||||
|
},
|
||||||
datasource: {
|
datasource: {
|
||||||
account: {
|
account: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|
|
@ -116,7 +116,7 @@ export interface Integration {
|
||||||
docs: string
|
docs: string
|
||||||
plus?: boolean
|
plus?: boolean
|
||||||
auth?: { type: string }
|
auth?: { type: string }
|
||||||
features?: DatasourceFeature[]
|
features?: Partial<Record<DatasourceFeature, boolean>>
|
||||||
relationships?: boolean
|
relationships?: boolean
|
||||||
description: string
|
description: string
|
||||||
friendlyName: string
|
friendlyName: string
|
||||||
|
|
Loading…
Reference in New Issue