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
16f30664
Commit
16f30664
authored
Feb 01, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'collapseable-panel-option-groups'
parents
3a5f03c7
59dfe794
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
79 deletions
+104
-79
packages/grafana-ui/src/components/PanelOptionsGroup/PanelOptionsGroup.tsx
+23
-11
packages/grafana-ui/src/components/PanelOptionsGroup/_PanelOptionsGroup.scss
+41
-2
packages/grafana-ui/src/components/ThresholdsEditor/_ThresholdsEditor.scss
+7
-7
packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.test.tsx
+1
-1
packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx
+3
-11
packages/grafana-ui/src/components/ValueMappingsEditor/__snapshots__/ValueMappingsEditor.test.tsx.snap
+29
-47
No files found.
packages/grafana-ui/src/components/PanelOptionsGroup/PanelOptionsGroup.tsx
View file @
16f30664
// Libraries
import
React
,
{
SFC
}
from
'react'
;
import
React
,
{
FunctionComponent
}
from
'react'
;
interface
Props
{
title
?:
string
;
onClose
?:
()
=>
void
;
children
:
JSX
.
Element
|
JSX
.
Element
[];
children
:
JSX
.
Element
|
JSX
.
Element
[]
|
boolean
;
onAdd
?:
()
=>
void
;
}
export
const
PanelOptionsGroup
:
SFC
<
Props
>
=
props
=>
{
export
const
PanelOptionsGroup
:
FunctionComponent
<
Props
>
=
props
=>
{
return
(
<
div
className=
"panel-options-group"
>
{
props
.
title
&&
(
{
props
.
onAdd
?
(
<
div
className=
"panel-options-group__header"
>
{
props
.
title
}
{
props
.
onClose
&&
(
<
button
className=
"btn btn-link"
onClick=
{
props
.
onClose
}
>
<
i
className=
"fa fa-remove"
/
>
<
/
butto
n
>
)
}
<
button
className=
"panel-options-group__add-btn"
onClick=
{
props
.
onAdd
}
>
<
div
className=
"panel-options-group__add-circle"
>
<
i
className=
"fa fa-plus"
/
>
</
div
>
<
span
className=
"panel-options-group__title"
>
{
props
.
title
}
</
spa
n
>
</
button
>
</
div
>
)
:
(
props
.
title
&&
(
<
div
className=
"panel-options-group__header"
>
<
span
className=
"panel-options-group__title"
>
{
props
.
title
}
</
span
>
{
props
.
onClose
&&
(
<
button
className=
"btn btn-link"
onClick=
{
props
.
onClose
}
>
<
i
className=
"fa fa-remove"
/>
</
button
>
)
}
</
div
>
)
)
}
<
div
className=
"panel-options-group__body"
>
{
props
.
children
}
</
div
>
{
props
.
children
&&
<
div
className=
"panel-options-group__body"
>
{
props
.
children
}
</
div
>
}
</
div
>
);
};
packages/grafana-ui/src/components/PanelOptionsGroup/_PanelOptionsGroup.scss
View file @
16f30664
...
...
@@ -7,18 +7,57 @@
.panel-options-group__header
{
padding
:
4px
8px
;
font-size
:
1
.1rem
;
background
:
$panel-options-group-header-bg
;
position
:
relative
;
border-radius
:
$border-radius
$border-radius
0
0
;
display
:
flex
;
align-items
:
center
;
.btn
{
position
:
absolute
;
right
:
0
;
top
:
0px
;
top
:
0
;
}
}
.panel-options-group__add-btn
{
background
:
none
;
border
:
none
;
display
:
flex
;
align-items
:
center
;
padding
:
0
;
&
:hover
{
.panel-options-group__add-circle
{
background-color
:
$btn-success-bg
;
color
:
$text-color-strong
;
}
}
}
.panel-options-group__add-circle
{
@include
gradientBar
(
$btn-success-bg
,
$btn-success-bg-hl
,
$text-color
);
border-radius
:
50px
;
width
:
20px
;
height
:
20px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
6px
;
i
{
position
:
relative
;
top
:
1px
;
}
}
.panel-options-group__title
{
font-size
:
1
.1rem
;
position
:
relative
;
top
:
1px
;
}
.panel-options-group__body
{
padding
:
20px
;
...
...
packages/grafana-ui/src/components/ThresholdsEditor/_ThresholdsEditor.scss
View file @
16f30664
.thresholds
{
margin-bottom
:
1
0px
;
margin-bottom
:
2
0px
;
}
.thresholds-row
{
display
:
flex
;
flex-direction
:
row
;
height
:
70
px
;
height
:
62
px
;
}
.thresholds-row
:first-child
>
.thresholds-row-color-indicator
{
...
...
@@ -21,21 +21,21 @@
}
.thresholds-row-add-button
{
@include
buttonBackground
(
$btn-success-bg
,
$btn-success-bg-hl
,
$text-color
);
align-self
:
center
;
margin-right
:
5px
;
color
:
$green
;
height
:
24px
;
width
:
24px
;
background-color
:
$green
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
cursor
:
pointer
;
}
.thresholds-row-add-button
>
i
{
color
:
$white
;
&
:hover
{
color
:
$text-color-strong
;
}
}
.thresholds-row-color-indicator
{
...
...
packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.test.tsx
View file @
16f30664
...
...
@@ -2,7 +2,7 @@ import React from 'react';
import
{
shallow
}
from
'enzyme'
;
import
{
ValueMappingsEditor
,
Props
}
from
'./ValueMappingsEditor'
;
import
{
MappingType
}
from
'../../types
/panel
'
;
import
{
MappingType
}
from
'../../types'
;
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
Props
=
{
...
...
packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx
View file @
16f30664
import
React
,
{
PureComponent
}
from
'react'
;
import
MappingRow
from
'./MappingRow'
;
import
{
MappingType
,
ValueMapping
}
from
'../../types
/panel
'
;
import
{
PanelOptionsGroup
}
from
'..
/PanelOptionsGroup/PanelOptionsGroup
'
;
import
{
MappingType
,
ValueMapping
}
from
'../../types'
;
import
{
PanelOptionsGroup
}
from
'..'
;
export
interface
Props
{
valueMappings
:
ValueMapping
[];
...
...
@@ -81,8 +81,7 @@ export class ValueMappingsEditor extends PureComponent<Props, State> {
const
{
valueMappings
}
=
this
.
state
;
return
(
<
PanelOptionsGroup
title=
"Value Mappings"
>
<
div
>
<
PanelOptionsGroup
title=
"Add value mapping"
onAdd=
{
this
.
addMapping
}
>
{
valueMappings
.
length
>
0
&&
valueMappings
.
map
((
valueMapping
,
index
)
=>
(
<
MappingRow
...
...
@@ -92,13 +91,6 @@ export class ValueMappingsEditor extends PureComponent<Props, State> {
removeValueMapping=
{
()
=>
this
.
onRemoveMapping
(
valueMapping
.
id
)
}
/>
))
}
</
div
>
<
div
className=
"add-mapping-row"
onClick=
{
this
.
addMapping
}
>
<
div
className=
"add-mapping-row-icon"
>
<
i
className=
"fa fa-plus"
/>
</
div
>
<
div
className=
"add-mapping-row-label"
>
Add mapping
</
div
>
</
div
>
</
PanelOptionsGroup
>
);
}
...
...
packages/grafana-ui/src/components/ValueMappingsEditor/__snapshots__/ValueMappingsEditor.test.tsx.snap
View file @
16f30664
...
...
@@ -2,55 +2,37 @@
exports[`Render should render component 1`] = `
<Component
title="Value Mappings"
onAdd={[Function]}
title="Add value mapping"
>
<div>
<MappingRow
key="Ok-0"
removeValueMapping={[Function]}
updateValueMapping={[Function]}
valueMapping={
Object {
"id": 1,
"operator": "",
"text": "Ok",
"type": 1,
"value": "20",
}
<MappingRow
key="Ok-0"
removeValueMapping={[Function]}
updateValueMapping={[Function]}
valueMapping={
Object {
"id": 1,
"operator": "",
"text": "Ok",
"type": 1,
"value": "20",
}
/>
<MappingRow
key="Meh-1"
removeValueMapping={[Function]}
updat
eValueMapping={[Function]}
valueMapping={
Object
{
"from": "21",
"id": 2
,
"operator": ""
,
"text": "Meh
",
"to": "30
",
"type": 2
,
}
}
/>
<MappingRow
key="Meh-1"
remov
eValueMapping={[Function]}
updateValueMapping={[Function]}
valueMapping=
{
Object {
"from": "21"
,
"id": 2
,
"operator": "
",
"text": "Meh
",
"to": "30"
,
"type": 2,
}
/>
</div>
<div
className="add-mapping-row"
onClick={[Function]}
>
<div
className="add-mapping-row-icon"
>
<i
className="fa fa-plus"
/>
</div>
<div
className="add-mapping-row-label"
>
Add mapping
</div>
</div>
}
/>
</Component>
`;
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