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
ba354599
Commit
ba354599
authored
7 years ago
by
Ryan Senior
Browse files
Options
Downloads
Patches
Plain Diff
Add remapping awareness to pulses
parent
246332c5
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/pulse/render.clj
+22
-4
22 additions, 4 deletions
src/metabase/pulse/render.clj
with
22 additions
and
4 deletions
src/metabase/pulse/render.clj
+
22
−
4
View file @
ba354599
...
...
@@ -224,13 +224,26 @@
(
render-to-png
html
os
width
)
(
.toByteArray
os
)))
(
defn-
create-remapping-lookup
[
cols
col-indexes
]
(
into
{}
(
for
[
col-index
col-indexes
:let
[{
:keys
[
remapped_from
]}
(
nth
cols
col-index
)]
:when
remapped_from
]
[
remapped_from
col-index
])))
(
defn-
render-table
[
card
rows
cols
col-indexes
bar-column
]
(
let
[
max-value
(
if
bar-column
(
apply
max
(
map
bar-column
rows
)))]
(
let
[
max-value
(
if
bar-column
(
apply
max
(
map
bar-column
rows
)))
remapping-lookup
(
create-remapping-lookup
cols
col-indexes
)]
[
:table
{
:style
(
style
{
:padding-bottom
:8px,
:border-bottom
(
str
"4px solid "
color-gray-1
)})}
[
:thead
[
:tr
(
for
[
col-idx
col-indexes
:let
[
col
(
nth
cols
col-idx
)]]
(
for
[
col-idx
col-indexes
:let
[
col-at-index
(
nth
cols
col-idx
)
col
(
if
(
:remapped_to
col-at-index
)
(
nth
cols
(
get
remapping-lookup
(
:name
col-at-index
)))
col-at-index
)]
:when
(
not
(
:remapped_from
col-at-index
))]
[
:th
{
:style
(
style
bar-td-style
bar-th-style
{
:min-width
:60px
})}
(
h
(
s/upper-case
(
name
(
or
(
:display_name
col
)
(
:name
col
)))))])
(
when
bar-column
...
...
@@ -238,9 +251,14 @@
[
:tbody
(
map-indexed
(
fn
[
row-idx
row
]
[
:tr
{
:style
(
style
{
:color
(
if
(
odd?
row-idx
)
color-gray-2
color-gray-3
)})}
(
for
[
col-idx
col-indexes
:let
[
col
(
nth
cols
col-idx
)]]
(
for
[
col-idx
col-indexes
:let
[
col
(
nth
cols
col-idx
)]
:when
(
not
(
:remapped_from
col
))]
[
:td
{
:style
(
style
bar-td-style
(
when
(
and
bar-column
(
=
col-idx
1
))
{
:font-weight
700
}))}
(
->
row
(
nth
col-idx
)
(
format-cell
col
)
h
)])
(
if-let
[
remapped-index
(
and
(
:remapped_to
col
)
(
get
remapping-lookup
(
:name
col
)))]
(
->
row
(
nth
remapped-index
)
(
format-cell
(
nth
cols
remapped-index
))
h
)
(
->
row
(
nth
col-idx
)
(
format-cell
col
)
h
))])
(
when
bar-column
[
:td
{
:style
(
style
bar-td-style
{
:width
:99%
})}
[
:div
{
:style
(
style
{
:background-color
color-purple
...
...
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