feat: view groups (#7176)
Fix #4244 and #4356 This pull request introduces the new "view groups" capability, enabling the reordering, hiding, and showing of columns in Kanban mode. The core enhancement includes the addition of a new entity named `ViewGroup`, which manages column behaviors and interactions. #### Key Changes: 1. **ViewGroup Entity**: The newly added `ViewGroup` entity is responsible for handling the organization and state of columns. This includes: - The ability to reorder columns. - The option to hide or show specific columns based on user preferences. #### Conclusion: This PR adds a significant new feature that enhances the flexibility of Kanban views through the `ViewGroup` entity. We'll later add the view group logic to table view too. --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -0,0 +1,77 @@
|
||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { VIEW_GROUP_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { ViewWorkspaceEntity } from 'src/modules/view/standard-objects/view.workspace-entity';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.viewGroup,
|
||||
namePlural: 'viewGroups',
|
||||
labelSingular: 'View Group',
|
||||
labelPlural: 'View Groups',
|
||||
description: '(System) View Groups',
|
||||
icon: 'IconTag',
|
||||
})
|
||||
@WorkspaceIsNotAuditLogged()
|
||||
@WorkspaceIsSystem()
|
||||
export class ViewGroupWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: VIEW_GROUP_STANDARD_FIELD_IDS.fieldMetadataId,
|
||||
type: FieldMetadataType.UUID,
|
||||
label: 'Field Metadata Id',
|
||||
description: 'View Group target field',
|
||||
icon: 'IconTag',
|
||||
})
|
||||
fieldMetadataId: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: VIEW_GROUP_STANDARD_FIELD_IDS.isVisible,
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: 'Visible',
|
||||
description: 'View Group visibility',
|
||||
icon: 'IconEye',
|
||||
defaultValue: true,
|
||||
})
|
||||
isVisible: boolean;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: VIEW_GROUP_STANDARD_FIELD_IDS.fieldValue,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Field Value',
|
||||
description: 'Group by this field value',
|
||||
})
|
||||
fieldValue: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: VIEW_GROUP_STANDARD_FIELD_IDS.position,
|
||||
type: FieldMetadataType.NUMBER,
|
||||
label: 'Position',
|
||||
description: 'View Field position',
|
||||
icon: 'IconList',
|
||||
defaultValue: 0,
|
||||
})
|
||||
position: number;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: VIEW_GROUP_STANDARD_FIELD_IDS.view,
|
||||
type: RelationMetadataType.MANY_TO_ONE,
|
||||
label: 'View',
|
||||
description: 'View Group related view',
|
||||
icon: 'IconLayoutCollage',
|
||||
inverseSideTarget: () => ViewWorkspaceEntity,
|
||||
inverseSideFieldKey: 'viewGroups',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
view?: ViewWorkspaceEntity | null;
|
||||
|
||||
@WorkspaceJoinColumn('view')
|
||||
viewId: string | null;
|
||||
}
|
||||
@ -18,6 +18,7 @@ import { FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/f
|
||||
import { ViewFieldWorkspaceEntity } from 'src/modules/view/standard-objects/view-field.workspace-entity';
|
||||
import { ViewFilterWorkspaceEntity } from 'src/modules/view/standard-objects/view-filter.workspace-entity';
|
||||
import { ViewSortWorkspaceEntity } from 'src/modules/view/standard-objects/view-sort.workspace-entity';
|
||||
import { ViewGroupWorkspaceEntity } from 'src/modules/view/standard-objects/view-group.workspace-entity';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.view,
|
||||
@ -113,6 +114,18 @@ export class ViewWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
viewFields: Relation<ViewFieldWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: VIEW_STANDARD_FIELD_IDS.viewGroups,
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
label: 'View Groups',
|
||||
description: 'View Groups',
|
||||
icon: 'IconTag',
|
||||
inverseSideTarget: () => ViewGroupWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
viewGroups: Relation<ViewGroupWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: VIEW_STANDARD_FIELD_IDS.viewFilters,
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
|
||||
Reference in New Issue
Block a user