From 827e1846a86b386d69c7acf607f6b51820ce92cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 23 Apr 2014 09:05:10 +0200 Subject: [PATCH] Closes #333, New version availability check will now checks http://grafanarel.s3.amazonaws.com/latest.json if there is a new version. And the link now points to http://grafana.org/download --- src/app/controllers/dash.js | 2 +- src/app/directives/all.js | 3 ++- src/app/directives/grafanaVersionCheck.js | 33 +++++++++++++++++++++++ src/app/partials/dasheditor.html | 7 ++--- src/css/bootstrap.dark.min.css | 2 +- src/css/bootstrap.light.min.css | 2 +- src/css/less/grafana.less | 7 ++++- tasks/build_task.js | 2 +- 8 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 src/app/directives/grafanaVersionCheck.js 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 @@