Merge remote-tracking branch 'origin/develop' into feature/app-overview-section

This commit is contained in:
Dean 2022-05-11 16:21:15 +01:00
commit 7607d5c8e8
16 changed files with 86 additions and 64 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"description": "Budibase backend core libraries used in server and worker",
"main": "src/index.js",
"author": "Budibase",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "^1.0.148-alpha.1",
"@budibase/string-templates": "^1.0.151-alpha.2",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -67,10 +67,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^1.0.148-alpha.1",
"@budibase/client": "^1.0.148-alpha.1",
"@budibase/frontend-core": "^1.0.148-alpha.1",
"@budibase/string-templates": "^1.0.148-alpha.1",
"@budibase/bbui": "^1.0.151-alpha.2",
"@budibase/client": "^1.0.151-alpha.2",
"@budibase/frontend-core": "^1.0.151-alpha.2",
"@budibase/string-templates": "^1.0.151-alpha.2",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -53,6 +53,7 @@
: { schema: {} }
$: schema = getSchemaForTable(tableId, { searchableSchema: true }).schema
$: schemaFields = Object.values(schema || {})
$: queryLimit = tableId?.includes("datasource") ? "∞" : "1000"
const onChange = Utils.sequential(async (e, key) => {
try {
@ -330,6 +331,7 @@
on:change={e => onChange(e, key)}
{bindings}
updateOnChange={false}
placeholder={value.customType === "queryLimit" ? queryLimit : ""}
/>
</div>
{/if}

View File

@ -12,6 +12,7 @@
export let appOverview
export let releaseLock
export let editIcon
export let copyAppId
</script>
<div class="title" data-cy={`${app.devId}`}>
@ -75,6 +76,9 @@
<MenuItem on:click={() => unpublishApp(app)} icon="GlobeRemove">
Unpublish
</MenuItem>
<MenuItem on:click={() => copyAppId(app)} icon="Copy">
Copy App ID
</MenuItem>
{/if}
{#if !app.deployed}
<MenuItem on:click={() => updateApp(app)} icon="Edit">Edit</MenuItem>

View File

@ -11,6 +11,7 @@
Body,
Search,
Divider,
Helpers,
} from "@budibase/bbui"
import TemplateDisplay from "components/common/TemplateDisplay.svelte"
import Spinner from "components/common/Spinner.svelte"
@ -264,6 +265,11 @@
}
}
const copyAppId = async app => {
await Helpers.copyToClipboard(app.prodId)
notifications.success("App ID copied to clipboard.")
}
function createAppFromTemplateUrl(templateKey) {
// validate the template key just to make sure
const templateParts = templateKey.split("/")
@ -412,6 +418,7 @@
<div class="appTable">
{#each filteredApps as app (app.appId)}
<AppRow
{copyAppId}
{releaseLock}
{editIcon}
{app}

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "^1.0.148-alpha.1",
"@budibase/frontend-core": "^1.0.148-alpha.1",
"@budibase/string-templates": "^1.0.148-alpha.1",
"@budibase/bbui": "^1.0.151-alpha.2",
"@budibase/frontend-core": "^1.0.151-alpha.2",
"@budibase/string-templates": "^1.0.151-alpha.2",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "^1.0.148-alpha.1",
"@budibase/bbui": "^1.0.151-alpha.2",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -68,10 +68,10 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "^10.0.3",
"@budibase/backend-core": "^1.0.148-alpha.1",
"@budibase/client": "^1.0.148-alpha.1",
"@budibase/pro": "1.0.148-alpha.1",
"@budibase/string-templates": "^1.0.148-alpha.1",
"@budibase/backend-core": "^1.0.151-alpha.2",
"@budibase/client": "^1.0.151-alpha.2",
"@budibase/pro": "1.0.151-alpha.2",
"@budibase/string-templates": "^1.0.151-alpha.2",
"@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0",

View File

@ -6,7 +6,7 @@ exports.csv = function (headers, rows) {
.map(header => {
let val = row[header]
val =
typeof val === "object"
typeof val === "object" && !(val instanceof Date)
? `"${JSON.stringify(val).replace(/"/g, "'")}"`
: `"${val}"`
return val.trim()

View File

@ -50,6 +50,7 @@ exports.definition = {
limit: {
type: "number",
title: "Limit",
customType: "queryLimit",
},
},
required: ["tableId"],

View File

@ -147,7 +147,7 @@ module PostgresModule {
return parts.join(" || ")
}
async internalQuery(query: SqlQuery) {
async internalQuery(query: SqlQuery, close: boolean = true) {
const client = this.client
this.index = 1
// need to handle a specific issue with json data types in postgres,
@ -164,10 +164,11 @@ module PostgresModule {
try {
return await client.query(query.sql, query.bindings || [])
} catch (err) {
await this.client.end()
// @ts-ignore
throw new Error(err)
} finally {
await this.client.end()
if (close) await this.client.end()
}
}
@ -204,48 +205,54 @@ module PostgresModule {
}
} catch (err) {
tableKeys = {}
} finally {
await this.client.close()
}
const columnsResponse = await this.client.query(this.COLUMNS_SQL)
const tables: { [key: string]: Table } = {}
try {
const columnsResponse = await this.client.query(this.COLUMNS_SQL)
for (let column of columnsResponse.rows) {
const tableName: string = column.table_name
const columnName: string = column.column_name
const tables: { [key: string]: Table } = {}
// table key doesn't exist yet
if (!tables[tableName] || !tables[tableName].schema) {
tables[tableName] = {
_id: buildExternalTableId(datasourceId, tableName),
primary: tableKeys[tableName] || [],
name: tableName,
schema: {},
for (let column of columnsResponse.rows) {
const tableName: string = column.table_name
const columnName: string = column.column_name
// table key doesn't exist yet
if (!tables[tableName] || !tables[tableName].schema) {
tables[tableName] = {
_id: buildExternalTableId(datasourceId, tableName),
primary: tableKeys[tableName] || [],
name: tableName,
schema: {},
}
}
const identity = !!(
column.identity_generation ||
column.identity_start ||
column.identity_increment
)
const hasDefault =
typeof column.column_default === "string" &&
column.column_default.startsWith("nextval")
const isGenerated =
column.is_generated && column.is_generated !== "NEVER"
const isAuto: boolean = hasDefault || identity || isGenerated
tables[tableName].schema[columnName] = {
autocolumn: isAuto,
name: columnName,
...convertSqlType(column.data_type),
}
}
const identity = !!(
column.identity_generation ||
column.identity_start ||
column.identity_increment
)
const hasDefault =
typeof column.column_default === "string" &&
column.column_default.startsWith("nextval")
const isGenerated =
column.is_generated && column.is_generated !== "NEVER"
const isAuto: boolean = hasDefault || identity || isGenerated
tables[tableName].schema[columnName] = {
autocolumn: isAuto,
name: columnName,
...convertSqlType(column.data_type),
}
const final = finaliseExternalTables(tables, entities)
this.tables = final.tables
this.schemaErrors = final.errors
} catch (err) {
// @ts-ignore
throw new Error(err)
} finally {
await this.client.end()
}
const final = finaliseExternalTables(tables, entities)
this.tables = final.tables
this.schemaErrors = final.errors
}
async create(query: SqlQuery | string) {
@ -274,8 +281,9 @@ module PostgresModule {
if (Array.isArray(input)) {
const responses = []
for (let query of input) {
responses.push(await this.internalQuery(query))
responses.push(await this.internalQuery(query, false))
}
await this.client.end()
return responses
} else {
const response = await this.internalQuery(input)

View File

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

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "1.0.148-alpha.1",
"version": "1.0.151-alpha.2",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -31,9 +31,9 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "^1.0.148-alpha.1",
"@budibase/pro": "1.0.148-alpha.1",
"@budibase/string-templates": "^1.0.148-alpha.1",
"@budibase/backend-core": "^1.0.151-alpha.2",
"@budibase/pro": "1.0.151-alpha.2",
"@budibase/string-templates": "^1.0.151-alpha.2",
"@koa/router": "^8.0.0",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "^0.3.0",