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:
@ -126,6 +126,33 @@ export const viewPrefillData = async (
|
||||
)
|
||||
.execute();
|
||||
}
|
||||
|
||||
if (
|
||||
'groups' in viewDefinition &&
|
||||
viewDefinition.groups &&
|
||||
viewDefinition.groups.length > 0
|
||||
) {
|
||||
await entityManager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.viewGroup`, [
|
||||
'fieldMetadataId',
|
||||
'isVisible',
|
||||
'fieldValue',
|
||||
'position',
|
||||
'viewId',
|
||||
])
|
||||
.values(
|
||||
viewDefinition.groups.map((group: any) => ({
|
||||
fieldMetadataId: group.fieldMetadataId,
|
||||
isVisible: group.isVisible,
|
||||
fieldValue: group.fieldValue,
|
||||
position: group.position,
|
||||
viewId: viewDefinition.id,
|
||||
})),
|
||||
)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
return viewDefinitionsWithId;
|
||||
|
||||
@ -73,5 +73,52 @@ export const opportunitiesByStageView = (
|
||||
size: 150,
|
||||
},
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.stage
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'NEW',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.stage
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'SCREENING',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.stage
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'MEETING',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.stage
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'PROPOSAL',
|
||||
position: 3,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.stage
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'CUSTOMER',
|
||||
position: 4,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
@ -89,5 +89,34 @@ export const tasksByStatusView = (
|
||||
},
|
||||
*/
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[
|
||||
TASK_STANDARD_FIELD_IDS.status
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'TODO',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[
|
||||
TASK_STANDARD_FIELD_IDS.status
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'IN_PROGESS',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.task].fields[
|
||||
TASK_STANDARD_FIELD_IDS.status
|
||||
],
|
||||
isVisible: true,
|
||||
fieldValue: 'DONE',
|
||||
position: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
@ -368,6 +368,14 @@ export const VIEW_FIELD_STANDARD_FIELD_IDS = {
|
||||
view: '20202020-e8da-4521-afab-d6d231f9fa18',
|
||||
};
|
||||
|
||||
export const VIEW_GROUP_STANDARD_FIELD_IDS = {
|
||||
fieldMetadataId: '20202020-8f26-46ae-afed-fdacd7778682',
|
||||
fieldValue: '20202020-175e-4596-b7a4-1cd9d14e5a30',
|
||||
isVisible: '20202020-0fed-4b44-88fd-a064c4fcfce4',
|
||||
position: '20202020-748e-4645-8f32-84aae7726c04',
|
||||
view: '20202020-5bc7-4110-b23f-fb851fb133b4',
|
||||
};
|
||||
|
||||
export const VIEW_FILTER_STANDARD_FIELD_IDS = {
|
||||
fieldMetadataId: '20202020-c9aa-4c94-8d0e-9592f5008fb0',
|
||||
operand: '20202020-bd23-48c4-9fab-29d1ffb80310',
|
||||
@ -392,6 +400,7 @@ export const VIEW_STANDARD_FIELD_IDS = {
|
||||
position: '20202020-e9db-4303-b271-e8250c450172',
|
||||
isCompact: '20202020-674e-4314-994d-05754ea7b22b',
|
||||
viewFields: '20202020-542b-4bdc-b177-b63175d48edf',
|
||||
viewGroups: '20202020-e1a1-419f-ac81-1986a5ea59a8',
|
||||
viewFilters: '20202020-ff23-4154-b63c-21fb36cd0967',
|
||||
viewSorts: '20202020-891b-45c3-9fe1-80a75b4aa043',
|
||||
favorites: '20202020-c818-4a86-8284-9ec0ef0a59a5',
|
||||
|
||||
@ -35,6 +35,7 @@ export const STANDARD_OBJECT_IDS = {
|
||||
taskTarget: '20202020-5a9a-44e8-95df-771cd06d0fb1',
|
||||
timelineActivity: '20202020-6736-4337-b5c4-8b39fae325a5',
|
||||
viewField: '20202020-4d19-4655-95bf-b2a04cf206d4',
|
||||
viewGroup: '20202020-725f-47a4-8008-4255f9519f70',
|
||||
viewFilter: '20202020-6fb6-4631-aded-b7d67e952ec8',
|
||||
viewSort: '20202020-e46a-47a8-939a-e5d911f83531',
|
||||
view: '20202020-722e-4739-8e2c-0c372d661f49',
|
||||
|
||||
@ -28,6 +28,7 @@ import { BehavioralEventWorkspaceEntity } from 'src/modules/timeline/standard-ob
|
||||
import { TimelineActivityWorkspaceEntity } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity';
|
||||
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 { ViewGroupWorkspaceEntity } from 'src/modules/view/standard-objects/view-group.workspace-entity';
|
||||
import { ViewSortWorkspaceEntity } from 'src/modules/view/standard-objects/view-sort.workspace-entity';
|
||||
import { ViewWorkspaceEntity } from 'src/modules/view/standard-objects/view.workspace-entity';
|
||||
import { WebhookWorkspaceEntity } from 'src/modules/webhook/standard-objects/webhook.workspace-entity';
|
||||
@ -56,6 +57,7 @@ export const standardObjectMetadataDefinitions = [
|
||||
FavoriteWorkspaceEntity,
|
||||
TimelineActivityWorkspaceEntity,
|
||||
ViewFieldWorkspaceEntity,
|
||||
ViewGroupWorkspaceEntity,
|
||||
ViewFilterWorkspaceEntity,
|
||||
ViewSortWorkspaceEntity,
|
||||
ViewWorkspaceEntity,
|
||||
|
||||
Reference in New Issue
Block a user