Skip to content

Commit

Permalink
Merge pull request #404 from rashidkpc/master
Browse files Browse the repository at this point in the history
Fixing grunt build and 0 height bars
  • Loading branch information
Rashid Khan committed Aug 23, 2013
2 parents 2cff988 + ada84c4 commit d45690a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
25 changes: 13 additions & 12 deletions js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,20 +749,22 @@ angular.module('kibana.services', [])
});
};


this.elasticsearch_load = function(type,id) {
var request = ejs.Request().indices(config.kibana_index).types(type);
return request.query(
ejs.IdsQuery(id)
).doSearch(function(results) {
if(_.isUndefined(results)) {
return false;
return $http({
url: config.elasticsearch + "/" + config.kibana_index + "/"+type+"/"+id,
method: "GET"
}).error(function(data, status, headers, conf) {
if(status === 0) {
alertSrv.set('Error',"Could not contact Elasticsearch at "+config.elasticsearch+
". Please ensure that Elasticsearch is reachable from your system." ,'error');
} else {
self.dash_load(angular.fromJson(results.hits.hits[0]['_source']['dashboard']));
return true;
alertSrv.set('Error',"Could not find "+id+". If you"+
" are using a proxy, ensure it is configured correctly",'error');
}
},
function(data,status) {
alertSrv.set('Error','Could not load '+config.elasticsearch+"/"+config.kibana_index+"/"+type+"/"+id,'error');
return false;
}).success(function(data, status, headers) {
self.dash_load(angular.fromJson(data['_source']['dashboard']));
});
};

Expand All @@ -786,7 +788,6 @@ angular.module('kibana.services', [])

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

// TOFIX: Implement error handling here
return request.doIndex(
// Success
function(result) {
Expand Down
2 changes: 1 addition & 1 deletion panels/dashcontrol/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ angular.module('kibana.dashcontrol', [])
type,
($scope.elasticsearch.title || dashboard.current.title),
($scope.panel.ttl_enable ? ttl : false)
).then(
).then(
function(result) {
if(!_.isUndefined(result._id)) {
alertSrv.set('Dashboard Saved','This dashboard has been saved to Elasticsearch as "' +
Expand Down
41 changes: 20 additions & 21 deletions panels/histogram/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,22 @@ angular.module('kibana.histogram', [])
$scope.get_time_range = function () {
var range = $scope.range = filterSrv.timeRange('min');
return range;
}
};

$scope.get_interval = function () {
var interval = $scope.panel.interval
, range;
var interval = $scope.panel.interval,
range;
if ($scope.panel.auto_int) {
range = $scope.get_time_range()
range = $scope.get_time_range();
if (range) {
interval = kbn.secondsToHms(
kbn.calculate_interval(range.from, range.to, $scope.panel.resolution, 0) / 1000
);
}
}
$scope.panel.interval = interval || '10m';
return $scope.panel.interval
}
return $scope.panel.interval;
};
/**
* Fetch the data for a chunk of a queries results. Multiple segments occur when several indicies
* need to be consulted (like timestamped logstash indicies)
Expand All @@ -116,7 +117,7 @@ angular.module('kibana.histogram', [])
*/
$scope.get_data = function(segment, query_id) {
if (_.isUndefined(segment)) {
segment = 0
segment = 0;
}
delete $scope.panel.error;

Expand All @@ -126,7 +127,7 @@ angular.module('kibana.histogram', [])
}


var _range = $scope.get_time_range()
var _range = $scope.get_time_range();
var _interval = $scope.get_interval(_range);

if ($scope.panel.auto_int) {
Expand Down Expand Up @@ -187,9 +188,9 @@ angular.module('kibana.histogram', [])
// Make sure we're still on the same query/queries
if($scope.query_id === query_id && _.difference(facetIds, $scope.panel.queries.ids).length === 0) {

var i = 0
, time_series
, hits;
var i = 0,
time_series,
hits;

_.each($scope.panel.queries.ids, function(id) {
var query_results = results.facets[id];
Expand Down Expand Up @@ -341,7 +342,7 @@ angular.module('kibana.histogram', [])
lineWidth: scope.panel.linewidth,
steps: false
},
bars: { show: scope.panel.bars, fill: 1, barWidth: barwidth/1.8, zero: false },
bars: { show: scope.panel.bars, fill: 1, lineWidth:0, barWidth: barwidth/1.7, zero: false },
points: { show: scope.panel.points, fill: 1, fillColor: false, radius: 5},
shadowSize: 1
},
Expand Down Expand Up @@ -396,9 +397,7 @@ angular.module('kibana.histogram', [])

function tt(x, y, contents) {
// If the tool tip already exists, don't recreate it, just update it
var tooltip = $('#pie-tooltip').length
? $('#pie-tooltip')
: $('<div id="pie-tooltip"></div>');
var tooltip = $('#pie-tooltip').length ? $('#pie-tooltip') : $('<div id="pie-tooltip"></div>');

tooltip.html(contents).css({
position: 'absolute',
Expand Down Expand Up @@ -463,7 +462,7 @@ angular.module('kibana.histogram', [])
if (end) {
this.addValue(end, null);
}
}
};
/**
* Add a row
* @param int time The time for the value, in
Expand All @@ -486,11 +485,11 @@ angular.module('kibana.histogram', [])
*/
this.ZeroFilled.prototype.getFlotPairs = function () {
// var startTime = performance.now();
var times = _.map(_.keys(this._data), base10Int).sort()
, result = []
, i
, next
, expected_next;
var times = _.map(_.keys(this._data), base10Int).sort(),
result = [],
i,
next,
expected_next;
for(i = 0; i < times.length; i++) {
result.push([ times[i], this._data[times[i]] ]);
next = times[i + 1];
Expand Down

0 comments on commit d45690a

Please sign in to comment.