Skip to content

Commit

Permalink
white-space cleanse, and added forin flags to a couple files that nee…
Browse files Browse the repository at this point in the history
…d to be looked at at a later date.
  • Loading branch information
Spencer Alger committed Aug 27, 2013
1 parent d778873 commit 389f8ae
Show file tree
Hide file tree
Showing 19 changed files with 149 additions and 148 deletions.
6 changes: 3 additions & 3 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// Base modules
var modules = [
'kibana.services',
'kibana.controllers',
'kibana.filters',
'kibana.directives',
'kibana.controllers',
'kibana.filters',
'kibana.directives',
'elasticjs.service',
'$strap.directives',
'kibana.panels',
Expand Down
6 changes: 3 additions & 3 deletions js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

angular.module('kibana.controllers', [])
.controller('DashCtrl', function($scope, $rootScope, $http, $timeout, $route, ejsResource,
.controller('DashCtrl', function($scope, $rootScope, $http, $timeout, $route, ejsResource,
fields, dashboard, alertSrv) {

$scope.editor = {
Expand All @@ -23,7 +23,7 @@ angular.module('kibana.controllers', [])
$scope.fields = fields;
$scope.reset_row();

var ejs = $scope.ejs = ejsResource(config.elasticsearch);
var ejs = $scope.ejs = ejsResource(config.elasticsearch);
};

$scope.add_row = function(dash,row) {
Expand Down Expand Up @@ -58,7 +58,7 @@ angular.module('kibana.controllers', [])
return $scope.editorTabs;
};

// This is whoafully incomplete, but will do for now
// This is whoafully incomplete, but will do for now
$scope.parse_error = function(data) {
var _error = data.match("nested: (.*?);");
return _.isNull(_error) ? data : _error[1];
Expand Down
4 changes: 2 additions & 2 deletions js/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ angular.module('kibana.directives', [])
link: function(scope, elem, attrs) {
var template = '<i class="icon-spinner small icon-spin icon-large panel-loading" '+
'ng-show="panelMeta.loading == true && !panel.title"></i>'+
' <span class="editlink panelextra pointer" style="right:15px;top:0px" ' +
' <span class="editlink panelextra pointer" style="right:15px;top:0px" ' +
'bs-modal="\'partials/paneleditor.html\'" ng-show="panel.editable != false">'+
'<span class="small">{{panel.type}}</span> <i class="icon-cog pointer"></i> '+
'</span><h4>'+
Expand Down Expand Up @@ -73,7 +73,7 @@ angular.module('kibana.directives', [])
elm.bind('blur', function() {
scope.$apply(function() {
ngModelCtrl.$setViewValue(elm.val());
});
});
});
}
};
Expand Down
2 changes: 1 addition & 1 deletion js/services.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*jshint globalstrict:true */
/*jshint globalstrict:true, forin:false */
/*global angular:true */
/*global Blob:false*/
'use strict';
Expand Down
57 changes: 29 additions & 28 deletions js/shared.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint forin:false*/
// Wrap this all up in a 'kbn' object so I don't have a billion globals
(function() {
'use strict';
Expand Down Expand Up @@ -102,54 +103,54 @@
kbn.round_interval = function(interval) {
switch (true) {
// 0.5s
case (interval <= 500):
case (interval <= 500):
return 100; // 0.1s
// 5s
case (interval <= 5000):
case (interval <= 5000):
return 1000; // 1s
// 7.5s
case (interval <= 7500):
case (interval <= 7500):
return 5000; // 5s
// 15s
case (interval <= 15000):
case (interval <= 15000):
return 10000; // 10s
// 45s
case (interval <= 45000):
case (interval <= 45000):
return 30000; // 30s
// 3m
case (interval <= 180000):
case (interval <= 180000):
return 60000; // 1m
// 9m
case (interval <= 450000):
case (interval <= 450000):
return 300000; // 5m
// 20m
case (interval <= 1200000):
case (interval <= 1200000):
return 600000; // 10m
// 45m
case (interval <= 2700000):
case (interval <= 2700000):
return 1800000; // 30m
// 2h
case (interval <= 7200000):
case (interval <= 7200000):
return 3600000; // 1h
// 6h
case (interval <= 21600000):
case (interval <= 21600000):
return 10800000; // 3h
// 24h
case (interval <= 86400000):
case (interval <= 86400000):
return 43200000; // 12h
// 48h
case (interval <= 172800000):
case (interval <= 172800000):
return 86400000; // 24h
// 1w
case (interval <= 604800000):
case (interval <= 604800000):
return 86400000; // 24h
// 3w
case (interval <= 1814400000):
case (interval <= 1814400000):
return 604800000; // 1w
// 2y
case (interval < 3628800000):
case (interval < 3628800000):
return 2592000000; // 30d
default:
default:
return 31536000000; // 1y
}
};
Expand Down Expand Up @@ -194,21 +195,21 @@
kbn.interval_to_seconds = function(string) {
var matches = string.match(/(\d+(?:\.\d+)?)([Mwdhmsy])/);
switch (matches[2]) {
case 'y':
case 'y':
return matches[1]*31536000;
case 'M':
case 'M':
return matches[1]*2592000;
case 'w':
case 'w':
return matches[1]*604800;
case 'd':
case 'd':
return matches[1]*86400;
case 'h':
case 'h':
return matches[1]*3600;
case 'm':
case 'm':
return matches[1]*60;
case 's':
case 's':
return matches[1];
}
}
};

// This should go away, moment.js can do this
Expand All @@ -235,7 +236,7 @@
if (objidx > 0) {
strval = strval + ', ';
}

strval = strval + JSON.stringify(obj[objidx]);
}
array[rootname] = strval;
Expand Down Expand Up @@ -299,7 +300,7 @@ _.mixin({

array.splice(toIndex, 0, array.splice(fromIndex, 1)[0] );
return array;
}
}
});

_.mixin({
Expand All @@ -308,7 +309,7 @@ _.mixin({

array.splice(index, 1);
return array;
}
}
});

_.mixin({
Expand Down
10 changes: 5 additions & 5 deletions panels/bettermap/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ angular.module('kibana.bettermap', [])
$scope.panel.error = "Please select a field that contains geo point in [lon,lat] format";
return;
}

// Determine the field to sort on
var timeField = _.uniq(_.pluck(filterSrv.getByType('time'),'field'));
if(timeField.length > 1) {
Expand All @@ -75,7 +75,7 @@ angular.module('kibana.bettermap', [])
var _segment = _.isUndefined(segment) ? 0 : segment;

$scope.panel.queries.ids = querySrv.idsByMode($scope.panel.queries);
// This could probably be changed to a BoolFilter
// This could probably be changed to a BoolFilter
var boolQuery = $scope.ejs.BoolQuery();
_.each($scope.panel.queries.ids,function(id) {
boolQuery = boolQuery.should(querySrv.getEjsObj(id));
Expand Down Expand Up @@ -132,7 +132,7 @@ angular.module('kibana.bettermap', [])
} else {
return;
}

$scope.$emit('draw');

// Get $size results then stop querying
Expand Down Expand Up @@ -169,12 +169,12 @@ angular.module('kibana.bettermap', [])

var map, markers, layerGroup, mcg;

function render_panel() {
function render_panel() {
scope.panelMeta.loading = false;

var scripts = $LAB.script("panels/bettermap/lib/leaflet.js").wait()
.script("panels/bettermap/lib/plugins.js");

//add markers dynamically
scripts.wait(function(){
if(_.isUndefined(map)) {
Expand Down
4 changes: 2 additions & 2 deletions panels/column/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
### Parameters
* panels :: an array of panel objects. All of their spans should be set to 12
*/

'use strict';
Expand Down Expand Up @@ -84,7 +84,7 @@ angular.module('kibana.column', [])
}
elem.html($compile(angular.element(template))(scope));
});
});
});
}
};
}).filter('withoutColumn', function() {
Expand Down
4 changes: 2 additions & 2 deletions panels/dashcontrol/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* hide_control :: Upon save, hide this panel
* elasticsearch_size :: show this many dashboards under the ES section in the load drop down
* temp :: Allow saving of temp dashboards
* ttl :: Enable setting ttl.
* ttl :: Enable setting ttl.
* temp_ttl :: How long should temp dashboards persist
*/
Expand Down Expand Up @@ -91,7 +91,7 @@ angular.module('kibana.dashcontrol', [])
).then(
function(result) {
if(!_.isUndefined(result._id)) {
alertSrv.set('Dashboard Saved','This dashboard has been saved to Elasticsearch as "' +
alertSrv.set('Dashboard Saved','This dashboard has been saved to Elasticsearch as "' +
result._id + '"','success',5000);
if(type === 'temp') {
$scope.share = dashboard.share_link(dashboard.current.title,'temp',result._id);
Expand Down
8 changes: 4 additions & 4 deletions panels/derivequeries/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Derivequeries
### Parameters
* label :: The label to stick over the field
* label :: The label to stick over the field
* query :: A string to use as a filter for the terms facet
* field :: the field to facet on
* rest :: include a filter that matches all other terms,
Expand Down Expand Up @@ -54,7 +54,7 @@ angular.module('kibana.derivequeries', [])

$scope.get_data = function() {
update_history($scope.panel.query);

// Make sure we have everything for the request to complete
if(dashboard.indices.length === 0) {
return;
Expand Down Expand Up @@ -122,8 +122,8 @@ angular.module('kibana.derivequeries', [])
});
};

$scope.set_refresh = function (state) {
$scope.refresh = state;
$scope.set_refresh = function (state) {
$scope.refresh = state;
};

$scope.close_edit = function() {
Expand Down
2 changes: 1 addition & 1 deletion panels/fields/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ angular.module('kibana.fields', [])
var _d = {
style : {},
arrange : 'vertical',
micropanel_position : 'right',
micropanel_position : 'right',
};
_.defaults($scope.panel,_d);

Expand Down
Loading

0 comments on commit 389f8ae

Please sign in to comment.