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
199f772b
Unverified
Commit
199f772b
authored
Jul 01, 2020
by
Torkel Ödegaard
Committed by
GitHub
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StatPanel: Add migration for singlestat tableColumn to to fields property (#25901)
parent
a02c6f2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.test.ts
+12
-0
packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts
+5
-1
No files found.
packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.test.ts
View file @
199f772b
...
@@ -198,6 +198,18 @@ describe('sharedSingleStatMigrationHandler', () => {
...
@@ -198,6 +198,18 @@ describe('sharedSingleStatMigrationHandler', () => {
expect
(
panel
.
fieldConfig
.
defaults
.
max
).
toBe
(
undefined
);
expect
(
panel
.
fieldConfig
.
defaults
.
max
).
toBe
(
undefined
);
});
});
it
(
'change from angular singlestat with tableColumn set'
,
()
=>
{
const
old
:
any
=
{
angular
:
{
tableColumn
:
'info'
,
},
};
const
panel
=
{}
as
PanelModel
;
const
newOptions
=
sharedSingleStatPanelChangedHandler
(
panel
,
'singlestat'
,
old
);
expect
(
newOptions
.
reduceOptions
.
calcs
).
toEqual
([
'mean'
]);
expect
(
newOptions
.
reduceOptions
.
fields
).
toBe
(
'/^info$/'
);
});
it
(
'change from angular singlestat with no enabled gauge'
,
()
=>
{
it
(
'change from angular singlestat with no enabled gauge'
,
()
=>
{
const
old
:
any
=
{
const
old
:
any
=
{
angular
:
{
angular
:
{
...
...
packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts
View file @
199f772b
...
@@ -55,7 +55,7 @@ function migrateFromAngularSinglestat(panel: PanelModel<Partial<SingleStatBaseOp
...
@@ -55,7 +55,7 @@ function migrateFromAngularSinglestat(panel: PanelModel<Partial<SingleStatBaseOp
const
prevPanel
=
prevOptions
.
angular
;
const
prevPanel
=
prevOptions
.
angular
;
const
reducer
=
fieldReducers
.
getIfExists
(
prevPanel
.
valueName
);
const
reducer
=
fieldReducers
.
getIfExists
(
prevPanel
.
valueName
);
const
options
=
{
const
options
=
{
field
Options
:
{
reduce
Options
:
{
calcs
:
[
reducer
?
reducer
.
id
:
ReducerID
.
mean
],
calcs
:
[
reducer
?
reducer
.
id
:
ReducerID
.
mean
],
},
},
orientation
:
VizOrientation
.
Horizontal
,
orientation
:
VizOrientation
.
Horizontal
,
...
@@ -67,6 +67,10 @@ function migrateFromAngularSinglestat(panel: PanelModel<Partial<SingleStatBaseOp
...
@@ -67,6 +67,10 @@ function migrateFromAngularSinglestat(panel: PanelModel<Partial<SingleStatBaseOp
defaults
.
unit
=
prevPanel
.
format
;
defaults
.
unit
=
prevPanel
.
format
;
}
}
if
(
prevPanel
.
tableColumn
)
{
options
.
reduceOptions
.
fields
=
`/^
${
prevPanel
.
tableColumn
}
$/`
;
}
if
(
prevPanel
.
nullPointMode
)
{
if
(
prevPanel
.
nullPointMode
)
{
defaults
.
nullValueMode
=
prevPanel
.
nullPointMode
;
defaults
.
nullValueMode
=
prevPanel
.
nullPointMode
;
}
}
...
...
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