mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Merge pull request #12494 from ToolJet/fix/container-migrate-header
fix: Migrates showHeader property to false for exiting containers
This commit is contained in:
commit
610a8fd81d
5 changed files with 74 additions and 24 deletions
|
|
@ -124,24 +124,6 @@ export const baseComponentProperties = (
|
|||
});
|
||||
}
|
||||
|
||||
items.push({
|
||||
title: 'Additional actions',
|
||||
isOpen: true,
|
||||
children: additionalActions?.map((property) =>
|
||||
renderElement(
|
||||
component,
|
||||
componentMeta,
|
||||
paramUpdated,
|
||||
dataQueries,
|
||||
property,
|
||||
'properties',
|
||||
currentState,
|
||||
allComponents,
|
||||
darkMode
|
||||
)
|
||||
),
|
||||
});
|
||||
|
||||
if (events.length > 0) {
|
||||
items.push({
|
||||
title: `${i18next.t('widget.common.events', 'Events')}`,
|
||||
|
|
@ -163,6 +145,24 @@ export const baseComponentProperties = (
|
|||
});
|
||||
}
|
||||
|
||||
items.push({
|
||||
title: 'Additional actions',
|
||||
isOpen: true,
|
||||
children: additionalActions?.map((property) =>
|
||||
renderElement(
|
||||
component,
|
||||
componentMeta,
|
||||
paramUpdated,
|
||||
dataQueries,
|
||||
property,
|
||||
'properties',
|
||||
currentState,
|
||||
allComponents,
|
||||
darkMode
|
||||
)
|
||||
),
|
||||
});
|
||||
|
||||
if (validations.length > 0) {
|
||||
items.push({
|
||||
title: `${i18next.t('widget.common.validation', 'Validation')}`,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export const containerConfig = {
|
|||
displayName: 'Show header',
|
||||
validation: {
|
||||
schema: { type: 'boolean' },
|
||||
defaultValue: false,
|
||||
defaultValue: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -154,7 +154,7 @@ export const containerConfig = {
|
|||
showOnMobile: { value: '{{false}}' },
|
||||
},
|
||||
properties: {
|
||||
showHeader: { value: `{{false}}` },
|
||||
showHeader: { value: `{{true}}` },
|
||||
loadingState: { value: `{{false}}` },
|
||||
visibility: { value: '{{true}}' },
|
||||
disabledState: { value: '{{false}}' },
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export const containerConfig = {
|
|||
displayName: 'Show header',
|
||||
validation: {
|
||||
schema: { type: 'boolean' },
|
||||
defaultValue: false,
|
||||
defaultValue: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -154,7 +154,7 @@ export const containerConfig = {
|
|||
showOnMobile: { value: '{{false}}' },
|
||||
},
|
||||
properties: {
|
||||
showHeader: { value: `{{false}}` },
|
||||
showHeader: { value: `{{true}}` },
|
||||
loadingState: { value: `{{false}}` },
|
||||
visibility: { value: '{{true}}' },
|
||||
disabledState: { value: '{{false}}' },
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
import { Component } from 'src/entities/component.entity';
|
||||
|
||||
import { processDataInBatches } from '@helpers/migration.helper';
|
||||
import { EntityManager, MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class UpdateContainerHeaderProperty1744097765065 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const componentTypes = ['Container'];
|
||||
const batchSize = 100;
|
||||
const entityManager = queryRunner.manager;
|
||||
|
||||
for (const componentType of componentTypes) {
|
||||
await processDataInBatches(
|
||||
entityManager,
|
||||
async (entityManager: EntityManager) => {
|
||||
return await entityManager.find(Component, {
|
||||
where: { type: componentType },
|
||||
order: { createdAt: 'ASC' },
|
||||
});
|
||||
},
|
||||
async (entityManager: EntityManager, components: Component[]) => {
|
||||
await this.processUpdates(entityManager, components);
|
||||
},
|
||||
batchSize
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private async processUpdates(entityManager: EntityManager, components: Component[]) {
|
||||
for (const component of components) {
|
||||
const properties = component.properties;
|
||||
const styles = component.styles;
|
||||
const general = component.general;
|
||||
|
||||
// Update showHeader property to false for old instances
|
||||
if (!properties.showHeader) {
|
||||
properties.showHeader = { value: '{{false}}' };
|
||||
}
|
||||
|
||||
// Update the modal component with the modified properties
|
||||
await entityManager.update(Component, component.id, {
|
||||
properties,
|
||||
styles,
|
||||
general,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {}
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ export const containerConfig = {
|
|||
displayName: 'Show header',
|
||||
validation: {
|
||||
schema: { type: 'boolean' },
|
||||
defaultValue: false,
|
||||
defaultValue: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -154,7 +154,7 @@ export const containerConfig = {
|
|||
showOnMobile: { value: '{{false}}' },
|
||||
},
|
||||
properties: {
|
||||
showHeader: { value: `{{false}}` },
|
||||
showHeader: { value: `{{true}}` },
|
||||
loadingState: { value: `{{false}}` },
|
||||
visibility: { value: '{{true}}' },
|
||||
disabledState: { value: '{{false}}' },
|
||||
|
|
|
|||
Loading…
Reference in a new issue