Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
063a1acf
Commit
063a1acf
authored
Nov 14, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
started on options and groups
parent
e4e41474
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
20 deletions
+27
-20
public/app/core/components/Picker/UnitPicker.tsx
+26
-19
public/app/core/utils/kbn.ts
+0
-0
public/app/plugins/panel/gauge/module.tsx
+1
-1
No files found.
public/app/core/components/Picker/UnitPicker.tsx
View file @
063a1acf
import
React
,
{
PureComponent
}
from
'react'
;
import
Select
from
'react-select'
;
import
Select
,
{
components
}
from
'react-select'
;
import
ResetStyles
from
'app/core/components/Picker/ResetStyles'
;
import
DescriptionOption
from
'./DescriptionOption'
;
import
kbn
from
'../../utils/kbn'
;
interface
Props
{
width
:
number
;
className
?:
string
;
onSelected
:
(
item
:
any
)
=>
{}
|
void
;
placeholder
?:
string
;
}
export
class
UnitPicker
extends
PureComponent
<
Props
>
{
formatGroupLabel
=
data
=>
{
console
.
log
(
'format'
,
data
);
const
groupStyles
=
{
margin
:
'0 15px'
,
fontSize
:
'16px'
,
fontWeight
:
700
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
};
}
as
React
.
CSSProperties
;
const
groupBadgeStyles
=
{
backgroundColor
:
'#EBECF0'
,
...
...
@@ -37,29 +34,39 @@ export class UnitPicker extends PureComponent<Props> {
return
(
<
div
style=
{
groupStyles
}
>
<
span
>
{
data
.
label
}
</
span
>
<
span
style=
{
groupBadgeStyles
}
>
{
data
.
submenu
.
length
}
</
span
>
<
span
style=
{
groupBadgeStyles
}
>
{
data
.
options
.
length
}
</
span
>
</
div
>
);
};
render
()
{
const
{
className
,
onSelected
,
placeholder
,
width
}
=
this
.
props
;
renderOption
=
props
=>
{
return
(
<
components
.
Option
{
...
props
}
>
<
div
className=
"description-picker-option__button btn btn-link"
>
<
div
className=
"gf-form"
>
{
props
.
children
}
</
div
>
</
div
>
</
components
.
Option
>
);
};
renderGroup
=
props
=>
{
return
<
components
.
Group
{
...
props
}
/>;
};
render
()
{
const
options
=
kbn
.
getUnitFormats
();
return
(
<
Select
classNamePrefix=
"gf-form-select-box"
className=
{
`width-${width} gf-form-input gf-form-input--form-dropdown ${className || ''}`
}
components=
{
{
Option
:
DescriptionOption
,
}
}
getOptionLabel=
{
i
=>
i
.
text
}
getOptionValue=
{
i
=>
i
.
value
}
className=
"width-20 gf-form-input"
isSearchable=
{
false
}
onChange=
{
onSelected
}
options=
{
options
}
placeholder=
{
placeholder
||
'Choose'
}
placeholder=
"Choose"
components=
{
{
Option
:
this
.
renderOption
,
Group
:
this
.
renderGroup
,
}
}
styles=
{
ResetStyles
}
formatGroupLabel=
{
this
.
formatGroupLabel
}
/>
...
...
public/app/core/utils/kbn.ts
View file @
063a1acf
This diff is collapsed.
Click to expand it.
public/app/plugins/panel/gauge/module.tsx
View file @
063a1acf
...
...
@@ -27,7 +27,7 @@ export class GaugeOptions extends PureComponent<PanelOptionsProps<Options>> {
<
div
>
<
div
className=
"section gf-form-group"
>
<
h5
className=
"page-heading"
>
Units
</
h5
>
<
UnitPicker
width=
{
20
}
onSelected=
{
()
=>
{}
}
/>
<
UnitPicker
onSelected=
{
()
=>
{}
}
/>
</
div
>
</
div
>
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment