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
5ceedc4a
Commit
5ceedc4a
authored
Jan 11, 2019
by
Hugo Häggmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved defaultProps to ui/components
parent
0b8165fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
27 deletions
+31
-27
packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.test.tsx
+1
-1
packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx
+3
-1
packages/grafana-ui/src/types/gauge.ts
+18
-1
public/app/plugins/panel/gauge/GaugePanelOptions.tsx
+2
-19
public/app/plugins/panel/gauge/ValueMappings.test.tsx
+3
-3
public/app/plugins/panel/gauge/module.tsx
+4
-2
No files found.
packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.test.tsx
View file @
5ceedc4a
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
{
BasicGaugeColor
,
GaugeOptions
,
PanelOptionsProps
}
from
'@grafana/ui'
;
import
{
ThresholdsEditor
}
from
'./ThresholdsEditor'
;
import
{
BasicGaugeColor
,
PanelOptionsProps
,
GaugeOptions
}
from
'../../types'
;
const
defaultProps
=
{
options
:
{
...
...
packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx
View file @
5ceedc4a
import
React
,
{
PureComponent
}
from
'react'
;
import
tinycolor
,
{
ColorInput
}
from
'tinycolor2'
;
import
{
BasicGaugeColor
,
ColorPicker
,
GaugeOptions
,
PanelOptionsProps
,
Threshold
}
from
'@grafana/ui'
;
import
{
Threshold
,
PanelOptionsProps
,
GaugeOptions
,
BasicGaugeColor
}
from
'../../types'
;
import
{
ColorPicker
}
from
'../ColorPicker/ColorPicker'
;
interface
State
{
thresholds
:
Threshold
[];
...
...
packages/grafana-ui/src/types/gauge.ts
View file @
5ceedc4a
import
{
RangeMap
,
Threshold
,
ValueMap
}
from
'@grafana/ui
'
;
import
{
BasicGaugeColor
,
RangeMap
,
Threshold
,
ValueMap
}
from
'./panel
'
;
export
interface
GaugeOptions
{
baseColor
:
string
;
...
...
@@ -14,3 +14,20 @@ export interface GaugeOptions {
thresholds
:
Threshold
[];
unit
:
string
;
}
export
const
GaugePanelOptionsDefaultProps
=
{
options
:
{
baseColor
:
BasicGaugeColor
.
Green
,
minValue
:
0
,
maxValue
:
100
,
prefix
:
''
,
showThresholdMarkers
:
true
,
showThresholdLabels
:
false
,
suffix
:
''
,
decimals
:
0
,
stat
:
'avg'
,
unit
:
'none'
,
mappings
:
[],
thresholds
:
[],
},
};
public/app/plugins/panel/gauge/GaugePanelOptions.tsx
View file @
5ceedc4a
import
React
,
{
PureComponent
}
from
'react'
;
import
{
BasicGaugeColor
,
GaugeOption
s
,
PanelOptionsProps
,
ThresholdsEditor
}
from
'@grafana/ui'
;
import
{
GaugeOptions
,
GaugePanelOptionsDefaultProp
s
,
PanelOptionsProps
,
ThresholdsEditor
}
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
=
{
options
:
{
baseColor
:
BasicGaugeColor
.
Green
,
minValue
:
0
,
maxValue
:
100
,
prefix
:
''
,
showThresholdMarkers
:
true
,
showThresholdLabels
:
false
,
suffix
:
''
,
decimals
:
0
,
stat
:
'avg'
,
unit
:
'none'
,
mappings
:
[],
thresholds
:
[],
},
};
export
default
class
GaugePanelOptions
extends
PureComponent
<
PanelOptionsProps
<
GaugeOptions
>>
{
static
defaultProps
=
d
efaultProps
;
static
defaultProps
=
GaugePanelOptionsD
efaultProps
;
render
()
{
const
{
onChange
,
options
}
=
this
.
props
;
...
...
public/app/plugins/panel/gauge/ValueMappings.test.tsx
View file @
5ceedc4a
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
{
GaugeOptions
,
MappingType
,
PanelOptionsProps
}
from
'@grafana/ui'
;
import
{
GaugePanelOptionsDefaultProps
}
from
'@grafana/ui/src/types/gauge'
;
import
ValueMappings
from
'./ValueMappings'
;
import
{
defaultProps
}
from
'app/plugins/panel/gauge/GaugePanelOptions'
;
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
PanelOptionsProps
<
GaugeOptions
>
=
{
onChange
:
jest
.
fn
(),
options
:
{
...
d
efaultProps
.
options
,
...
GaugePanelOptionsD
efaultProps
.
options
,
mappings
:
[
{
id
:
1
,
operator
:
''
,
type
:
MappingType
.
ValueToText
,
value
:
'20'
,
text
:
'Ok'
},
{
id
:
2
,
operator
:
''
,
type
:
MappingType
.
RangeToText
,
from
:
'21'
,
to
:
'30'
,
text
:
'Meh'
},
...
...
@@ -67,7 +67,7 @@ describe('Next id to add', () => {
});
it
(
'should default to 1'
,
()
=>
{
const
{
instance
}
=
setup
({
options
:
{
...
d
efaultProps
.
options
}
});
const
{
instance
}
=
setup
({
options
:
{
...
GaugePanelOptionsD
efaultProps
.
options
}
});
expect
(
instance
.
state
.
nextIdToAdd
).
toEqual
(
1
);
});
...
...
public/app/plugins/panel/gauge/module.tsx
View file @
5ceedc4a
import
GaugePanelOptions
,
{
defaultProps
}
from
'./GaugePanelOptions'
;
import
{
GaugePanelOptionsDefaultProps
}
from
'@grafana/ui'
;
import
GaugePanelOptions
from
'./GaugePanelOptions'
;
import
{
GaugePanel
}
from
'./GaugePanel'
;
export
{
GaugePanel
as
Panel
,
GaugePanelOptions
as
PanelOptions
,
d
efaultProps
as
PanelDefaults
};
export
{
GaugePanel
as
Panel
,
GaugePanelOptions
as
PanelOptions
,
GaugePanelOptionsD
efaultProps
as
PanelDefaults
};
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