Repository navigation
Todo
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
- The counts per status or per month are the next question after the single numbers.
Why this is needed
- After single numbers, users ask for counts per status or per month; today the API has no grouped counts.
- buildiq parity: chart is a buildiq aggregation widget; the feature comparison says Tables "lacks, needs aggregations on the API".
- Plan: part of the aggregation widgets, behind the aggregation endpoint ("the aggregation endpoint (sprint 2) before the aggregation widgets"). Grouping by the target of a relation needs
extendfor relation cells (Relations: filter, sort, inverse lookups, inline resolve, import and export #3347). Acceptance path 4 and the page filter (Page filter widget for the widgets on a page #3433) depend on them.
Describe the solution you'd like
- Widgets that plot grouped and timeseries aggregates: a chart (bar, line or pie) and a stacked bar over two grouping columns.
- Depends on the aggregation endpoint. Links: project plan, sprint 2.
Diagram
sequenceDiagram
actor U as Viewer
participant C as Chart widget
participant API as GET api/2 tables/{id}/aggregate (new)
participant DB as cell tables
U->>C: open the page
C->>API: grouped mode, group by status
API->>DB: count per group
DB-->>API: groups and counts
API-->>C: series
C-->>U: bar, line or pie in theme colours, with a table of the values
U->>C: open a stacked bar
C->>API: grouped mode, two grouping columns, or timeseries mode per month
API-->>C: series per group
Acceptance Criteria
- Each type is listed by
GET /api/2/widget-typeswith its settings schema. - Data comes from the grouped and timeseries modes of the aggregation endpoint.
- Colours come from the theme, and the chart has a text alternative (a table of the values).
- Export and import carry the widgets.
- Unit tests for the schemas, a Playwright spec per widget.
- The values count only rows the viewer may read; on a view source the view's filter applies.
- Settings are stored as JSON text in the
settingstext column oftables_contexts_widget(at most 60000 bytes,GridWidgetTypes::SETTINGS_MAX_BYTES), not in a database JSON column, as advised on Grid pages in applications (frontend) #3099. Nothing is filtered or sorted on them. - Widgets are saved through the page route
PATCH api/2/contexts/{contextId}/pages/{pageId}, which declares#[RequirePermission]for managing the application, and the service checks the same right before it writes. A test saves a page with the new widget as a reader of the application and expects 403, as learned in the review of feat(contexts): give applications a menu with its own API #3135. - Usable at 360 px wide: nothing cut off and no horizontal scroll of the page. Every action works with the keyboard alone.
Components
- CnChartWidget (adapt, week 44): the chart widget type (bar, line, pie); its series come from
aggregate.groupedandaggregate.timeseriesof the data adapter instead of OpenRegister. - CnStackedBarWidget (adapt, week 44): the stacked bar widget type over two grouping columns, on
aggregate.grouped.
Out of scope
- Drilling down from a bar into the rows.
- Exporting a chart as an image.
- The aggregation endpoint: Robert's Q9 draft.
- Slicing, in landing order: one PR for the bar chart, then line and pie, then the stacked bar.
Describe alternatives you've considered
Questions for maintainers
- Which chart component? Options: (a) a chart library added to Tables, (b) a chart component contributed to nc-vue, the way
NcStatsBlock(feat: add NcStatsBlock component nextcloud-libraries/nextcloud-vue#9142) was. We would go with (b): other apps get the same charts, and the theme and dark mode are handled once. - Which time buckets for timeseries? Options: (a) day, week, month and year, (b) any interval. We would go with (a): it covers the cases we know and keeps the endpoint simple.
Additional context
Linking to other objects
- Object: widgets with a source, a mode (grouped or timeseries) and grouping columns.
- Today: grouping can only use the cells of the source table. Grouping by a relation's target needs
extendfor relation cells (Relations: filter, sort, inverse lookups, inline resolve, import and export #3347). - What this issue must do: keep the source by its slug and the grouping columns by their technical name (the existing column property), so export and import map them. Charts over links (for example mails per case per month) come from the link store of Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468 once it can count per group; they are not part of this issue.
- A widget that shows another app's object (a Deck board, a calendar, a text file) is the same registration question as Q2 (do apps register widgets for Tables?), still open on Grid pages in applications (frontend) #3099. The Teams widgets of Team dashboard circles#2552 and Team dashboard V1 circles#3010 go in a similar direction; maintainers can say whether Tables widgets and Teams widgets should share one registry.
Relevant files:
Related issues
- Relations: filter, sort, inverse lookups, inline resolve, import and export #3347 (
extendfor relation cells) - the aggregation endpoint: Robert's Q9 draft
Drafted with AI assistance from the project plan; @remko48 reviews it. Part of #3419.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity