From 1ec197ce8fd6ee076fc29cd3f759fc4731564de4 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Nov 2022 10:33:57 +0000 Subject: [PATCH 1/4] Update side panel icon --- packages/client/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 4f1352f338..3b2bd31fe7 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -5189,7 +5189,7 @@ }, "sidepanel": { "name": "Side Panel", - "icon": "AdDisplay", + "icon": "RailRight", "hasChildren": true, "illegalChildren": [ "section" From 3480f6741c521f5cf9ec75e9e04e5c4cb1b7dd79 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Nov 2022 14:23:04 +0000 Subject: [PATCH 2/4] Rename table settings migration and only run on dev apps --- packages/server/src/migrations/index.ts | 4 ++-- packages/types/src/sdk/migrations.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/migrations/index.ts b/packages/server/src/migrations/index.ts index de0a1ddc54..a66d793142 100644 --- a/packages/server/src/migrations/index.ts +++ b/packages/server/src/migrations/index.ts @@ -74,10 +74,10 @@ export const buildMigrations = () => { }) break } - case MigrationName.TABLE_SETTINGS: { + case MigrationName.TABLE_SETTINGS_LINKS_TO_ACTIONS: { serverMigrations.push({ ...definition, - appOpts: { all: true }, + appOpts: { dev: true }, fn: tableSettings.run, }) break diff --git a/packages/types/src/sdk/migrations.ts b/packages/types/src/sdk/migrations.ts index 8db355a039..4667ed0c8f 100644 --- a/packages/types/src/sdk/migrations.ts +++ b/packages/types/src/sdk/migrations.ts @@ -44,7 +44,7 @@ export enum MigrationName { EVENT_GLOBAL_BACKFILL = "event_global_backfill", EVENT_INSTALLATION_BACKFILL = "event_installation_backfill", GLOBAL_INFO_SYNC_USERS = "global_info_sync_users", - TABLE_SETTINGS = "table_settings", + TABLE_SETTINGS_LINKS_TO_ACTIONS = "table_settings_links_to_actions", // increment this number to re-activate this migration SYNC_QUOTAS = "sync_quotas_1", } From 90003493602d009524e15df06a76897b271567a5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Nov 2022 14:23:27 +0000 Subject: [PATCH 3/4] Refactor table settings migration slightly and add missing await keyword --- .../src/migrations/functions/tableSettings.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/server/src/migrations/functions/tableSettings.ts b/packages/server/src/migrations/functions/tableSettings.ts index 40baf48e6a..2db3df0d0f 100644 --- a/packages/server/src/migrations/functions/tableSettings.ts +++ b/packages/server/src/migrations/functions/tableSettings.ts @@ -39,25 +39,25 @@ export const run = async (appDb: any) => { } // Recursively update any relevant components and mutate the screen docs - screens.forEach((screen: any) => { - migrateTableSettings(screen.props, screen) + for (let screen of screens) { + const changed = migrateTableSettings(screen.props) // Save screen if we updated it - if (screen.touched) { - delete screen.touched - appDb.put(screen) + if (changed) { + await appDb.put(screen) console.log( `Screen ${screen.routing?.route} contained table settings which were migrated` ) } - }) + } } // Recursively searches and mutates a screen doc to migrate table component // and table block settings -const migrateTableSettings = (component: any, screen: any) => { +const migrateTableSettings = (component: any) => { + let changed = false if (!component) { - return + return changed } // Migration 1: migrate table row click settings @@ -70,7 +70,7 @@ const migrateTableSettings = (component: any, screen: any) => { const column = linkColumn || "_id" const action = convertLinkSettingToAction(linkURL, !!linkPeek, column) if (action) { - screen.touched = true + changed = true component.onClick = action if (component._component.endsWith("/tableblock")) { component.clickBehaviour = "actions" @@ -93,7 +93,7 @@ const migrateTableSettings = (component: any, screen: any) => { !!titleButtonPeek ) if (action) { - screen.touched = true + changed = true component.onClickTitleButton = action component.titleButtonClickBehaviour = "actions" } @@ -102,8 +102,10 @@ const migrateTableSettings = (component: any, screen: any) => { // Recurse down the tree as needed component._children?.forEach((child: any) => { - migrateTableSettings(child, screen) + const childChanged = migrateTableSettings(child) + changed = changed || childChanged }) + return changed } // Util ti convert the legacy settings into a navigation action structure From cd24c408fe9d8775158a45270877a944bbe4b8a7 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Nov 2022 14:27:49 +0000 Subject: [PATCH 4/4] Rename migration --- packages/backend-core/src/migrations/definitions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/src/migrations/definitions.ts b/packages/backend-core/src/migrations/definitions.ts index 0e77eb00b4..0dd57fe639 100644 --- a/packages/backend-core/src/migrations/definitions.ts +++ b/packages/backend-core/src/migrations/definitions.ts @@ -23,7 +23,7 @@ export const DEFINITIONS: MigrationDefinition[] = [ }, { type: MigrationType.APP, - name: MigrationName.TABLE_SETTINGS, + name: MigrationName.TABLE_SETTINGS_LINKS_TO_ACTIONS, }, { type: MigrationType.GLOBAL,