mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 01:18:23 +00:00
cherrypicked ee/00195c064
This commit is contained in:
parent
7997e5426f
commit
b88d500e16
3 changed files with 25 additions and 58 deletions
|
|
@ -6,39 +6,28 @@ export class ListviewDefaultMode1688977149516 implements MigrationInterface {
|
|||
const entityManager = queryRunner.manager;
|
||||
const appVersions = await entityManager.find(AppVersion);
|
||||
for (const version of appVersions) {
|
||||
const definition = version['definition'];
|
||||
const definition = JSON.parse(JSON.stringify(version?.definition));
|
||||
|
||||
if (definition) {
|
||||
const pages = definition['pages'];
|
||||
if (pages) {
|
||||
if (Object.keys(pages).length > 0) {
|
||||
for (const pageId of Object.keys(pages)) {
|
||||
const components = definition['pages'][pageId]['components'];
|
||||
if (components) {
|
||||
if (Object.keys(components).length > 0) {
|
||||
for (const componentId of Object.keys(components)) {
|
||||
const component = components[componentId];
|
||||
|
||||
if (component?.component?.component === 'Listview') {
|
||||
component['component']['definition']['properties']['mode'] = {
|
||||
value: 'list',
|
||||
};
|
||||
|
||||
components[componentId] = {
|
||||
...component,
|
||||
component: {
|
||||
...component.component,
|
||||
definition: {
|
||||
...component.component.definition,
|
||||
},
|
||||
},
|
||||
};
|
||||
if (
|
||||
component?.component?.component === 'Listview' &&
|
||||
component.component?.definition?.properties?.mode
|
||||
) {
|
||||
component.component.definition.properties.mode['value'] = 'list';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
definition['components'] = components;
|
||||
version.definition = definition;
|
||||
}
|
||||
}
|
||||
version.definition = definition;
|
||||
await entityManager.update(AppVersion, { id: version.id }, { definition });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,25 +4,23 @@ import { AppVersion } from '../src/entities/app_version.entity';
|
|||
export class CellSizeRegularCondensed1692973078520 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const entityManager = queryRunner.manager;
|
||||
const queryBuilder = queryRunner.connection.createQueryBuilder();
|
||||
|
||||
const appVersionRepository = entityManager.getRepository(AppVersion);
|
||||
|
||||
const appVersions = await appVersionRepository.find();
|
||||
|
||||
for (const version of appVersions) {
|
||||
const definition = version?.['definition'];
|
||||
const definition = JSON.parse(JSON.stringify(version?.definition));
|
||||
if (definition) {
|
||||
const pages = definition?.['pages'];
|
||||
if (pages) {
|
||||
if (Object.keys(pages).length > 0) {
|
||||
for (const pageId of Object.keys(pages)) {
|
||||
const components = pages?.[pageId]?.['components'];
|
||||
if (components) {
|
||||
const components = pages[pageId]?.['components'];
|
||||
|
||||
if (Object.keys(components).length > 0) {
|
||||
for (const componentId of Object.keys(components)) {
|
||||
const component = components[componentId];
|
||||
if (component?.component?.component === 'Table') {
|
||||
component.component.definition.styles.cellSize = {
|
||||
value: 'regular',
|
||||
};
|
||||
if (component?.component?.component === 'Table' && component.component?.definition?.styles?.cellSize) {
|
||||
component.component.styles.cellSize = {
|
||||
...component.component.styles.cellSize,
|
||||
options: [
|
||||
|
|
@ -30,27 +28,19 @@ export class CellSizeRegularCondensed1692973078520 implements MigrationInterface
|
|||
{ name: 'Regular', value: 'regular' },
|
||||
],
|
||||
};
|
||||
components[componentId] = {
|
||||
...component,
|
||||
component: {
|
||||
...component.component,
|
||||
definition: {
|
||||
...component.component.definition,
|
||||
},
|
||||
},
|
||||
|
||||
component.component.definition.styles.cellSize = {
|
||||
value: 'regular',
|
||||
};
|
||||
}
|
||||
}
|
||||
pages[pageId]['components'] = components;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
definition['pages'] = pages;
|
||||
|
||||
version.definition = definition;
|
||||
|
||||
await queryBuilder.update(AppVersion).set({ definition }).where('id = :id', { id: version.id }).execute();
|
||||
await entityManager.update(AppVersion, { id: version.id }, { definition });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@ import { AppVersion } from '../src/entities/app_version.entity';
|
|||
export class TableRowCellStyle1692974311591 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const entityManager = queryRunner.manager;
|
||||
const queryBuilder = queryRunner.connection.createQueryBuilder();
|
||||
|
||||
const appVersionRepository = entityManager.getRepository(AppVersion);
|
||||
|
||||
const appVersions = await appVersionRepository.find();
|
||||
|
||||
for (const version of appVersions) {
|
||||
const definition = version['definition'];
|
||||
const definition = JSON.parse(JSON.stringify(version?.definition));
|
||||
|
||||
if (definition) {
|
||||
const pages = definition['pages'];
|
||||
if (pages) {
|
||||
if (Object.keys(pages).length > 0) {
|
||||
for (const pageId of Object.keys(pages)) {
|
||||
const components = pages[pageId]['components'];
|
||||
if (components) {
|
||||
if (Object.keys(components).length > 0) {
|
||||
for (const componentId of Object.keys(components)) {
|
||||
const component = components[componentId];
|
||||
if (component?.component?.component === 'Table') {
|
||||
|
|
@ -32,27 +32,15 @@ export class TableRowCellStyle1692974311591 implements MigrationInterface {
|
|||
{ name: 'Striped', value: 'table-striped' },
|
||||
],
|
||||
};
|
||||
components[componentId] = {
|
||||
...component,
|
||||
component: {
|
||||
...component.component,
|
||||
definition: {
|
||||
...component.component.definition,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
pages[pageId]['components'] = components;
|
||||
}
|
||||
}
|
||||
|
||||
definition['pages'] = pages;
|
||||
|
||||
version.definition = definition;
|
||||
|
||||
await queryBuilder.update(AppVersion).set({ definition }).where('id = :id', { id: version.id }).execute();
|
||||
await entityManager.update(AppVersion, { id: version.id }, { definition });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue