Skip to content

Commit

Permalink
Merge pull request #400 from spenceralger/master
Browse files Browse the repository at this point in the history
Creates zero-filled data for the histogram.
  • Loading branch information
spenceralger committed Aug 22, 2013
2 parents 3b9bc6b + 69ab6bb commit 2cff988
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 86 deletions.
39 changes: 19 additions & 20 deletions js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ angular.module('kibana.services', [])

this.clearAll = function() {
self.list = [];
};
};

})
.service('fields', function(dashboard, $rootScope, $http, alertSrv) {
Expand Down Expand Up @@ -116,7 +116,7 @@ angular.module('kibana.services', [])
ret[propName] = obj;
}
}
return ret;
return ret;
};

})
Expand Down Expand Up @@ -242,11 +242,11 @@ angular.module('kibana.services', [])
ids : [],
});

// For convenience
var ejs = ejsResource(config.elasticsearch);
// For convenience
var ejs = ejsResource(config.elasticsearch);
var _q = dashboard.current.services.query;

this.colors = [
this.colors = [
"#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0", //1
"#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477", //2
"#B7DBAB","#F4D598","#70DBED","#F9BA8F","#F29191","#82B5D8","#E5A8E2","#AEA2E0", //3
Expand All @@ -264,7 +264,7 @@ angular.module('kibana.services', [])
_q = dashboard.current.services.query;
self.list = dashboard.current.services.query.list;
self.ids = dashboard.current.services.query.ids;

if (self.ids.length === 0) {
self.set({});
}
Expand Down Expand Up @@ -330,7 +330,7 @@ angular.module('kibana.services', [])
};

this.idsByMode = function(config) {
switch(config.mode)
switch(config.mode)
{
case 'all':
return self.ids;
Expand Down Expand Up @@ -370,7 +370,7 @@ angular.module('kibana.services', [])
});

// For convenience
var ejs = ejsResource(config.elasticsearch);
var ejs = ejsResource(config.elasticsearch);
var _f = dashboard.current.services.filter;

// Save a reference to this
Expand All @@ -390,7 +390,7 @@ angular.module('kibana.services', [])

};

// This is used both for adding filters and modifying them.
// This is used both for adding filters and modifying them.
// If an id is passed, the filter at that id is updated
this.set = function(filter,id) {
_.defaults(filter,{mandate:'must'});
Expand Down Expand Up @@ -425,7 +425,7 @@ angular.module('kibana.services', [])
var either_bool = ejs.BoolFilter().must(ejs.MatchAllFilter());
_.each(ids,function(id) {
if(self.list[id].active) {
switch(self.list[id].mandate)
switch(self.list[id].mandate)
{
case 'mustNot':
bool = bool.mustNot(self.getEjsObj(id));
Expand Down Expand Up @@ -563,7 +563,7 @@ angular.module('kibana.services', [])
};

// An elasticJS client to use
var ejs = ejsResource(config.elasticsearch);
var ejs = ejsResource(config.elasticsearch);
var gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;

// Store a reference to this
Expand Down Expand Up @@ -602,8 +602,8 @@ angular.module('kibana.services', [])

// No dashboard in the URL
} else {
// Check if browser supports localstorage, and if there's a dashboard
if (window.Modernizr.localstorage &&
// Check if browser supports localstorage, and if there's a dashboard
if (window.Modernizr.localstorage &&
!(_.isUndefined(window.localStorage['dashboard'])) &&
window.localStorage['dashboard'] !== ''
) {
Expand All @@ -612,11 +612,11 @@ angular.module('kibana.services', [])
// No? Ok, grab default.json, its all we have now
} else {
self.file_load('default.json');
}
}
}
};

// 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
this.refresh = function() {
if(self.current.index.interval !== 'none') {
Expand All @@ -626,7 +626,7 @@ angular.module('kibana.services', [])
self.current.index.pattern,self.current.index.interval
).then(function (p) {
if(p.length > 0) {
self.indices = p;
self.indices = p;
} else {
//TODO: Option to not failover
if(self.current.failover) {
Expand Down Expand Up @@ -711,7 +711,7 @@ angular.module('kibana.services', [])
return true;
} else {
return false;
}
}
};

this.purge_default = function() {
Expand Down Expand Up @@ -770,7 +770,7 @@ angular.module('kibana.services', [])
// Clone object so we can modify it without influencing the existing obejct
var save = _.clone(self.current);
var id;

// Change title on object clone
if (type === 'dashboard') {
id = save.title = _.isUndefined(title) ? self.current.title : title;
Expand All @@ -783,7 +783,7 @@ angular.module('kibana.services', [])
title: save.title,
dashboard: angular.toJson(save)
});

request = type === 'temp' && ttl ? request.ttl(ttl) : request;

// TOFIX: Implement error handling here
Expand Down Expand Up @@ -868,5 +868,4 @@ angular.module('kibana.services', [])
return false;
});
};

});
Loading

0 comments on commit 2cff988

Please sign in to comment.