Simplify integration features

This commit is contained in:
Adria Navarro 2023-05-24 10:50:51 +02:00
parent 0c97f61cc8
commit 237cda064c
19 changed files with 61 additions and 43 deletions

View File

@ -8,6 +8,7 @@
saveDatasource as save,
validateDatasourceConfig,
} from "builderStore/datasource"
import { DatasourceFeature } from "@budibase/types"
export let integration
export let modal
@ -36,10 +37,8 @@
return connected
}
$: shouldValidate = integration.features?.find(f => f === "connection")
async function saveDatasource() {
if (shouldValidate) {
if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) {
const valid = await validateConfig()
if (!valid) {
return false
@ -64,11 +63,7 @@
title={`Connect to ${name}`}
onConfirm={() => saveDatasource()}
onCancel={() => modal.show()}
confirmText={datasource.plus
? shouldValidate
? "Connect"
: "Save and continue"
: "Save and continue to query"}
confirmText={datasource.plus ? "Connect" : "Save and continue to query"}
cancelText="Back"
showSecondaryButton={datasource.plus}
size="L"

View File

@ -21,6 +21,7 @@
import { cloneDeep } from "lodash/fp"
import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte"
import { API } from "api"
import { DatasourceFeature } from "@budibase/types"
const querySchema = {
name: {},
@ -64,9 +65,11 @@
}
const saveDatasource = async () => {
const valid = await validateConfig()
if (!valid) {
return false
if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) {
const valid = await validateConfig()
if (!valid) {
return false
}
}
try {
// Create datasource

View File

@ -1,7 +1,7 @@
import { writable } from "svelte/store"
import { API } from "api"
import { licensing } from "./licensing"
import { ConfigType } from "../../../../types/src/documents"
import { ConfigType } from "@budibase/types"
export const createFeatureStore = () => {
const internalStore = writable({

View File

@ -20,7 +20,9 @@ const SCHEMA: Integration = {
"Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
friendlyName: "Airtable",
type: "Spreadsheet",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
apiKey: {
type: DatasourceFieldType.PASSWORD,

View File

@ -23,7 +23,9 @@ const SCHEMA: Integration = {
type: "Non-relational",
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. ",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
url: {
type: DatasourceFieldType.STRING,

View File

@ -20,7 +20,9 @@ const SCHEMA: Integration = {
type: "Non-relational",
description:
"Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
url: {
type: DatasourceFieldType.STRING,

View File

@ -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.",
friendlyName: "DynamoDB",
type: "Non-relational",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
region: {
type: DatasourceFieldType.STRING,

View File

@ -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.",
friendlyName: "ElasticSearch",
type: "Non-relational",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
url: {
type: DatasourceFieldType.STRING,

View File

@ -20,7 +20,9 @@ const SCHEMA: Integration = {
type: "Non-relational",
description:
"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: {
email: {
type: DatasourceFieldType.STRING,

View File

@ -66,10 +66,10 @@ const SCHEMA: Integration = {
"Create and collaborate on online spreadsheets in real-time and from any device.",
friendlyName: "Google Sheets",
type: "Spreadsheet",
features: [
DatasourceFeature.CONNECTION_CHECKING,
DatasourceFeature.FETCH_TABLE_NAMES,
],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
},
datasource: {
spreadsheetId: {
display: "Google Sheet URL",

View File

@ -40,10 +40,10 @@ const SCHEMA: Integration = {
"Microsoft SQL Server is a relational database management system developed by Microsoft. ",
friendlyName: "MS SQL Server",
type: "Relational",
features: [
DatasourceFeature.CONNECTION_CHECKING,
DatasourceFeature.FETCH_TABLE_NAMES,
],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
},
datasource: {
user: {
type: DatasourceFieldType.STRING,

View File

@ -40,7 +40,9 @@ const getSchema = () => {
type: "Non-relational",
description:
"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: {
connectionString: {
type: DatasourceFieldType.STRING,

View File

@ -36,10 +36,10 @@ const SCHEMA: Integration = {
type: "Relational",
description:
"MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
features: [
DatasourceFeature.CONNECTION_CHECKING,
DatasourceFeature.FETCH_TABLE_NAMES,
],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
},
datasource: {
host: {
type: DatasourceFieldType.STRING,

View File

@ -50,10 +50,10 @@ const SCHEMA: Integration = {
type: "Relational",
description:
"Oracle Database is an object-relational database management system developed by Oracle Corporation",
features: [
DatasourceFeature.CONNECTION_CHECKING,
DatasourceFeature.FETCH_TABLE_NAMES,
],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
},
datasource: {
host: {
type: DatasourceFieldType.STRING,

View File

@ -52,10 +52,10 @@ const SCHEMA: Integration = {
type: "Relational",
description:
"PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
features: [
DatasourceFeature.CONNECTION_CHECKING,
DatasourceFeature.FETCH_TABLE_NAMES,
],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
[DatasourceFeature.FETCH_TABLE_NAMES]: true,
},
datasource: {
host: {
type: DatasourceFieldType.STRING,

View File

@ -21,7 +21,9 @@ const SCHEMA: Integration = {
"Redis is a caching tool, providing powerful key-value store capabilities.",
friendlyName: "Redis",
type: "Non-relational",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
host: {
type: "string",

View File

@ -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.",
friendlyName: "Amazon S3",
type: "Object store",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
region: {
type: "string",

View File

@ -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.",
friendlyName: "Snowflake",
type: "Relational",
features: [DatasourceFeature.CONNECTION_CHECKING],
features: {
[DatasourceFeature.CONNECTION_CHECKING]: true,
},
datasource: {
account: {
type: "string",

View File

@ -116,7 +116,7 @@ export interface Integration {
docs: string
plus?: boolean
auth?: { type: string }
features?: DatasourceFeature[]
features?: Partial<Record<DatasourceFeature, boolean>>
relationships?: boolean
description: string
friendlyName: string