Commit f98f4d50 by Rashid Khan

Added color stepping functions

parent d9a2b28b
......@@ -28,6 +28,7 @@
"globals": {
"define": true,
"require": true
"require": true,
"Chromath": false
}
}
\ No newline at end of file
......@@ -6,7 +6,6 @@ define([
'jquery',
'underscore',
'require',
'elasticjs',
'bootstrap',
'angular-sanitize',
......
define(['jquery', 'underscore','moment'],
define(['jquery','underscore','moment','chromath'],
function($, _, moment) {
'use strict';
......@@ -459,5 +459,20 @@ function($, _, moment) {
].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;
});
\ No newline at end of file
......@@ -13,7 +13,7 @@ require.config({
text: '../vendor/require/text',
moment: '../vendor/moment',
filesaver: '../vendor/filesaver',
chromath: '../vendor/chromath',
angular: '../vendor/angular/angular',
'angular-dragdrop': '../vendor/angular/angular-dragdrop',
'angular-strap': '../vendor/angular/angular-strap',
......
......@@ -16,7 +16,6 @@ function (angular) {
restrict: 'A',
link: function(scope, elem, attr) {
if(!esVersion.is(attr.esVersion)) {
console.log('hiding');
elem.hide();
}
}
......
......@@ -6,6 +6,7 @@
overflow-x: scroll;
}
</style>
<div class="row-fluid">
<div ng-class="{'span3':panel.field_list}" ng-show="panel.field_list">
<div class="sidebar-nav">
......
......@@ -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
// here before telling the panels to refresh
this.refresh = function() {
if(self.current.index.interval !== 'none') {
if(filterSrv.idsByType('time').length > 0) {
var _range = filterSrv.timeRange('last');
......
......@@ -17,14 +17,28 @@ function (angular, _, config) {
ids : [],
});
// Defaults for query objects
// Defaults for generic query object
var _query = {
query: '*',
alias: '',
pin: false,
type: 'lucene'
};
// Defaults for specific query types
var _dTypes = {
"lucene": {
query: "*"
},
"regex": {
query: ".*"
},
"derive": {
query: "*",
field: "_type",
size: "5"
}
};
// For convenience
var ejs = ejsResource(config.elasticsearch);
var _q = dashboard.current.services.query;
......@@ -80,6 +94,7 @@ function (angular, _, config) {
query.id = _id;
query.color = query.color || colorAt(_id);
_.defaults(query,_query);
_.defaults(query,_dTypes[query.type]);
self.list[_id] = query;
self.ids.push(_id);
......@@ -102,10 +117,13 @@ function (angular, _, config) {
}
};
this.getEjsObj = function(id) {
return self.toEjsObj(self.list[id]);
// This must return an array to correctly resolve compound query types, eg derived
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) {
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