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
c90979a8
Commit
c90979a8
authored
Jan 16, 2019
by
Hugo Häggmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved ValueMappings to grafana/ui/component and renamed it ValueMappingsEditor
parent
639dc6c3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
12 deletions
+75
-12
packages/grafana-ui/src/components/ValueMappingsEditor/MappingRow.tsx
+4
-1
packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.test.tsx
+6
-5
packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx
+4
-2
packages/grafana-ui/src/components/ValueMappingsEditor/_ValueMappingsEditor.scss
+0
-0
packages/grafana-ui/src/components/ValueMappingsEditor/__snapshots__/ValueMappingsEditor.test.tsx.snap
+56
-0
packages/grafana-ui/src/components/index.scss
+1
-0
packages/grafana-ui/src/components/index.ts
+1
-0
public/app/plugins/panel/gauge/GaugePanelOptions.tsx
+2
-2
public/sass/_grafana.scss
+1
-2
No files found.
p
ublic/app/plugins/panel/gauge
/MappingRow.tsx
→
p
ackages/grafana-ui/src/components/ValueMappingsEditor
/MappingRow.tsx
View file @
c90979a8
import
React
,
{
PureComponent
}
from
'react'
;
import
{
MappingType
,
RangeMap
,
Select
,
ValueMap
,
Label
}
from
'@grafana/ui'
;
import
{
ValueMap
,
RangeMap
,
MappingType
}
from
'../../types/panel'
;
import
{
Label
}
from
'../Label/Label'
;
import
{
Select
}
from
'../Select/Select'
;
interface
Props
{
mapping
:
ValueMap
|
RangeMap
;
...
...
p
ublic/app/plugins/panel/gauge/ValueMappings
.test.tsx
→
p
ackages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor
.test.tsx
View file @
c90979a8
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
{
GaugeOptions
,
MappingType
,
PanelOptionsProps
}
from
'@grafana/ui'
;
import
{
defaultProps
}
from
'app/plugins/panel/gauge/GaugePanelOptions'
;
import
ValueMappings
from
'./ValueMappings'
;
import
{
defaultProps
}
from
'app/plugins/panel/gauge/GaugePanelOptions'
;
import
{
ValueMappingsEditor
}
from
'./ValueMappingsEditor'
;
import
{
PanelOptionsProps
,
MappingType
}
from
'../../types/panel'
;
import
{
GaugeOptions
}
from
'../../types/gauge'
;
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
PanelOptionsProps
<
GaugeOptions
>
=
{
...
...
@@ -19,9 +20,9 @@ const setup = (propOverrides?: object) => {
Object
.
assign
(
props
,
propOverrides
);
const
wrapper
=
shallow
(<
ValueMappings
{
...
props
}
/>);
const
wrapper
=
shallow
(<
ValueMappings
Editor
{
...
props
}
/>);
const
instance
=
wrapper
.
instance
()
as
ValueMappings
;
const
instance
=
wrapper
.
instance
()
as
ValueMappings
Editor
;
return
{
instance
,
...
...
p
ublic/app/plugins/panel/gauge/ValueMappings
.tsx
→
p
ackages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor
.tsx
View file @
c90979a8
import
React
,
{
PureComponent
}
from
'react'
;
import
{
GaugeOptions
,
PanelOptionsProps
,
MappingType
,
RangeMap
,
ValueMap
,
PanelOptionsGroup
}
from
'@grafana/ui'
;
import
MappingRow
from
'./MappingRow'
;
import
{
PanelOptionsProps
,
ValueMap
,
RangeMap
,
MappingType
}
from
'../../types/panel'
;
import
{
GaugeOptions
}
from
'../../types/gauge'
;
import
{
PanelOptionsGroup
}
from
'../PanelOptionsGroup/PanelOptionsGroup'
;
interface
State
{
mappings
:
Array
<
ValueMap
|
RangeMap
>
;
nextIdToAdd
:
number
;
}
export
default
class
ValueMappings
extends
PureComponent
<
PanelOptionsProps
<
GaugeOptions
>
,
State
>
{
export
class
ValueMappingsEditor
extends
PureComponent
<
PanelOptionsProps
<
GaugeOptions
>
,
State
>
{
constructor
(
props
)
{
super
(
props
);
...
...
p
ublic/sass/components/_value-mappings
.scss
→
p
ackages/grafana-ui/src/components/ValueMappingsEditor/_ValueMappingsEditor
.scss
View file @
c90979a8
File moved
packages/grafana-ui/src/components/ValueMappingsEditor/__snapshots__/ValueMappingsEditor.test.tsx.snap
0 → 100644
View file @
c90979a8
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render should render component 1`] = `
<Component
title="Value Mappings"
>
<div>
<MappingRow
key="Ok-0"
mapping={
Object {
"id": 1,
"operator": "",
"text": "Ok",
"type": 1,
"value": "20",
}
}
removeMapping={[Function]}
updateMapping={[Function]}
/>
<MappingRow
key="Meh-1"
mapping={
Object {
"from": "21",
"id": 2,
"operator": "",
"text": "Meh",
"to": "30",
"type": 2,
}
}
removeMapping={[Function]}
updateMapping={[Function]}
/>
</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>
`;
packages/grafana-ui/src/components/index.scss
View file @
c90979a8
...
...
@@ -6,3 +6,4 @@
@import
'PanelOptionsGroup/PanelOptionsGroup'
;
@import
'PanelOptionsGrid/PanelOptionsGrid'
;
@import
'ColorPicker/ColorPicker'
;
@import
'ValueMappingsEditor/ValueMappingsEditor'
;
packages/grafana-ui/src/components/index.ts
View file @
c90979a8
...
...
@@ -19,3 +19,4 @@ export { GfFormLabel } from './GfFormLabel/GfFormLabel';
export
{
Graph
}
from
'./Graph/Graph'
;
export
{
PanelOptionsGroup
}
from
'./PanelOptionsGroup/PanelOptionsGroup'
;
export
{
PanelOptionsGrid
}
from
'./PanelOptionsGrid/PanelOptionsGrid'
;
export
{
ValueMappingsEditor
}
from
'./ValueMappingsEditor/ValueMappingsEditor'
;
public/app/plugins/panel/gauge/GaugePanelOptions.tsx
View file @
c90979a8
...
...
@@ -6,10 +6,10 @@ import {
ThresholdsEditor
,
Threshold
,
PanelOptionsGrid
,
ValueMappingsEditor
,
}
from
'@grafana/ui'
;
import
ValueOptions
from
'app/plugins/panel/gauge/ValueOptions'
;
import
ValueMappings
from
'app/plugins/panel/gauge/ValueMappings'
;
import
GaugeOptionsEditor
from
'./GaugeOptionsEditor'
;
export
const
defaultProps
=
{
...
...
@@ -44,7 +44,7 @@ export default class GaugePanelOptions extends PureComponent<PanelOptionsProps<G
<
ThresholdsEditor
onChange=
{
this
.
onThresholdsChanged
}
thresholds=
{
options
.
thresholds
}
/>
</
PanelOptionsGrid
>
<
ValueMappings
onChange=
{
onChange
}
options=
{
options
}
/>
<
ValueMappings
Editor
onChange=
{
onChange
}
options=
{
options
}
/>
</>
);
}
...
...
public/sass/_grafana.scss
View file @
c90979a8
// DEPENDENCIES
// DEPENDENCIES
@import
'../../node_modules/react-table/react-table.css'
;
// VENDOR
...
...
@@ -97,7 +97,6 @@
@import
'components/add_data_source.scss'
;
@import
'components/page_loader'
;
@import
'components/toggle_button_group'
;
@import
'components/value-mappings'
;
@import
'components/popover-box'
;
// LOAD @grafana/ui components
...
...
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