Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Aggregate queries for table views - #2] Add aggregate queries footer for simple views #9025

Merged
merged 13 commits into from
Dec 12, 2024

Conversation

ijreilly
Copy link
Collaborator

In this PR, we are introducing aggregate queries on table views, behind a feature flag.
This does not work with view groups yet, nor with views that have records until the bottom. (both will be tackled next)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces aggregate query functionality (sum, count, etc.) for table views, adding a new footer component that displays aggregate calculations for columns, with the feature protected behind a flag.

  • Added new RecordTableFooter component with sticky positioning and mobile responsiveness in /packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableFooter.tsx
  • Added useAggregateRecordsForRecordTableColumnFooter hook in /packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx for computing aggregate values
  • Extended ColumnDefinition type with optional aggregateOperation property in /packages/twenty-front/src/modules/object-record/record-table/types/ColumnDefinition.ts
  • Added buildRecordGqlFieldsAggregate utility in /packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/buildRecordGqlFieldsAggregate.ts for constructing GraphQL aggregate queries
  • Added missing aggregateOperation field in view field update mutation in /packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts

18 file(s) reviewed, 29 comment(s)
Edit PR Review Bot Settings | Greptile

import { FieldMetadataType } from "~/generated/graphql";
import { isDefined } from "~/utils/isDefined";

export const getAvailableAggregateOperationsForFieldMetadataType = ({fieldMetadataType}: {fieldMetadataType?: FieldMetadataType}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Inconsistent spacing in type definition - there should be a space after the colon

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@Weiko Weiko merged commit 05cd0d1 into main Dec 12, 2024
19 checks passed
@Weiko Weiko deleted the add-aggregate-queries-table-view-2 branch December 12, 2024 12:39
Copy link

sentry-io bot commented Dec 12, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: ViewField not found /welcome View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants