Remove front component and command menu item old seeds (#18737)
Deprecated seeds
This commit is contained in:
-7
@@ -1,7 +0,0 @@
|
|||||||
export const FRONT_COMPONENT_SEEDS = {
|
|
||||||
DEMO_APP: 'DEMO_APP',
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const COMMAND_MENU_ITEM_SEEDS = {
|
|
||||||
DEMO_FRONT_COMPONENT: 'DEMO_FRONT_COMPONENT',
|
|
||||||
} as const;
|
|
||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
import { CommandMenuItemAvailabilityType } from 'src/engine/metadata-modules/command-menu-item/enums/command-menu-item-availability-type.enum';
|
|
||||||
import {
|
|
||||||
COMMAND_MENU_ITEM_SEEDS,
|
|
||||||
FRONT_COMPONENT_SEEDS,
|
|
||||||
} from 'src/engine/workspace-manager/dev-seeder/core/constants/front-component-and-command-menu-item-seeds.constant';
|
|
||||||
import { generateSeedId } from 'src/engine/workspace-manager/dev-seeder/core/utils/generate-seed-id.util';
|
|
||||||
|
|
||||||
type FrontComponentSeed = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
workspaceId: string;
|
|
||||||
universalIdentifier: string;
|
|
||||||
applicationId: string;
|
|
||||||
sourceComponentPath: string;
|
|
||||||
builtComponentPath: string;
|
|
||||||
componentName: string;
|
|
||||||
builtComponentChecksum: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type CommandMenuItemSeed = {
|
|
||||||
id: string;
|
|
||||||
workspaceId: string;
|
|
||||||
universalIdentifier: string;
|
|
||||||
applicationId: string;
|
|
||||||
workflowVersionId: null;
|
|
||||||
frontComponentId: string;
|
|
||||||
label: string;
|
|
||||||
icon: string | null;
|
|
||||||
isPinned: boolean;
|
|
||||||
availabilityType: CommandMenuItemAvailabilityType;
|
|
||||||
availabilityObjectMetadataId: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
type FrontComponentAndCommandMenuItemSeeds = {
|
|
||||||
frontComponents: FrontComponentSeed[];
|
|
||||||
commandMenuItems: CommandMenuItemSeed[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getFrontComponentAndCommandMenuItemDataSeeds = (
|
|
||||||
workspaceId: string,
|
|
||||||
applicationId: string,
|
|
||||||
): FrontComponentAndCommandMenuItemSeeds => {
|
|
||||||
const frontComponentId = generateSeedId(
|
|
||||||
workspaceId,
|
|
||||||
FRONT_COMPONENT_SEEDS.DEMO_APP,
|
|
||||||
);
|
|
||||||
|
|
||||||
const frontComponents: FrontComponentSeed[] = [
|
|
||||||
{
|
|
||||||
id: frontComponentId,
|
|
||||||
name: 'Demo App',
|
|
||||||
workspaceId,
|
|
||||||
universalIdentifier: frontComponentId,
|
|
||||||
applicationId,
|
|
||||||
sourceComponentPath: 'src/front-components/demo-app.tsx',
|
|
||||||
builtComponentPath: 'src/front-components/demo-app.mjs',
|
|
||||||
componentName: 'DemoApp',
|
|
||||||
builtComponentChecksum: '1234567890',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const commandMenuItemId = generateSeedId(
|
|
||||||
workspaceId,
|
|
||||||
COMMAND_MENU_ITEM_SEEDS.DEMO_FRONT_COMPONENT,
|
|
||||||
);
|
|
||||||
|
|
||||||
const commandMenuItems: CommandMenuItemSeed[] = [
|
|
||||||
{
|
|
||||||
id: commandMenuItemId,
|
|
||||||
workspaceId,
|
|
||||||
universalIdentifier: commandMenuItemId,
|
|
||||||
applicationId,
|
|
||||||
workflowVersionId: null,
|
|
||||||
frontComponentId,
|
|
||||||
label: 'Open Demo App',
|
|
||||||
icon: 'IconApps',
|
|
||||||
isPinned: false,
|
|
||||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
|
||||||
availabilityObjectMetadataId: null,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return { frontComponents, commandMenuItems };
|
|
||||||
};
|
|
||||||
-88
@@ -1,88 +0,0 @@
|
|||||||
import { type DataSource } from 'typeorm';
|
|
||||||
|
|
||||||
import { getFrontComponentAndCommandMenuItemDataSeeds } from 'src/engine/workspace-manager/dev-seeder/core/utils/get-front-component-and-command-menu-item-data-seeds.util';
|
|
||||||
|
|
||||||
type SeedFrontComponentsAndCommandMenuItemsArgs = {
|
|
||||||
dataSource: DataSource;
|
|
||||||
schemaName: string;
|
|
||||||
workspaceId: string;
|
|
||||||
applicationId: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const seedFrontComponentsAndCommandMenuItems = async ({
|
|
||||||
dataSource,
|
|
||||||
schemaName,
|
|
||||||
workspaceId,
|
|
||||||
applicationId,
|
|
||||||
}: SeedFrontComponentsAndCommandMenuItemsArgs) => {
|
|
||||||
const { frontComponents, commandMenuItems } =
|
|
||||||
getFrontComponentAndCommandMenuItemDataSeeds(workspaceId, applicationId);
|
|
||||||
|
|
||||||
if (frontComponents.length > 0) {
|
|
||||||
await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(`${schemaName}.frontComponent`, [
|
|
||||||
'id',
|
|
||||||
'name',
|
|
||||||
'workspaceId',
|
|
||||||
'universalIdentifier',
|
|
||||||
'applicationId',
|
|
||||||
'sourceComponentPath',
|
|
||||||
'builtComponentPath',
|
|
||||||
'componentName',
|
|
||||||
'builtComponentChecksum',
|
|
||||||
])
|
|
||||||
.values(
|
|
||||||
frontComponents.map((row) => ({
|
|
||||||
id: row.id,
|
|
||||||
name: row.name,
|
|
||||||
workspaceId: row.workspaceId,
|
|
||||||
universalIdentifier: row.universalIdentifier,
|
|
||||||
applicationId: row.applicationId,
|
|
||||||
sourceComponentPath: row.sourceComponentPath,
|
|
||||||
builtComponentPath: row.builtComponentPath,
|
|
||||||
componentName: row.componentName,
|
|
||||||
builtComponentChecksum: row.builtComponentChecksum,
|
|
||||||
})),
|
|
||||||
)
|
|
||||||
.orIgnore()
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commandMenuItems.length > 0) {
|
|
||||||
await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(`${schemaName}.commandMenuItem`, [
|
|
||||||
'id',
|
|
||||||
'workspaceId',
|
|
||||||
'universalIdentifier',
|
|
||||||
'applicationId',
|
|
||||||
'workflowVersionId',
|
|
||||||
'frontComponentId',
|
|
||||||
'label',
|
|
||||||
'icon',
|
|
||||||
'isPinned',
|
|
||||||
'availabilityType',
|
|
||||||
'availabilityObjectMetadataId',
|
|
||||||
])
|
|
||||||
.values(
|
|
||||||
commandMenuItems.map((row) => ({
|
|
||||||
id: row.id,
|
|
||||||
workspaceId: row.workspaceId,
|
|
||||||
universalIdentifier: row.universalIdentifier,
|
|
||||||
applicationId: row.applicationId,
|
|
||||||
workflowVersionId: row.workflowVersionId,
|
|
||||||
frontComponentId: row.frontComponentId,
|
|
||||||
label: row.label,
|
|
||||||
icon: row.icon,
|
|
||||||
isPinned: row.isPinned,
|
|
||||||
availabilityType: row.availabilityType,
|
|
||||||
availabilityObjectMetadataId: row.availabilityObjectMetadataId,
|
|
||||||
})),
|
|
||||||
)
|
|
||||||
.orIgnore()
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
-18
@@ -18,7 +18,6 @@ import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/work
|
|||||||
import { SeededWorkspacesIds } from 'src/engine/workspace-manager/dev-seeder/core/constants/seeder-workspaces.constant';
|
import { SeededWorkspacesIds } from 'src/engine/workspace-manager/dev-seeder/core/constants/seeder-workspaces.constant';
|
||||||
import { DevSeederPermissionsService } from 'src/engine/workspace-manager/dev-seeder/core/services/dev-seeder-permissions.service';
|
import { DevSeederPermissionsService } from 'src/engine/workspace-manager/dev-seeder/core/services/dev-seeder-permissions.service';
|
||||||
import { seedCoreSchema } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-core-schema.util';
|
import { seedCoreSchema } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-core-schema.util';
|
||||||
import { seedFrontComponentsAndCommandMenuItems } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-front-components-and-command-menu-items.util';
|
|
||||||
import { seedPageLayoutTabs } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-page-layout-tabs.util';
|
import { seedPageLayoutTabs } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-page-layout-tabs.util';
|
||||||
import { seedPageLayoutWidgets } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-page-layout-widgets.util';
|
import { seedPageLayoutWidgets } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-page-layout-widgets.util';
|
||||||
import { seedPageLayouts } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-page-layouts.util';
|
import { seedPageLayouts } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-page-layouts.util';
|
||||||
@@ -151,23 +150,6 @@ export class DevSeederService {
|
|||||||
featureFlags: featureFlagsMap,
|
featureFlags: featureFlagsMap,
|
||||||
});
|
});
|
||||||
|
|
||||||
await seedFrontComponentsAndCommandMenuItems({
|
|
||||||
dataSource: this.coreDataSource,
|
|
||||||
schemaName: 'core',
|
|
||||||
workspaceId,
|
|
||||||
applicationId: workspaceCustomFlatApplication.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
const relatedCommandMenuItemAndFrontComponentCacheKeysToInvalidate = [
|
|
||||||
...getMetadataRelatedMetadataNames(ALL_METADATA_NAME.commandMenuItem),
|
|
||||||
...getMetadataRelatedMetadataNames(ALL_METADATA_NAME.frontComponent),
|
|
||||||
].map(getMetadataFlatEntityMapsKey);
|
|
||||||
|
|
||||||
await this.workspaceCacheService.invalidateAndRecompute(
|
|
||||||
workspaceId,
|
|
||||||
relatedCommandMenuItemAndFrontComponentCacheKeysToInvalidate,
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.workspaceCacheStorageService.flush(workspaceId, undefined);
|
await this.workspaceCacheStorageService.flush(workspaceId, undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user