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
24265108
Commit
24265108
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Chart type icons... without the real icons
parent
9ff793d7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/frontend_client/app/css/query_builder.css
+21
-0
21 additions, 0 deletions
resources/frontend_client/app/css/query_builder.css
resources/frontend_client/app/query_builder/visualization.react.js
+58
-24
58 additions, 24 deletions
.../frontend_client/app/query_builder/visualization.react.js
with
79 additions
and
24 deletions
resources/frontend_client/app/css/query_builder.css
+
21
−
0
View file @
24265108
...
...
@@ -329,3 +329,24 @@
border-color
:
var
(
--brand-color
);
color
:
#fff
;
}
.ChartType-button
{
width
:
38px
;
height
:
38px
;
border-radius
:
38px
;
background-color
:
white
;
border
:
1px
solid
#ccdff6
;
}
.ChartType-popover
{
min-width
:
15em
!important
;
}
.ChartType--selected
{
color
:
white
;
background-color
:
rgb
(
74
,
144
,
226
);
}
.ChartType--notSensible
{
opacity
:
0.5
;
}
This diff is collapsed.
Click to expand it.
resources/frontend_client/app/query_builder/visualization.react.js
+
58
−
24
View file @
24265108
'
use strict
'
;
import
{
CardRenderer
}
from
'
../card/card.charting
'
;
import
Icon
from
'
./icon.react
'
;
import
PopoverWithTrigger
from
'
./popover_with_trigger.react
'
;
import
QueryVisualizationTable
from
'
./visualization_table.react
'
;
import
QueryVisualizationChart
from
'
./visualization_chart.react
'
;
...
...
@@ -22,6 +23,18 @@ export default React.createClass({
cellClickedFn
:
React
.
PropTypes
.
func
},
visualizationTypeNames
:
{
'
scalar
'
:
'
Number
'
,
'
table
'
:
'
Table
'
,
'
line
'
:
'
Line
'
,
'
bar
'
:
'
Bar
'
,
'
pie
'
:
'
Pie
'
,
'
area
'
:
'
Area
'
,
'
state
'
:
'
State map
'
,
'
country
'
:
'
Country map
'
,
'
pin_map
'
:
'
Pin map
'
},
getDefaultProps
:
function
()
{
return
{
// NOTE: this should be more dynamic from the backend, it's set based on the query lang
...
...
@@ -108,9 +121,9 @@ export default React.createClass({
return
(
display
!==
"
table
"
&&
display
!==
"
scalar
"
);
},
setDisplay
:
function
(
event
)
{
setDisplay
:
function
(
type
)
{
// notify our parent about our change
this
.
props
.
setDisplayFn
(
event
.
target
.
valu
e
);
this
.
props
.
setDisplayFn
(
typ
e
);
},
setChartColor
:
function
(
color
)
{
...
...
@@ -118,6 +131,48 @@ export default React.createClass({
this
.
props
.
setChartColorFn
(
color
);
},
renderChartTypePicker
:
function
()
{
var
tetherOptions
=
{
attachment
:
'
bottom center
'
,
targetAttachment
:
'
top center
'
,
targetOffset
:
'
-25px 0
'
};
var
chartTypeButton
=
(
<
div
className
=
"
inline-block
"
>
<
span
className
=
"
ChartType-button text-brand text-brand-hover shadowed flex layout-centered
"
>
<
Icon
name
=
"
star
"
width
=
"
18px
"
height
=
"
18px
"
><
/Icon
>
<
/span
>
<
/div
>
);
var
displayOptions
=
this
.
props
.
visualizationTypes
.
map
((
type
,
index
)
=>
{
var
classes
=
cx
({
'
p2
'
:
true
,
'
ChartType--selected
'
:
type
===
this
.
props
.
card
.
display
,
'
ChartType--notSensible
'
:
!
this
.
isSensibleChartDisplay
(
type
)
});
var
name
=
this
.
visualizationTypeNames
[
type
]
||
type
;
return
(
<
li
className
=
{
classes
}
key
=
{
index
}
onClick
=
{
this
.
setDisplay
.
bind
(
null
,
type
)}
>
<
Icon
name
=
"
star
"
width
=
"
18px
"
height
=
"
18px
"
/>
<
span
className
=
"
ml1
"
>
{
name
}
<
/span
>
<
/li
>
);
});
return
(
<
span
>
Showing
<
PopoverWithTrigger
className
=
"
PopoverBody ChartType-popover
"
tetherOptions
=
{
tetherOptions
}
triggerElement
=
{
chartTypeButton
}
>
<
ul
className
=
""
>
{
displayOptions
}
<
/ul
>
<
/PopoverWithTrigger
>
<
/span
>
);
},
renderChartColorPicker
:
function
()
{
if
(
this
.
props
.
card
.
display
===
"
line
"
||
this
.
props
.
card
.
display
===
"
area
"
||
this
.
props
.
card
.
display
===
"
bar
"
)
{
var
colors
=
this
.
props
.
visualizationSettingsApi
.
getDefaultColorHarmony
();
...
...
@@ -192,30 +247,9 @@ export default React.createClass({
}
else
{
var
vizControls
;
if
(
this
.
props
.
result
&&
this
.
props
.
result
.
error
===
undefined
)
{
var
displayOptions
=
[];
for
(
var
i
=
0
;
i
<
this
.
props
.
visualizationTypes
.
length
;
i
++
)
{
var
val
=
this
.
props
.
visualizationTypes
[
i
];
if
(
this
.
isSensibleChartDisplay
(
val
))
{
displayOptions
.
push
(
<
option
key
=
{
i
}
value
=
{
val
}
>
{
val
}
<
/option
>
);
}
else
{
// NOTE: the key below MUST be different otherwise we get React errors, so we just append a '_' to it (sigh)
displayOptions
.
push
(
<
option
key
=
{
i
+
'
_
'
}
value
=
{
val
}
>
{
val
}
(
not
sensible
)
<
/option
>
);
}
}
vizControls
=
(
<
div
>
Show
as
:
<
label
className
=
"
Select ml2
"
>
<
select
onChange
=
{
this
.
setDisplay
}
value
=
{
this
.
props
.
card
.
display
}
>
{
displayOptions
}
<
/select
>
<
/label
>
{
this
.
renderChartTypePicker
()}
{
this
.
renderChartColorPicker
()}
<
/div
>
);
...
...
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