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
887e3f21
Unverified
Commit
887e3f21
authored
1 year ago
by
Cal Herries
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
BE: Remove filterParameters from parameter if values_query_type=none (#34660)
parent
595ea881
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/models/dashboard.clj
+9
-4
9 additions, 4 deletions
src/metabase/models/dashboard.clj
test/metabase/models/dashboard_test.clj
+16
-0
16 additions, 0 deletions
test/metabase/models/dashboard_test.clj
with
25 additions
and
4 deletions
src/metabase/models/dashboard.clj
+
9
−
4
View file @
887e3f21
...
...
@@ -131,10 +131,15 @@
(
or
(
=
(
:name
p
)
""
)
(
=
(
:slug
p
)
""
))
(
assoc
:name
"unnamed"
:slug
"unnamed"
)
;; We don't support linked filters for parameters with :values_source_type of anything except nil,
;; but it was previously possible to set :values_source_type to "static-list" or "card" and still
;; have linked filters. (metabase#33892)
(
some?
(
:values_source_type
p
))
(
or
;; we don't support linked filters for parameters with :values_source_type of anything except nil,
;; but it was previously possible to set :values_source_type to "static-list" or "card" and still
;; have linked filters. (metabase#33892)
(
some?
(
:values_source_type
p
))
(
=
(
:values_query_type
p
)
"none"
))
;; linked filters don't do anything when parameters have values_query_type="none" (aka "Input box"),
;; but it was previously possible to set :values_query_type to "none" and still have linked filters.
;; (metabase#34657)
(
dissoc
:filteringParameters
)))
(
defn-
migrate-parameters-list
...
...
This diff is collapsed.
Click to expand it.
test/metabase/models/dashboard_test.clj
+
16
−
0
View file @
887e3f21
...
...
@@ -670,6 +670,22 @@
(
:filteringParameters
parameter
)))
(
is
(
not
(
contains?
parameter
:filteringParameters
))))))))))
(
deftest
migrate-parameters-with-linked-filters-and-values-query-type-test
(
testing
"test that a Dashboard's :parameters filterParameters are cleared if the :values_query_type is 'none'"
(
doseq
[[
values_query_type
keep-filtering-parameters?
]
{
"none"
false
"list"
true
}]
(
testing
(
format
"\nvalues_query_type=%s"
values_query_type
)
(
mt/with-temp
[
:model/Dashboard
dashboard
{
:parameters
[(
merge
default-parameter
{
:filteringParameters
[
"other-param-id"
]
:values_query_type
values_query_type
})]}]
(
let
[
parameter
(
first
(
:parameters
dashboard
))]
(
if
keep-filtering-parameters?
(
is
(
=
[
"other-param-id"
]
(
:filteringParameters
parameter
)))
(
is
(
not
(
contains?
parameter
:filteringParameters
))))))))))
(
deftest
migrate-parameters-empty-name-test
(
testing
"test that a Dashboard's :parameters is selected with a non-nil name and slug"
(
doseq
[[
name
slug
]
[[
""
""
]
[
""
"slug"
]
[
"name"
""
]]]
...
...
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