Merge branch 'develop' of github.com:Budibase/budibase into feature/automation-query

This commit is contained in:
mike12345567 2021-09-16 15:33:03 +01:00
commit c759329a61
13 changed files with 102 additions and 43 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/auth", "name": "@budibase/auth",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"description": "Authentication middlewares for budibase builder and apps", "description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js", "main": "src/index.js",
"author": "Budibase", "author": "Budibase",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",

View File

@ -37,9 +37,8 @@ Cypress.Commands.add("createApp", name => {
cy.contains("Create app").click() cy.contains("Create app").click()
}) })
.then(() => { .then(() => {
cy.get(".selected > .content", { cy.expandBudibaseConnection()
timeout: 20000, cy.get(".nav-item.selected > .content").should("be.visible")
}).should("be.visible")
}) })
}) })
@ -83,6 +82,7 @@ Cypress.Commands.add("createTable", tableName => {
Cypress.Commands.add("addColumn", (tableName, columnName, type) => { Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
// Select Table // Select Table
cy.selectTable(tableName)
cy.contains(".nav-item", tableName).click() cy.contains(".nav-item", tableName).click()
cy.contains("Create column").click() cy.contains("Create column").click()
@ -161,3 +161,15 @@ Cypress.Commands.add("createScreen", (screenName, route) => {
cy.get(".spectrum-Button--cta").click() cy.get(".spectrum-Button--cta").click()
}) })
}) })
Cypress.Commands.add("expandBudibaseConnection", () => {
if (Cypress.$(".nav-item > .content > .opened").length === 0) {
// expand the Budibase DB connection string
cy.get(".icon.arrow").eq(0).click()
}
})
Cypress.Commands.add("selectTable", tableName => {
cy.expandBudibaseConnection()
cy.contains(".nav-item", tableName).click()
})

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -65,10 +65,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.125-alpha.7", "@budibase/bbui": "^0.9.125-alpha.10",
"@budibase/client": "^0.9.125-alpha.7", "@budibase/client": "^0.9.125-alpha.10",
"@budibase/colorpicker": "1.1.2", "@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^0.9.125-alpha.7", "@budibase/string-templates": "^0.9.125-alpha.10",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",

View File

@ -9,7 +9,10 @@
import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte" import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte"
import ICONS from "./icons" import ICONS from "./icons"
let openDataSources = []
function selectDatasource(datasource) { function selectDatasource(datasource) {
toggleNode(datasource)
datasources.select(datasource._id) datasources.select(datasource._id)
$goto(`./datasource/${datasource._id}`) $goto(`./datasource/${datasource._id}`)
} }
@ -19,6 +22,15 @@
$goto(`./datasource/${query.datasourceId}/${query._id}`) $goto(`./datasource/${query.datasourceId}/${query._id}`)
} }
function toggleNode(datasource) {
const isOpen = openDataSources.includes(datasource._id)
if (isOpen) {
openDataSources = openDataSources.filter(id => datasource._id !== id)
} else {
openDataSources = [...openDataSources, datasource._id]
}
}
onMount(() => { onMount(() => {
datasources.fetch() datasources.fetch()
queries.fetch() queries.fetch()
@ -31,8 +43,11 @@
<NavItem <NavItem
border={idx > 0} border={idx > 0}
text={datasource.name} text={datasource.name}
opened={openDataSources.includes(datasource._id)}
selected={$datasources.selected === datasource._id} selected={$datasources.selected === datasource._id}
withArrow={true}
on:click={() => selectDatasource(datasource)} on:click={() => selectDatasource(datasource)}
on:iconClick={() => toggleNode(datasource)}
> >
<div class="datasource-icon" slot="icon"> <div class="datasource-icon" slot="icon">
<svelte:component <svelte:component
@ -46,13 +61,16 @@
{/if} {/if}
</NavItem> </NavItem>
<TableNavigator sourceId={datasource._id} /> {#if openDataSources.includes(datasource._id)}
<TableNavigator sourceId={datasource._id} />
{/if}
{#each $queries.list.filter(query => query.datasourceId === datasource._id) as query} {#each $queries.list.filter(query => query.datasourceId === datasource._id) as query}
<NavItem <NavItem
indentLevel={1} indentLevel={1}
icon="SQLQuery" icon="SQLQuery"
text={query.name} text={query.name}
opened={$queries.selected === query._id}
selected={$queries.selected === query._id} selected={$queries.selected === query._id}
on:click={() => onClickQuery(query)} on:click={() => onClickQuery(query)}
> >

View File

@ -1,5 +1,6 @@
<script> <script>
import { Icon } from "@budibase/bbui" import { Icon } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
export let icon export let icon
export let withArrow = false export let withArrow = false
@ -10,6 +11,13 @@
export let selected = false export let selected = false
export let opened = false export let opened = false
export let draggable = false export let draggable = false
const dispatch = createEventDispatcher()
function onIconClick(event) {
event.stopPropagation()
dispatch("iconClick")
}
</script> </script>
<div <div
@ -28,7 +36,7 @@
> >
<div class="content"> <div class="content">
{#if withArrow} {#if withArrow}
<div class:opened class="icon arrow"> <div class:opened class="icon arrow" on:click={onIconClick}>
<Icon size="S" name="ChevronRight" /> <Icon size="S" name="ChevronRight" />
</div> </div>
{/if} {/if}

View File

@ -1,5 +1,5 @@
<script> <script>
import { onMount } from "svelte" import { onMount, onDestroy } from "svelte"
import { store, currentAsset } from "builderStore" import { store, currentAsset } from "builderStore"
import iframeTemplate from "./iframeTemplate" import iframeTemplate from "./iframeTemplate"
import { Screen } from "builderStore/store/screenTemplates/utils/Screen" import { Screen } from "builderStore/store/screenTemplates/utils/Screen"
@ -97,26 +97,47 @@
{ once: true } { once: true }
) )
// Add listener for events sent by cliebt library in preview // Add listener for events sent by client library in preview
iframe.contentWindow.addEventListener("bb-event", event => { iframe.contentWindow.addEventListener("bb-event", handleBudibaseEvent)
const { type, data } = event.detail iframe.contentWindow.addEventListener("keydown", handleKeydownEvent)
if (type === "select-component" && data.id) {
store.actions.components.select({ _id: data.id })
} else if (type === "update-prop") {
store.actions.components.updateProp(data.prop, data.value)
} else if (type === "delete-component" && data.id) {
idToDelete = data.id
confirmDeleteDialog.show()
} else if (type === "preview-loaded") {
// Wait for this event to show the client library if intelligent
// loading is supported
loading = false
} else {
console.warning(`Client sent unknown event type: ${type}`)
}
})
}) })
// remove all iframe event listeners on component destroy
onDestroy(() => {
iframe.contentWindow.removeEventListener("bb-event", handleBudibaseEvent)
iframe.contentWindow.removeEventListener("keydown", handleKeydownEvent)
})
const handleBudibaseEvent = event => {
const { type, data } = event.detail
if (type === "select-component" && data.id) {
store.actions.components.select({ _id: data.id })
} else if (type === "update-prop") {
store.actions.components.updateProp(data.prop, data.value)
} else if (type === "delete-component" && data.id) {
confirmDeleteComponent(data.id)
} else if (type === "preview-loaded") {
// Wait for this event to show the client library if intelligent
// loading is supported
loading = false
} else {
console.warning(`Client sent unknown event type: ${type}`)
}
};
const handleKeydownEvent = event => {
if ((event.key === "Delete" || event.key === "Backspace") &&
selectedComponentId &&
['input', 'textarea'].indexOf(iframe.contentWindow.document.activeElement?.tagName.toLowerCase()) === -1) {
confirmDeleteComponent(selectedComponentId);
}
}
const confirmDeleteComponent = (componentId) => {
idToDelete = componentId
confirmDeleteDialog.show()
}
const deleteComponent = () => { const deleteComponent = () => {
store.actions.components.delete({ _id: idToDelete }) store.actions.components.delete({ _id: idToDelete })
idToDelete = null idToDelete = null

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.125-alpha.7", "@budibase/bbui": "^0.9.125-alpha.10",
"@budibase/standard-components": "^0.9.124", "@budibase/standard-components": "^0.9.124",
"@budibase/string-templates": "^0.9.125-alpha.7", "@budibase/string-templates": "^0.9.125-alpha.10",
"regexparam": "^1.3.0", "regexparam": "^1.3.0",
"shortid": "^2.2.15", "shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5" "svelte-spa-router": "^3.0.5"

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -64,9 +64,9 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.125-alpha.7", "@budibase/auth": "^0.9.125-alpha.10",
"@budibase/client": "^0.9.125-alpha.7", "@budibase/client": "^0.9.125-alpha.10",
"@budibase/string-templates": "^0.9.125-alpha.7", "@budibase/string-templates": "^0.9.125-alpha.10",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0", "@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1", "@sendgrid/mail": "7.1.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.125-alpha.7", "version": "0.9.125-alpha.10",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -25,8 +25,8 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.125-alpha.7", "@budibase/auth": "^0.9.125-alpha.10",
"@budibase/string-templates": "^0.9.125-alpha.7", "@budibase/string-templates": "^0.9.125-alpha.10",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"@techpass/passport-openidconnect": "^0.3.0", "@techpass/passport-openidconnect": "^0.3.0",
"aws-sdk": "^2.811.0", "aws-sdk": "^2.811.0",