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
86c2ec28
Unverified
Commit
86c2ec28
authored
2 years ago
by
Mahatthana (Kelvin) Nomsawadi
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix whitelabeled colors aren't respected in x-rays (#22458)
parent
1357f3c3
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/automagic_dashboards/populate.clj
+17
-5
17 additions, 5 deletions
src/metabase/automagic_dashboards/populate.clj
src/metabase/models/dashboard.clj
+1
-1
1 addition, 1 deletion
src/metabase/models/dashboard.clj
with
18 additions
and
6 deletions
src/metabase/automagic_dashboards/populate.clj
+
17
−
5
View file @
86c2ec28
...
...
@@ -7,6 +7,7 @@
[
metabase.automagic-dashboards.filters
:as
filters
]
[
metabase.models.card
:as
card
]
[
metabase.models.collection
:as
collection
]
[
metabase.public-settings
:as
public-settings
]
[
metabase.query-processor.util
:as
qp.util
]
[
metabase.util.i18n
:refer
[
trs
]]
[
toucan.db
:as
db
]))
...
...
@@ -43,9 +44,20 @@
:location
"/"
)
(
create-collection!
"Automatically Generated Dashboards"
"#509EE3"
nil
nil
)))
(
def
colors
"Colors used for coloring charts and collections."
[
"#509EE3"
"#9CC177"
"#A989C5"
"#EF8C8C"
"#f9d45c"
"#F1B556"
"#A6E7F3"
"#7172AD"
])
(
defn
colors
"A vector of colors used for coloring charts and collections. Uses [[public-settings/application-colors]] for user choices."
[]
(
let
[
order
[
:brand
:accent1
:accent2
:accent3
:accent4
:accent5
:accent6
:accent7
]
colors-map
(
merge
{
:brand
"#509EE3"
:accent1
"#88BF4D"
:accent2
"#A989C5"
:accent3
"#EF8C8C"
:accent4
"#F9D45C"
:accent5
"#F2A86F"
:accent6
"#98D9D9"
:accent7
"#7172AD"
}
(
public-settings/application-colors
))]
(
into
[]
(
map
colors-map
)
order
)))
(
defn-
ensure-distinct-colors
[
candidates
]
...
...
@@ -55,14 +67,14 @@
(
fn
[
acc
color
count
]
(
if
(
=
count
1
)
(
conj
acc
color
)
(
concat
acc
[
color
(
first
(
drop-while
(
conj
(
set
acc
)
color
)
colors
))])))
(
concat
acc
[
color
(
first
(
drop-while
(
conj
(
set
acc
)
color
)
(
colors
))
)
])))
[])))
(
defn
map-to-colors
"Map given objects to distinct colors."
[
objs
]
(
->>
objs
(
map
(
comp
colors
#
(
mod
%
(
count
colors
))
hash
))
(
map
(
comp
(
colors
)
#
(
mod
%
(
count
(
colors
))
)
hash
))
ensure-distinct-colors
))
(
defn-
colorize
...
...
This diff is collapsed.
Click to expand it.
src/metabase/models/dashboard.clj
+
1
−
1
View file @
86c2ec28
...
...
@@ -350,7 +350,7 @@
dashcards
(
:ordered_cards
dashboard
)
collection
(
populate/create-collection!
(
ensure-unique-collection-name
(
:name
dashboard
)
parent-collection-id
)
(
rand-nth
populate/colors
)
(
rand-nth
(
populate/colors
)
)
"Automatically generated cards."
parent-collection-id
)
dashboard
(
db/insert!
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