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:
Jérémy M
2024-10-24 15:38:52 +02:00
committed by GitHub
parent 68a060a046
commit e8d96cfd10
61 changed files with 1408 additions and 508 deletions

View File

@ -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;

View File

@ -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,
},
],
};
};

View File

@ -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,
},
],
};
};