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
a2e08dc4
Unverified
Commit
a2e08dc4
authored
Jun 19, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure to process panels in collapsed rows when exporting dashboard
parent
d450ec94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
3 deletions
+66
-3
public/app/features/dashboard/export/exporter.ts
+13
-2
public/app/features/dashboard/specs/exporter.jest.ts
+53
-1
No files found.
public/app/features/dashboard/export/exporter.ts
View file @
a2e08dc4
...
...
@@ -63,8 +63,7 @@ export class DashboardExporter {
);
};
// check up panel data sources
for
(
let
panel
of
saveModel
.
panels
)
{
const
processPanel
=
panel
=>
{
if
(
panel
.
datasource
!==
undefined
)
{
templateizeDatasourceUsage
(
panel
);
}
...
...
@@ -86,6 +85,18 @@ export class DashboardExporter {
version
:
panelDef
.
info
.
version
,
};
}
};
// check up panel data sources
for
(
let
panel
of
saveModel
.
panels
)
{
processPanel
(
panel
);
// handle collapsed rows
if
(
panel
.
collapsed
!==
undefined
&&
panel
.
collapsed
===
true
&&
panel
.
panels
)
{
for
(
let
rowPanel
of
panel
.
panels
)
{
processPanel
(
rowPanel
);
}
}
}
// templatize template vars
...
...
public/app/features/dashboard/specs/exporter.jest.ts
View file @
a2e08dc4
...
...
@@ -62,6 +62,27 @@ describe('given dashboard with repeated panels', () => {
type
:
'graph'
,
},
{
id
:
3
,
repeat
:
null
,
repeatPanelId
:
2
},
{
id
:
4
,
collapsed
:
true
,
panels
:
[
{
id
:
10
,
datasource
:
'gfdb'
,
type
:
'table'
},
{
id
:
11
},
{
id
:
12
,
datasource
:
'-- Mixed --'
,
targets
:
[{
datasource
:
'other'
}],
},
{
id
:
13
,
datasource
:
'$ds'
},
{
id
:
14
,
repeat
:
'apps'
,
datasource
:
'gfdb'
,
type
:
'heatmap'
,
},
{
id
:
15
,
repeat
:
null
,
repeatPanelId
:
14
},
],
},
],
};
...
...
@@ -78,6 +99,18 @@ describe('given dashboard with repeated panels', () => {
info
:
{
version
:
'1.1.0'
},
};
config
.
panels
[
'table'
]
=
{
id
:
'table'
,
name
:
'Table'
,
info
:
{
version
:
'1.1.1'
},
};
config
.
panels
[
'heatmap'
]
=
{
id
:
'heatmap'
,
name
:
'Heatmap'
,
info
:
{
version
:
'1.1.2'
},
};
dash
=
new
DashboardModel
(
dash
,
{});
var
exporter
=
new
DashboardExporter
(
datasourceSrvStub
);
exporter
.
makeExportable
(
dash
).
then
(
clean
=>
{
...
...
@@ -91,6 +124,11 @@ describe('given dashboard with repeated panels', () => {
expect
(
panel
.
datasource
).
toBe
(
'${DS_GFDB}'
);
});
it
(
'should replace datasource refs in collapsed row'
,
()
=>
{
var
panel
=
exported
.
panels
[
5
].
panels
[
0
];
expect
(
panel
.
datasource
).
toBe
(
'${DS_GFDB}'
);
});
it
(
'should replace datasource in variable query'
,
()
=>
{
expect
(
exported
.
templating
.
list
[
0
].
datasource
).
toBe
(
'${DS_GFDB}'
);
expect
(
exported
.
templating
.
list
[
0
].
options
.
length
).
toBe
(
0
);
...
...
@@ -126,13 +164,27 @@ describe('given dashboard with repeated panels', () => {
expect
(
require
).
not
.
toBe
(
undefined
);
});
it
(
'should add panel to required'
,
()
=>
{
it
(
'should add
graph
panel to required'
,
()
=>
{
var
require
=
_
.
find
(
exported
.
__requires
,
{
name
:
'Graph'
});
expect
(
require
.
name
).
toBe
(
'Graph'
);
expect
(
require
.
id
).
toBe
(
'graph'
);
expect
(
require
.
version
).
toBe
(
'1.1.0'
);
});
it
(
'should add table panel to required'
,
()
=>
{
var
require
=
_
.
find
(
exported
.
__requires
,
{
name
:
'Table'
});
expect
(
require
.
name
).
toBe
(
'Table'
);
expect
(
require
.
id
).
toBe
(
'table'
);
expect
(
require
.
version
).
toBe
(
'1.1.1'
);
});
it
(
'should add heatmap panel to required'
,
()
=>
{
var
require
=
_
.
find
(
exported
.
__requires
,
{
name
:
'Heatmap'
});
expect
(
require
.
name
).
toBe
(
'Heatmap'
);
expect
(
require
.
id
).
toBe
(
'heatmap'
);
expect
(
require
.
version
).
toBe
(
'1.1.2'
);
});
it
(
'should add grafana version'
,
()
=>
{
var
require
=
_
.
find
(
exported
.
__requires
,
{
name
:
'Grafana'
});
expect
(
require
.
type
).
toBe
(
'grafana'
);
...
...
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