From 5e9b92cd1d657dd83fdf0dd3e90592e9034433c4 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 19 Mar 2024 15:25:56 +0000 Subject: [PATCH 1/6] Update pro and account portal references. --- packages/account-portal | 2 +- packages/pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account-portal b/packages/account-portal index 7f388799c0..6465dc9c2a 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit 7f388799c023c37b9e13663819f3ee402ade4adf +Subproject commit 6465dc9c2a38e1380b32204cad4ae0c1f33e065a diff --git a/packages/pro b/packages/pro index cbc1197dc4..7d1b3eaf33 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit cbc1197dc4b6982c1fcdc8c99b53bf9292e6e3b2 +Subproject commit 7d1b3eaf33e560d19d591813e5bba91d75ef3953 From 7dc9e4ef3f3ffa4f652dbe2ee8a4b45fc526e959 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 19 Mar 2024 15:34:02 +0000 Subject: [PATCH 2/6] Fix incorrect test. --- packages/server/src/integrations/tests/sqlAlias.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/tests/sqlAlias.spec.ts b/packages/server/src/integrations/tests/sqlAlias.spec.ts index 8bef9e59d2..ccb164bcfd 100644 --- a/packages/server/src/integrations/tests/sqlAlias.spec.ts +++ b/packages/server/src/integrations/tests/sqlAlias.spec.ts @@ -294,7 +294,7 @@ describe("Captures of real examples", () => { type: "datasource", isSQL: false, }) - ).toEqual(true) + ).toEqual(false) }) it("should disable when no fields", () => { From 2a100eef293a92e514ca3ce85c2b462a2ef87904 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 19 Mar 2024 16:46:07 +0100 Subject: [PATCH 3/6] Remove flakiness name generator --- .../backend-core/tests/core/utilities/structures/userGroups.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/tests/core/utilities/structures/userGroups.ts b/packages/backend-core/tests/core/utilities/structures/userGroups.ts index 4dc870a00a..4af3f72e51 100644 --- a/packages/backend-core/tests/core/utilities/structures/userGroups.ts +++ b/packages/backend-core/tests/core/utilities/structures/userGroups.ts @@ -3,7 +3,7 @@ import { generator } from "./generator" export function userGroup(): UserGroup { return { - name: generator.word(), + name: generator.guid(), icon: generator.word(), color: generator.word(), } From 35e1114fac4543f756543f716015c8eab24deb43 Mon Sep 17 00:00:00 2001 From: Conor Webb <126772285+ConorWebb96@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:13:28 +0000 Subject: [PATCH 4/6] Added a setting to allow the title's text alignment to be changed (#13235) * Added setting to allow title text alignment to be set and changed * Switched out for icons instead of a select as per feedback. * Edited right icon to display the correct icon. * Updated to use the paragrah alignment component icons. * Added button list component * Reworked template to use BarButtonList over ActionButton component * Updated selectedArray name to alignmentOptions provides better meaning --- .../_components/Navigation/index.svelte | 20 +++++++++++++++++++ .../builder/src/stores/builder/navigation.js | 1 + .../client/src/components/app/Layout.svelte | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte index 50e1ad0cf8..4db218f60b 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte @@ -24,6 +24,13 @@ navigationStore, } from "stores/builder" 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 .map(screen => screen.routing?.route) @@ -46,6 +53,10 @@ notifications.error("Error updating navigation settings") } } + + const updateTextAlign = textAlignValue => { + navigationStore.syncAppNavigation({ textAlign: textAlignValue }) + } update("title", e.detail)} updateOnChange={false} /> + +
+ +
+ {/if}
diff --git a/packages/builder/src/stores/builder/navigation.js b/packages/builder/src/stores/builder/navigation.js index 88565de99d..0cc4923c56 100644 --- a/packages/builder/src/stores/builder/navigation.js +++ b/packages/builder/src/stores/builder/navigation.js @@ -11,6 +11,7 @@ export const INITIAL_NAVIGATION_STATE = { hideLogo: null, logoUrl: null, hideTitle: null, + textAlign: "Left", navBackground: null, navWidth: null, navTextColor: null, diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index f1dcdf6b37..1b92c0fefc 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -36,6 +36,7 @@ export let pageWidth export let logoLinkUrl export let openLogoLinkInNewTab + export let textAlign export let embedded = false @@ -226,7 +227,7 @@ {/if} {/if} {#if !hideTitle && title} - {title} + {title} {/if}
{#if !embedded} From 9eeb04fa9527c24038c98efd1bfb874564fad33e Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 19 Mar 2024 16:50:48 +0000 Subject: [PATCH 5/6] Fix broken mocks. --- packages/server/__mocks__/airtable.ts | 11 +- packages/server/__mocks__/aws-sdk.ts | 169 ++++++++---------- packages/server/__mocks__/mssql.ts | 27 ++- packages/server/__mocks__/mysql2.ts | 23 ++- packages/server/__mocks__/oracledb.ts | 46 ++--- packages/server/__mocks__/pg.ts | 46 +++-- .../routes/tests/queries/query.seq.spec.ts | 1 + 7 files changed, 138 insertions(+), 185 deletions(-) diff --git a/packages/server/__mocks__/airtable.ts b/packages/server/__mocks__/airtable.ts index f4dd974d7e..fed30ca069 100644 --- a/packages/server/__mocks__/airtable.ts +++ b/packages/server/__mocks__/airtable.ts @@ -1,8 +1,5 @@ -module AirtableMock { - const Airtable = () => { - // @ts-ignore - this.base = jest.fn() - } - - module.exports = Airtable +class Airtable { + base = jest.fn() } + +module.exports = Airtable diff --git a/packages/server/__mocks__/aws-sdk.ts b/packages/server/__mocks__/aws-sdk.ts index f23425a7be..d6d33f6c46 100644 --- a/packages/server/__mocks__/aws-sdk.ts +++ b/packages/server/__mocks__/aws-sdk.ts @@ -1,102 +1,81 @@ import fs from "fs" import { join } from "path" -module AwsMock { - const aws: any = {} +const response = (body: any, extra?: any) => () => ({ + promise: () => body, + ...extra, +}) - const response = (body: any, extra?: any) => () => ({ - promise: () => body, - ...extra, - }) - - const DocumentClient = () => { - // @ts-ignore - this.put = jest.fn(response({})) - // @ts-ignore - this.query = jest.fn( - response({ - Items: [], - }) - ) - // @ts-ignore - this.scan = jest.fn( - response({ - Items: [ - { - Name: "test", - }, - ], - }) - ) - // @ts-ignore - this.get = jest.fn(response({})) - // @ts-ignore - this.update = jest.fn(response({})) - // @ts-ignore - this.delete = jest.fn(response({})) - } - - const S3 = () => { - // @ts-ignore - this.listObjects = jest.fn( - response({ - Contents: [], - }) - ) - - // @ts-ignore - this.createBucket = jest.fn( - response({ - Contents: {}, - }) - ) - - // @ts-ignore - this.deleteObjects = jest.fn( - response({ - Contents: {}, - }) - ) - - // @ts-ignore - this.getSignedUrl = (operation, params) => { - return `http://example.com/${params.Bucket}/${params.Key}` - } - - // @ts-ignore - this.headBucket = jest.fn( - response({ - Contents: {}, - }) - ) - - // @ts-ignore - this.upload = jest.fn( - response({ - Contents: {}, - }) - ) - - // @ts-ignore - this.getObject = jest.fn( - response( +class DocumentClient { + put = jest.fn(response({})) + query = jest.fn( + response({ + Items: [], + }) + ) + scan = jest.fn( + response({ + Items: [ { - Body: "", + Name: "test", }, - { - createReadStream: jest - .fn() - .mockReturnValue( - fs.createReadStream(join(__dirname, "aws-sdk.ts")) - ), - } - ) - ) - } - - aws.DynamoDB = { DocumentClient } - aws.S3 = S3 - aws.config = { update: jest.fn() } - - module.exports = aws + ], + }) + ) + get = jest.fn(response({})) + update = jest.fn(response({})) + delete = jest.fn(response({})) +} + +class S3 { + listObjects = jest.fn( + response({ + Contents: [], + }) + ) + createBucket = jest.fn( + response({ + Contents: {}, + }) + ) + deleteObjects = jest.fn( + response({ + Contents: {}, + }) + ) + getSignedUrl = jest.fn((operation, params) => { + return `http://example.com/${params.Bucket}/${params.Key}` + }) + headBucket = jest.fn( + response({ + Contents: {}, + }) + ) + upload = jest.fn( + response({ + Contents: {}, + }) + ) + getObject = jest.fn( + response( + { + Body: "", + }, + { + createReadStream: jest + .fn() + .mockReturnValue(fs.createReadStream(join(__dirname, "aws-sdk.ts"))), + } + ) + ) +} + +module.exports = { + DynamoDB: { + DocumentClient, + }, + S3, + config: { + update: jest.fn(), + }, } diff --git a/packages/server/__mocks__/mssql.ts b/packages/server/__mocks__/mssql.ts index cdfb7d520e..6a34e1e9d7 100644 --- a/packages/server/__mocks__/mssql.ts +++ b/packages/server/__mocks__/mssql.ts @@ -1,24 +1,17 @@ -module MsSqlMock { - const mssql: any = {} - - mssql.query = jest.fn(() => ({ +module.exports = { + ConnectionPool: jest.fn(() => ({ + connect: jest.fn(() => ({ + request: jest.fn(() => ({ + query: jest.fn(sql => ({ recordset: [sql] })), + })), + })), + })), + query: jest.fn(() => ({ recordset: [ { a: "string", 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 + })), } diff --git a/packages/server/__mocks__/mysql2.ts b/packages/server/__mocks__/mysql2.ts index 9d42a35dd8..67ff897811 100644 --- a/packages/server/__mocks__/mysql2.ts +++ b/packages/server/__mocks__/mysql2.ts @@ -1,14 +1,11 @@ -module MySQLMock { - const mysql: any = {} - - const client = { - connect: jest.fn(), - query: jest.fn((query, bindings, fn) => { - fn(null, []) - }), - } - - mysql.createConnection = jest.fn(() => client) - - module.exports = mysql +const client = { + connect: jest.fn(), + query: jest.fn((query, bindings, fn) => { + fn(null, []) + }), +} + +module.exports = { + createConnection: jest.fn(() => client), + client, } diff --git a/packages/server/__mocks__/oracledb.ts b/packages/server/__mocks__/oracledb.ts index 63d6b0887b..0172ace0e6 100644 --- a/packages/server/__mocks__/oracledb.ts +++ b/packages/server/__mocks__/oracledb.ts @@ -1,31 +1,21 @@ -module OracleDbMock { - // mock execute - const execute = jest.fn(() => ({ - rows: [ - { - a: "string", - b: 1, - }, - ], - })) +const executeMock = jest.fn(() => ({ + rows: [ + { + a: "string", + b: 1, + }, + ], +})) - const close = jest.fn() +const closeMock = jest.fn() - // mock connection - const Connection = () => {} - Connection.prototype.execute = execute - Connection.prototype.close = close - - // mock oracledb - const oracleDb: any = {} - oracleDb.getConnection = jest.fn(() => { - // @ts-ignore - return new Connection() - }) - - // expose mocks - oracleDb.executeMock = execute - oracleDb.closeMock = close - - module.exports = oracleDb +class Connection { + execute = executeMock + close = closeMock +} + +module.exports = { + getConnection: jest.fn(() => new Connection()), + executeMock, + closeMock, } diff --git a/packages/server/__mocks__/pg.ts b/packages/server/__mocks__/pg.ts index d7db297335..50a7c7349e 100644 --- a/packages/server/__mocks__/pg.ts +++ b/packages/server/__mocks__/pg.ts @@ -1,29 +1,25 @@ -module PgMock { - const pg: any = {} +const query = jest.fn(() => ({ + rows: [ + { + a: "string", + b: 1, + }, + ], +})) - const query = jest.fn(() => ({ - rows: [ - { - a: "string", - b: 1, - }, - ], - })) - - // constructor - const Client = () => {} - Client.prototype.query = query - Client.prototype.end = jest.fn(cb => { +class Client { + query = query + end = jest.fn(cb => { if (cb) cb() }) - Client.prototype.connect = jest.fn() - Client.prototype.release = jest.fn() - - const on = jest.fn() - - pg.Client = Client - pg.queryMock = query - pg.on = on - - module.exports = pg + connect = jest.fn() + release = jest.fn() +} + +const on = jest.fn() + +module.exports = { + Client, + queryMock: query, + on, } diff --git a/packages/server/src/api/routes/tests/queries/query.seq.spec.ts b/packages/server/src/api/routes/tests/queries/query.seq.spec.ts index 0ca424c48b..10b90eafb1 100644 --- a/packages/server/src/api/routes/tests/queries/query.seq.spec.ts +++ b/packages/server/src/api/routes/tests/queries/query.seq.spec.ts @@ -330,6 +330,7 @@ describe("/queries", () => { ], }, ] + pg.queryMock.mockImplementation(() => ({ rows, })) From 5ef1bd655cb75adb5690606f6db39d3638f8495f Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 19 Mar 2024 16:55:28 +0000 Subject: [PATCH 6/6] Update pro reference. --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 7d1b3eaf33..993b9f010f 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 7d1b3eaf33e560d19d591813e5bba91d75ef3953 +Subproject commit 993b9f010f619b7f8b50c89105c645e3d874929e