From fb74d10573b412b0195db912676b4ceabcde28ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 19 May 2016 10:21:16 +0200 Subject: [PATCH] feat(export): added grafana version to requires array, #5084 --- public/app/features/dashboard/export/exporter.ts | 8 ++++++++ public/app/features/dashboard/specs/exporter_specs.ts | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/public/app/features/dashboard/export/exporter.ts b/public/app/features/dashboard/export/exporter.ts index 25b20198a25..065bfa15a59 100644 --- a/public/app/features/dashboard/export/exporter.ts +++ b/public/app/features/dashboard/export/exporter.ts @@ -78,6 +78,14 @@ export class DashboardExporter { templateizeDatasourceUsage(annotationDef); } + // add grafana version + requires['grafana'] = { + type: 'grafana', + id: 'grafana', + name: 'Grafana', + version: config.buildInfo.version + }; + return Promise.all(promises).then(() => { _.each(datasources, (value, key) => { inputs.push(value); diff --git a/public/app/features/dashboard/specs/exporter_specs.ts b/public/app/features/dashboard/specs/exporter_specs.ts index 26ad31eeadf..811ca0f563d 100644 --- a/public/app/features/dashboard/specs/exporter_specs.ts +++ b/public/app/features/dashboard/specs/exporter_specs.ts @@ -14,6 +14,10 @@ describe.only('given dashboard with repeated panels', function() { annotations: { list: [] }, }; + config.buildInfo = { + version: "3.0.2" + }; + dash.templating.list.push({ name: 'apps', type: 'query', @@ -104,5 +108,12 @@ describe.only('given dashboard with repeated panels', function() { expect(require.version).to.be("1.1.0"); }); + it('should add grafana version', function() { + var require = _.findWhere(exported.__requires, {name: 'Grafana'}); + expect(require.type).to.be("grafana"); + expect(require.id).to.be("grafana"); + expect(require.version).to.be("3.0.2"); + }); + });