diff --git a/src/app/controllers/dash.js b/src/app/controllers/dash.js index 3aca01a8901176..589495d426b87f 100755 --- a/src/app/controllers/dash.js +++ b/src/app/controllers/dash.js @@ -10,13 +10,15 @@ function (angular, config, _) { var module = angular.module('kibana.controllers'); module.controller('DashCtrl', function( - $scope, $route, ejsResource, fields, dashboard, alertSrv, panelMove) { + $scope, $route, ejsResource, fields, dashboard, alertSrv, panelMove, esVersion) { + + $scope.requiredElasticSearchVersion = ">=0.20.5"; + $scope.editor = { index: 0 }; - // For moving stuff around the dashboard. Needs better names - $scope.panelMove = panelMove; + // For moving stuff around the dashboard. $scope.panelMoveDrop = panelMove.onDrop; $scope.panelMoveStart = panelMove.onStart; $scope.panelMoveStop = panelMove.onStop; @@ -24,16 +26,18 @@ function (angular, config, _) { $scope.panelMoveOut = panelMove.onOut; - $scope.init = function() { $scope.config = config; - // Make underscore.js available to views + // Make stuff, including underscore.js available to views $scope._ = _; $scope.dashboard = dashboard; $scope.dashAlerts = alertSrv; + $scope.esVersion = esVersion; + + // Clear existing alerts alertSrv.clearAll(); - // Provide a global list of all see fields + // Provide a global list of all seen fields $scope.fields = fields; $scope.reset_row(); diff --git a/src/app/directives/all.js b/src/app/directives/all.js index ad2fad891b1d26..3e5225f4ed2873 100755 --- a/src/app/directives/all.js +++ b/src/app/directives/all.js @@ -7,5 +7,6 @@ define([ './ngBlur', './ngModelOnBlur', './tip', - './confirmClick' + './confirmClick', + './esVersion' ], function () {}); \ No newline at end of file diff --git a/src/app/directives/esVersion.js b/src/app/directives/esVersion.js new file mode 100644 index 00000000000000..00007e212d25ee --- /dev/null +++ b/src/app/directives/esVersion.js @@ -0,0 +1,25 @@ +/* + Only show an element if it meets an Elasticsearch version requirement +*/ + +define([ + 'angular', + 'app', +], +function (angular) { + 'use strict'; + + angular + .module('kibana.directives') + .directive('esVersion', function(esVersion) { + return { + restrict: 'A', + link: function(scope, elem, attr) { + if(!esVersion.is(attr.esVersion)) { + console.log('hiding'); + elem.hide(); + } + } + }; + }); +}); \ No newline at end of file diff --git a/src/app/filters/all.js b/src/app/filters/all.js index 41860832a75275..ec6187f294a216 100755 --- a/src/app/filters/all.js +++ b/src/app/filters/all.js @@ -24,6 +24,18 @@ define(['angular', 'jquery', 'underscore', 'moment'], function (angular, $, _, m }; }); + /* + Filter an array of objects by elasticsearch version requirements + */ + module.filter('esVersion', function(esVersion) { + return function(items, require) { + var ret = _.filter(items,function(qt) { + return esVersion.is(qt[require]) ? true : false; + }); + return ret; + }; + }); + module.filter('slice', function() { return function(arr, start, end) { if(!_.isUndefined(arr)) { diff --git a/src/app/panels/query/meta.html b/src/app/panels/query/meta.html index 432887cbc5cec7..5a383ce2955ca3 100755 --- a/src/app/panels/query/meta.html +++ b/src/app/panels/query/meta.html @@ -1,4 +1,4 @@ -