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
3cf881bd
Commit
3cf881bd
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Add better UI for non-multi SelectPicker
parent
2f51d136
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
resources/frontend_client/app/css/core/colors.css
+1
-0
1 addition, 0 deletions
resources/frontend_client/app/css/core/colors.css
resources/frontend_client/app/query_builder/filters/pickers/SelectPicker.react.js
+46
-12
46 additions, 12 deletions
...t/app/query_builder/filters/pickers/SelectPicker.react.js
with
47 additions
and
12 deletions
resources/frontend_client/app/css/core/colors.css
+
1
−
0
View file @
3cf881bd
...
...
@@ -98,6 +98,7 @@
.bg-gold
{
background-color
:
var
(
--gold-color
);
}
.bg-purple
{
background-color
:
var
(
--purple-color
);
}
.bg-purple-light
{
background-color
:
var
(
--purple-light-color
);
}
.bg-green
{
background-color
:
var
(
--green-color
);
}
/* alt */
...
...
This diff is collapsed.
Click to expand it.
resources/frontend_client/app/query_builder/filters/pickers/SelectPicker.react.js
+
46
−
12
View file @
3cf881bd
...
...
@@ -4,6 +4,10 @@ import React, { Component, PropTypes } from "react";
import
CheckBox
from
'
metabase/components/CheckBox.react
'
;
import
{
capitalize
}
from
"
metabase/lib/formatting
"
;
import
cx
from
"
classnames
"
;
export
default
class
SelectPicker
extends
Component
{
selectValue
(
key
,
selected
)
{
let
values
;
...
...
@@ -20,8 +24,18 @@ export default class SelectPicker extends Component {
this
.
props
.
onValuesChange
(
values
);
}
nameForOption
(
option
)
{
if
(
option
.
name
===
""
)
{
return
"
Empty
"
;
}
else
if
(
typeof
option
.
name
===
"
string
"
)
{
return
option
.
name
;
}
else
{
return
capitalize
(
String
(
option
.
name
));
}
}
render
()
{
let
{
values
,
options
,
placeholder
}
=
this
.
props
;
let
{
values
,
options
,
placeholder
,
multi
}
=
this
.
props
;
let
checked
=
{};
for
(
let
value
of
values
)
{
...
...
@@ -29,20 +43,40 @@ export default class SelectPicker extends Component {
}
return
(
<
div
className
=
"
px1 pt1
"
style
=
{{
maxHeight
:
'
2
00px
'
,
overflowY
:
'
scroll
'
}}
>
<
div
className
=
"
px1 pt1
"
style
=
{{
maxHeight
:
'
4
00px
'
,
overflowY
:
'
scroll
'
}}
>
{
placeholder
?
<
h5
>
{
placeholder
}
<
/h5
>
:
null
}
<
ul
>
{
options
.
map
((
option
,
index
)
=>
<
li
key
=
{
index
}
>
<
label
className
=
"
flex align-center full cursor-pointer p1
"
onClick
=
{(
e
)
=>
this
.
selectValue
(
option
.
key
,
!
checked
[
option
.
key
])}
>
<
CheckBox
checked
=
{
checked
[
option
.
key
]}
/
>
<
h4
className
=
"
ml1
"
>
{
option
.
name
}
<
/h4
>
<
/label
>
<
/li
>
)}
<
/ul
>
{
multi
&&
false
?
<
ul
>
{
options
.
map
((
option
,
index
)
=>
<
li
key
=
{
index
}
>
<
label
className
=
"
flex align-center cursor-pointer p1
"
onClick
=
{()
=>
this
.
selectValue
(
option
.
key
,
!
checked
[
option
.
key
])}
>
<
CheckBox
checked
=
{
checked
[
option
.
key
]}
/
>
<
h4
className
=
"
ml1
"
>
{
this
.
nameForOption
(
option
)}
<
/h4
>
<
/label
>
<
/li
>
)}
<
/ul
>
:
<
div
className
=
"
flex flex-wrap py1
"
>
{
options
.
map
((
option
,
index
)
=>
<
div
className
=
"
half
"
style
=
{{
padding
:
"
0.15em
"
}}
>
<
button
style
=
{{
height
:
"
95px
"
}}
className
=
{
cx
(
"
full rounded bordered border-purple text-centered text-bold
"
,
{
"
text-purple bg-white
"
:
values
[
0
]
!==
option
.
key
,
"
text-white bg-purple-light
"
:
values
[
0
]
===
option
.
key
})}
onClick
=
{()
=>
this
.
selectValue
(
option
.
key
,
true
)}
>
{
this
.
nameForOption
(
option
)}
<
/button
>
<
/div
>
)}
<
/div
>
}
<
/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