Merge pull request #7770 from Budibase/fix/datasource-rename

Data source -> datasource throughout code - plus friendly plugin name displayed
This commit is contained in:
Michael Drury 2022-09-14 18:47:54 +02:00 committed by GitHub
commit f18a865d53
27 changed files with 68 additions and 58 deletions

View File

@ -65,7 +65,7 @@ Budibase is open-source - licensed as GPL v3. This should fill you with confiden
<br /><br /> <br /><br />
### Load data or start from scratch ### Load data or start from scratch
Budibase pulls in data from multiple sources, including MongoDB, CouchDB, PostgreSQL, MySQL, Airtable, S3, DynamoDB, or a REST API. And unlike other platforms, with Budibase you can start from scratch and create business apps with no data sources. [Request new data sources](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas). Budibase pulls in data from multiple sources, including MongoDB, CouchDB, PostgreSQL, MySQL, Airtable, S3, DynamoDB, or a REST API. And unlike other platforms, with Budibase you can start from scratch and create business apps with no datasources. [Request new datasources](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
<p align="center"> <p align="center">
<img alt="Budibase data" src="https://res.cloudinary.com/daog6scxm/image/upload/v1636970242/Out%20of%20beta%20launch/data_n1tlhf.png"> <img alt="Budibase data" src="https://res.cloudinary.com/daog6scxm/image/upload/v1636970242/Out%20of%20beta%20launch/data_n1tlhf.png">

View File

@ -348,7 +348,7 @@ export interface paths {
} }
} }
responses: { responses: {
/** Returns the created table, including the ID which has been generated for it. This can be internal or external data sources. */ /** Returns the created table, including the ID which has been generated for it. This can be internal or external datasources. */
200: { 200: {
content: { content: {
"application/json": components["schemas"]["tableOutput"] "application/json": components["schemas"]["tableOutput"]
@ -959,7 +959,7 @@ export interface components {
query: { query: {
/** @description The ID of the query. */ /** @description The ID of the query. */
_id: string _id: string
/** @description The ID of the data source the query belongs to. */ /** @description The ID of the datasource the query belongs to. */
datasourceId?: string datasourceId?: string
/** @description The bindings which are required to perform this query. */ /** @description The bindings which are required to perform this query. */
parameters?: string[] parameters?: string[]
@ -983,7 +983,7 @@ export interface components {
data: { data: {
/** @description The ID of the query. */ /** @description The ID of the query. */
_id: string _id: string
/** @description The ID of the data source the query belongs to. */ /** @description The ID of the datasource the query belongs to. */
datasourceId?: string datasourceId?: string
/** @description The bindings which are required to perform this query. */ /** @description The bindings which are required to perform this query. */
parameters?: string[] parameters?: string[]

View File

@ -82,10 +82,10 @@ filterTests(['smoke', 'all'], () => {
}) })
if (Cypress.env("TEST_ENV")) { if (Cypress.env("TEST_ENV")) {
it("should generate data source screens", () => { it("should generate datasource screens", () => {
// Using MySQL data source for testing this // Using MySQL datasource for testing this
const datasource = "MySQL" const datasource = "MySQL"
// Select & configure MySQL data source // Select & configure MySQL datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
cy.addDatasourceConfig(datasource) cy.addDatasourceConfig(datasource)
// Create Autogenerated screens from a MySQL table - MySQL contains books table // Create Autogenerated screens from a MySQL table - MySQL contains books table

View File

@ -11,8 +11,8 @@ filterTests(["all"], () => {
const queryName = "Cypress Test Query" const queryName = "Cypress Test Query"
const queryRename = "CT Query Rename" const queryRename = "CT Query Rename"
it("Should add MySQL data source without configuration", () => { it("Should add MySQL datasource without configuration", () => {
// Select MySQL data source // Select MySQL datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
// Attempt to fetch tables without applying configuration // Attempt to fetch tables without applying configuration
cy.intercept("**/datasources").as("datasource") cy.intercept("**/datasources").as("datasource")
@ -35,8 +35,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true })
}) })
it("should add MySQL data source and fetch tables", () => { it("should add MySQL datasource and fetch tables", () => {
// Add & configure MySQL data source // Add & configure MySQL datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
cy.intercept("**/datasources").as("datasource") cy.intercept("**/datasources").as("datasource")
cy.addDatasourceConfig(datasource) cy.addDatasourceConfig(datasource)
@ -52,7 +52,7 @@ filterTests(["all"], () => {
}) })
it("should check table fetching error", () => { it("should check table fetching error", () => {
// MySQL test data source contains tables without primary keys // MySQL test datasource contains tables without primary keys
cy.get(".spectrum-InLineAlert") cy.get(".spectrum-InLineAlert")
.should("contain", "Error fetching tables") .should("contain", "Error fetching tables")
.and("contain", "No primary key constraint found") .and("contain", "No primary key constraint found")

View File

@ -11,8 +11,8 @@ filterTests(["all"], () => {
const queryName = "Cypress Test Query" const queryName = "Cypress Test Query"
const queryRename = "CT Query Rename" const queryRename = "CT Query Rename"
it("Should add Oracle data source and skip table fetch", () => { it("Should add Oracle datasource and skip table fetch", () => {
// Select Oracle data source // Select Oracle datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
// Skip table fetch - no config added // Skip table fetch - no config added
cy.get(".spectrum-Button") cy.get(".spectrum-Button")
@ -23,7 +23,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Textfield-input", { timeout: 500 }) cy.get(".spectrum-Textfield-input", { timeout: 500 })
.eq(1) .eq(1)
.should("have.value", "localhost") .should("have.value", "localhost")
// Add another Oracle data source, configure & skip table fetch // Add another Oracle datasource, configure & skip table fetch
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
cy.addDatasourceConfig(datasource, true) cy.addDatasourceConfig(datasource, true)
// Confirm config and no tables // Confirm config and no tables
@ -33,8 +33,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Body").eq(2).should("contain", "No tables found.") cy.get(".spectrum-Body").eq(2).should("contain", "No tables found.")
}) })
it("Should add Oracle data source and fetch tables without configuration", () => { it("Should add Oracle datasource and fetch tables without configuration", () => {
// Select Oracle data source // Select Oracle datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
// Attempt to fetch tables without applying configuration // Attempt to fetch tables without applying configuration
cy.intercept("**/datasources").as("datasource") cy.intercept("**/datasources").as("datasource")
@ -49,8 +49,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true })
}) })
xit("should add Oracle data source and fetch tables", () => { xit("should add Oracle datasource and fetch tables", () => {
// Add & configure Oracle data source // Add & configure Oracle datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
cy.intercept("**/datasources").as("datasource") cy.intercept("**/datasources").as("datasource")
cy.addDatasourceConfig(datasource) cy.addDatasourceConfig(datasource)

View File

@ -11,8 +11,8 @@ filterTests(["all"], () => {
const queryName = "Cypress Test Query" const queryName = "Cypress Test Query"
const queryRename = "CT Query Rename" const queryRename = "CT Query Rename"
xit("Should add PostgreSQL data source without configuration", () => { xit("Should add PostgreSQL datasource without configuration", () => {
// Select PostgreSQL data source // Select PostgreSQL datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
// Attempt to fetch tables without applying configuration // Attempt to fetch tables without applying configuration
cy.intercept("**/datasources").as("datasource") cy.intercept("**/datasources").as("datasource")
@ -27,8 +27,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true })
}) })
it("should add PostgreSQL data source and fetch tables", () => { it("should add PostgreSQL datasource and fetch tables", () => {
// Add & configure PostgreSQL data source // Add & configure PostgreSQL datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
cy.intercept("**/datasources").as("datasource") cy.intercept("**/datasources").as("datasource")
cy.addDatasourceConfig(datasource) cy.addDatasourceConfig(datasource)

View File

@ -10,8 +10,8 @@ filterTests(["smoke", "all"], () => {
const datasource = "REST" const datasource = "REST"
const restUrl = "https://api.openbrewerydb.org/breweries" const restUrl = "https://api.openbrewerydb.org/breweries"
it("Should add REST data source with incorrect API", () => { it("Should add REST datasource with incorrect API", () => {
// Select REST data source // Select REST datasource
cy.selectExternalDatasource(datasource) cy.selectExternalDatasource(datasource)
// Enter incorrect api & attempt to send query // Enter incorrect api & attempt to send query
cy.get(".query-buttons", { timeout: 1000 }).contains("Add query").click({ force: true }) cy.get(".query-buttons", { timeout: 1000 }).contains("Add query").click({ force: true })

View File

@ -763,7 +763,7 @@ Cypress.Commands.add("navigateToDataSection", () => {
}) })
Cypress.Commands.add("navigateToAutogeneratedModal", () => { Cypress.Commands.add("navigateToAutogeneratedModal", () => {
// Screen name must already exist within data source // Screen name must already exist within datasource
cy.contains("Design").click() cy.contains("Design").click()
cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) cy.get(".spectrum-Button").contains("Add screen").click({ force: true })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
@ -779,7 +779,7 @@ Cypress.Commands.add("navigateToAutogeneratedModal", () => {
Cypress.Commands.add("selectExternalDatasource", datasourceName => { Cypress.Commands.add("selectExternalDatasource", datasourceName => {
// Navigates to Data Section // Navigates to Data Section
cy.navigateToDataSection() cy.navigateToDataSection()
// Open Data Source modal // Open Datasource modal
cy.get(".nav").within(() => { cy.get(".nav").within(() => {
cy.get(".add-button").click() cy.get(".add-button").click()
}) })

View File

@ -27,7 +27,7 @@ export async function saveDatasource(config, skipFetch = false) {
// Create datasource // Create datasource
const resp = await datasources.save(datasource, !skipFetch && datasource.plus) const resp = await datasources.save(datasource, !skipFetch && datasource.plus)
// update the tables incase data source plus // update the tables incase datasource plus
await tables.fetch() await tables.fetch()
await datasources.select(resp._id) await datasources.select(resp._id)
return resp return resp

View File

@ -32,8 +32,8 @@
: [] : []
$: openDataSource = enrichedDataSources.find(x => x.open) $: openDataSource = enrichedDataSources.find(x => x.open)
$: { $: {
// Ensure the open data source is always included in the list of open // Ensure the open datasource is always included in the list of open
// data sources // datasources
if (openDataSource) { if (openDataSource) {
openNode(openDataSource) openNode(openDataSource)
} }
@ -79,7 +79,7 @@
}) })
const containsActiveEntity = datasource => { const containsActiveEntity = datasource => {
// If we're view a query then the data source ID is in the URL // If we're view a query then the datasource ID is in the URL
if ($params.selectedDatasource === datasource._id) { if ($params.selectedDatasource === datasource._id) {
return true return true
} }

View File

@ -126,7 +126,7 @@
<Modal bind:this={modal}> <Modal bind:this={modal}>
<ModalContent <ModalContent
disabled={!Object.keys(integration).length} disabled={!Object.keys(integration).length}
title="Add data source" title="Add datasource"
confirmText="Continue" confirmText="Continue"
showSecondaryButton={showImportButton} showSecondaryButton={showImportButton}
secondaryButtonText="Import" secondaryButtonText="Import"
@ -155,7 +155,7 @@
</Layout> </Layout>
<Layout noPadding gap="XS"> <Layout noPadding gap="XS">
<Body size="S">Connect to an external data source</Body> <Body size="S">Connect to an external datasource</Body>
<div class="item-list"> <div class="item-list">
{#each Object.entries(integrations).filter(([key, val]) => key !== IntegrationTypes.INTERNAL && !val.custom) as [integrationType, schema]} {#each Object.entries(integrations).filter(([key, val]) => key !== IntegrationTypes.INTERNAL && !val.custom) as [integrationType, schema]}
<DatasourceCard <DatasourceCard
@ -170,7 +170,7 @@
{#if customIntegrations.length > 0} {#if customIntegrations.length > 0}
<Layout noPadding gap="XS"> <Layout noPadding gap="XS">
<Body size="S">Custom data source</Body> <Body size="S">Custom datasource</Body>
<div class="item-list"> <div class="item-list">
{#each customIntegrations as [integrationType, schema]} {#each customIntegrations as [integrationType, schema]}
<DatasourceCard <DatasourceCard

View File

@ -73,13 +73,13 @@
<div class="root"> <div class="root">
<Body size="S"> <Body size="S">
Choose the data source that provides the row you would like to duplicate. Choose the datasource that provides the row you would like to duplicate.
<br /> <br />
You can always add or override fields manually. You can always add or override fields manually.
</Body> </Body>
<div class="params"> <div class="params">
<Label small>Data Source</Label> <Label small>Datasource</Label>
<Select <Select
bind:value={parameters.providerId} bind:value={parameters.providerId}
options={providerOptions} options={providerOptions}

View File

@ -71,13 +71,13 @@
<div class="root"> <div class="root">
<Body size="S"> <Body size="S">
Choosing a Data Source will automatically use the data it provides, but it's Choosing a Datasource will automatically use the data it provides, but it's
optional.<br /> optional.<br />
You can always add or override fields manually. You can always add or override fields manually.
</Body> </Body>
<div class="params"> <div class="params">
<Label small>Data Source</Label> <Label small>Datasource</Label>
<Select <Select
bind:value={parameters.providerId} bind:value={parameters.providerId}
options={providerOptions} options={providerOptions}

View File

@ -77,7 +77,7 @@
size="L" size="L"
> >
<Body size="S"> <Body size="S">
Select which data source you would like to use to create your screens Select which datasource you would like to use to create your screens
</Body> </Body>
<Layout noPadding gap="S"> <Layout noPadding gap="S">
{#each filteredSources as datasource} {#each filteredSources as datasource}

View File

@ -66,7 +66,7 @@
<Heading size="XS">Autogenerated screens</Heading> <Heading size="XS">Autogenerated screens</Heading>
<Body size="S"> <Body size="S">
Add autogenerated screens with CRUD functionality to get a working Add autogenerated screens with CRUD functionality to get a working
app quickly! (Requires a data source) app quickly! (Requires a datasource)
</Body> </Body>
</div> </div>
</div> </div>

View File

@ -20,6 +20,8 @@
? plugin.schema.schema.icon || "Book" ? plugin.schema.schema.icon || "Book"
: plugin.schema.schema.icon || "Beaker" : plugin.schema.schema.icon || "Beaker"
$: friendlyName = plugin?.schema?.schema?.friendlyName
function pluginDeleted() { function pluginDeleted() {
if (detailsModal) { if (detailsModal) {
detailsModal.hide() detailsModal.hide()
@ -41,6 +43,9 @@
> >
{plugin.name} {plugin.name}
</Body> </Body>
<Body size="XS" color="var(--spectrum-global-color-gray-900)">
{friendlyName}
</Body>
</div> </div>
</div> </div>
</div> </div>
@ -65,6 +70,11 @@
<Input disabled value={plugin.name} /> <Input disabled value={plugin.name} />
</div> </div>
<div class="details-row">
<Label size="M">Friendly name</Label>
<Input disabled value={friendlyName} />
</div>
<div class="details-row"> <div class="details-row">
<Label size="M">Type</Label> <Label size="M">Type</Label>
<Input <Input
@ -127,7 +137,7 @@
.details-row { .details-row {
display: grid; display: grid;
grid-template-columns: 60px 1fr; grid-template-columns: 70px 1fr;
grid-gap: var(--spacing-l) var(--spacing-l); grid-gap: var(--spacing-l) var(--spacing-l);
align-items: center; align-items: center;
} }

View File

@ -41,7 +41,7 @@
if (["user", "url"].includes(context.closestComponentId)) { if (["user", "url"].includes(context.closestComponentId)) {
return {} return {}
} }
// Always inherit the closest data source // Always inherit the closest datasource
const closestContext = context[`${context.closestComponentId}`] || {} const closestContext = context[`${context.closestComponentId}`] || {}
return closestContext || {} return closestContext || {}
} }

View File

@ -372,7 +372,7 @@
formState, formState,
formApi, formApi,
// Data source is needed by attachment fields to be able to upload files // Datasource is needed by attachment fields to be able to upload files
// to the correct table ID // to the correct table ID
dataSource, dataSource,
}) })

View File

@ -13,7 +13,7 @@ const schemaComponentMap = {
/** /**
* Determine data types for search fields and only use those that are valid * Determine data types for search fields and only use those that are valid
* @param searchColumns the search columns to use * @param searchColumns the search columns to use
* @param schema the data source schema * @param schema the datasource schema
*/ */
export const enrichSearchColumns = (searchColumns, schema) => { export const enrichSearchColumns = (searchColumns, schema) => {
let enrichedColumns = [] let enrichedColumns = []

View File

@ -1327,7 +1327,7 @@
"type": "string" "type": "string"
}, },
"datasourceId": { "datasourceId": {
"description": "The ID of the data source the query belongs to.", "description": "The ID of the datasource the query belongs to.",
"type": "string" "type": "string"
}, },
"parameters": { "parameters": {
@ -1386,7 +1386,7 @@
"type": "string" "type": "string"
}, },
"datasourceId": { "datasourceId": {
"description": "The ID of the data source the query belongs to.", "description": "The ID of the datasource the query belongs to.",
"type": "string" "type": "string"
}, },
"parameters": { "parameters": {
@ -2289,7 +2289,7 @@
}, },
"responses": { "responses": {
"200": { "200": {
"description": "Returns the created table, including the ID which has been generated for it. This can be internal or external data sources.", "description": "Returns the created table, including the ID which has been generated for it. This can be internal or external datasources.",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {

View File

@ -1004,7 +1004,7 @@ components:
description: The ID of the query. description: The ID of the query.
type: string type: string
datasourceId: datasourceId:
description: The ID of the data source the query belongs to. description: The ID of the datasource the query belongs to.
type: string type: string
parameters: parameters:
description: The bindings which are required to perform this query. description: The bindings which are required to perform this query.
@ -1051,7 +1051,7 @@ components:
description: The ID of the query. description: The ID of the query.
type: string type: string
datasourceId: datasourceId:
description: The ID of the data source the query belongs to. description: The ID of the datasource the query belongs to.
type: string type: string
parameters: parameters:
description: The bindings which are required to perform this query. description: The bindings which are required to perform this query.
@ -1665,7 +1665,7 @@ paths:
responses: responses:
"200": "200":
description: Returns the created table, including the ID which has been description: Returns the created table, including the ID which has been
generated for it. This can be internal or external data sources. generated for it. This can be internal or external datasources.
content: content:
application/json: application/json:
schema: schema:

View File

@ -82,7 +82,7 @@ const querySchema = object(
type: "string", type: "string",
}, },
datasourceId: { datasourceId: {
description: "The ID of the data source the query belongs to.", description: "The ID of the datasource the query belongs to.",
type: "string", type: "string",
}, },
parameters: { parameters: {

View File

@ -53,7 +53,7 @@ exports.save = async ctx => {
} }
exports.fetchView = async ctx => { exports.fetchView = async ctx => {
// there are no views in external data sources, shouldn't ever be called // there are no views in external datasources, shouldn't ever be called
// for now just fetch // for now just fetch
const split = ctx.params.viewName.split("all_") const split = ctx.params.viewName.split("all_")
ctx.params.tableId = split[1] ? split[1] : split[0] ctx.params.tableId = split[1] ? split[1] : split[0]

View File

@ -26,7 +26,7 @@ const read = [],
* responses: * responses:
* 200: * 200:
* description: Returns the created table, including the ID which has been generated for it. This can be * description: Returns the created table, including the ID which has been generated for it. This can be
* internal or external data sources. * internal or external datasources.
* content: * content:
* application/json: * application/json:
* schema: * schema:

View File

@ -55,7 +55,7 @@ router
* @apiParam (Body) {string} [_rev] If updating an existing internal table then the revision must also be specified. * @apiParam (Body) {string} [_rev] If updating an existing internal table then the revision must also be specified.
* @apiParam (Body) {string} type] This should either be "internal" or "external" depending on the table type - * @apiParam (Body) {string} type] This should either be "internal" or "external" depending on the table type -
* this will default to internal. * this will default to internal.
* @apiParam (Body) {string} [sourceId] If creating an external table then this should be set to the data source ID. If * @apiParam (Body) {string} [sourceId] If creating an external table then this should be set to the datasource ID. If
* building an internal table this does not need to be set, although it will be returned as "bb_internal". * building an internal table this does not need to be set, although it will be returned as "bb_internal".
* @apiParam (Body) {string} name The name of the table, this will be used in the UI. To rename the table simply * @apiParam (Body) {string} name The name of the table, this will be used in the UI. To rename the table simply
* supply the table structure to this endpoint with the name changed. * supply the table structure to this endpoint with the name changed.

View File

@ -344,7 +344,7 @@ export interface paths {
}; };
}; };
responses: { responses: {
/** Returns the created table, including the ID which has been generated for it. This can be internal or external data sources. */ /** Returns the created table, including the ID which has been generated for it. This can be internal or external datasources. */
200: { 200: {
content: { content: {
"application/json": components["schemas"]["tableOutput"]; "application/json": components["schemas"]["tableOutput"];
@ -965,7 +965,7 @@ export interface components {
query: { query: {
/** @description The ID of the query. */ /** @description The ID of the query. */
_id: string; _id: string;
/** @description The ID of the data source the query belongs to. */ /** @description The ID of the datasource the query belongs to. */
datasourceId?: string; datasourceId?: string;
/** @description The bindings which are required to perform this query. */ /** @description The bindings which are required to perform this query. */
parameters?: string[]; parameters?: string[];
@ -989,7 +989,7 @@ export interface components {
data: { data: {
/** @description The ID of the query. */ /** @description The ID of the query. */
_id: string; _id: string;
/** @description The ID of the data source the query belongs to. */ /** @description The ID of the datasource the query belongs to. */
datasourceId?: string; datasourceId?: string;
/** @description The bindings which are required to perform this query. */ /** @description The bindings which are required to perform this query. */
parameters?: string[]; parameters?: string[];

View File

@ -560,7 +560,7 @@ class TestConfiguration {
async createQuery(config = null) { async createQuery(config = null) {
if (!this.datasource && !config) { if (!this.datasource && !config) {
throw "No data source created for query." throw "No datasource created for query."
} }
config = config || basicQuery(this.datasource._id) config = config || basicQuery(this.datasource._id)
return this._req(config, null, controllers.query.save) return this._req(config, null, controllers.query.save)