From a4d7f0463b31043c5abd98744b6a29b03e9b7202 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 24 Feb 2015 21:13:26 -0700 Subject: [PATCH 01/51] Add option to save time with dashboard --- src/kibana/plugins/dashboard/index.js | 10 ++++++++++ .../plugins/dashboard/partials/save_dashboard.html | 6 ++++++ .../plugins/dashboard/services/_saved_dashboard.js | 10 ++++++++-- .../plugins/settings/sections/objects/_view.html | 1 + src/kibana/plugins/settings/sections/objects/_view.js | 3 +++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/kibana/plugins/dashboard/index.js b/src/kibana/plugins/dashboard/index.js index 0eb4b15e753b8e..633c52d7bf7f8d 100644 --- a/src/kibana/plugins/dashboard/index.js +++ b/src/kibana/plugins/dashboard/index.js @@ -56,6 +56,14 @@ define(function (require) { }); var dash = $scope.dash = $route.current.locals.dash; + + // I don't like this, but not sure how else to tell if this is a fresh load of the + // saved dashboard object, so looking for _a in the URL. Ideas? + if (dash.timeRestore && dash.timeTo && dash.timeFrom && !$routeParams._a) { + timefilter.time.to = dash.timeTo; + timefilter.time.from = dash.timeFrom; + } + $scope.$on('$destroy', dash.destroy); var matchQueryFilter = function (filter) { @@ -135,6 +143,8 @@ define(function (require) { $state.title = dash.id = dash.title; $state.save(); dash.panelsJSON = angular.toJson($state.panels); + dash.timeFrom = dash.timeRestore ? timefilter.time.from : undefined; + dash.timeTo = dash.timeRestore ? timefilter.time.to : undefined; dash.save() .then(function (id) { diff --git a/src/kibana/plugins/dashboard/partials/save_dashboard.html b/src/kibana/plugins/dashboard/partials/save_dashboard.html index 03476726c999d2..9f4be5b0e9573b 100644 --- a/src/kibana/plugins/dashboard/partials/save_dashboard.html +++ b/src/kibana/plugins/dashboard/partials/save_dashboard.html @@ -2,6 +2,12 @@
+

+ +

\ No newline at end of file diff --git a/src/kibana/plugins/dashboard/services/_saved_dashboard.js b/src/kibana/plugins/dashboard/services/_saved_dashboard.js index c38d07fc012c18..8faa0ad1233b7e 100644 --- a/src/kibana/plugins/dashboard/services/_saved_dashboard.js +++ b/src/kibana/plugins/dashboard/services/_saved_dashboard.js @@ -23,7 +23,10 @@ define(function (require) { hits: 'integer', description: 'string', panelsJSON: 'string', - version: 'integer' + version: 'integer', + timeRestore: 'boolean', + timeTo: 'string', + timeFrom: 'string' }, // defeult values to assign to the doc @@ -32,7 +35,10 @@ define(function (require) { hits: 0, description: '', panelsJSON: '[]', - version: 1 + version: 1, + timeRestore: false, + timeTo: undefined, + timeFrom: undefined }, searchSource: true, diff --git a/src/kibana/plugins/settings/sections/objects/_view.html b/src/kibana/plugins/settings/sections/objects/_view.html index 33f108c6967473..bba1d86dd66875 100644 --- a/src/kibana/plugins/settings/sections/objects/_view.html +++ b/src/kibana/plugins/settings/sections/objects/_view.html @@ -24,6 +24,7 @@

Proceed with caution

- Invalid JSON syntax + Invalid JSON syntax + + + + + - {{conf.value || conf.defVal}} - {{conf.value === undefined ? conf.defVal : conf.value}} - {{(conf.value || conf.defVal).join(', ')}} + + + + {{conf.value || conf.defVal}} + {{(conf.value || conf.defVal).join(', ')}} + {{conf.value === undefined ? conf.defVal : conf.value}} + diff --git a/src/kibana/plugins/settings/sections/advanced/index.js b/src/kibana/plugins/settings/sections/advanced/index.js index bc041329fd45c5..686fffc6f03b5c 100644 --- a/src/kibana/plugins/settings/sections/advanced/index.js +++ b/src/kibana/plugins/settings/sections/advanced/index.js @@ -20,7 +20,7 @@ define(function (require) { ESC: 27 }; - var NAMED_EDITORS = ['json', 'array', 'boolean']; + var NAMED_EDITORS = ['json', 'array', 'boolean', 'select']; var NORMAL_EDITOR = ['number', 'string', 'null', 'undefined']; function getEditorType(conf) { @@ -42,11 +42,13 @@ define(function (require) { defVal: def.value, type: getValType(def, val), description: def.description, + options: def.options, value: val, }; var editor = getEditorType(conf); conf.json = editor === 'json'; + conf.select = editor === 'select'; conf.bool = editor === 'boolean'; conf.array = editor === 'array'; conf.normal = editor === 'normal'; From 0f2a95be9c39949c482f940d66152772ef29fe74 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Tue, 21 Apr 2015 08:51:56 -0700 Subject: [PATCH 37/51] [vislib/vis] when a handler already exists, destroy it --- src/kibana/components/vislib/vis.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/kibana/components/vislib/vis.js b/src/kibana/components/vislib/vis.js index a29910c72ac912..7f0619785077b9 100644 --- a/src/kibana/components/vislib/vis.js +++ b/src/kibana/components/vislib/vis.js @@ -49,6 +49,11 @@ define(function (require) { throw new Error('No valid data!'); } + if (this.handler) { + this.data = null; + this._runOnHandler('destroy'); + } + this.data = data; this.handler = handlerTypes[chartType](this) || handlerTypes.column(this); this._runOnHandler('render'); From 47157afadffe1ceda294c06b4f2c17f78731d772 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 22 Apr 2015 10:15:15 -0700 Subject: [PATCH 38/51] mightExist to previouslyStored --- src/kibana/plugins/dashboard/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kibana/plugins/dashboard/index.js b/src/kibana/plugins/dashboard/index.js index 74d5dcd036fe52..97a7ba6a6e53d4 100644 --- a/src/kibana/plugins/dashboard/index.js +++ b/src/kibana/plugins/dashboard/index.js @@ -60,7 +60,7 @@ define(function (require) { // I don't like this, but not sure how else to tell if this is a fresh load of the // saved dashboard object, so looking for _a in the URL. Ideas? - if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.mightExist()) { + if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; } From 251b75568f19bb46464707ba19b8ac500de0fca7 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 22 Apr 2015 12:40:09 -0700 Subject: [PATCH 39/51] [visualize/editor] fix sidebar tabs broken by 12cd11ec083c8b528056dbb1bad41d4da5a611ba --- src/kibana/plugins/visualize/editor/sidebar.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/kibana/plugins/visualize/editor/sidebar.js b/src/kibana/plugins/visualize/editor/sidebar.js index fff80f1d126520..36f62912704100 100644 --- a/src/kibana/plugins/visualize/editor/sidebar.js +++ b/src/kibana/plugins/visualize/editor/sidebar.js @@ -12,11 +12,9 @@ define(function (require) { template: require('text!plugins/visualize/editor/sidebar.html'), scope: true, controllerAs: 'sidebar', - link: function ($scope) { + controller: function ($scope) { $scope.$bind('vis', 'editableVis'); - if ($scope.vis) { - $scope.sidebar.section = $scope.vis.type.requiresSearch ? 'data' : 'options'; - } + this.section = _.get($scope, 'vis.type.requiresSearch') ? 'data' : 'options'; } }; }); From 510d5824a98813f077f1bb863d9c2141da171459 Mon Sep 17 00:00:00 2001 From: lukasolson Date: Wed, 22 Apr 2015 16:57:37 -0700 Subject: [PATCH 40/51] Add look back setting in advanced for field mappings (issues/3645) --- src/kibana/components/config/defaults.js | 7 ++++++- src/kibana/components/index_patterns/_mapper.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/kibana/components/config/defaults.js b/src/kibana/components/config/defaults.js index 756409a112b793..6814d07bdd0f40 100644 --- a/src/kibana/components/config/defaults.js +++ b/src/kibana/components/config/defaults.js @@ -81,6 +81,11 @@ define(function (require) { 'truncate:maxHeight': { value: 115, description: 'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation.' + }, + 'indexPattern:fieldMapping:lookBack': { + value: 5, + description: 'For index patterns containing timestamps in their names, look for this many recent matching ' + + 'patterns from which to query the field mapping.' } }; -}); \ No newline at end of file +}); diff --git a/src/kibana/components/index_patterns/_mapper.js b/src/kibana/components/index_patterns/_mapper.js index 520ded4614c3b7..03c8e2dd723cbf 100644 --- a/src/kibana/components/index_patterns/_mapper.js +++ b/src/kibana/components/index_patterns/_mapper.js @@ -1,5 +1,5 @@ define(function (require) { - return function MapperService(Private, Promise, es, configFile) { + return function MapperService(Private, Promise, es, configFile, config) { var _ = require('lodash'); var moment = require('moment'); @@ -51,7 +51,7 @@ define(function (require) { promise = self.getIndicesForIndexPattern(indexPattern) .then(function (existing) { if (existing.matches.length === 0) throw new IndexPatternMissingIndices(); - return existing.matches.slice(-5); // Grab the most recent 5 + return existing.matches.slice(-config.get('indexPattern:fieldMapping:lookBack')); // Grab the most recent }); } From e2d54c4a998584b800bf97f1a13c14f967f3d22c Mon Sep 17 00:00:00 2001 From: Juan Thomassie Date: Thu, 23 Apr 2015 10:14:35 -0500 Subject: [PATCH 41/51] add autoPrecision param, increase default max precision to 8 --- src/kibana/components/config/defaults.js | 4 +-- src/kibana/components/vislib/lib/dispatch.js | 2 +- .../vislib/visualizations/tile_map.js | 25 +++++++++---------- .../vis_types/vislib/editors/tile_map.html | 19 ++++++++++---- .../plugins/vis_types/vislib/tile_map.js | 2 +- src/kibana/plugins/visualize/editor/editor.js | 16 +++++++++++- 6 files changed, 45 insertions(+), 23 deletions(-) diff --git a/src/kibana/components/config/defaults.js b/src/kibana/components/config/defaults.js index 756409a112b793..10c2eecdf365aa 100644 --- a/src/kibana/components/config/defaults.js +++ b/src/kibana/components/config/defaults.js @@ -57,8 +57,8 @@ define(function (require) { description: 'Never show more than this many bar in date histograms, scale values if needed', }, 'visualization:tileMap:maxPrecision': { - value: 7, - description: 'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, ' + + value: 8, + description: 'The maximum geoHash precision displayed on tile maps: 8 is high, 10 is very high, ' + '12 is the max. Explanation of cell dimensions: http://www.elastic.co/guide/en/elasticsearch/reference/current/' + 'search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator', }, diff --git a/src/kibana/components/vislib/lib/dispatch.js b/src/kibana/components/vislib/lib/dispatch.js index f59694dfb8b78a..444d2c571f460c 100644 --- a/src/kibana/components/vislib/lib/dispatch.js +++ b/src/kibana/components/vislib/lib/dispatch.js @@ -19,7 +19,7 @@ define(function (require) { this.handler = handler; this.dispatch = d3.dispatch('brush', 'click', 'hover', 'mouseup', - 'mousedown', 'mouseover', 'mouseout'); + 'mousedown', 'mouseover', 'mouseout', 'mapZoomEnd'); } /** diff --git a/src/kibana/components/vislib/visualizations/tile_map.js b/src/kibana/components/vislib/visualizations/tile_map.js index 69ae1b494372b0..0b602649e0847b 100644 --- a/src/kibana/components/vislib/visualizations/tile_map.js +++ b/src/kibana/components/vislib/visualizations/tile_map.js @@ -103,7 +103,13 @@ define(function (require) { map.on('moveend', function setZoomCenter() { mapZoom = self._attr.mapZoom = map.getZoom(); mapCenter = self._attr.mapCenter = map.getCenter(); - self.zoomPrecision(mapZoom); + }); + + map.on('zoomend', function (e) { + var mapInfo = { + zoom: map.getZoom() / 18 + }; + self.events.dispatch.mapZoomEnd(mapInfo); }); // add label for splits @@ -135,19 +141,12 @@ define(function (require) { }; }; - /** - * change precision based on map zoom - * - * @method zoomPrecision - * @param mapZoom {Number} - * @return {undefined} - */ - TileMap.prototype.zoomPrecision = function (mapZoom) { - var self = this; - console.log(self._attr.zoomPrecision, agg.params.precision, mapZoom); - if (mapZoom < 3) { + TileMap.prototype.addZoomEndEvent = function (element) { + var events = this.events; + var zoomend = events.addMapZoomEndEvent(); + var attachedEvents = element.call(zoomend); - } + return attachedEvents; }; /** diff --git a/src/kibana/plugins/vis_types/vislib/editors/tile_map.html b/src/kibana/plugins/vis_types/vislib/editors/tile_map.html index f2541a7ae5b9b9..9a6a7c56fd69b8 100644 --- a/src/kibana/plugins/vis_types/vislib/editors/tile_map.html +++ b/src/kibana/plugins/vis_types/vislib/editors/tile_map.html @@ -11,16 +11,25 @@
-
+
+ \ No newline at end of file diff --git a/src/kibana/plugins/vis_types/vislib/tile_map.js b/src/kibana/plugins/vis_types/vislib/tile_map.js index f4632b5d70e926..37e8ca9a2a81b1 100644 --- a/src/kibana/plugins/vis_types/vislib/tile_map.js +++ b/src/kibana/plugins/vis_types/vislib/tile_map.js @@ -14,7 +14,7 @@ define(function (require) { defaults: { mapType: 'Scaled Circle Markers', isDesaturated: true, - zoomPrecision: true + autoPrecision: true }, mapTypes: ['Scaled Circle Markers', 'Shaded Circle Markers', 'Shaded Geohash Grid', 'Pins'], editor: require('text!plugins/vis_types/vislib/editors/tile_map.html') diff --git a/src/kibana/plugins/visualize/editor/editor.js b/src/kibana/plugins/visualize/editor/editor.js index 4e4ab4e671611b..b403476645fab6 100644 --- a/src/kibana/plugins/visualize/editor/editor.js +++ b/src/kibana/plugins/visualize/editor/editor.js @@ -50,7 +50,7 @@ define(function (require) { 'kibana/notify', 'kibana/courier' ]) - .controller('VisEditor', function ($scope, $route, timefilter, AppState, $location, kbnUrl, $timeout, courier, Private, Promise) { + .controller('VisEditor', function ($scope, $route, timefilter, AppState, $location, kbnUrl, $timeout, courier, Private, Promise, config) { var _ = require('lodash'); var angular = require('angular'); @@ -125,6 +125,20 @@ define(function (require) { editableVis.listeners.click = vis.listeners.click = filterBarClickHandler($state); editableVis.listeners.brush = vis.listeners.brush = brushEvent; + editableVis.listeners.mapZoomEnd = vis.listeners.mapZoomEnd = function (event) { + var geoHash = _.find(vis.aggs, function (agg) { + return agg.type.name === 'geohash_grid' && vis.params.autoPrecision; + }); + + if (!geoHash) return; + + console.log(' '); + console.log('zoom', event.zoom * 18, event.zoom, + ' precision', Math.ceil(config.get('visualization:tileMap:maxPrecision') * event.zoom)); + + geoHash.params.precision = Math.ceil(config.get('visualization:tileMap:maxPrecision') * event.zoom); + $scope.fetch(); + }; // track state of editable vis vs. "actual" vis $scope.stageEditableVis = transferVisState(editableVis, vis, true); From 1d2cc4065ad026df49a405238a3401969d242ac0 Mon Sep 17 00:00:00 2001 From: Juan Thomassie Date: Thu, 23 Apr 2015 14:35:11 -0500 Subject: [PATCH 42/51] set default precision back to 7, rendering shapes to canvas, added switch to tune the zoom to precision ratio --- .../components/agg_types/buckets/geo_hash.js | 2 +- src/kibana/components/config/defaults.js | 4 +- .../vislib/visualizations/tile_map.js | 3 +- src/kibana/index.html | 1 + src/kibana/plugins/visualize/editor/editor.js | 65 +++++++++++++++++-- 5 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/kibana/components/agg_types/buckets/geo_hash.js b/src/kibana/components/agg_types/buckets/geo_hash.js index 61e1c52b9498b5..2bbaf405d00903 100644 --- a/src/kibana/components/agg_types/buckets/geo_hash.js +++ b/src/kibana/components/agg_types/buckets/geo_hash.js @@ -3,7 +3,7 @@ define(function (require) { var _ = require('lodash'); var moment = require('moment'); var BucketAggType = Private(require('components/agg_types/buckets/_bucket_agg_type')); - var defaultPrecision = 3; + var defaultPrecision = 2; function getPrecision(precision) { var maxPrecision = _.parseInt(config.get('visualization:tileMap:maxPrecision')); diff --git a/src/kibana/components/config/defaults.js b/src/kibana/components/config/defaults.js index 10c2eecdf365aa..756409a112b793 100644 --- a/src/kibana/components/config/defaults.js +++ b/src/kibana/components/config/defaults.js @@ -57,8 +57,8 @@ define(function (require) { description: 'Never show more than this many bar in date histograms, scale values if needed', }, 'visualization:tileMap:maxPrecision': { - value: 8, - description: 'The maximum geoHash precision displayed on tile maps: 8 is high, 10 is very high, ' + + value: 7, + description: 'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, ' + '12 is the max. Explanation of cell dimensions: http://www.elastic.co/guide/en/elasticsearch/reference/current/' + 'search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator', }, diff --git a/src/kibana/components/vislib/visualizations/tile_map.js b/src/kibana/components/vislib/visualizations/tile_map.js index 0b602649e0847b..7299081544ac01 100644 --- a/src/kibana/components/vislib/visualizations/tile_map.js +++ b/src/kibana/components/vislib/visualizations/tile_map.js @@ -107,7 +107,8 @@ define(function (require) { map.on('zoomend', function (e) { var mapInfo = { - zoom: map.getZoom() / 18 + zoom: map.getZoom(), + zoomPct: map.getZoom() / 18 }; self.events.dispatch.mapZoomEnd(mapInfo); }); diff --git a/src/kibana/index.html b/src/kibana/index.html index 1d275523b1b98b..9a3d61b3a99c0b 100644 --- a/src/kibana/index.html +++ b/src/kibana/index.html @@ -28,6 +28,7 @@

window.KIBANA_VERSION='@@version'; window.KIBANA_BUILD_NUM='@@buildNum'; window.KIBANA_COMMIT_SHA='@@commitSha'; + window.L_PREFER_CANVAS = true; diff --git a/src/kibana/plugins/visualize/editor/editor.js b/src/kibana/plugins/visualize/editor/editor.js index b403476645fab6..9885ba23cffe55 100644 --- a/src/kibana/plugins/visualize/editor/editor.js +++ b/src/kibana/plugins/visualize/editor/editor.js @@ -132,11 +132,68 @@ define(function (require) { if (!geoHash) return; - console.log(' '); - console.log('zoom', event.zoom * 18, event.zoom, - ' precision', Math.ceil(config.get('visualization:tileMap:maxPrecision') * event.zoom)); + var autoPrecision; + switch (event.zoom) { + case 1: + autoPrecision = 1; + break; + case 2: + autoPrecision = 2; + break; + case 3: + autoPrecision = 2; + break; + case 4: + autoPrecision = 3; + break; + case 5: + autoPrecision = 3; + break; + case 6: + autoPrecision = 4; + break; + case 7: + autoPrecision = 4; + break; + case 8: + autoPrecision = 4; + break; + case 9: + autoPrecision = 5; + break; + case 10: + autoPrecision = 5; + break; + case 11: + autoPrecision = 6; + break; + case 12: + autoPrecision = 6; + break; + case 13: + autoPrecision = 7; + break; + case 14: + autoPrecision = 8; + break; + case 15: + autoPrecision = 9; + break; + case 16: + autoPrecision = 10; + break; + case 17: + autoPrecision = 11; + break; + case 18: + autoPrecision = 12; + break; + default: + autoPrecision = 2; + } - geoHash.params.precision = Math.ceil(config.get('visualization:tileMap:maxPrecision') * event.zoom); + autoPrecision = _.min([autoPrecision, config.get('visualization:tileMap:maxPrecision')]); + geoHash.params.precision = autoPrecision; $scope.fetch(); }; From 6b74f8e75d366742bae7f0b50e9e5d434a207962 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Thu, 23 Apr 2015 15:56:06 -0700 Subject: [PATCH 43/51] Remove comment --- src/kibana/plugins/dashboard/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/kibana/plugins/dashboard/index.js b/src/kibana/plugins/dashboard/index.js index 97a7ba6a6e53d4..63f1fb644531ef 100644 --- a/src/kibana/plugins/dashboard/index.js +++ b/src/kibana/plugins/dashboard/index.js @@ -58,8 +58,6 @@ define(function (require) { var dash = $scope.dash = $route.current.locals.dash; - // I don't like this, but not sure how else to tell if this is a fresh load of the - // saved dashboard object, so looking for _a in the URL. Ideas? if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; From cd342bb661496a4fb640b08752c83be80ec3c839 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Thu, 23 Apr 2015 16:39:25 -0700 Subject: [PATCH 44/51] Switch button positions --- src/kibana/plugins/visualize/editor/sidebar.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/kibana/plugins/visualize/editor/sidebar.html b/src/kibana/plugins/visualize/editor/sidebar.html index 7feaa3d979b939..6ee14a9aa7a978 100644 --- a/src/kibana/plugins/visualize/editor/sidebar.html +++ b/src/kibana/plugins/visualize/editor/sidebar.html @@ -25,14 +25,6 @@ -
  • - -
  • +
  • + +
  • From ad3f28bb46a429c27cea1a8f60105c6dd6a11f94 Mon Sep 17 00:00:00 2001 From: Juan Thomassie Date: Fri, 24 Apr 2015 08:51:15 -0500 Subject: [PATCH 45/51] removed L_PREFER_CANVAS script from index.html --- src/kibana/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/kibana/index.html b/src/kibana/index.html index 9a3d61b3a99c0b..1d275523b1b98b 100644 --- a/src/kibana/index.html +++ b/src/kibana/index.html @@ -28,7 +28,6 @@

    window.KIBANA_VERSION='@@version'; window.KIBANA_BUILD_NUM='@@buildNum'; window.KIBANA_COMMIT_SHA='@@commitSha'; - window.L_PREFER_CANVAS = true; From 7b2b2206007484ea36bd8313cf9e825336f6f985 Mon Sep 17 00:00:00 2001 From: Juan Thomassie Date: Fri, 24 Apr 2015 09:20:49 -0500 Subject: [PATCH 46/51] removed Pin map type from tile map --- .../vislib/visualizations/tile_map.js | 23 +------------------ .../plugins/vis_types/vislib/tile_map.js | 2 +- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/kibana/components/vislib/visualizations/tile_map.js b/src/kibana/components/vislib/visualizations/tile_map.js index 141739335d242f..6cee1ca132cdaa 100644 --- a/src/kibana/components/vislib/visualizations/tile_map.js +++ b/src/kibana/components/vislib/visualizations/tile_map.js @@ -178,34 +178,13 @@ define(function (require) { } else if (this._attr.mapType === 'Shaded Geohash Grid') { featureLayer = this.shadedGeohashGrid(map, mapData); } else { - featureLayer = this.pinMarkers(mapData); + featureLayer = this.scaledCircleMarkers(map, mapData); } } return featureLayer; }; - /** - * Type of data overlay for map: - * creates featurelayer from mapData (geoJson) - * with default leaflet pin markers - * - * @method pinMarkers - * @param mapData {Object} - * @return {Leaflet object} featureLayer - */ - TileMap.prototype.pinMarkers = function (mapData) { - var self = this; - - var featureLayer = L.geoJson(mapData, { - onEachFeature: function (feature, layer) { - self.bindPopup(feature, layer); - } - }); - - return featureLayer; - }; - /** * Type of data overlay for map: * creates featurelayer from mapData (geoJson) diff --git a/src/kibana/plugins/vis_types/vislib/tile_map.js b/src/kibana/plugins/vis_types/vislib/tile_map.js index de1be2a1eadbf5..03348487016609 100644 --- a/src/kibana/plugins/vis_types/vislib/tile_map.js +++ b/src/kibana/plugins/vis_types/vislib/tile_map.js @@ -15,7 +15,7 @@ define(function (require) { mapType: 'Scaled Circle Markers', isDesaturated: true }, - mapTypes: ['Scaled Circle Markers', 'Shaded Circle Markers', 'Shaded Geohash Grid', 'Pins'], + mapTypes: ['Scaled Circle Markers', 'Shaded Circle Markers', 'Shaded Geohash Grid'], editor: require('text!plugins/vis_types/vislib/editors/tile_map.html') }, responseConverter: geoJsonConverter, From 76a992e3c46e4223937a73c01d949f19581a5f4b Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Fri, 24 Apr 2015 07:56:10 -0700 Subject: [PATCH 47/51] Remove the test watcher --- tasks/config/watch.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tasks/config/watch.js b/tasks/config/watch.js index 86e777f29927d1..05250a55006eef 100644 --- a/tasks/config/watch.js +++ b/tasks/config/watch.js @@ -1,12 +1,5 @@ module.exports = function (grunt) { var config = { - test: { - files: [ - '<%= unitTestDir %>/**/*.js' - ], - tasks: ['mocha:unit'] - }, - less: { files: [ '<%= app %>/**/styles/**/*.less', From fba3f34c2dd7bd9c57963effe44028533e8df878 Mon Sep 17 00:00:00 2001 From: Shelby Sturgis Date: Fri, 24 Apr 2015 14:20:07 -0400 Subject: [PATCH 48/51] Closes #3676. Fixes issue with legend not properly highlighting chart with numeric labels --- src/kibana/components/vislib/lib/legend.js | 4 ++-- test/unit/specs/vislib/lib/legend.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/kibana/components/vislib/lib/legend.js b/src/kibana/components/vislib/lib/legend.js index 90e027bf2bc5d4..de7a9be69bdd60 100644 --- a/src/kibana/components/vislib/lib/legend.js +++ b/src/kibana/components/vislib/lib/legend.js @@ -138,14 +138,14 @@ define(function (require) { // legend legendDiv.selectAll('li') .filter(function (d) { - return this.getAttribute('data-label') !== label; + return this.getAttribute('data-label') !== label.toString(); }) .classed('blur_shape', true); // all data-label attribute charts.selectAll('[data-label]') .filter(function (d) { - return this.getAttribute('data-label') !== label; + return this.getAttribute('data-label') !== label.toString(); }) .classed('blur_shape', true); diff --git a/test/unit/specs/vislib/lib/legend.js b/test/unit/specs/vislib/lib/legend.js index 53763f0d71557e..01d8fe8eec9e44 100644 --- a/test/unit/specs/vislib/lib/legend.js +++ b/test/unit/specs/vislib/lib/legend.js @@ -5,17 +5,20 @@ define(function (require) { var slices = require('vislib_fixtures/mock_data/histogram/_slices'); var stackedSeries = require('vislib_fixtures/mock_data/date_histogram/_stacked_series'); + var histogramSlices = require('vislib_fixtures/mock_data/histogram/_slices'); var dataArray = [ stackedSeries, slices, + histogramSlices, stackedSeries, - stackedSeries, + stackedSeries ]; var chartTypes = [ 'histogram', 'pie', + 'pie', 'area', 'line' ]; @@ -24,7 +27,7 @@ define(function (require) { histogram: '.chart rect', pie: '.chart path', area: '.chart path', - line: '.chart circle', + line: '.chart circle' }; angular.module('LegendFactory', ['kibana']); From 6ae6a68a5b30d5380c7a7cad357f66b0abad86da Mon Sep 17 00:00:00 2001 From: Khalah Jones-Golden Date: Fri, 24 Apr 2015 16:34:35 -0400 Subject: [PATCH 49/51] [Tooltip] Changed the mouseout event to a mouseleave --- src/kibana/components/vislib/components/tooltip/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kibana/components/vislib/components/tooltip/tooltip.js b/src/kibana/components/vislib/components/tooltip/tooltip.js index 4dd63b6c4182db..49a672266e4270 100644 --- a/src/kibana/components/vislib/components/tooltip/tooltip.js +++ b/src/kibana/components/vislib/components/tooltip/tooltip.js @@ -133,7 +133,7 @@ define(function (require) { var events = self.events ? self.events.eventResponse(d, i) : d; return render(tooltipFormatter(events)); }) - .on('mouseout.tip', function () { + .on('mouseleave.tip', function () { render(); }); }); From 562672d914e186f346eefc62be240e23939774d9 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 27 Apr 2015 14:25:02 -0700 Subject: [PATCH 50/51] [kbnUrl] can't call method destroy of undefined --- src/kibana/components/url/url.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kibana/components/url/url.js b/src/kibana/components/url/url.js index 15a18c0eda3328..53396c557108e3 100644 --- a/src/kibana/components/url/url.js +++ b/src/kibana/components/url/url.js @@ -43,7 +43,8 @@ define(function (require) { if (self.shouldAutoReload(next, prev)) { var appState = getAppState(); - appState.destroy(); + if (appState) appState.destroy(); + reloading = $rootScope.$on('$locationChangeSuccess', function () { // call the "unlisten" function returned by $on reloading(); From a3f3ec48b31362a3fb56959a16668ba01020757e Mon Sep 17 00:00:00 2001 From: Spencer Date: Mon, 27 Apr 2015 17:51:07 -0700 Subject: [PATCH 51/51] [visualize/editor] less magic numbers moved to a function that calculates an appropriate zoom --- src/kibana/plugins/visualize/editor/editor.js | 73 ++----------------- 1 file changed, 8 insertions(+), 65 deletions(-) diff --git a/src/kibana/plugins/visualize/editor/editor.js b/src/kibana/plugins/visualize/editor/editor.js index 9885ba23cffe55..dd03139889c6e8 100644 --- a/src/kibana/plugins/visualize/editor/editor.js +++ b/src/kibana/plugins/visualize/editor/editor.js @@ -126,74 +126,13 @@ define(function (require) { editableVis.listeners.click = vis.listeners.click = filterBarClickHandler($state); editableVis.listeners.brush = vis.listeners.brush = brushEvent; editableVis.listeners.mapZoomEnd = vis.listeners.mapZoomEnd = function (event) { + if (!vis.params.autoPrecision) return; + var geoHash = _.find(vis.aggs, function (agg) { - return agg.type.name === 'geohash_grid' && vis.params.autoPrecision; + return agg.type.name === 'geohash_grid'; }); - if (!geoHash) return; - - var autoPrecision; - switch (event.zoom) { - case 1: - autoPrecision = 1; - break; - case 2: - autoPrecision = 2; - break; - case 3: - autoPrecision = 2; - break; - case 4: - autoPrecision = 3; - break; - case 5: - autoPrecision = 3; - break; - case 6: - autoPrecision = 4; - break; - case 7: - autoPrecision = 4; - break; - case 8: - autoPrecision = 4; - break; - case 9: - autoPrecision = 5; - break; - case 10: - autoPrecision = 5; - break; - case 11: - autoPrecision = 6; - break; - case 12: - autoPrecision = 6; - break; - case 13: - autoPrecision = 7; - break; - case 14: - autoPrecision = 8; - break; - case 15: - autoPrecision = 9; - break; - case 16: - autoPrecision = 10; - break; - case 17: - autoPrecision = 11; - break; - case 18: - autoPrecision = 12; - break; - default: - autoPrecision = 2; - } - - autoPrecision = _.min([autoPrecision, config.get('visualization:tileMap:maxPrecision')]); - geoHash.params.precision = autoPrecision; + geoHash.params.precision = autoPrecision(event.zoom, config.get('visualization:tileMap:maxPrecision')); $scope.fetch(); }; @@ -359,6 +298,10 @@ define(function (require) { }; } + function autoPrecision(zoom, limit) { + return Math.min(Math.round(0.02 * Math.pow(zoom, 2) + 0.24 * zoom + 0.723), limit); + } + init(); }); });