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
4252a066
Unverified
Commit
4252a066
authored
1 year ago
by
Alexander Polyankin
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix table columns remapped fields (#39798)
parent
e4dcb68b
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
e2e/test/scenarios/question/reproductions/39795-reorder-column-field-mapping.cy.spec.js
+42
-0
42 additions, 0 deletions
...productions/39795-reorder-column-field-mapping.cy.spec.js
frontend/src/metabase-lib/Question.ts
+3
-1
3 additions, 1 deletion
frontend/src/metabase-lib/Question.ts
with
45 additions
and
1 deletion
e2e/test/scenarios/question/reproductions/39795-reorder-column-field-mapping.cy.spec.js
0 → 100644
+
42
−
0
View file @
4252a066
import
{
SAMPLE_DB_ID
}
from
"
e2e/support/cypress_data
"
;
import
{
SAMPLE_DATABASE
}
from
"
e2e/support/cypress_sample_database
"
;
import
{
getDraggableElements
,
moveColumnDown
,
visitQuestionAdhoc
,
restore
,
}
from
"
e2e/support/helpers
"
;
const
{
ORDERS
,
ORDERS_ID
,
PRODUCTS
}
=
SAMPLE_DATABASE
;
describe
(
"
issue 39795
"
,
()
=>
{
beforeEach
(()
=>
{
restore
();
cy
.
signInAsAdmin
();
//If you comment out this post, then the test will pass.
cy
.
request
(
"
post
"
,
`/api/field/
${
ORDERS
.
PRODUCT_ID
}
/dimension`
,
{
human_readable_field_id
:
PRODUCTS
.
TITLE
,
name
:
"
Product ID
"
,
type
:
"
external
"
,
});
});
it
(
"
should allow me to re-order even when a field is set with a different display value (metabase#39795)
"
,
()
=>
{
visitQuestionAdhoc
({
dataset_query
:
{
database
:
SAMPLE_DB_ID
,
query
:
{
"
source-table
"
:
ORDERS_ID
,
},
type
:
"
query
"
,
},
});
cy
.
findByTestId
(
"
viz-settings-button
"
).
click
();
moveColumnDown
(
getDraggableElements
().
first
(),
2
);
// We are not able to re-order because the dataset will also contain values a column for Product ID
// This causes the isValid() check to fire, and you are always forced into the default value for table.columns
getDraggableElements
().
eq
(
2
).
should
(
"
contain.text
"
,
"
ID
"
);
});
});
This diff is collapsed.
Click to expand it.
frontend/src/metabase-lib/Question.ts
+
3
−
1
View file @
4252a066
...
...
@@ -515,7 +515,7 @@ class Question {
return
this
;
}
_syncTableColumnSettings
({
data
:
{
cols
=
[]
}
=
{}
}:
Dataset
)
{
_syncTableColumnSettings
({
data
=
{}
}:
Dataset
)
{
const
columnSettings
=
this
.
setting
(
"
table.columns
"
)
||
[];
// "table.columns" receive a value only if there are custom settings
// e.g. some columns are hidden. If it's empty, it means everything is visible
...
...
@@ -524,6 +524,8 @@ class Question {
return
this
;
}
// remove columns used for remapping only
const
cols
=
data
.
cols
.
filter
(
col
=>
col
.
remapped_from
==
null
);
const
columnIndexes
=
findColumnIndexesForColumnSettings
(
cols
,
columnSettings
,
...
...
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