Hide workflows + remove feature flag from entities (#9768)
From now on workflow entities and views will be seed for every new workspace. What will prevent user to see those is the feature flag used in frontend. It will prevent workflow objects to be stored in the recoil state. Without feature flag, workflows will: - remain invisible in metadata - not be accessible through views or show page - remain invisible on side menu
This commit is contained in:
@ -13,7 +13,6 @@ export const seedWorkspaceWithDemoData = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
objectMetadata: ObjectMetadataEntity[],
|
||||
isWorkflowEnabled: boolean,
|
||||
) => {
|
||||
const objectMetadataMap = objectMetadata.reduce((acc, object) => {
|
||||
acc[object.standardId ?? ''] = {
|
||||
@ -38,7 +37,6 @@ export const seedWorkspaceWithDemoData = async (
|
||||
entityManager,
|
||||
schemaName,
|
||||
objectMetadataMap,
|
||||
isWorkflowEnabled,
|
||||
);
|
||||
|
||||
await seedWorkspaceFavorites(
|
||||
|
||||
@ -18,7 +18,6 @@ export const seedViewWithDemoData = async (
|
||||
entityManager: EntityManager,
|
||||
schemaName: string,
|
||||
objectMetadataStandardIdToIdMap: ObjectMetadataStandardIdToIdMap,
|
||||
isWorkflowEnabled: boolean,
|
||||
) => {
|
||||
const viewDefinitions = [
|
||||
seedCompaniesAllView(objectMetadataStandardIdToIdMap),
|
||||
@ -28,13 +27,9 @@ export const seedViewWithDemoData = async (
|
||||
notesAllView(objectMetadataStandardIdToIdMap),
|
||||
tasksAllView(objectMetadataStandardIdToIdMap),
|
||||
tasksByStatusView(objectMetadataStandardIdToIdMap),
|
||||
...(isWorkflowEnabled
|
||||
? [
|
||||
workflowsAllView(objectMetadataStandardIdToIdMap),
|
||||
workflowVersionsAllView(objectMetadataStandardIdToIdMap),
|
||||
workflowRunsAllView(objectMetadataStandardIdToIdMap),
|
||||
]
|
||||
: []),
|
||||
workflowsAllView(objectMetadataStandardIdToIdMap),
|
||||
workflowVersionsAllView(objectMetadataStandardIdToIdMap),
|
||||
workflowRunsAllView(objectMetadataStandardIdToIdMap),
|
||||
];
|
||||
|
||||
return createWorkspaceViews(entityManager, schemaName, viewDefinitions);
|
||||
|
||||
@ -11,7 +11,6 @@ export const standardObjectsPrefillData = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
objectMetadata: ObjectMetadataEntity[],
|
||||
isWorkflowEnabled: boolean,
|
||||
) => {
|
||||
const objectMetadataMap = objectMetadata.reduce((acc, object) => {
|
||||
if (!object.standardId) {
|
||||
@ -41,7 +40,6 @@ export const standardObjectsPrefillData = async (
|
||||
entityManager,
|
||||
schemaName,
|
||||
objectMetadataMap,
|
||||
isWorkflowEnabled,
|
||||
);
|
||||
|
||||
await seedWorkspaceFavorites(
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';
|
||||
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
|
||||
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
|
||||
@ -104,16 +103,10 @@ export class WorkspaceManagerService {
|
||||
const createdObjectMetadata =
|
||||
await this.objectMetadataService.findManyWithinWorkspace(workspaceId);
|
||||
|
||||
const isWorkflowEnabled = await this.featureFlagService.isFeatureEnabled(
|
||||
FeatureFlagKey.IsWorkflowEnabled,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
await standardObjectsPrefillData(
|
||||
workspaceDataSource,
|
||||
dataSourceMetadata.schema,
|
||||
createdObjectMetadata,
|
||||
isWorkflowEnabled,
|
||||
);
|
||||
}
|
||||
|
||||
@ -140,16 +133,10 @@ export class WorkspaceManagerService {
|
||||
const createdObjectMetadata =
|
||||
await this.objectMetadataService.findManyWithinWorkspace(workspaceId);
|
||||
|
||||
const isWorkflowEnabled = await this.featureFlagService.isFeatureEnabled(
|
||||
FeatureFlagKey.IsWorkflowEnabled,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
await seedWorkspaceWithDemoData(
|
||||
workspaceDataSource,
|
||||
dataSourceMetadata.schema,
|
||||
createdObjectMetadata,
|
||||
isWorkflowEnabled,
|
||||
);
|
||||
|
||||
await this.seederService.seedCustomObjects(
|
||||
|
||||
Reference in New Issue
Block a user