');
+
+ var svg = d3.select(el).append("svg")
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", height + margin.top + margin.bottom)
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ // Row Labels
+ var rowLabels = svg.append("g") // jshint ignore:line
+ .selectAll(".rowLabelg")
+ .data(rowLabel)
+ .enter()
+ .append("text")
+ .text(function (d) {
+ if(d.length > 8) {
+ return d.substring(0,8)+'..';
+ } else {
+ return d;
+ }
+ })
+ .attr("x", 0)
+ .attr("y", function (d, i) {
+ return hcrow.indexOf(i + 1) * cellSize;
+ })
+ .style("text-anchor", "end")
+ .attr("transform", "translate(-6," + cellSize / 1.5 + ")")
+ .attr("class", function (d, i) {
+ return "rowLabel_" + scope.generated_id + " mono r" + i;
+ })
+ .on("mouseover", function (d) {
+ d3.select(this).classed("text-hover", true);
+ $tooltip.html(d).place_tt(d3.event.pageX, d3.event.pageY);
+ })
+ .on("mouseout", function () {
+ d3.select(this).classed("text-hover", false);
+
+ d3.select(this).classed("cell-hover", false);
+ d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", false);
+ d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", false);
+
+ $tooltip.detach();
+ })
+ .on("click", function (d, i) {
+ rowSortOrder = !rowSortOrder;
+ sortbylabel("r", i, rowSortOrder);
});
- var colorBuckets = colors.length,
- colorScale = d3.scale.quantile().domain([0, 10]).range(colors);
-
- var $tooltip = $('
');
+ // Column labels
+ var colLabels = svg.append("g") // jshint ignore:line
+ .selectAll(".colLabelg")
+ .data(colLabel)
+ .enter()
+ .append("text")
+ .text(function (d) {
+ if(d.length > 6) {
+ return d.substring(0,6)+'..';
+ } else {
+ return d;
+ }
+ })
+ .attr("x", 0)
+ .attr("y", function (d, i) {
+ return hccol.indexOf(i + 1) * cellSize;
+ })
+ .style("text-anchor", "left")
+ .attr("transform", "translate(" + cellSize / 2 + ",-6) rotate (-90)")
+ .attr("class", function (d, i) {
+ return "colLabel_" + scope.generated_id + " mono c" + i;
+ })
+ .on("mouseover", function (d) {
+ d3.select(this).classed("text-hover", true);
+
+ // var offsetX = d3.event.offsetX || d3.event.layerX;
+ // var p = $('#' + scope.generated_id).parent();
+ // var scrollLeft = $(p).parent().scrollLeft();
+
+ // var layerX = d3.event.offsetX ? d3.event.layerX : Math.abs(scrollLeft - offsetX);
+
+ // var offsetY = d3.event.layerY;
+ // var scrollTop = $(p).parent().scrollTop();
+
+ // var layerY = d3.event.offsetY ? d3.event.layerY : Math.abs(offsetY - scrollTop);
+
+ $tooltip.html(d).place_tt(d3.event.pageX, d3.event.pageY);
+ })
+ .on("mouseout", function () {
+ d3.select(this).classed("text-hover", false);
+
+ d3.select(this).classed("cell-hover", false);
+ d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", false);
+ d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", false);
+
+ $tooltip.detach();
+ })
+ .on("click", function (d, i) {
+ colSortOrder = !colSortOrder;
+ sortbylabel("c", i, colSortOrder);
+ });
- var svg = d3.select(el).append("svg")
- .attr("width", width + margin.left + margin.right)
- .attr("height", height + margin.top + margin.bottom)
- .append("g")
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
- // Row Labels
- var rowLabels = svg.append("g")
- .selectAll(".rowLabelg")
- .data(rowLabel)
- .enter()
- .append("text")
- .text(function (d) {
- if(d.length > 8)
- return d.substring(0,8)+'..';
- else
- return d;
- })
- .attr("x", 0)
- .attr("y", function (d, i) {
- return hcrow.indexOf(i + 1) * cellSize;
- })
- .style("text-anchor", "end")
- .attr("transform", "translate(-6," + cellSize / 1.5 + ")")
- .attr("class", function (d, i) {
- return "rowLabel_" + scope.generated_id + " mono r" + i;
- })
- .on("mouseover", function (d) {
- d3.select(this).classed("text-hover", true);
- $tooltip.html(d).place_tt(d3.event.pageX, d3.event.pageY);
- })
- .on("mouseout", function (d) {
- d3.select(this).classed("text-hover", false);
-
- d3.select(this).classed("cell-hover", false);
- d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", false);
- d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", false);
-
- $tooltip.detach();
- })
- .on("click", function (d, i) {
- rowSortOrder = !rowSortOrder;
- sortbylabel("r", i, rowSortOrder);
+ // Heatmap component
+ var heatMap = svg.append("g").attr("class", "g3") // jshint ignore:line
+ .selectAll(".cellg")
+ .data(data, function (d) {
+ return d.row + ":" + d.col;
+ })
+ .enter()
+ .append("rect")
+ .attr("x", function (d) {
+ return hccol.indexOf(d.col) * cellSize;
+ })
+ .attr("y", function (d) {
+ return hcrow.indexOf(d.row) * cellSize;
+ })
+ .attr("class", function (d) {
+ return "cell_" + scope.generated_id + " cell-border cr" + (d.row - 1) + "_" + scope.generated_id + " cc" + (d.col - 1) + "_" + scope.generated_id;
+ })
+ .attr("width", cellSize)
+ .attr("height", cellSize)
+ .style("fill", function (d) {
+ return colorScale(d.value);
+ })
+ .on("mouseover", function (d, i) {
+ //highlight text
+ d3.select(this).classed("cell-hover", true);
+ d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", function (r, ri) {
+ return ri === (d.row - 1);
});
-
- // Column labels
- var colLabels = svg.append("g")
- .selectAll(".colLabelg")
- .data(colLabel)
- .enter()
- .append("text")
- .text(function (d) {
- if(d.length > 6)
- return d.substring(0,6)+'..';
- else
- return d;
- })
- .attr("x", 0)
- .attr("y", function (d, i) {
- return hccol.indexOf(i + 1) * cellSize;
- })
- .style("text-anchor", "left")
- .attr("transform", "translate(" + cellSize / 2 + ",-6) rotate (-90)")
- .attr("class", function (d, i) {
- return "colLabel_" + scope.generated_id + " mono c" + i;
- })
- .on("mouseover", function (d) {
- d3.select(this).classed("text-hover", true);
-
- var offsetX = d3.event.offsetX || d3.event.layerX;
- var p = $('#' + scope.generated_id).parent();
- var scrollLeft = $(p).parent().scrollLeft();
-
- var layerX = d3.event.offsetX ? d3.event.layerX : Math.abs(scrollLeft - offsetX);
-
- var offsetY = d3.event.layerY;
- var scrollTop = $(p).parent().scrollTop();
-
- var layerY = d3.event.offsetY ? d3.event.layerY : Math.abs(offsetY - scrollTop);
-
- $tooltip.html(d).place_tt(d3.event.pageX, d3.event.pageY);
- })
- .on("mouseout", function (d) {
- d3.select(this).classed("text-hover", false);
-
- d3.select(this).classed("cell-hover", false);
- d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", false);
- d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", false);
-
- $tooltip.detach();
- })
- .on("click", function (d, i) {
- colSortOrder = !colSortOrder;
- sortbylabel("c", i, colSortOrder);
+ d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", function (c, ci) {
+ return ci === (d.col - 1);
});
+
+ $tooltip.html(rowLabel[d.row - 1] + "," + colLabel[d.col - 1] + " (" + scope.data[i].value + ")").place_tt(d3.event.pageX, d3.event.pageY);
+ })
+ .on("mouseout", function () {
+ d3.select(this).classed("cell-hover", false);
+ d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", false);
+ d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", false);
+
+ $tooltip.detach();
+ });
+
+ // Function to sort the cells with respect to selected row or column
+ function sortbylabel(rORc, i, sortOrder) {
+ // rORc .. r for row, c for column
+ var t = svg.transition().duration(1200);
- // Heatmap component
- var heatMap = svg.append("g").attr("class", "g3")
- .selectAll(".cellg")
- .data(data, function (d) {
- return d.row + ":" + d.col;
- })
- .enter()
- .append("rect")
- .attr("x", function (d) {
- return hccol.indexOf(d.col) * cellSize;
- })
- .attr("y", function (d) {
- return hcrow.indexOf(d.row) * cellSize;
- })
- .attr("class", function (d) {
- return "cell_" + scope.generated_id + " cell-border cr" + (d.row - 1) + "_" + scope.generated_id + " cc" + (d.col - 1) + "_" + scope.generated_id;
- })
- .attr("width", cellSize)
- .attr("height", cellSize)
- .style("fill", function (d) {
- return colorScale(d.value);
- })
- .on("mouseover", function (d, i) {
- //highlight text
- d3.select(this).classed("cell-hover", true);
- d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", function (r, ri) {
- return ri == (d.row - 1);
- });
- d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", function (c, ci) {
- return ci == (d.col - 1);
- });
-
- $tooltip.html(rowLabel[d.row - 1] + "," + colLabel[d.col - 1] + " (" + scope.data[i].value + ")").place_tt(d3.event.pageX, d3.event.pageY);
- })
- .on("mouseout", function () {
- d3.select(this).classed("cell-hover", false);
- d3.selectAll(".rowLabel_" + scope.generated_id).classed("text-highlight", false);
- d3.selectAll(".colLabel_" + scope.generated_id).classed("text-highlight", false);
-
- $tooltip.detach();
+ var values = []; // holds the values in this specific row
+ for(var j = 0; j < col_number; j++) { values.push(0); }
+
+ var sorted; // sorted is zero-based index
+ d3.selectAll(".c" + rORc + i + "_" + scope.generated_id)
+ .filter(function (ce) {
+ if(rORc === "r") {
+ values[ce.col - 1] = ce.value;
+ } else {
+ values[ce.row - 1] = ce.value;
+ }
+ });
+ if (rORc === "r") { // sorting by rows
+ // can't be col_number
+ // must select from already there coluns (rows)
+ sorted = d3.range(col_number).sort(function (a, b) {
+ var value;
+ if (sortOrder) {
+ value = values[b] - values[a];
+ value = isNaN(value) ? Infinity : value;
+ } else {
+ value = values[a] - values[b];
+ value = isNaN(value) ? Infinity : value;
+ }
+ return value;
});
-
- // Function to sort the cells with respect to selected row or column
- function sortbylabel(rORc, i, sortOrder) {
- // rORc .. r for row, c for column
- var t = svg.transition().duration(1200);
-
- var values = []; // holds the values in this specific row
- for(var j = 0; j < col_number; j++) { values.push(0) };
- var sorted; // sorted is zero-based index
- d3.selectAll(".c" + rORc + i + "_" + scope.generated_id)
- .filter(function (ce) {
- if(rORc == "r") {
- values[ce.col - 1] = ce.value;
+ t.selectAll(".cell_" + scope.generated_id)
+ .attr("x", function (d) {
+ return sorted.indexOf(d.col - 1) * cellSize;
+ });
+ t.selectAll(".colLabel_" + scope.generated_id)
+ .attr("y", function (d, i) {
+ return sorted.indexOf(i) * cellSize;
+ });
+ } else { // sorting by columns
+ sorted = d3.range(row_number).sort(function (a, b) {
+ var value;
+ if (sortOrder) {
+ value = values[b] - values[a];
+ value = isNaN(value) ? Infinity : value;
} else {
- values[ce.row - 1] = ce.value;
+ value = values[a] - values[b];
+ value = isNaN(value) ? Infinity : value;
}
+ return value;
+ });
+ t.selectAll(".cell_" + scope.generated_id)
+ .attr("y", function (d) {
+ return sorted.indexOf(d.row - 1) * cellSize;
+ });
+ t.selectAll(".rowLabel_" + scope.generated_id)
+ .attr("y", function (d, i) {
+ return sorted.indexOf(i) * cellSize;
});
- if (rORc == "r") { // sorting by rows
- // can't be col_number
- // must select from already there coluns (rows)
- sorted = d3.range(col_number).sort(function (a, b) {
- var value;
- if (sortOrder) {
- value = values[b] - values[a];
- value = isNaN(value) ? Infinity : value;
- } else {
- value = values[a] - values[b];
- value = isNaN(value) ? Infinity : value;
- }
- return value;
- });
-
- t.selectAll(".cell_" + scope.generated_id)
- .attr("x", function (d) {
- return sorted.indexOf(d.col - 1) * cellSize;
- });
- t.selectAll(".colLabel_" + scope.generated_id)
- .attr("y", function (d, i) {
- return sorted.indexOf(i) * cellSize;
- });
- } else { // sorting by columns
- sorted = d3.range(row_number).sort(function (a, b) {
- var value;
- if (sortOrder) {
- value = values[b] - values[a];
- value = isNaN(value) ? Infinity : value;
- } else {
- value = values[a] - values[b];
- value = isNaN(value) ? Infinity : value;
- }
- return value;
- });
- t.selectAll(".cell_" + scope.generated_id)
- .attr("y", function (d) {
- return sorted.indexOf(d.row - 1) * cellSize;
- });
- t.selectAll(".rowLabel_" + scope.generated_id)
- .attr("y", function (d, i) {
- return sorted.indexOf(i) * cellSize;
- });
- }
}
-// }); // end of require
+ }
}
}
};
diff --git a/src/app/panels/histogram/module.js b/src/app/panels/histogram/module.js
index 47217804b..b04bfc954 100755
--- a/src/app/panels/histogram/module.js
+++ b/src/app/panels/histogram/module.js
@@ -46,8 +46,6 @@ define([
function (angular, app, $, _, kbn, moment, timeSeries) {
'use strict';
- var DEBUG = false; // DEBUG mode
-
var module = angular.module('kibana.panels.histogram', []);
app.useModule(module);
@@ -197,8 +195,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// Solr
$scope.sjs.client.server(dashboard.current.solr.server + dashboard.current.solr.core_name);
- if (DEBUG) { console.debug('histogram:\n\tdashboard=',dashboard,'\n\t$scope=',$scope,'\n\t$scope.panel=',$scope.panel,'\n\tquerySrv=',querySrv,'\n\tfilterSrv=',filterSrv); }
-
var request = $scope.sjs.Request().indices(dashboard.indices[segment]);
$scope.panel.queries.ids = querySrv.idsByMode($scope.panel.queries);
@@ -235,7 +231,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
var end_time = filterSrv.getEndTime();
// facet.range.end does NOT accept * as a value, need to convert it to NOW
- if (end_time == '*') {
+ if (end_time === '*') {
end_time = 'NOW';
}
@@ -304,7 +300,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// Populate scope when we have results
results.then(function(results) {
- if (DEBUG) { console.debug('histogram:\n\trequest='+request+'\n\tresults=',results); }
$scope.panelMeta.loading = false;
if(segment === 0) {
@@ -332,9 +327,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
hits;
_.each($scope.panel.queries.ids, function(id) {
- // var query_results = results.facets[id];
-
- if (DEBUG) { console.debug('histogram: i=',i,', segment=',segment,', $scope=',$scope); }
// we need to initialize the data variable on the first run,
// and when we are working on the first segment of the data.
@@ -346,9 +338,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
fill_style: 'minimal'
});
hits = 0;
- if (DEBUG) { console.debug('\tfirst run: i='+i+', time_series=',time_series); }
} else {
- if (DEBUG) { console.debug('\tNot first run: i='+i+', $scope.data[i].time_series=',$scope.data[i].time_series,', hits='+$scope.data[i].hits); }
time_series = $scope.data[i].time_series;
// Bug fix for wrong event count:
// Solr don't need to accumulate hits count since it can get total count from facet query.
@@ -360,23 +350,24 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// Solr facet counts response is in one big array.
// So no need to get each segment like Elasticsearch does.
+ var entry_time, entries, entry_value;
if ($scope.panel.mode === 'count') {
// Entries from facet_ranges counts
- var entries = results.facet_counts.facet_ranges[time_field].counts;
+ entries = results.facet_counts.facet_ranges[time_field].counts;
for (var j = 0; j < entries.length; j++) {
- var entry_time = new Date(entries[j]).getTime(); // convert to millisec
+ entry_time = new Date(entries[j]).getTime(); // convert to millisec
j++;
var entry_count = entries[j];
time_series.addValue(entry_time, entry_count);
hits += entry_count; // The series level hits counter
$scope.hits += entry_count; // Entire dataset level hits counter
- };
+ }
} else if ($scope.panel.mode === 'values') {
if ($scope.panel.group_field) {
// Group By Field is specified
var groups = results.grouped[$scope.panel.group_field].groups;
- for (var j=0; j < groups.length; j++) {
+ for (var j=0; j < groups.length; j++) { // jshint ignore: line
var docs = groups[j].doclist.docs;
var group_time_series = new timeSeries.ZeroFilled({
interval: _interval,
@@ -388,8 +379,8 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// loop through each group results
for (var k=0; k < docs.length; k++) {
- var entry_time = new Date(docs[k][time_field]).getTime(); // convert to millisec
- var entry_value = docs[k][$scope.panel.value_field];
+ entry_time = new Date(docs[k][time_field]).getTime(); // convert to millisec
+ entry_value = docs[k][$scope.panel.value_field];
group_time_series.addValue(entry_time, entry_value);
hits += 1;
$scope.hits += 1;
@@ -408,10 +399,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
};
}
} else { // Group By Field is not specified
- var entries = results.response.docs;
- for (var j=0; j < entries.length; j++) {
- var entry_time = new Date(entries[j][time_field]).getTime(); // convert to millisec
- var entry_value = entries[j][$scope.panel.value_field];
+ entries = results.response.docs;
+ for (var j=0; j < entries.length; j++) { // jshint ignore: line
+ entry_time = new Date(entries[j][time_field]).getTime(); // convert to millisec
+ entry_value = entries[j][$scope.panel.value_field];
time_series.addValue(entry_time, entry_value);
hits += 1;
$scope.hits += 1;
@@ -435,17 +426,9 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
i++;
});
-
- if (DEBUG) { console.debug('histogram: Before render $scope=',$scope,'$scope.panel=',$scope.panel); }
// Tell the histogram directive to render.
$scope.$emit('render');
-
- // Don't need this for Solr unless we need to support multiple queries.
- // If we still have segments left, get them
- // if(segment < dashboard.indices.length-1) {
- // $scope.get_data(segment+1,query_id);
- // }
}
});
};
@@ -614,7 +597,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// If 'lines_smooth' is enabled, loop through $scope.data[] and remove zero filled entries.
// Without zero values, the line chart will appear smooth as SiLK ;-)
if (scope.panel.lines_smooth) {
- for (var i=0; i < scope.data.length; i++) {
+ for (var i=0; i < scope.data.length; i++) { // jshint ignore: line
var new_data = [];
for (var j=0; j < scope.data[i].data.length; j++) {
// if value of the timestamp !== 0, then add it to new_data
@@ -625,8 +608,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
scope.data[i].data = new_data;
}
}
-
- if (DEBUG) { console.debug('histogram:\n\tflot options = ',options,'\n\tscope.data = ',scope.data); }
scope.plot = $.plot(elem, scope.data, options);
} catch(e) {
@@ -669,7 +650,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
}
$tooltip
.html(
- group + dashboard.numberWithCommas(value) + " @ " + (scope.panel.timezone === 'utc'? moment.utc(item.datapoint[0]).format('MM/DD HH:mm:ss') : moment(item.datapoint[0]).format('MM/DD HH:mm:ss'))
+ group + dashboard.numberWithCommas(value) + " @ " + (scope.panel.timezone === 'utc'? moment.utc(item.datapoint[0]).format('MM/DD HH:mm:ss') : moment(item.datapoint[0]).format('MM/DD HH:mm:ss'))
// group + dashboard.numberWithCommas(value) + " @ " + moment(item.datapoint[0]).format('MM/DD HH:mm:ss')
// group + dashboard.numberWithCommas(value) + " @ " + moment(item.datapoint[0])
)
diff --git a/src/app/panels/hits/module.js b/src/app/panels/hits/module.js
index 4dc9d3fc8..479378489 100755
--- a/src/app/panels/hits/module.js
+++ b/src/app/panels/hits/module.js
@@ -26,8 +26,6 @@ define([
var module = angular.module('kibana.panels.hits', []);
app.useModule(module);
- var DEBUG = false; // DEBUG mode
-
module.controller('hits', function($scope, querySrv, dashboard, filterSrv) {
$scope.panelMeta = {
modals : [
@@ -75,7 +73,7 @@ define([
};
- $scope.get_data = function(segment,query_id) {
+ $scope.get_data = function() {
delete $scope.panel.error;
$scope.panelMeta.loading = true;
@@ -87,12 +85,6 @@ define([
// Solr
$scope.sjs.client.server(dashboard.current.solr.server + dashboard.current.solr.core_name);
- var _segment = _.isUndefined(segment) ? 0 : segment;
-
- if (DEBUG) {
- console.log('hits:\n\tdashboard',dashboard,'\n\tquerySrv=',querySrv,'\n\tfilterSrv=',filterSrv);
- }
-
var request = $scope.sjs.Request().indices(dashboard.indices);
$scope.panel.queries.ids = querySrv.idsByMode($scope.panel.queries);
@@ -140,21 +132,8 @@ define([
$scope.panel.error = $scope.parse_error(results.error);
return;
}
-
- // Convert facet ids to numbers
-// var facetIds = _.map(_.keys(results.facets),function(k){return parseInt(k, 10);});
-
- // Make sure we're still on the same query/queries
-// if($scope.query_id === query_id &&
-// _.intersection(facetIds,$scope.panel.queries.ids).length === $scope.panel.queries.ids.length
-// ) {
var i = 0;
var id = $scope.panel.queries.ids[0];
-// _.each($scope.panel.queries.ids, function(id) {
-// var v = results.facets[id];
-// var hits = _.isUndefined($scope.data[i]) || _segment === 0 ?
-// v.count : $scope.data[i].hits+v.count;
-// $scope.hits += v.count;
var hits = $scope.hits;
// Create series
$scope.data[i] = {
@@ -164,15 +143,7 @@ define([
data: [[i,hits]]
};
-// i++;
-// });
-
$scope.$emit('render');
-// if(_segment < dashboard.indices.length-1) {
-// $scope.get_data(_segment+1,query_id);
-// }
-
-// }
});
};
diff --git a/src/app/panels/map/module.js b/src/app/panels/map/module.js
index 30e90798c..09fdb826b 100755
--- a/src/app/panels/map/module.js
+++ b/src/app/panels/map/module.js
@@ -22,8 +22,6 @@ define([
function (angular, app, _, $) {
'use strict';
- var DEBUG = false; // DEBUG mode
-
var module = angular.module('kibana.panels.map', []);
app.useModule(module);
@@ -155,8 +153,6 @@ function (angular, app, _, $) {
request = request.setQuery($scope.panel.queries.query);
}
- if (DEBUG) { console.debug('map: $scope.panel=',$scope.panel); }
-
var results = request.doSearch();
// Populate scope when we have results
@@ -172,8 +168,6 @@ function (angular, app, _, $) {
$scope.$emit('render');
return false;
}
-
- if (DEBUG) { console.debug('map: results=',results); }
if ($scope.panel.mode === 'count') {
terms = results.facet_counts.facet_fields[$scope.panel.field];
@@ -198,11 +192,9 @@ function (angular, app, _, $) {
$scope.data[terms[i].toUpperCase()] += terms[i+1];
}
}
- };
+ }
}
- if (DEBUG) { console.debug('map: $scope.data=',$scope.data); }
-
$scope.$emit('render');
});
};
diff --git a/src/app/panels/multiseries/module.js b/src/app/panels/multiseries/module.js
index 0ca706378..971b8484b 100644
--- a/src/app/panels/multiseries/module.js
+++ b/src/app/panels/multiseries/module.js
@@ -15,8 +15,6 @@ define([
var module = angular.module('kibana.panels.multiseries', []);
app.useModule(module);
- var DEBUG = false; // DEBUG mode
-
module.controller('multiseries', function ($scope, dashboard, querySrv, filterSrv) {
$scope.panelMeta = {
modals: [
@@ -170,14 +168,15 @@ define([
var el = element[0];
// deepcopy of the data in the scope
- var data = jQuery.extend(true, [], scope.data);
+ var data;
+ data = jQuery.extend(true, [], scope.data); // jshint ignore: line
- if (d3.keys(data[0]).indexOf(scope.panel.field) === -1)
+ if (d3.keys(data[0]).indexOf(scope.panel.field) === -1) {
return;
+ }
var parent_width = $("#multiseries").width(),
- aspectRatio = 400 / 600,
- fixed_height = 600;
+ aspectRatio = 400 / 600;
var margin = {
top: 20,
@@ -349,7 +348,7 @@ define([
.style("stroke", function (d) {
return color(d.name);
})
- .style("fill", "transparent")
+ .style("fill", "transparent");
city.append("text")
.datum(function (d) {
diff --git a/src/app/panels/rangeFacet/module.js b/src/app/panels/rangeFacet/module.js
index 04de763a7..0f3c3f58f 100755
--- a/src/app/panels/rangeFacet/module.js
+++ b/src/app/panels/rangeFacet/module.js
@@ -37,8 +37,6 @@ define([
function (angular, app, $, _, kbn, moment, timeSeries) {
'use strict';
- var DEBUG = false; // DEBUG mode
-
var module = angular.module('kibana.panels.rangeFacet', []);
app.useModule(module);
@@ -171,13 +169,13 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
field: $scope.panel.range_field
});
dashboard.refresh();
- }
+ };
// set the configrations in settings
$scope.set_configrations = function(from,to){
$scope.panel.minimum = parseInt(from);
$scope.panel.maximum = parseInt(to);
- }
+ };
//set the range filter from old configrations
$scope.range_apply = function(){
@@ -188,7 +186,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
field: $scope.panel.range_field
});
dashboard.refresh();
- }
+ };
/**
* Fetch the data for a chunk of a queries results. Multiple segments occur when several indicies
@@ -217,7 +215,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
}
var _range = $scope.get_facet_range();
- var _interval = $scope.get_interval(_range);
if ($scope.panel.auto_int) {
$scope.panel.interval = kbn.calculate_gap(_range.from, _range.to, $scope.panel.resolution, 0);
@@ -228,8 +225,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// Solr
$scope.sjs.client.server(dashboard.current.solr.server + dashboard.current.solr.core_name);
- if (DEBUG) { console.debug('RangeFacet:\n\tdashboard=',dashboard,'\n\t$scope=',$scope,'\n\t$scope.panel=',$scope.panel,'\n\tquerySrv=',querySrv,'\n\tfilterSrv=',filterSrv); }
-
var request = $scope.sjs.Request().indices(dashboard.indices[segment]);
$scope.panel.queries.ids = querySrv.idsByMode($scope.panel.queries);
@@ -261,9 +256,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// Build Solr query
var fq = '&' + filterSrv.getSolrFq();
- var time_field = filterSrv.getTimeField();
- var start_time = filterSrv.getStartTime();
- var end_time = filterSrv.getEndTime();
var wt_json = '&wt=json';
var rows_limit = '&rows=0'; // for RangeFacet, we do not need the actual response doc, so set rows=0
@@ -310,8 +302,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// Populate scope when we have results
results.then(function(results) {
- var _range = $scope.get_facet_range()
- if (DEBUG) { console.debug('RangeFacet:\n\trequest='+request+'\n\tresults=',results); }
+ var _range = $scope.get_facet_range();
$scope.panelMeta.loading = false;
if(segment === 0) {
@@ -339,9 +330,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
hits;
_.each($scope.panel.queries.ids, function(id) {
- // var query_results = results.facets[id];
-
- if (DEBUG) { console.debug('facetrange: i=',i, '$scope=',$scope); }
// we need to initialize the data variable on the first run,
// and when we are working on the first segment of the data.
@@ -352,9 +340,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
fill_style: 'minimal'
});
hits = 0;
- if (DEBUG) { console.debug('\tfirst run: i='+i+', numeric_series=',numeric_series); }
} else {
- if (DEBUG) { console.debug('\tNot first run: i='+i+', $scope.data[i].numeric_series=',$scope.data[i].numeric_series,', hits='+$scope.data[i].hits); }
numeric_series = $scope.data[i].numeric_series;
// Bug fix for wrong event count:
// Solr don't need to accumulate hits count since it can get total count from facet query.
@@ -363,7 +349,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
hits = 0;
$scope.hits = 0;
}
- $scope.range_count = 0
+ $scope.range_count = 0;
// Solr facet counts response is in one big array.
// So no need to get each segment like Elasticsearch does.
// Entries from facet_ranges counts
@@ -375,8 +361,8 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
numeric_series.addValue(entry_time, entry_count);
hits += entry_count; // The series level hits counter
$scope.hits += entry_count; // Entire dataset level hits counter
- $scope.range_count += 1 // count the number of ranges to help later in bar width
- };
+ $scope.range_count += 1; // count the number of ranges to help later in bar width
+ }
$scope.data[i] = {
info: querySrv.list[id],
@@ -386,8 +372,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
i++;
});
-
- if (DEBUG) { console.debug('RangeFacet: Before render $scope=',$scope,'$scope.panel=',$scope.panel); }
// Tell the RangeFacet directive to render.
$scope.$emit('render');
@@ -405,11 +389,12 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan
$scope.zoom = function(factor) {
var _range = filterSrv.facetRange($scope.panel.range_field)[1];
- if (_.isUndefined(_range))
+ if (_.isUndefined(_range)){
_range = {
from: $scope.panel.minimum,
to: $scope.panel.maximum
- }
+ };
+ }
var _timespan = (_range.to.valueOf() - _range.from.valueOf());
var _center = _range.to.valueOf() - _timespan/2;
@@ -446,7 +431,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
});
- module.directive('rangefacetChart', function(dashboard, filterSrv) {
+ module.directive('rangefacetChart', function(dashboard) {
return {
restrict: 'A',
template: '
',
@@ -556,7 +541,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
// If 'lines_smooth' is enabled, loop through $scope.data[] and remove zero filled entries.
// Without zero values, the line chart will appear smooth as SiLK ;-)
if (scope.panel.lines_smooth) {
- for (var i=0; i < scope.data.length; i++) {
+ for (var i=0; i < scope.data.length; i++) { // jshint ignore: line
var new_data = [];
for (var j=0; j < scope.data[i].data.length; j++) {
// if value of the timestamp !== 0, then add it to new_data
@@ -567,8 +552,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
scope.data[i].data = new_data;
}
}
-
- if (DEBUG) { console.debug('RangeFacet:\n\tflot options = ',options,'\n\tscope.data = ',scope.data); }
scope.plot = $.plot(elem, scope.data, options);
} catch(e) {
@@ -606,7 +589,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
elem.bind("plotselected", function (event, ranges) {
scope.set_range_filter(ranges.xaxis.from, ranges.xaxis.to);
- scope.set_configrations(ranges.xaxis.from, ranges.xaxis.to)
+ scope.set_configrations(ranges.xaxis.from, ranges.xaxis.to);
dashboard.refresh();
});
}
diff --git a/src/app/panels/scatterplot/module.js b/src/app/panels/scatterplot/module.js
index fd37b423a..7c40b5d17 100644
--- a/src/app/panels/scatterplot/module.js
+++ b/src/app/panels/scatterplot/module.js
@@ -15,8 +15,6 @@ define([
var module = angular.module('kibana.panels.scatterplot', []);
app.useModule(module);
- var DEBUG = false; // DEBUG mode
-
module.controller('scatterplot', function($scope, dashboard, querySrv, filterSrv) {
$scope.panelMeta = {
modals: [{
@@ -60,7 +58,7 @@ define([
$scope.get_data();
};
- $scope.get_data = function(segment, query_id) {
+ $scope.get_data = function() {
// Show progress by displaying a spinning wheel icon on panel
$scope.panelMeta.loading = true;
var request, results;
@@ -160,24 +158,19 @@ define([
var el = element[0];
- // deepcopy of the data in the scope
-
- //var data = jQuery.extend(true, [], scope.data);
-
var parent_width = element.parent().width(),
height = parseInt(scope.row.height),
- padding = 50,
- paddingy = 20,
- aspectRatio = 400 / 600;
+ padding = 50;
var margin = {
top: 20,
right: 20,
bottom: 60,
left: 40
- },
- width = parent_width - margin.left - margin.right,
- height = height - margin.top - margin.bottom;
+ },
+ width = parent_width - margin.left - margin.right;
+
+ height = height - margin.top - margin.bottom;
var x = d3.scale.linear()
.range([0, width - padding * 2]);
@@ -237,7 +230,7 @@ define([
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
- .text(scope.panel.yaxis)
+ .text(scope.panel.yaxis);
svg.selectAll(".dot")
.data(scope.data)
@@ -259,7 +252,7 @@ define([
field_type + " (" + d[scope.panel.xaxis] + ", " + d[scope.panel.yaxis] + ")
")
.place_tt(d3.event.pageX, d3.event.pageY);
})
- .on("mouseout", function(d) {
+ .on("mouseout", function() {
$tooltip.detach();
});
if (scope.panel.field_type) {
diff --git a/src/app/panels/table/module.js b/src/app/panels/table/module.js
index 832c2b3de..4fd496926 100755
--- a/src/app/panels/table/module.js
+++ b/src/app/panels/table/module.js
@@ -29,8 +29,6 @@ define([
function (angular, app, _, kbn, moment) {
'use strict';
- var DEBUG = false; // DEBUG mode
-
var module = angular.module('kibana.panels.table', []);
app.useModule(module);
module.controller('table', function($rootScope, $scope, fields, querySrv, dashboard, filterSrv) {
@@ -102,15 +100,16 @@ function (angular, app, _, kbn, moment) {
$scope.init = function () {
$scope.Math = Math;
// Solr
- $scope.sjs = $scope.sjs || sjsResource(dashboard.current.solr.server + dashboard.current.solr.core_name);
+ $scope.sjs = $scope.sjs || sjsResource(dashboard.current.solr.server + dashboard.current.solr.core_name); // jshint ignore: line
$scope.$on('refresh',function(){$scope.get_data();});
$scope.panel.exportSize = $scope.panel.size * $scope.panel.pages;
$scope.fields = fields;
// Backward compatibility with old dashboards without important fields
// Set important fields to all fields if important fields array is empty
- if (_.isEmpty($scope.panel.important_fields))
+ if (_.isEmpty($scope.panel.important_fields)) {
$scope.panel.important_fields = fields.list;
+ }
$scope.get_data();
};
@@ -221,29 +220,9 @@ function (angular, app, _, kbn, moment) {
$scope.sjs.client.server(dashboard.current.solr.server + dashboard.current.solr.core_name);
var request = $scope.sjs.Request().indices(dashboard.indices[_segment]);
- // var boolQuery = $scope.sjs.BoolQuery();
- // _.each($scope.panel.queries.ids,function(id) {
- // boolQuery = boolQuery.should(querySrv.getEjsObj(id));
- // });
-
- // request = request.query(
- // $scope.sjs.FilteredQuery(
- // boolQuery,
- // filterSrv.getBoolFilter(filterSrv.ids) // search time range is provided here.
- // ))
- // .highlight(
- // $scope.sjs.Highlight($scope.panel.highlight)
- // .fragmentSize(2147483647) // Max size of a 32bit unsigned int
- // .preTags('@start-highlight@')
- // .postTags('@end-highlight@')
- // )
- // .size($scope.panel.size*$scope.panel.pages) // Set the size of query result
- // .sort($scope.panel.sort[0],$scope.panel.sort[1]);
$scope.panel_request = request;
- // if (DEBUG) { console.debug('table:\n\trequest.toString()=',request.toString()); }
-
var fq = '&' + filterSrv.getSolrFq();
var query_size = $scope.panel.size * $scope.panel.pages;
var wt_json = '&wt=json';
@@ -265,8 +244,6 @@ function (angular, app, _, kbn, moment) {
$scope.panel.queries.basic_query = querySrv.getQuery(0) + fq + sorting;
$scope.panel.queries.query = $scope.panel.queries.basic_query + wt_json + rows_limit;
- if (DEBUG) { console.debug('table: query=',$scope.panel.queries.query); }
-
// Set the additional custom query
if ($scope.panel.queries.custom != null) {
request = request.setQuery($scope.panel.queries.query + $scope.panel.queries.custom);
@@ -289,8 +266,6 @@ function (angular, app, _, kbn, moment) {
$scope.data = [];
}
- if (DEBUG) { console.debug('table:\n\tresults=',results,'\n\t_segment=',_segment,', $scope.hits=',$scope.hits,', $scope.data=',$scope.data,', query_id=',query_id,'\n\t$scope.panel',$scope.panel); }
-
// Check for error and abort if found
if(!(_.isUndefined(results.error))) {
$scope.panel.error = $scope.parse_error(results.error.msg); // There's also results.error.code
@@ -313,8 +288,6 @@ function (angular, app, _, kbn, moment) {
// from a single faceted query.
$scope.hits = results.response.numFound;
- if (DEBUG) { console.debug('table: $scope.hits=',$scope.hits,', $scope.data=',$scope.data); }
-
// Keep only what we need for the set
$scope.data = $scope.data.slice(0,$scope.panel.size * $scope.panel.pages);
} else {
@@ -328,8 +301,6 @@ function (angular, app, _, kbn, moment) {
!((_.contains(filterSrv.timeField(),$scope.panel.sort[0])) && $scope.panel.sort[1] === 'desc')) &&
_segment+1 < dashboard.indices.length) {
$scope.get_data(_segment+1,$scope.query_id);
-
- if (DEBUG) { console.debug('\tnot sorting in reverse chrono order!'); }
}
});
@@ -347,7 +318,13 @@ function (angular, app, _, kbn, moment) {
}
var exportQuery = $scope.panel.queries.basic_query + '&wt=' + filetype + omitHeader + rows_limit + fl;
var request = $scope.panel_request;
- request = request.setQuery(exportQuery);
+
+ if ($scope.panel.queries.custom != null) {
+ request = request.setQuery(exportQuery + $scope.panel.queries.custom);
+ } else {
+ request = request.setQuery(exportQuery);
+ }
+
var response = request.doSearch();
response.then(function(response) {
@@ -427,7 +404,7 @@ function (angular, app, _, kbn, moment) {
module.filter('tableTruncate', function() {
return function(text,length,factor,field,imageFields) {
// If image field, then do not truncate, otherwise we will get invalid URIs.
- if (typeof field != 'undefined' && imageFields.length>0 && _.contains(imageFields, field)) {
+ if (typeof field !== 'undefined' && imageFields.length>0 && _.contains(imageFields, field)) {
return text;
}
@@ -488,10 +465,10 @@ function (angular, app, _, kbn, moment) {
// This filter will check the input field to see if it should be displayed as
![](data)
module.filter('tableDisplayImageField', function() {
return function(data, field, imageFields, width, height) {
- if (typeof field != 'undefined' && imageFields.length>0 && _.contains(imageFields, field)) {
+ if (typeof field !== 'undefined' && imageFields.length>0 && _.contains(imageFields, field)) {
return '
![]('+data+')
';
}
return data;
- }
+ };
});
});
diff --git a/src/app/panels/terms/module.js b/src/app/panels/terms/module.js
index 8c8b0035b..9ade7a2c5 100755
--- a/src/app/panels/terms/module.js
+++ b/src/app/panels/terms/module.js
@@ -20,12 +20,10 @@ define([
function (angular, app, _, $, kbn) {
'use strict';
- var DEBUG = false; // DEBUG mode
-
var module = angular.module('kibana.panels.terms', []);
app.useModule(module);
- module.controller('terms', function($scope, querySrv, dashboard, filterSrv, alertSrv) {
+ module.controller('terms', function($scope, querySrv, dashboard, filterSrv) {
$scope.panelMeta = {
modals : [
{
@@ -84,7 +82,6 @@ function (angular, app, _, $, kbn) {
};
$scope.testMultivalued = function() {
- // if($scope.panel.field && $scope.panel.field !== '' && $scope.fields.typeList[$scope.panel.field] && $scope.fields.typeList[$scope.panel.field].schema.indexOf("M") > -1) {
if($scope.panel.field && $scope.fields.typeList[$scope.panel.field] && $scope.fields.typeList[$scope.panel.field].schema.indexOf("M") > -1) {
$scope.panel.error = "Can't proceed with Multivalued field";
return;
@@ -103,32 +100,12 @@ function (angular, app, _, $, kbn) {
}
$scope.panelMeta.loading = true;
- var request, results, boolQuery;
+ var request, results;
$scope.sjs.client.server(dashboard.current.solr.server + dashboard.current.solr.core_name);
- if (DEBUG) { console.debug('terms:\n\tdashboard',dashboard,'\n\tquerySrv=',querySrv,'\n\tfilterSrv=',filterSrv); }
-
request = $scope.sjs.Request().indices(dashboard.indices);
$scope.panel.queries.ids = querySrv.idsByMode($scope.panel.queries);
- // This could probably be changed to a BoolFilter
- // boolQuery = $scope.sjs.BoolQuery();
- // _.each($scope.panel.queries.ids,function(id) {
- // boolQuery = boolQuery.should(querySrv.getEjsObj(id));
- // });
-
- // Terms mode
- // request = request
- // .facet($scope.sjs.TermsFacet('terms')
- // .field($scope.panel.field)
- // .size($scope.panel.size)
- // .order($scope.panel.order)
- // .exclude($scope.panel.exclude)
- // .facetFilter($scope.sjs.QueryFilter(
- // $scope.sjs.FilteredQuery(
- // boolQuery,
- // filterSrv.getBoolFilter(filterSrv.ids)
- // )))).size(0);
// Populate the inspector panel
$scope.inspector = angular.toJson(JSON.parse(request.toString()),true);
@@ -136,15 +113,15 @@ function (angular, app, _, $, kbn) {
// Build Solr query
var fq = '&' + filterSrv.getSolrFq();
var wt_json = '&wt=json';
- var rows_limit = '&rows=0' // for terms, we do not need the actual response doc, so set rows=0
+ var rows_limit = '&rows=0'; // for terms, we do not need the actual response doc, so set rows=0
var facet = '';
if ($scope.panel.mode === 'count') {
- facet = '&facet=true&facet.field=' + $scope.panel.field + '&facet.limit=' + $scope.panel.size + '&facet.missing=true';
+ facet = '&facet=true&facet.field=' + $scope.panel.field + '&facet.limit=' + $scope.panel.size;
} else {
// if mode != 'count' then we need to use stats query
// stats does not support something like facet.limit, so we have to sort and limit the results manually.
- facet = '&stats=true&stats.facet=' + $scope.panel.field + '&stats.field=' + $scope.panel.stats_field + '&facet.missing=true';
+ facet = '&stats=true&stats.facet=' + $scope.panel.field + '&stats.field=' + $scope.panel.stats_field;
}
var exclude_length = $scope.panel.exclude.length;
@@ -152,7 +129,7 @@ function (angular, app, _, $, kbn) {
if(exclude_length > 0){
for (var i = 0; i < exclude_length; i++) {
exclude_filter += '&fq=-' + $scope.panel.field +":"+ $scope.panel.exclude[i];
- };
+ }
}
// Set the panel's query
@@ -169,7 +146,6 @@ function (angular, app, _, $, kbn) {
// Populate scope when we have results
results.then(function(results) {
- if (DEBUG) { console.debug('terms: results=',results); }
// Check for error and abort if found
if(!(_.isUndefined(results.error))) {
$scope.panel.error = $scope.parse_error(results.error.msg);
@@ -184,7 +160,7 @@ function (angular, app, _, $, kbn) {
var valid = $('#colorTest').css('color');
$('#colorTest').css('color', color);
- if (valid == $('#colorTest').css('color')) {
+ if (valid === $('#colorTest').css('color')) {
return false;
} else {
return true;
@@ -201,7 +177,6 @@ function (angular, app, _, $, kbn) {
var sum = 0;
var k = 0;
- var missing =0;
$scope.panelMeta.loading = false;
$scope.hits = results.response.numFound;
$scope.data = [];
@@ -215,14 +190,12 @@ function (angular, app, _, $, kbn) {
i++;
var count = v[i];
sum += count;
- if(term == null)
- missing = count
// if count = 0, do not add it to the chart, just skip it
- if (count == 0) continue;
+ if (count === 0) { continue; }
var slice = { label : term, data : [[k,count]], actions: true};
slice = addSliceColor(slice,term);
$scope.data.push(slice);
- };
+ }
});
} else {
// In stats mode, set y-axis min to null so jquery.flot will set the scale automatically.
@@ -234,7 +207,7 @@ function (angular, app, _, $, kbn) {
}
// Sort the results
- if ($scope.panel.order == 'descending') {
+ if ($scope.panel.order === 'descending') {
$scope.data = _.sortBy($scope.data, function(d) {return -d.data[0][1];});
} else {
$scope.data = _.sortBy($scope.data, function(d) {return d.data[0][1];});
@@ -249,14 +222,12 @@ function (angular, app, _, $, kbn) {
$scope.data.push({label:'Missing field',
// data:[[k,results.facets.terms.missing]],meta:"missing",color:'#aaa',opacity:0});
// TODO: Hard coded to 0 for now. Solr faceting does not provide 'missing' value.
- data:[[k,missing]],meta:"missing",color:'#aaa',opacity:0});
+ data:[[k,0]],meta:"missing",color:'#aaa',opacity:0});
$scope.data.push({label:'Other values',
// data:[[k+1,results.facets.terms.other]],meta:"other",color:'#444'});
// TODO: Hard coded to 0 for now. Solr faceting does not provide 'other' value.
data:[[k+1,$scope.hits-sum]],meta:"other",color:'#444'});
- if (DEBUG) { console.debug('terms: $scope.data = ',$scope.data); }
-
$scope.$emit('render');
});
};
@@ -336,12 +307,10 @@ function (angular, app, _, $, kbn) {
chartData = scope.panel.other ? chartData :
_.without(chartData,_.findWhere(chartData,{meta:'other'}));
- if (DEBUG) { console.debug('terms: render_panel() => chartData = ',chartData); }
-
if (filterSrv.idsByTypeAndField('terms',scope.panel.field).length > 0) {
colors.push(scope.panel.lastColor);
} else {
- colors = scope.panel.chartColors
+ colors = scope.panel.chartColors;
}
require(['jquery.flot.pie'], function(){
diff --git a/src/app/panels/text/module.js b/src/app/panels/text/module.js
index bd9857e72..2ee8b3c39 100755
--- a/src/app/panels/text/module.js
+++ b/src/app/panels/text/module.js
@@ -70,18 +70,17 @@ function (angular, app, _, require) {
module.filter('newlines', function(){
return function (input) {
- if(input)
- return input.replace(/\n/g, '
');
+ if(input) {
+ return input.replace(/\n/g, '
');
+ }
};
});
module.filter('striphtml', function () {
return function(text) {
- if(text)
- return text
- .replace(/&/g, '&')
- .replace(/>/g, '>')
- .replace(//g, '>').replace(/ have to be in format: 'logstash-YYYY-MM-DD'
- // 'logs': {
- // '_version_': {
- // 'type': 'long',
- // },
- // 'allText': {
- // 'type': 'text_general'
- // }
- // }
- // }
- // };
-
- // _.each(p.data.fields, function(v,k) {
- // // Exclude fields: id and _version, from the filter
- // // if (! _.contains(['id', '_version_'], v.name)) {
- // // mapping[log_index][logs][v.name] = { 'type':v.type };
- // // }
- // mapping[log_index][logs][v.name] = { 'type':v.type };
- // });
-
if (config.USE_ADMIN_LUKE) {
_.each(p.data.fields, function(v,k) {
// k is the field name
mapping[log_index][logs][k] = {'type':v.type, 'schema':v.schema};
});
} else {
- _.each(p.data.fields, function(v,k) {
- // k is the array index number
+ _.each(p.data.fields, function(v) {
mapping[log_index][logs][v.name] = {'type':v.type, 'schema':''};
});
}
diff --git a/src/app/services/filterSrv.js b/src/app/services/filterSrv.js
index b50272905..e6f8f2488 100755
--- a/src/app/services/filterSrv.js
+++ b/src/app/services/filterSrv.js
@@ -155,7 +155,7 @@ define([
if (DEBUG) { console.debug('filterSrv: v=',v,' k=',k); }
- if (v.type == 'time') {
+ if (v.type === 'time') {
time_field = v.field;
// Check for type of timestamps
// In case of relative timestamps, they will be string, not Date obj.
@@ -170,37 +170,37 @@ define([
} else {
end_time = v.to;
}
- } else if (v.type == 'terms') {
- if (v.mandate == 'must') {
+ } else if (v.type === 'terms') {
+ if (v.mandate === 'must') {
filter_fq = filter_fq + '&fq=' + v.field + ':"' + v.value + '"';
- } else if (v.mandate == 'mustNot') {
+ } else if (v.mandate === 'mustNot') {
filter_fq = filter_fq + '&fq=-' + v.field + ':"' + v.value + '"';
- } else if (v.mandate == 'either') {
+ } else if (v.mandate === 'either') {
filter_either.push(v.field + ':"' + v.value + '"');
}
- } else if (v.type == 'field') {
+ } else if (v.type === 'field') {
// v.query contains double-quote around it.
- if (v.mandate == 'must') {
+ if (v.mandate === 'must') {
filter_fq = filter_fq + '&fq=' + v.field + ':' + v.query;
- } else if (v.mandate == 'mustNot') {
+ } else if (v.mandate === 'mustNot') {
filter_fq = filter_fq + '&fq=-' + v.field + ':' + v.query;
- } else if (v.mandate == 'either') {
+ } else if (v.mandate === 'either') {
filter_either.push(v.field + ':' + v.query);
}
- } else if (v.type == 'querystring') {
- if (v.mandate == 'must') {
+ } else if (v.type === 'querystring') {
+ if (v.mandate === 'must') {
filter_fq = filter_fq + '&fq=' + v.query;
- } else if (v.mandate == 'mustNot') {
+ } else if (v.mandate === 'mustNot') {
filter_fq = filter_fq + '&fq=-' + v.query;
- } else if (v.mandate == 'either') {
+ } else if (v.mandate === 'either') {
filter_either.push(v.query);
}
- } else if (v.type == 'range') {
- if (v.mandate == 'must') {
+ } else if (v.type === 'range') {
+ if (v.mandate === 'must') {
filter_fq = filter_fq + '&fq=' + v.field + ':[' + v.from +' TO '+ v.to +']';
- } else if (v.mandate == 'mustNot') {
+ } else if (v.mandate === 'mustNot') {
filter_fq = filter_fq + '&fq=-' + v.field + ':[' + v.from +' TO '+ v.to +']';
- } else if (v.mandate == 'either') {
+ } else if (v.mandate === 'either') {
filter_either.push(v.field + ':[' + v.from +' TO '+ v.to +']');
}
} else {
@@ -231,31 +231,31 @@ define([
this.getTimeField = function() {
var time_field;
_.each(self.list, function(v) {
- if (v.type == 'time') {
+ if (v.type === 'time') {
time_field = v.field;
return;
}
});
return time_field;
- }
+ };
// Get range field for Solr query
this.getRangeField = function() {
var range_field;
_.each(self.list, function(v) {
- if (v.type == 'range') {
+ if (v.type === 'range') {
range_field = v.field;
return;
}
});
return range_field;
- }
+ };
// Get start time for Solr query (e.g. facet.range.start)
this.getStartTime = function() {
var start_time;
_.each(self.list, function(v) {
- if (v.type == 'time') {
+ if (v.type === 'time') {
if (v.from instanceof Date) {
start_time = new Date(v.from).toISOString();
} else {
@@ -271,7 +271,7 @@ define([
this.getEndTime = function() {
var end_time;
_.each(self.list, function(v) {
- if (v.type == 'time') {
+ if (v.type === 'time') {
if (v.to instanceof Date) {
end_time = new Date(v.to).toISOString();
} else {
@@ -287,7 +287,7 @@ define([
this.getStartTimeAndEndTime = function() {
var start_time, end_time;
_.each(self.list, function(v) {
- if (v.type == 'time') {
+ if (v.type === 'time') {
start_time = new Date(v.from).toISOString();
end_time = new Date(v.to).toISOString();
return;
@@ -304,12 +304,12 @@ define([
this.idsByTypeAndField = function(type,field,inactive){
var _require = inactive ? {type:type} : {type:type, field:field, active:true};
return _.pluck(_.where(self.list,_require),'id');
- }
+ };
// this method used to get the range filter with specific field
this.getRangeFieldFilter = function(type, field, inactive){
return _.pick(self.list, self.idsByTypeAndField(type, field, inactive));
- }
+ };
this.removeByType = function(type) {
var ids = self.idsByType(type);
@@ -359,6 +359,7 @@ define([
to: new Date(_.min(_.pluck(_t,'to')))
};
}
+ break; // not neccessary, but added to pass jshint test
case "max":
return {
from: new Date(_.min(_.pluck(_t,'from'))),
@@ -379,7 +380,7 @@ define([
from: _.max(_.pluck(_t,'from')),
to: _.min(_.pluck(_t,'to'))
};
- }
+ };
this.remove = function(id) {
if(!_.isUndefined(self.list[id])) {
diff --git a/src/app/services/kbnIndex.js b/src/app/services/kbnIndex.js
index 8b0c8d3cd..c1ce7b999 100755
--- a/src/app/services/kbnIndex.js
+++ b/src/app/services/kbnIndex.js
@@ -35,7 +35,7 @@ function (angular, _, config, moment) {
return all_collections(solr_server).then(function (p) {
return p;
});
- }
+ };
// returns a promise containing an array of all collections in Solr
// param: solr_server (e.g. http://localhost:8983/solr/)
@@ -47,7 +47,7 @@ function (angular, _, config, moment) {
} else {
// admin API is disabled, then cannot retrieve the collection list from Solr.
// return an empty list
- return new Promise(function(resolve,reject) {
+ return new Promise(function(resolve) {
var emptyList = [];
resolve(emptyList);
});
@@ -131,7 +131,7 @@ function (angular, _, config, moment) {
// extract and convert timestamp to YYYY.MM.DD
var t = timestamp_array[i].substr(0,10).replace(/-/g,'.');
indices.push('logstash-' + t);
- };
+ }
// indices[] should be in this format
// indices = ['logstash-2013.11.25'];
diff --git a/src/app/services/querySrv.js b/src/app/services/querySrv.js
index c97f5dca5..cc6dc91c2 100755
--- a/src/app/services/querySrv.js
+++ b/src/app/services/querySrv.js
@@ -6,8 +6,6 @@ define([
function (angular, _, config) {
'use strict';
- var DEBUG = false; // DEBUG mode
-
var module = angular.module('kibana.services');
module.service('querySrv', function(dashboard, ejsResource, sjsResource) {
@@ -105,35 +103,23 @@ function (angular, _, config) {
switch(q.type)
{
case 'lucene':
- // return ejs.QueryStringQuery(q.query || '*');
return sjs.QueryStringQuery(q.query || '*:*');
- // return (q.query || '*:*'); // ERROR: CANNOT return like this
default:
- // return _.isUndefined(q.query) ? false : ejs.QueryStringQuery(q.query || '*');
return _.isUndefined(q.query) ? false : sjs.QueryStringQuery(q.query || '*:*');
- // return _.isUndefined(q.query) ? false : (q.query || '*:*'); // ERROR: CANNOT return like this
}
};
// Get query string for Solr with defType param and default fields (df).
this.getQuery = function(id) {
- // var solr_q = 'q=' + self.list[id].query;
// Need to url encode the query
var solr_q = 'q=' + encodeURIComponent(self.list[id].query);
- // if (self.list[id].type) {
- // solr_q += '&defType=' + self.list[id].type;
- // }
- // if (self.list[id].df) {
- // solr_q += '&' + self.list[id].df;
- // }
-
if (dashboard.current.solr.global_params) {
solr_q += dashboard.current.solr.global_params;
}
return solr_q;
- }
+ };
this.findQuery = function(queryString) {
return _.findWhere(self.list,{query:queryString});