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
79a8017f
Commit
79a8017f
authored
May 10, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(export): more progress on dashboard export
parent
db664c61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
+22
-1
public/app/features/dashboard/exporter.ts
+14
-0
public/app/features/dashboard/specs/exporter_specs.ts
+8
-1
No files found.
public/app/features/dashboard/exporter.ts
View file @
79a8017f
...
...
@@ -16,6 +16,7 @@ export class DashboardExporter {
dynSrv
.
process
(
dash
,
{
cleanUpOnly
:
true
});
var
inputs
=
[];
var
requires
=
{};
var
datasources
=
{};
var
promises
=
[];
...
...
@@ -30,6 +31,13 @@ export class DashboardExporter {
pluginId
:
ds
.
meta
.
id
,
};
panel
.
datasource
=
'${'
+
refName
+
'}'
;
requires
[
'datasource'
+
ds
.
meta
.
id
]
=
{
type
:
'datasource'
,
id
:
ds
.
meta
.
id
,
name
:
ds
.
meta
.
name
,
version
:
ds
.
meta
.
info
.
version
};
}));
}
});
...
...
@@ -40,7 +48,13 @@ export class DashboardExporter {
inputs
.
push
(
value
);
});
requires
=
_
.
map
(
requires
,
req
=>
{
return
req
;
});
dash
[
"__inputs"
]
=
inputs
;
dash
[
"__requires"
]
=
requires
;
return
dash
;
});
}
...
...
public/app/features/dashboard/specs/exporter_specs.ts
View file @
79a8017f
...
...
@@ -2,7 +2,7 @@ import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/co
import
{
DashboardExporter
}
from
'../exporter'
;
describe
(
'given dashboard with repeated panels'
,
function
()
{
describe
.
only
(
'given dashboard with repeated panels'
,
function
()
{
var
dash
,
exported
;
beforeEach
((
done
)
=>
{
...
...
@@ -39,6 +39,7 @@ describe('given dashboard with repeated panels', function() {
exporter
.
makeExportable
(
dash
).
then
(
clean
=>
{
exported
=
clean
;
done
();
console
.
log
(
'done'
);
});
});
...
...
@@ -56,5 +57,11 @@ describe('given dashboard with repeated panels', function() {
expect
(
panel
.
datasource
).
to
.
be
(
"${DS_GFDB}"
);
});
it
(
'should add datasource as input'
,
function
()
{
expect
(
exported
.
__inputs
[
0
].
name
).
to
.
be
(
"DS_GFDB"
);
expect
(
exported
.
__inputs
[
0
].
pluginId
).
to
.
be
(
"testdb"
);
expect
(
exported
.
__inputs
[
0
].
type
).
to
.
be
(
"datasource"
);
});
});
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