Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
25d1a661
Unverified
Commit
25d1a661
authored
2 years ago
by
Alexander Polyankin
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix pivot table formatting (#24153)
parent
bc0ddcd9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/lib/data_grid.js
+4
-6
4 additions, 6 deletions
frontend/src/metabase/lib/data_grid.js
frontend/test/metabase/scenarios/visualizations/reproductions/23076.cy.spec.js
+1
-1
1 addition, 1 deletion
...e/scenarios/visualizations/reproductions/23076.cy.spec.js
with
5 additions
and
7 deletions
frontend/src/metabase/lib/data_grid.js
+
4
−
6
View file @
25d1a661
...
...
@@ -161,7 +161,6 @@ export function multiLevelPivot(data, settings) {
);
const
formattedRowTree
=
addSubtotals
(
formattedRowTreeWithoutSubtotals
,
leftIndexFormatters
,
showSubtotalsByColumn
,
);
if
(
formattedRowTreeWithoutSubtotals
.
length
>
1
)
{
...
...
@@ -360,7 +359,7 @@ function addValueColumnNodes(nodes, valueColumns) {
// This inserts nodes into the left header tree for subtotals.
// We also mark nodes with `hasSubtotal` to display collapsing UI
function
addSubtotals
(
rowColumnTree
,
formatters
,
showSubtotalsByColumn
)
{
function
addSubtotals
(
rowColumnTree
,
showSubtotalsByColumn
)
{
// For top-level items we want to show subtotal even if they have only one child
// Except the case when top-level items have flat structure
// (meaning all of the items have just one child)
...
...
@@ -370,7 +369,7 @@ function addSubtotals(rowColumnTree, formatters, showSubtotalsByColumn) {
const
notFlat
=
rowColumnTree
.
some
(
item
=>
item
.
children
.
length
>
1
);
return
rowColumnTree
.
flatMap
(
item
=>
addSubtotal
(
item
,
formatters
,
showSubtotalsByColumn
,
{
addSubtotal
(
item
,
showSubtotalsByColumn
,
{
shouldShowSubtotal
:
notFlat
||
item
.
children
.
length
>
1
,
}),
);
...
...
@@ -378,7 +377,6 @@ function addSubtotals(rowColumnTree, formatters, showSubtotalsByColumn) {
function
addSubtotal
(
item
,
[
formatter
,
...
formatters
],
[
isSubtotalEnabled
,
...
showSubtotalsByColumn
],
{
shouldShowSubtotal
=
false
}
=
{},
)
{
...
...
@@ -386,7 +384,7 @@ function addSubtotal(
const
subtotal
=
hasSubtotal
?
[
{
value
:
t
`Totals for
${
formatter
(
item
.
value
)
}
`
,
value
:
t
`Totals for
${
item
.
value
}
`
,
rawValue
:
item
.
rawValue
,
span
:
1
,
isSubtotal
:
true
,
...
...
@@ -403,7 +401,7 @@ function addSubtotal(
children
:
item
.
children
.
flatMap
(
child
=>
// add subtotals until the last level
child
.
children
.
length
>
0
?
addSubtotal
(
child
,
formatters
,
showSubtotalsByColumn
,
{
?
addSubtotal
(
child
,
showSubtotalsByColumn
,
{
shouldShowSubtotal
:
child
.
children
.
length
>
1
,
})
:
child
,
...
...
This diff is collapsed.
Click to expand it.
frontend/test/metabase/scenarios/visualizations/reproductions/23076.cy.spec.js
+
1
−
1
View file @
25d1a661
...
...
@@ -29,7 +29,7 @@ const questionDetails = {
},
};
describe
.
skip
(
"
issue 23076
"
,
()
=>
{
describe
(
"
issue 23076
"
,
()
=>
{
beforeEach
(()
=>
{
restore
();
cy
.
signInAsAdmin
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment