Commit f98f4d50 by Rashid Khan

Added color stepping functions

parent d9a2b28b
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
"globals": { "globals": {
"define": true, "define": true,
"require": true "require": true,
"Chromath": false
} }
} }
\ No newline at end of file
...@@ -6,7 +6,6 @@ define([ ...@@ -6,7 +6,6 @@ define([
'jquery', 'jquery',
'underscore', 'underscore',
'require', 'require',
'elasticjs', 'elasticjs',
'bootstrap', 'bootstrap',
'angular-sanitize', 'angular-sanitize',
......
define(['jquery', 'underscore','moment'], define(['jquery','underscore','moment','chromath'],
function($, _, moment) { function($, _, moment) {
'use strict'; 'use strict';
...@@ -459,5 +459,20 @@ function($, _, moment) { ...@@ -459,5 +459,20 @@ function($, _, moment) {
].join(';') + '"></div>'; ].join(';') + '"></div>';
}; };
kbn.colorSteps = function(col,steps) {
var _d = 1.6/steps, // distance between steps
_p = []; // adjustment percentage
// Create a range of numbers between -0.8 and 0.8
for(var i = 1; i<steps+1; i+=1) {
_p.push(i%2 ? ((i-1)*_d*-1)/2 : i*_d/2);
}
// Create the color range
return _.map(_p.sort(function(a,b){return a-b;}),function(v) {
return v<0 ? Chromath.darken(col,v*-1).toString() : Chromath.lighten(col,v).toString();
});
};
return kbn; return kbn;
}); });
\ No newline at end of file
...@@ -13,7 +13,7 @@ require.config({ ...@@ -13,7 +13,7 @@ require.config({
text: '../vendor/require/text', text: '../vendor/require/text',
moment: '../vendor/moment', moment: '../vendor/moment',
filesaver: '../vendor/filesaver', filesaver: '../vendor/filesaver',
chromath: '../vendor/chromath',
angular: '../vendor/angular/angular', angular: '../vendor/angular/angular',
'angular-dragdrop': '../vendor/angular/angular-dragdrop', 'angular-dragdrop': '../vendor/angular/angular-dragdrop',
'angular-strap': '../vendor/angular/angular-strap', 'angular-strap': '../vendor/angular/angular-strap',
......
...@@ -16,7 +16,6 @@ function (angular) { ...@@ -16,7 +16,6 @@ function (angular) {
restrict: 'A', restrict: 'A',
link: function(scope, elem, attr) { link: function(scope, elem, attr) {
if(!esVersion.is(attr.esVersion)) { if(!esVersion.is(attr.esVersion)) {
console.log('hiding');
elem.hide(); elem.hide();
} }
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
overflow-x: scroll; overflow-x: scroll;
} }
</style> </style>
<div class="row-fluid"> <div class="row-fluid">
<div ng-class="{'span3':panel.field_list}" ng-show="panel.field_list"> <div ng-class="{'span3':panel.field_list}" ng-show="panel.field_list">
<div class="sidebar-nav"> <div class="sidebar-nav">
......
...@@ -123,6 +123,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) { ...@@ -123,6 +123,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
// Since the dashboard is responsible for index computation, we can compute and assign the indices // Since the dashboard is responsible for index computation, we can compute and assign the indices
// here before telling the panels to refresh // here before telling the panels to refresh
this.refresh = function() { this.refresh = function() {
if(self.current.index.interval !== 'none') { if(self.current.index.interval !== 'none') {
if(filterSrv.idsByType('time').length > 0) { if(filterSrv.idsByType('time').length > 0) {
var _range = filterSrv.timeRange('last'); var _range = filterSrv.timeRange('last');
......
...@@ -17,14 +17,28 @@ function (angular, _, config) { ...@@ -17,14 +17,28 @@ function (angular, _, config) {
ids : [], ids : [],
}); });
// Defaults for query objects // Defaults for generic query object
var _query = { var _query = {
query: '*',
alias: '', alias: '',
pin: false, pin: false,
type: 'lucene' type: 'lucene'
}; };
// Defaults for specific query types
var _dTypes = {
"lucene": {
query: "*"
},
"regex": {
query: ".*"
},
"derive": {
query: "*",
field: "_type",
size: "5"
}
};
// For convenience // For convenience
var ejs = ejsResource(config.elasticsearch); var ejs = ejsResource(config.elasticsearch);
var _q = dashboard.current.services.query; var _q = dashboard.current.services.query;
...@@ -80,6 +94,7 @@ function (angular, _, config) { ...@@ -80,6 +94,7 @@ function (angular, _, config) {
query.id = _id; query.id = _id;
query.color = query.color || colorAt(_id); query.color = query.color || colorAt(_id);
_.defaults(query,_query); _.defaults(query,_query);
_.defaults(query,_dTypes[query.type]);
self.list[_id] = query; self.list[_id] = query;
self.ids.push(_id); self.ids.push(_id);
...@@ -102,10 +117,13 @@ function (angular, _, config) { ...@@ -102,10 +117,13 @@ function (angular, _, config) {
} }
}; };
this.getEjsObj = function(id) { // This must return an array to correctly resolve compound query types, eg derived
return self.toEjsObj(self.list[id]); this.getEjsObj = function(ids) {
return self.toEjsObj(self.list[ids]);
}; };
// In the case of a compound query, such as a derived query, we'd need to
// return an array of elasticJS objects. Not sure if that is appropriate?
this.toEjsObj = function (q) { this.toEjsObj = function (q) {
switch(q.type) switch(q.type)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment