Merge master.

This commit is contained in:
Sam Rose 2024-03-19 17:07:26 +00:00
commit 03a702e765
No known key found for this signature in database
13 changed files with 164 additions and 189 deletions

@ -1 +1 @@
Subproject commit 7f388799c023c37b9e13663819f3ee402ade4adf Subproject commit 6465dc9c2a38e1380b32204cad4ae0c1f33e065a

View File

@ -24,6 +24,13 @@
navigationStore, navigationStore,
} from "stores/builder" } from "stores/builder"
import { DefaultAppTheme } from "constants" import { DefaultAppTheme } from "constants"
import BarButtonList from "/src/components/design/settings/controls/BarButtonList.svelte"
$: alignmentOptions = [
{ value: "Left", barIcon: "TextAlignLeft" },
{ value: "Center", barIcon: "TextAlignCenter" },
{ value: "Right", barIcon: "TextAlignRight" },
]
$: screenRouteOptions = $screenStore.screens $: screenRouteOptions = $screenStore.screens
.map(screen => screen.routing?.route) .map(screen => screen.routing?.route)
@ -46,6 +53,10 @@
notifications.error("Error updating navigation settings") notifications.error("Error updating navigation settings")
} }
} }
const updateTextAlign = textAlignValue => {
navigationStore.syncAppNavigation({ textAlign: textAlignValue })
}
</script> </script>
<Panel <Panel
@ -133,6 +144,15 @@
on:change={e => update("title", e.detail)} on:change={e => update("title", e.detail)}
updateOnChange={false} updateOnChange={false}
/> />
<div class="label">
<Label size="M">Text align</Label>
</div>
<BarButtonList
options={alignmentOptions}
value={$navigationStore.textAlign}
onChange={updateTextAlign}
/>
{/if} {/if}
<div class="label"> <div class="label">
<Label>Background</Label> <Label>Background</Label>

View File

@ -11,6 +11,7 @@ export const INITIAL_NAVIGATION_STATE = {
hideLogo: null, hideLogo: null,
logoUrl: null, logoUrl: null,
hideTitle: null, hideTitle: null,
textAlign: "Left",
navBackground: null, navBackground: null,
navWidth: null, navWidth: null,
navTextColor: null, navTextColor: null,

View File

@ -36,6 +36,7 @@
export let pageWidth export let pageWidth
export let logoLinkUrl export let logoLinkUrl
export let openLogoLinkInNewTab export let openLogoLinkInNewTab
export let textAlign
export let embedded = false export let embedded = false
@ -226,7 +227,7 @@
{/if} {/if}
{/if} {/if}
{#if !hideTitle && title} {#if !hideTitle && title}
<Heading size="S">{title}</Heading> <Heading size="S" {textAlign}>{title}</Heading>
{/if} {/if}
</div> </div>
{#if !embedded} {#if !embedded}

@ -1 +1 @@
Subproject commit 4f183993af024e5ddec1b90981fb9049a3c6c412 Subproject commit 993b9f010f619b7f8b50c89105c645e3d874929e

View File

@ -1,8 +1,5 @@
module AirtableMock { class Airtable {
const Airtable = () => { base = jest.fn()
// @ts-ignore
this.base = jest.fn()
} }
module.exports = Airtable module.exports = Airtable
}

View File

@ -1,25 +1,19 @@
import fs from "fs" import fs from "fs"
import { join } from "path" import { join } from "path"
module AwsMock {
const aws: any = {}
const response = (body: any, extra?: any) => () => ({ const response = (body: any, extra?: any) => () => ({
promise: () => body, promise: () => body,
...extra, ...extra,
}) })
const DocumentClient = () => { class DocumentClient {
// @ts-ignore put = jest.fn(response({}))
this.put = jest.fn(response({})) query = jest.fn(
// @ts-ignore
this.query = jest.fn(
response({ response({
Items: [], Items: [],
}) })
) )
// @ts-ignore scan = jest.fn(
this.scan = jest.fn(
response({ response({
Items: [ Items: [
{ {
@ -28,57 +22,41 @@ module AwsMock {
], ],
}) })
) )
// @ts-ignore get = jest.fn(response({}))
this.get = jest.fn(response({})) update = jest.fn(response({}))
// @ts-ignore delete = jest.fn(response({}))
this.update = jest.fn(response({}))
// @ts-ignore
this.delete = jest.fn(response({}))
} }
const S3 = () => { class S3 {
// @ts-ignore listObjects = jest.fn(
this.listObjects = jest.fn(
response({ response({
Contents: [], Contents: [],
}) })
) )
createBucket = jest.fn(
// @ts-ignore
this.createBucket = jest.fn(
response({ response({
Contents: {}, Contents: {},
}) })
) )
deleteObjects = jest.fn(
// @ts-ignore
this.deleteObjects = jest.fn(
response({ response({
Contents: {}, Contents: {},
}) })
) )
getSignedUrl = jest.fn((operation, params) => {
// @ts-ignore
this.getSignedUrl = (operation, params) => {
return `http://example.com/${params.Bucket}/${params.Key}` return `http://example.com/${params.Bucket}/${params.Key}`
} })
headBucket = jest.fn(
// @ts-ignore
this.headBucket = jest.fn(
response({ response({
Contents: {}, Contents: {},
}) })
) )
upload = jest.fn(
// @ts-ignore
this.upload = jest.fn(
response({ response({
Contents: {}, Contents: {},
}) })
) )
getObject = jest.fn(
// @ts-ignore
this.getObject = jest.fn(
response( response(
{ {
Body: "", Body: "",
@ -86,17 +64,18 @@ module AwsMock {
{ {
createReadStream: jest createReadStream: jest
.fn() .fn()
.mockReturnValue( .mockReturnValue(fs.createReadStream(join(__dirname, "aws-sdk.ts"))),
fs.createReadStream(join(__dirname, "aws-sdk.ts"))
),
} }
) )
) )
} }
aws.DynamoDB = { DocumentClient } module.exports = {
aws.S3 = S3 DynamoDB: {
aws.config = { update: jest.fn() } DocumentClient,
},
module.exports = aws S3,
config: {
update: jest.fn(),
},
} }

View File

@ -1,24 +1,17 @@
module MsSqlMock { module.exports = {
const mssql: any = {} ConnectionPool: jest.fn(() => ({
connect: jest.fn(() => ({
mssql.query = jest.fn(() => ({ request: jest.fn(() => ({
query: jest.fn(sql => ({ recordset: [sql] })),
})),
})),
})),
query: jest.fn(() => ({
recordset: [ recordset: [
{ {
a: "string", a: "string",
b: 1, b: 1,
}, },
], ],
}))
// mssql.connect = jest.fn(() => ({ recordset: [] }))
mssql.ConnectionPool = jest.fn(() => ({
connect: jest.fn(() => ({
request: jest.fn(() => ({
query: jest.fn(sql => ({ recordset: [sql] })),
})), })),
})),
}))
module.exports = mssql
} }

View File

@ -1,6 +1,3 @@
module MySQLMock {
const mysql: any = {}
const client = { const client = {
connect: jest.fn(), connect: jest.fn(),
query: jest.fn((query, bindings, fn) => { query: jest.fn((query, bindings, fn) => {
@ -8,7 +5,7 @@ module MySQLMock {
}), }),
} }
mysql.createConnection = jest.fn(() => client) module.exports = {
createConnection: jest.fn(() => client),
module.exports = mysql client,
} }

View File

@ -1,6 +1,4 @@
module OracleDbMock { const executeMock = jest.fn(() => ({
// mock execute
const execute = jest.fn(() => ({
rows: [ rows: [
{ {
a: "string", a: "string",
@ -9,23 +7,15 @@ module OracleDbMock {
], ],
})) }))
const close = jest.fn() const closeMock = jest.fn()
// mock connection class Connection {
const Connection = () => {} execute = executeMock
Connection.prototype.execute = execute close = closeMock
Connection.prototype.close = close }
// mock oracledb module.exports = {
const oracleDb: any = {} getConnection: jest.fn(() => new Connection()),
oracleDb.getConnection = jest.fn(() => { executeMock,
// @ts-ignore closeMock,
return new Connection()
})
// expose mocks
oracleDb.executeMock = execute
oracleDb.closeMock = close
module.exports = oracleDb
} }

View File

@ -1,6 +1,3 @@
module PgMock {
const pg: any = {}
const query = jest.fn(() => ({ const query = jest.fn(() => ({
rows: [ rows: [
{ {
@ -10,20 +7,19 @@ module PgMock {
], ],
})) }))
// constructor class Client {
const Client = () => {} query = query
Client.prototype.query = query end = jest.fn(cb => {
Client.prototype.end = jest.fn(cb => {
if (cb) cb() if (cb) cb()
}) })
Client.prototype.connect = jest.fn() connect = jest.fn()
Client.prototype.release = jest.fn() release = jest.fn()
}
const on = jest.fn() const on = jest.fn()
pg.Client = Client module.exports = {
pg.queryMock = query Client,
pg.on = on queryMock: query,
on,
module.exports = pg
} }

View File

@ -330,6 +330,7 @@ describe("/queries", () => {
], ],
}, },
] ]
pg.queryMock.mockImplementation(() => ({ pg.queryMock.mockImplementation(() => ({
rows, rows,
})) }))

View File

@ -294,7 +294,7 @@ describe("Captures of real examples", () => {
type: "datasource", type: "datasource",
isSQL: false, isSQL: false,
}) })
).toEqual(true) ).toEqual(false)
}) })
it("should disable when no fields", () => { it("should disable when no fields", () => {