Merge pull request #1540 from Budibase/fix/0.9.1-bugfixes
Fix/0.9.1 bugfixes
This commit is contained in:
commit
cc88c8c1d9
|
@ -71,6 +71,7 @@
|
||||||
"@spectrum-css/tags": "^3.0.2",
|
"@spectrum-css/tags": "^3.0.2",
|
||||||
"@spectrum-css/textfield": "^3.0.1",
|
"@spectrum-css/textfield": "^3.0.1",
|
||||||
"@spectrum-css/toast": "^3.0.1",
|
"@spectrum-css/toast": "^3.0.1",
|
||||||
|
"@spectrum-css/tooltip": "^3.0.3",
|
||||||
"@spectrum-css/treeview": "^3.0.2",
|
"@spectrum-css/treeview": "^3.0.2",
|
||||||
"@spectrum-css/typography": "^3.0.1",
|
"@spectrum-css/typography": "^3.0.1",
|
||||||
"@spectrum-css/underlay": "^2.0.9",
|
"@spectrum-css/underlay": "^2.0.9",
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
|
import Tooltip from "../Tooltip/Tooltip.svelte"
|
||||||
|
import Link from "../Link/Link.svelte"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
|
||||||
const displayLimit = 5
|
const displayLimit = 5
|
||||||
|
@ -13,9 +16,17 @@
|
||||||
|
|
||||||
{#each attachments as attachment}
|
{#each attachments as attachment}
|
||||||
{#if isImage(attachment.extension)}
|
{#if isImage(attachment.extension)}
|
||||||
|
<Link quiet target="_blank" href={attachment.url}>
|
||||||
<img src={attachment.url} alt={attachment.extension} />
|
<img src={attachment.url} alt={attachment.extension} />
|
||||||
|
</Link>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="file">{attachment.extension}</div>
|
<Tooltip text={attachment.name} direction="right">
|
||||||
|
<div class="file">
|
||||||
|
<Link quiet target="_blank" href={attachment.url}
|
||||||
|
>{attachment.extension}</Link
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{#if leftover}
|
{#if leftover}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<script>
|
||||||
|
import "@spectrum-css/tooltip/dist/index-vars.css"
|
||||||
|
|
||||||
|
export let direction = "top"
|
||||||
|
export let text = ""
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<span class="u-tooltip-showOnHover tooltip">
|
||||||
|
<slot />
|
||||||
|
<div class={`spectrum-Tooltip spectrum-Tooltip--${direction}`}>
|
||||||
|
<span class="spectrum-Tooltip-label">{text}</span>
|
||||||
|
<span class="spectrum-Tooltip-tip" />
|
||||||
|
</div>
|
||||||
|
</span>
|
|
@ -30,6 +30,7 @@ export { default as Label } from "./Label/Label.svelte"
|
||||||
export { default as Layout } from "./Layout/Layout.svelte"
|
export { default as Layout } from "./Layout/Layout.svelte"
|
||||||
export { default as Page } from "./Layout/Page.svelte"
|
export { default as Page } from "./Layout/Page.svelte"
|
||||||
export { default as Link } from "./Link/Link.svelte"
|
export { default as Link } from "./Link/Link.svelte"
|
||||||
|
export { default as Tooltip } from "./Tooltip/Tooltip.svelte"
|
||||||
export { default as Menu } from "./Menu/Menu.svelte"
|
export { default as Menu } from "./Menu/Menu.svelte"
|
||||||
export { default as MenuSection } from "./Menu/Section.svelte"
|
export { default as MenuSection } from "./Menu/Section.svelte"
|
||||||
export { default as MenuSeparator } from "./Menu/Separator.svelte"
|
export { default as MenuSeparator } from "./Menu/Separator.svelte"
|
||||||
|
|
|
@ -236,6 +236,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@spectrum-css/toast/-/toast-3.0.2.tgz#8e27cce799b1b1d0054a88b135dddf7fbf1bdc78"
|
resolved "https://registry.yarnpkg.com/@spectrum-css/toast/-/toast-3.0.2.tgz#8e27cce799b1b1d0054a88b135dddf7fbf1bdc78"
|
||||||
integrity sha512-sJp8DRsU2iSF67hlOQHFdRkbJHncspoOywHEsqcjh2KFl8gRY12rQL0ORG6J2THUt0LVBWSy48iwph9s4rkwsA==
|
integrity sha512-sJp8DRsU2iSF67hlOQHFdRkbJHncspoOywHEsqcjh2KFl8gRY12rQL0ORG6J2THUt0LVBWSy48iwph9s4rkwsA==
|
||||||
|
|
||||||
|
"@spectrum-css/tooltip@^3.0.3":
|
||||||
|
version "3.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@spectrum-css/tooltip/-/tooltip-3.0.3.tgz#26b8ca3b3d30e29630244d85eb4fc11d0c841281"
|
||||||
|
integrity sha512-ztRF7WW1FzyNavXBRc+80z67UoOrY9wl3cMYsVD3MpDnyxdzP8cjza1pCcolKBaFqRTcQKkxKw3GWtGICRKR5A==
|
||||||
|
|
||||||
"@spectrum-css/treeview@^3.0.2":
|
"@spectrum-css/treeview@^3.0.2":
|
||||||
version "3.0.2"
|
version "3.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@spectrum-css/treeview/-/treeview-3.0.2.tgz#d54d8f17290babb1c885f5d9355e225421beb0d2"
|
resolved "https://registry.yarnpkg.com/@spectrum-css/treeview/-/treeview-3.0.2.tgz#d54d8f17290babb1c885f5d9355e225421beb0d2"
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
let fieldDefinitions = cloneDeep(FIELDS)
|
let fieldDefinitions = cloneDeep(FIELDS)
|
||||||
const { hide } = getContext(Context.Modal)
|
const { hide } = getContext(Context.Modal)
|
||||||
|
|
||||||
|
export let onClosed = () => {}
|
||||||
export let field = {
|
export let field = {
|
||||||
type: "string",
|
type: "string",
|
||||||
constraints: fieldDefinitions.STRING.constraints,
|
constraints: fieldDefinitions.STRING.constraints,
|
||||||
|
@ -56,9 +57,8 @@
|
||||||
)
|
)
|
||||||
$: required = !!field?.constraints?.presence || primaryDisplay
|
$: required = !!field?.constraints?.presence || primaryDisplay
|
||||||
$: uneditable =
|
$: uneditable =
|
||||||
($tables.selected?._id === TableNames.USERS &&
|
$tables.selected?._id === TableNames.USERS &&
|
||||||
UNEDITABLE_USER_FIELDS.includes(field.name)) ||
|
UNEDITABLE_USER_FIELDS.includes(field.name)
|
||||||
(originalName && field.type === LINK_TYPE)
|
|
||||||
$: invalid =
|
$: invalid =
|
||||||
!field.name ||
|
!field.name ||
|
||||||
(field.type === LINK_TYPE && !field.tableId) ||
|
(field.type === LINK_TYPE && !field.tableId) ||
|
||||||
|
@ -98,7 +98,8 @@
|
||||||
} else {
|
} else {
|
||||||
tables.deleteField(field)
|
tables.deleteField(field)
|
||||||
notifications.success(`Column ${field.name} deleted.`)
|
notifications.success(`Column ${field.name} deleted.`)
|
||||||
hide()
|
confirmDeleteDialog.hide()
|
||||||
|
deletion = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +194,11 @@
|
||||||
onConfirm={saveColumn}
|
onConfirm={saveColumn}
|
||||||
disabled={invalid}
|
disabled={invalid}
|
||||||
>
|
>
|
||||||
<Input label="Name" bind:value={field.name} disabled={uneditable} />
|
<Input
|
||||||
|
label="Name"
|
||||||
|
bind:value={field.name}
|
||||||
|
disabled={uneditable || field.type === LINK_TYPE}
|
||||||
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
disabled={originalName}
|
disabled={originalName}
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
|
|
||||||
$: urlDisplay =
|
$: urlDisplay =
|
||||||
schema.urlDisplay &&
|
schema.urlDisplay &&
|
||||||
`${datasource.config.url}${query.fields.path}${query.fields.queryString}`
|
`${datasource.config.url}${query.fields.path ?? ""}${
|
||||||
|
query.fields.queryString ?? ""
|
||||||
|
}`
|
||||||
|
|
||||||
function updateQuery({ detail }) {
|
function updateQuery({ detail }) {
|
||||||
query.fields[schema.type] = detail.value
|
query.fields[schema.type] = detail.value
|
||||||
|
|
|
@ -9,6 +9,14 @@ mssql.query = jest.fn(() => ({
|
||||||
],
|
],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mssql.connect = jest.fn(() => ({ recordset: [] }))
|
// mssql.connect = jest.fn(() => ({ recordset: [] }))
|
||||||
|
|
||||||
|
mssql.ConnectionPool = jest.fn(() => ({
|
||||||
|
connect: jest.fn(() => ({
|
||||||
|
request: jest.fn(() => ({
|
||||||
|
query: jest.fn(() => ({})),
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
}))
|
||||||
|
|
||||||
module.exports = mssql
|
module.exports = mssql
|
||||||
|
|
|
@ -19,7 +19,14 @@ function enrichQueries(input) {
|
||||||
|
|
||||||
function formatResponse(resp) {
|
function formatResponse(resp) {
|
||||||
if (typeof resp === "string") {
|
if (typeof resp === "string") {
|
||||||
|
try {
|
||||||
resp = JSON.parse(resp)
|
resp = JSON.parse(resp)
|
||||||
|
} catch (err) {
|
||||||
|
console.error(
|
||||||
|
"Error parsing JSON response. Returning string in array instead."
|
||||||
|
)
|
||||||
|
resp = { response: resp }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!Array.isArray(resp)) {
|
if (!Array.isArray(resp)) {
|
||||||
resp = [resp]
|
resp = [resp]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
const sqlServer = require("mssql")
|
const sqlServer = require("mssql")
|
||||||
const { FIELD_TYPES } = require("./Integration")
|
const { FIELD_TYPES } = require("./Integration")
|
||||||
|
|
||||||
|
let pool
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
docs: "https://github.com/tediousjs/node-mssql",
|
docs: "https://github.com/tediousjs/node-mssql",
|
||||||
description:
|
description:
|
||||||
|
@ -49,11 +51,14 @@ const SCHEMA = {
|
||||||
class SqlServerIntegration {
|
class SqlServerIntegration {
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
this.config = config
|
this.config = config
|
||||||
this.client = sqlServer
|
if (!pool) {
|
||||||
|
pool = new sqlServer.ConnectionPool(this.config)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
return await this.client.connect(this.config)
|
const client = await pool.connect()
|
||||||
|
this.client = client.request()
|
||||||
}
|
}
|
||||||
|
|
||||||
async read(query) {
|
async read(query) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ class RestIntegration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async create({ path, queryString, headers = {}, json }) {
|
async create({ path = "", queryString = "", headers = {}, json }) {
|
||||||
this.headers = {
|
this.headers = {
|
||||||
...this.config.defaultHeaders,
|
...this.config.defaultHeaders,
|
||||||
...headers,
|
...headers,
|
||||||
|
@ -126,7 +126,7 @@ class RestIntegration {
|
||||||
return await this.parseResponse(response)
|
return await this.parseResponse(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
async read({ path, queryString, headers = {} }) {
|
async read({ path = "", queryString = "", headers = {} }) {
|
||||||
this.headers = {
|
this.headers = {
|
||||||
...this.config.defaultHeaders,
|
...this.config.defaultHeaders,
|
||||||
...headers,
|
...headers,
|
||||||
|
@ -139,7 +139,7 @@ class RestIntegration {
|
||||||
return await this.parseResponse(response)
|
return await this.parseResponse(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
async update({ path, queryString, headers = {}, json }) {
|
async update({ path = "", queryString = "", headers = {}, json }) {
|
||||||
this.headers = {
|
this.headers = {
|
||||||
...this.config.defaultHeaders,
|
...this.config.defaultHeaders,
|
||||||
...headers,
|
...headers,
|
||||||
|
@ -154,7 +154,7 @@ class RestIntegration {
|
||||||
return await this.parseResponse(response)
|
return await this.parseResponse(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete({ path, queryString, headers = {} }) {
|
async delete({ path = "", queryString = "", headers = {} }) {
|
||||||
this.headers = {
|
this.headers = {
|
||||||
...this.config.defaultHeaders,
|
...this.config.defaultHeaders,
|
||||||
...headers,
|
...headers,
|
||||||
|
|
|
@ -32,7 +32,8 @@ describe("MS SQL Server Integration", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("no rows returned", () => {
|
describe("no rows returned", () => {
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
|
await config.integration.connect()
|
||||||
config.integration.client.query.mockImplementation(() => ({ rows: [] }))
|
config.integration.client.query.mockImplementation(() => ({ rows: [] }))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue