diff --git a/src/app/controllers/dash.js b/src/app/controllers/dash.js index 30c263099ca..b9556a8e4da 100644 --- a/src/app/controllers/dash.js +++ b/src/app/controllers/dash.js @@ -38,7 +38,7 @@ function (angular, $, config, _) { index: 0 }; - $scope.grafanaVersion = grafanaVersion[0] === '@' ? 'version: master' : grafanaVersion; + $scope.grafanaVersion = grafanaVersion[0] === '@' ? 'master' : grafanaVersion; // For moving stuff around the dashboard. $scope.panelMoveDrop = panelMove.onDrop; diff --git a/src/app/directives/all.js b/src/app/directives/all.js index cff5e81bf31..01fed7c4b2f 100644 --- a/src/app/directives/all.js +++ b/src/app/directives/all.js @@ -14,5 +14,6 @@ define([ './bootstrap-tagsinput', './bodyClass', './addGraphiteFunc', - './graphiteFuncEditor' + './graphiteFuncEditor', + './grafanaVersionCheck' ], function () {}); \ No newline at end of file diff --git a/src/app/directives/grafanaVersionCheck.js b/src/app/directives/grafanaVersionCheck.js new file mode 100644 index 00000000000..0981b68066a --- /dev/null +++ b/src/app/directives/grafanaVersionCheck.js @@ -0,0 +1,33 @@ +define([ + 'angular' +], +function (angular) { + 'use strict'; + + angular + .module('kibana.directives') + .directive('grafanaVersionCheck', function($http, grafanaVersion) { + return { + restrict: 'A', + link: function(scope, elem) { + if (grafanaVersion[0] === '@') { + return; + } + + $http({ method: 'GET', url: 'http://grafanarel.s3.amazonaws.com/latest.json' }) + .then(function(response) { + if (!response.data || !response.data.version) { + return; + } + + if (grafanaVersion !== response.data.version) { + elem.append(' ' + + ' ' + + 'New version available: ' + response.data.version + + ''); + } + }); + } + }; + }); +}); \ No newline at end of file diff --git a/src/app/partials/dasheditor.html b/src/app/partials/dasheditor.html index 45a93071f4b..06ee5f7ada2 100644 --- a/src/app/partials/dasheditor.html +++ b/src/app/partials/dasheditor.html @@ -148,11 +148,12 @@