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
a0ab2944
Commit
a0ab2944
authored
7 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Only add infered filters if they apply to all cards
parent
bbe8bc41
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/automagic_dashboards/filters.clj
+16
-15
16 additions, 15 deletions
src/metabase/automagic_dashboards/filters.clj
with
16 additions
and
15 deletions
src/metabase/automagic_dashboards/filters.clj
+
16
−
15
View file @
a0ab2944
...
...
@@ -51,17 +51,16 @@
(
defn-
add-filter
[
dashcard
filter-id
field
]
(
if-let
[
targets
(
->>
(
conj
(
:series
dashcard
)
(
:card
dashcard
))
(
keep
(
fn
[
card
]
(
some->
card
(
filter-for-card
field
)
(
vector
card
))))
not-empty
)]
(
update
dashcard
:parameter_mappings
concat
(
for
[[
target
card
]
targets
]
{
:parameter_id
filter-id
:target
target
:card_id
(
:id
card
)}))
dashcard
))
(
let
[
mappings
(
->>
(
conj
(
:series
dashcard
)
(
:card
dashcard
))
(
keep
(
fn
[
card
]
(
when-let
[
target
(
filter-for-card
card
field
)]
{
:parameter_id
filter-id
:target
target
:card_id
(
:id
card
)})))
not-empty
)]
(
cond
(
nil?
(
:card
dashcard
))
dashcard
mappings
(
update
dashcard
:parameter_mappings
concat
mappings
))))
(
defn-
filter-type
[{
:keys
[
base_type
special_type
]
:as
field
}]
...
...
@@ -89,11 +88,13 @@
(
let
[
filter-id
(
->
candidate
hash
str
)
dashcards
(
:ordered_cards
dashboard
)
dashcards-new
(
map
#
(
add-filter
%
filter-id
candidate
)
dashcards
)]
(
cond->
dashboard
(
not=
dashcards
dashcards-new
)
(
->
(
assoc
:ordered_cards
dashcards-new
)
;; Only add filters that apply to all cards.
(
if
(
=
(
count
dashcards
)
(
count
dashcards-new
))
(
->
dashboard
(
assoc
:ordered_cards
dashcards-new
)
(
update
:parameters
conj
{
:id
filter-id
:type
(
filter-type
candidate
)
:name
(
:display_name
candidate
)
:slug
(
:name
candidate
)})))))
:slug
(
:name
candidate
)}))
dashboard
)))
dashboard
))))
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