1
0
Fork 0
mirror of synced 2024-10-05 12:34:50 +13:00

Merge branch 'side-panel' of github.com:Budibase/budibase into cheeks-lab-day-spreadsheet

This commit is contained in:
Andrew Kingston 2022-11-24 14:49:20 +00:00
commit 17b0647e74
5 changed files with 18 additions and 16 deletions

View file

@ -23,7 +23,7 @@ export const DEFINITIONS: MigrationDefinition[] = [
}, },
{ {
type: MigrationType.APP, type: MigrationType.APP,
name: MigrationName.TABLE_SETTINGS, name: MigrationName.TABLE_SETTINGS_LINKS_TO_ACTIONS,
}, },
{ {
type: MigrationType.GLOBAL, type: MigrationType.GLOBAL,

View file

@ -5189,7 +5189,7 @@
}, },
"sidepanel": { "sidepanel": {
"name": "Side Panel", "name": "Side Panel",
"icon": "AdDisplay", "icon": "RailRight",
"hasChildren": true, "hasChildren": true,
"illegalChildren": [ "illegalChildren": [
"section" "section"

View file

@ -39,25 +39,25 @@ export const run = async (appDb: any) => {
} }
// Recursively update any relevant components and mutate the screen docs // Recursively update any relevant components and mutate the screen docs
screens.forEach((screen: any) => { for (let screen of screens) {
migrateTableSettings(screen.props, screen) const changed = migrateTableSettings(screen.props)
// Save screen if we updated it // Save screen if we updated it
if (screen.touched) { if (changed) {
delete screen.touched await appDb.put(screen)
appDb.put(screen)
console.log( console.log(
`Screen ${screen.routing?.route} contained table settings which were migrated` `Screen ${screen.routing?.route} contained table settings which were migrated`
) )
} }
}) }
} }
// Recursively searches and mutates a screen doc to migrate table component // Recursively searches and mutates a screen doc to migrate table component
// and table block settings // and table block settings
const migrateTableSettings = (component: any, screen: any) => { const migrateTableSettings = (component: any) => {
let changed = false
if (!component) { if (!component) {
return return changed
} }
// Migration 1: migrate table row click settings // Migration 1: migrate table row click settings
@ -70,7 +70,7 @@ const migrateTableSettings = (component: any, screen: any) => {
const column = linkColumn || "_id" const column = linkColumn || "_id"
const action = convertLinkSettingToAction(linkURL, !!linkPeek, column) const action = convertLinkSettingToAction(linkURL, !!linkPeek, column)
if (action) { if (action) {
screen.touched = true changed = true
component.onClick = action component.onClick = action
if (component._component.endsWith("/tableblock")) { if (component._component.endsWith("/tableblock")) {
component.clickBehaviour = "actions" component.clickBehaviour = "actions"
@ -93,7 +93,7 @@ const migrateTableSettings = (component: any, screen: any) => {
!!titleButtonPeek !!titleButtonPeek
) )
if (action) { if (action) {
screen.touched = true changed = true
component.onClickTitleButton = action component.onClickTitleButton = action
component.titleButtonClickBehaviour = "actions" component.titleButtonClickBehaviour = "actions"
} }
@ -102,8 +102,10 @@ const migrateTableSettings = (component: any, screen: any) => {
// Recurse down the tree as needed // Recurse down the tree as needed
component._children?.forEach((child: any) => { 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 // Util ti convert the legacy settings into a navigation action structure

View file

@ -74,10 +74,10 @@ export const buildMigrations = () => {
}) })
break break
} }
case MigrationName.TABLE_SETTINGS: { case MigrationName.TABLE_SETTINGS_LINKS_TO_ACTIONS: {
serverMigrations.push({ serverMigrations.push({
...definition, ...definition,
appOpts: { all: true }, appOpts: { dev: true },
fn: tableSettings.run, fn: tableSettings.run,
}) })
break break

View file

@ -44,7 +44,7 @@ export enum MigrationName {
EVENT_GLOBAL_BACKFILL = "event_global_backfill", EVENT_GLOBAL_BACKFILL = "event_global_backfill",
EVENT_INSTALLATION_BACKFILL = "event_installation_backfill", EVENT_INSTALLATION_BACKFILL = "event_installation_backfill",
GLOBAL_INFO_SYNC_USERS = "global_info_sync_users", 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 // increment this number to re-activate this migration
SYNC_QUOTAS = "sync_quotas_1", SYNC_QUOTAS = "sync_quotas_1",
} }