2014-04-23 02:05:10 -05:00
|
|
|
define([
|
|
|
|
'angular'
|
|
|
|
],
|
|
|
|
function (angular) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
2014-07-28 11:11:52 -05:00
|
|
|
.module('grafana.directives')
|
2015-04-02 02:50:57 -05:00
|
|
|
.directive('grafanaVersionCheck', function($http, contextSrv) {
|
2014-04-23 02:05:10 -05:00
|
|
|
return {
|
|
|
|
restrict: 'A',
|
|
|
|
link: function(scope, elem) {
|
2015-04-02 02:50:57 -05:00
|
|
|
if (contextSrv.version === 'master') {
|
2014-08-27 03:41:27 -05:00
|
|
|
return;
|
2014-04-23 02:05:10 -05:00
|
|
|
}
|
|
|
|
|
2014-08-14 05:13:03 -05:00
|
|
|
$http({ method: 'GET', url: 'https://grafanarel.s3.amazonaws.com/latest.json' })
|
2014-04-23 02:05:10 -05:00
|
|
|
.then(function(response) {
|
|
|
|
if (!response.data || !response.data.version) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-02 02:50:57 -05:00
|
|
|
if (contextSrv.version !== response.data.version) {
|
2014-04-23 02:05:10 -05:00
|
|
|
elem.append('<i class="icon-info-sign"></i> ' +
|
|
|
|
'<a href="http://grafana.org/download" target="_blank"> ' +
|
|
|
|
'New version available: ' + response.data.version +
|
|
|
|
'</a>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
2014-08-27 02:01:50 -05:00
|
|
|
});
|