Merge pull request #10907 from Budibase/backmerge-master
Backmerge master 2023-06-15
This commit is contained in:
commit
407ec2cdb4
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.7.16-alpha.2",
|
||||
"version": "2.7.19",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/backend-core",
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
<meta charset='utf8'>
|
||||
<meta name='viewport' content='width=device-width'>
|
||||
<title>Budibase</title>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
||||
rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/400.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/600.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/700.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/remixicon.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body id="app">
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
"@codemirror/state": "^6.2.0",
|
||||
"@codemirror/theme-one-dark": "^6.1.2",
|
||||
"@codemirror/view": "^6.11.2",
|
||||
"@fontsource/source-sans-pro": "^5.0.3",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.2.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
||||
|
@ -122,6 +123,7 @@
|
|||
"tsconfig-paths": "4.0.0",
|
||||
"typescript": "4.7.3",
|
||||
"vite": "^3.0.8",
|
||||
"vite-plugin-static-copy": "^0.16.0",
|
||||
"vitest": "^0.29.2"
|
||||
},
|
||||
"nx": {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 787 B |
|
@ -8,7 +8,7 @@
|
|||
$: platformTitle =
|
||||
!$auth.user && platformTitleText ? platformTitleText : "Budibase"
|
||||
|
||||
$: faviconUrl = $organisation.faviconUrl || "https://i.imgur.com/Xhdt1YP.png"
|
||||
$: faviconUrl = $organisation.faviconUrl || "/builder/bblogo.png"
|
||||
|
||||
onMount(async () => {
|
||||
await organisation.init()
|
||||
|
@ -27,6 +27,6 @@
|
|||
<link rel="icon" href={faviconUrl} />
|
||||
{:else}
|
||||
<!-- A default must be set or the browser defaults to favicon.ico behaviour -->
|
||||
<link rel="icon" href={"https://i.imgur.com/Xhdt1YP.png"} />
|
||||
<link rel="icon" href={"/builder/bblogo.png"} />
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<div tabindex="-1" class="exampleApp">
|
||||
<div class="page">
|
||||
<div class="header">
|
||||
<img alt="Budibase Logo" src={"https://i.imgur.com/Xhdt1YP.png"} />
|
||||
<img alt="Budibase Logo" src={"/builder/bblogo.png"} />
|
||||
<h1>{name}</h1>
|
||||
</div>
|
||||
<div class="nav">Home</div>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { svelte } from "@sveltejs/vite-plugin-svelte"
|
||||
import replace from "@rollup/plugin-replace"
|
||||
import { defineConfig, loadEnv } from "vite"
|
||||
import { viteStaticCopy } from "vite-plugin-static-copy"
|
||||
import path from "path"
|
||||
|
||||
const ignoredWarnings = [
|
||||
|
@ -59,6 +60,18 @@ export default defineConfig(({ mode }) => {
|
|||
),
|
||||
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
|
||||
}),
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
src: "../../node_modules/@fontsource/source-sans-pro",
|
||||
dest: "fonts",
|
||||
},
|
||||
{
|
||||
src: "../../node_modules/remixicon/fonts/*",
|
||||
dest: "fonts",
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
optimizeDeps: {
|
||||
exclude: ["@roxi/routify"],
|
||||
|
|
|
@ -180,10 +180,7 @@
|
|||
{/if}
|
||||
<div class="logo">
|
||||
{#if !hideLogo}
|
||||
<img
|
||||
src={logoUrl || "https://i.imgur.com/Xhdt1YP.png"}
|
||||
alt={title}
|
||||
/>
|
||||
<img src={logoUrl || "/builder/bblogo.png"} alt={title} />
|
||||
{/if}
|
||||
{#if !hideTitle && title}
|
||||
<Heading size="S">{title}</Heading>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<img
|
||||
class="logo"
|
||||
alt="logo"
|
||||
src={logoUrl || "https://i.imgur.com/Xhdt1YP.png"}
|
||||
src={logoUrl || "/builder/bblogo.png"}
|
||||
height="48"
|
||||
/>
|
||||
</a>
|
||||
|
|
|
@ -19,6 +19,7 @@ import {
|
|||
breakRowIdField,
|
||||
convertRowId,
|
||||
generateRowIdField,
|
||||
getPrimaryDisplay,
|
||||
isRowId,
|
||||
isSQL,
|
||||
} from "../../../integrations/utils"
|
||||
|
@ -391,7 +392,10 @@ export class ExternalRequest {
|
|||
}
|
||||
}
|
||||
relatedRow = processFormulas(linkedTable, relatedRow)
|
||||
const relatedDisplay = display ? relatedRow[display] : undefined
|
||||
let relatedDisplay
|
||||
if (display) {
|
||||
relatedDisplay = getPrimaryDisplay(relatedRow[display])
|
||||
}
|
||||
row[relationship.column][key] = {
|
||||
primaryDisplay: relatedDisplay || "Invalid display column",
|
||||
_id: relatedRow._id,
|
||||
|
|
|
@ -40,19 +40,14 @@
|
|||
{#if favicon !== ""}
|
||||
<link rel="icon" type="image/png" href={favicon} />
|
||||
{:else}
|
||||
<link rel="icon" type="image/png" href="https://i.imgur.com/Xhdt1YP.png" />
|
||||
<link rel="icon" type="image/png" href="/builder/bblogo.png" />
|
||||
{/if}
|
||||
|
||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link href="/builder/fonts/source-sans-pro/400.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/600.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/700.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/remixicon.css" rel="stylesheet" />
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<title>Budibase Builder Preview</title>
|
||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link href="/builder/fonts/source-sans-pro/400.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/600.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/source-sans-pro/700.css" rel="stylesheet" />
|
||||
<link href="/builder/fonts/remixicon.css" rel="stylesheet" />
|
||||
<style>
|
||||
html, body {
|
||||
padding: 0;
|
||||
|
|
|
@ -91,7 +91,7 @@ const SCHEMA: Integration = {
|
|||
},
|
||||
}
|
||||
|
||||
function bindingTypeCoerce(bindings: any[]) {
|
||||
export function bindingTypeCoerce(bindings: any[]) {
|
||||
for (let i = 0; i < bindings.length; i++) {
|
||||
const binding = bindings[i]
|
||||
if (typeof binding !== "string") {
|
||||
|
@ -109,7 +109,12 @@ function bindingTypeCoerce(bindings: any[]) {
|
|||
dayjs(binding).isValid() &&
|
||||
!binding.includes(",")
|
||||
) {
|
||||
bindings[i] = dayjs(binding).toDate()
|
||||
let value: any
|
||||
value = new Date(binding)
|
||||
if (isNaN(value)) {
|
||||
value = binding
|
||||
}
|
||||
bindings[i] = value
|
||||
}
|
||||
}
|
||||
return bindings
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { default as MySQLIntegration } from "../mysql"
|
||||
import { default as MySQLIntegration, bindingTypeCoerce } from "../mysql"
|
||||
jest.mock("mysql2")
|
||||
|
||||
class TestConfiguration {
|
||||
|
@ -131,3 +131,21 @@ describe("MySQL Integration", () => {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("bindingTypeCoercion", () => {
|
||||
it("shouldn't coerce something that looks like a date", () => {
|
||||
const response = bindingTypeCoerce(["202205-1500"])
|
||||
expect(response[0]).toBe("202205-1500")
|
||||
})
|
||||
|
||||
it("should coerce an actual date", () => {
|
||||
const date = new Date("2023-06-13T14:24:22.620Z")
|
||||
const response = bindingTypeCoerce(["2023-06-13T14:24:22.620Z"])
|
||||
expect(response[0]).toEqual(date)
|
||||
})
|
||||
|
||||
it("should coerce numbers", () => {
|
||||
const response = bindingTypeCoerce(["0"])
|
||||
expect(response[0]).toEqual(0)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -328,3 +328,27 @@ export function finaliseExternalTables(
|
|||
.reduce((r, [k, v]) => ({ ...r, [k]: v }), {})
|
||||
return { tables: finalTables, errors }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided input is an object, but specifically not a date type object.
|
||||
* Used during coercion of types and relationship handling, dates are considered valid
|
||||
* and can be used as a display field, but objects and arrays cannot.
|
||||
* @param testValue an unknown type which this function will attempt to extract
|
||||
* a valid primary display string from.
|
||||
*/
|
||||
export function getPrimaryDisplay(testValue: unknown): string | undefined {
|
||||
if (testValue instanceof Date) {
|
||||
return testValue.toISOString()
|
||||
}
|
||||
if (
|
||||
Array.isArray(testValue) &&
|
||||
testValue[0] &&
|
||||
typeof testValue[0] !== "object"
|
||||
) {
|
||||
return testValue.join(", ")
|
||||
}
|
||||
if (typeof testValue === "object") {
|
||||
return undefined
|
||||
}
|
||||
return testValue as string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue