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
31bb2f80
Commit
31bb2f80
authored
Dec 05, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:grafana/grafana into develop
parents
6fae999f
afc03649
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
public/app/features/dashboard/dashboard_migration.ts
+3
-2
public/app/features/dashboard/specs/dashboard_migration.jest.ts
+24
-2
No files found.
public/app/features/dashboard/dashboard_migration.ts
View file @
31bb2f80
...
...
@@ -383,8 +383,8 @@ export class DashboardMigrator {
return
;
}
// Add special "row" panels if even one row is collapsed or has visible title
const
showRows
=
_
.
some
(
old
.
rows
,
(
row
)
=>
row
.
collapse
||
row
.
showTitle
);
// Add special "row" panels if even one row is collapsed
, repeated
or has visible title
const
showRows
=
_
.
some
(
old
.
rows
,
(
row
)
=>
row
.
collapse
||
row
.
showTitle
||
row
.
repeat
);
for
(
let
row
of
old
.
rows
)
{
let
height
:
any
=
row
.
height
||
DEFAULT_ROW_HEIGHT
;
...
...
@@ -398,6 +398,7 @@ export class DashboardMigrator {
rowPanel
.
type
=
'row'
;
rowPanel
.
title
=
row
.
title
;
rowPanel
.
collapsed
=
row
.
collapse
;
rowPanel
.
repeat
=
row
.
repeat
;
rowPanel
.
panels
=
[];
rowPanel
.
gridPos
=
{
x
:
0
,
y
:
yPos
,
w
:
GRID_COLUMN_COUNT
,
h
:
rowGridHeight
};
rowPanelModel
=
new
PanelModel
(
rowPanel
);
...
...
public/app/features/dashboard/specs/dashboard_migration.jest.ts
View file @
31bb2f80
...
...
@@ -2,6 +2,7 @@ import _ from 'lodash';
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
PanelModel
}
from
'../panel_model'
;
import
{
GRID_CELL_HEIGHT
,
GRID_CELL_VMARGIN
}
from
'app/core/constants'
;
import
{
expect
}
from
'test/lib/common'
;
jest
.
mock
(
'app/core/services/context_srv'
,
()
=>
({}));
...
...
@@ -315,12 +316,33 @@ describe('DashboardModel', function() {
expect
(
panelGridPos
).
toEqual
(
expectedGrid
);
});
it
(
'should add repeated row if repeat set'
,
function
()
{
model
.
rows
=
[
createRow
({
showTitle
:
true
,
title
:
"Row"
,
height
:
8
,
repeat
:
"server"
},
[[
6
]]),
createRow
({
height
:
8
},
[[
12
]])
];
let
dashboard
=
new
DashboardModel
(
model
);
let
panelGridPos
=
getGridPositions
(
dashboard
);
let
expectedGrid
=
[
{
x
:
0
,
y
:
0
,
w
:
24
,
h
:
8
},
{
x
:
0
,
y
:
1
,
w
:
12
,
h
:
8
},
{
x
:
0
,
y
:
9
,
w
:
24
,
h
:
8
},
{
x
:
0
,
y
:
10
,
w
:
24
,
h
:
8
}
];
expect
(
panelGridPos
).
toEqual
(
expectedGrid
);
expect
(
dashboard
.
panels
[
0
].
repeat
).
toBe
(
"server"
);
expect
(
dashboard
.
panels
[
1
].
repeat
).
toBeUndefined
();
expect
(
dashboard
.
panels
[
2
].
repeat
).
toBeUndefined
();
expect
(
dashboard
.
panels
[
3
].
repeat
).
toBeUndefined
();
});
});
});
function
createRow
(
options
,
panelDescriptions
:
any
[])
{
const
PANEL_HEIGHT_STEP
=
GRID_CELL_HEIGHT
+
GRID_CELL_VMARGIN
;
let
{
collapse
,
height
,
showTitle
,
title
}
=
options
;
let
{
collapse
,
height
,
showTitle
,
title
,
repeat
}
=
options
;
height
=
height
*
PANEL_HEIGHT_STEP
;
let
panels
=
[];
_
.
each
(
panelDescriptions
,
panelDesc
=>
{
...
...
@@ -330,7 +352,7 @@ function createRow(options, panelDescriptions: any[]) {
}
panels
.
push
(
panel
);
});
let
row
=
{
collapse
,
height
,
showTitle
,
title
,
panels
};
let
row
=
{
collapse
,
height
,
showTitle
,
title
,
panels
,
repeat
};
return
row
;
}
...
...
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