|
|
@@ -42,21 +42,34 @@ describe('given dashboard with repeated panels', function() {
|
|
|
repeat: 'test',
|
|
|
panels: [
|
|
|
{id: 2, repeat: 'apps', datasource: 'gfdb', type: 'graph'},
|
|
|
- {id: 2, repeat: null, repeatPanelId: 2},
|
|
|
+ {id: 3, repeat: null, repeatPanelId: 2},
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ datasource: '-- Mixed --',
|
|
|
+ targets: [{datasource: 'other'}],
|
|
|
+ },
|
|
|
]
|
|
|
});
|
|
|
+
|
|
|
dash.rows.push({
|
|
|
repeat: null,
|
|
|
repeatRowId: 1,
|
|
|
panels: [],
|
|
|
});
|
|
|
|
|
|
- var datasourceSrvStub = {
|
|
|
- get: sinon.stub().returns(Promise.resolve({
|
|
|
- name: 'gfdb',
|
|
|
- meta: {id: "testdb", info: {version: "1.2.1"}, name: "TestDB"}
|
|
|
- }))
|
|
|
- };
|
|
|
+ var datasourceSrvStub = {get: sinon.stub()};
|
|
|
+ datasourceSrvStub.get.withArgs('gfdb').returns(Promise.resolve({
|
|
|
+ name: 'gfdb',
|
|
|
+ meta: {id: "testdb", info: {version: "1.2.1"}, name: "TestDB"}
|
|
|
+ }));
|
|
|
+ datasourceSrvStub.get.withArgs('other').returns(Promise.resolve({
|
|
|
+ name: 'other',
|
|
|
+ meta: {id: "other", info: {version: "1.2.1"}, name: "OtherDB"}
|
|
|
+ }));
|
|
|
+ datasourceSrvStub.get.withArgs('-- Mixed --').returns(Promise.resolve({
|
|
|
+ name: 'mixed',
|
|
|
+ meta: {id: "mixed", info: {version: "1.2.1"}, name: "Mixed", builtIn: true}
|
|
|
+ }));
|
|
|
|
|
|
config.panels['graph'] = {
|
|
|
id: "graph",
|
|
|
@@ -72,7 +85,7 @@ describe('given dashboard with repeated panels', function() {
|
|
|
});
|
|
|
|
|
|
it('exported dashboard should not contain repeated panels', function() {
|
|
|
- expect(exported.rows[0].panels.length).to.be(1);
|
|
|
+ expect(exported.rows[0].panels.length).to.be(2);
|
|
|
});
|
|
|
|
|
|
it('exported dashboard should not contain repeated rows', function() {
|
|
|
@@ -109,6 +122,16 @@ describe('given dashboard with repeated panels', function() {
|
|
|
expect(require.version).to.be("1.2.1");
|
|
|
});
|
|
|
|
|
|
+ it('should not add built in datasources to required', function() {
|
|
|
+ var require = _.find(exported.__requires, {name: 'Mixed'});
|
|
|
+ expect(require).to.be(undefined);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should add datasources used in mixed mode', function() {
|
|
|
+ var require = _.find(exported.__requires, {name: 'OtherDB'});
|
|
|
+ expect(require).to.not.be(undefined);
|
|
|
+ });
|
|
|
+
|
|
|
it('should add panel to required', function() {
|
|
|
var require = _.find(exported.__requires, {name: 'Graph'});
|
|
|
expect(require.name).to.be("Graph");
|