diff --git a/public/POIs.js b/public/POIs.js index 2b5a5eb..9d07bbd 100644 --- a/public/POIs.js +++ b/public/POIs.js @@ -2,13 +2,15 @@ const _ = require('lodash'); const L = require('leaflet'); import { markerIcon } from 'plugins/enhanced_tilemap/vislib/markerIcon'; import { toLatLng } from 'plugins/enhanced_tilemap/vislib/geo_point'; +import { SearchSourceProvider } from 'ui/courier/data_source/search_source'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; import utils from 'plugins/enhanced_tilemap/utils'; define(function (require) { return function POIsFactory(Private, savedSearches) { - const SearchSource = Private(require('ui/courier/data_source/search_source')); - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const SearchSource = Private(SearchSourceProvider); + const queryFilter = Private(FilterBarQueryFilterProvider); /** * Points of Interest @@ -108,7 +110,7 @@ define(function (require) { }, pointToLayer: function (feature, latlng) { return L.circleMarker( - latlng, + latlng, { radius: 6 }); @@ -165,4 +167,4 @@ define(function (require) { return POIs; } -}); \ No newline at end of file +}); diff --git a/public/directives/savedSearch.js b/public/directives/savedSearch.js index 9187ec3..6fcbf4b 100644 --- a/public/directives/savedSearch.js +++ b/public/directives/savedSearch.js @@ -1,10 +1,13 @@ const _ = require('lodash'); -const module = require('ui/modules').get('kibana'); import { backwardsCompatible } from 'plugins/enhanced_tilemap/backwardsCompatible'; +import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; +import { uiModules } from 'ui/modules'; + +const module = uiModules.get('kibana'); define(function (require) { module.directive('savedSearch', function (Private, indexPatterns) { - const service = Private(require('ui/saved_objects/saved_object_registry')).byLoaderPropertiesName.searches; + const service = Private(SavedObjectRegistryProvider).byLoaderPropertiesName.searches; return { restrict: 'E', @@ -25,7 +28,7 @@ define(function (require) { }; fetchSavedSearches(); - + scope.updateIndex = function() { scope.warn = ""; scope.layer.savedSearchId = scope.savedSearch.value; @@ -85,7 +88,7 @@ define(function (require) { }).map(function (field) { return field.name; }); - + const labelFields = index.fields.filter(function (field) { let keep = true; if (field.type === 'boolean' || field.type === 'geo_point' || field.type === 'geo_shape') { diff --git a/public/directives/tooltipFormatter.html b/public/directives/tooltipFormatter.html index 2400ef7..bd5ddf9 100644 --- a/public/directives/tooltipFormatter.html +++ b/public/directives/tooltipFormatter.html @@ -10,7 +10,8 @@
- Saved search tooltip no longer supported. Kibana 5.5 changes broke this feature

+
- \ No newline at end of file + diff --git a/public/directives/tooltipFormatter.js b/public/directives/tooltipFormatter.js index 8a062e1..62dc216 100644 --- a/public/directives/tooltipFormatter.js +++ b/public/directives/tooltipFormatter.js @@ -1,10 +1,13 @@ const _ = require('lodash'); -const module = require('ui/modules').get('kibana'); +import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; +import { uiModules } from 'ui/modules'; + +const module = uiModules.get('kibana'); define(function (require) { module.directive('tooltipFormatter', function (Private, indexPatterns) { - const visService = Private(require('ui/saved_objects/saved_object_registry')).byLoaderPropertiesName.visualizations; - const searchService = Private(require('ui/saved_objects/saved_object_registry')).byLoaderPropertiesName.searches; + const visService = Private(SavedObjectRegistryProvider).byLoaderPropertiesName.visualizations; + const searchService = Private(SavedObjectRegistryProvider).byLoaderPropertiesName.searches; return { restrict: 'E', @@ -75,4 +78,4 @@ define(function (require) { } } }); -}); \ No newline at end of file +}); diff --git a/public/tooltip/popupVisualize.js b/public/tooltip/popupVisualize.js index 6ee615c..9f5cf96 100644 --- a/public/tooltip/popupVisualize.js +++ b/public/tooltip/popupVisualize.js @@ -6,8 +6,7 @@ import 'ui/visualize/visualize.less'; import 'ui/visualize/visualize_legend'; import $ from 'jquery'; import _ from 'lodash'; -import RegistryVisTypesProvider from 'ui/registry/vis_types'; -import uiModules from 'ui/modules'; +import { uiModules } from 'ui/modules'; import visualizeTemplate from 'ui/visualize/visualize.html'; import 'angular-sanitize'; @@ -18,14 +17,6 @@ import { uiModules .get('kibana/directive', ['ngSanitize']) .directive('popupVisualize', function (Notifier, SavedVis, indexPatterns, Private, config, $timeout) { - - - let visTypes = Private(RegistryVisTypesProvider); - - let notify = new Notifier({ - location: 'Visualize' - }); - return { restrict: 'E', require: '?renderCounter', diff --git a/public/tooltip/searchTooltip.html b/public/tooltip/searchTooltip.html index daef94c..d938ef9 100644 --- a/public/tooltip/searchTooltip.html +++ b/public/tooltip/searchTooltip.html @@ -1,7 +1,14 @@ - \ No newline at end of file + diff --git a/public/tooltip/searchTooltip.js b/public/tooltip/searchTooltip.js index da6c0e8..70b7ac4 100644 --- a/public/tooltip/searchTooltip.js +++ b/public/tooltip/searchTooltip.js @@ -1,14 +1,15 @@ import _ from 'lodash'; import $ from 'jquery'; import utils from 'plugins/enhanced_tilemap/utils'; +import { SearchSourceProvider } from 'ui/courier/data_source/search_source'; define(function (require) { return function SearchTooltipFactory( - $compile, $rootScope, $timeout, + $compile, $rootScope, $timeout, Private, savedSearches) { const geoFilter = Private(require('plugins/enhanced_tilemap/vislib/geoFilter')); - const SearchSource = Private(require('ui/courier/data_source/search_source')); + const SearchSource = Private(SearchSourceProvider); class SearchTooltip { constructor(searchId, fieldname, geotype, options) { @@ -35,10 +36,23 @@ define(function (require) { const self = this; savedSearches.get(this.searchId).then(function (savedSearch) { origSearchSource = savedSearch.searchSource; - self.$tooltipScope.hits = []; - self.$tooltipScope.indexPattern = savedSearch.searchSource._state.index; + self.$tooltipScope.searchSource = savedSearch.searchSource; self.$tooltipScope.columns = savedSearch.columns; self.$tooltipScope.sort = savedSearch.sort; + self.$tooltipScope.title = savedSearch.title; + self.$tooltipScope.description = savedSearch.description; + self.$tooltipScope.setSortOrder = () => { + console.log('setSortOrder no supported'); + }; + self.$tooltipScope.addColumn = () => { + console.log('addColumn no supported'); + }; + self.$tooltipScope.removeColumn = () => { + console.log('removeColumn no supported'); + }; + self.$tooltipScope.moveColumn = () => { + console.log('moveColumn no supported'); + }; self.$visEl = linkFn(self.$tooltipScope); }); @@ -68,7 +82,7 @@ define(function (require) { }); const $popup = $(map.getContainer()).find('.leaflet-popup-content'); - + //A lot can happed between calling fetch and getting a response //Only update popup content if the popup context is still for this fetch if ($popup @@ -83,10 +97,10 @@ define(function (require) { }); return loadHtml; - } + } } } return SearchTooltip; - }; -}); \ No newline at end of file + }; +}); diff --git a/public/tooltip/visTooltip.js b/public/tooltip/visTooltip.js index 125a1df..9bacc97 100644 --- a/public/tooltip/visTooltip.js +++ b/public/tooltip/visTooltip.js @@ -1,14 +1,15 @@ import _ from 'lodash'; import $ from 'jquery'; import utils from 'plugins/enhanced_tilemap/utils'; +import { SearchSourceProvider } from 'ui/courier/data_source/search_source'; define(function (require) { return function VisTooltipFactory( - $compile, $rootScope, $timeout, + $compile, $rootScope, $timeout, getAppState, Private, savedVisualizations) { const geoFilter = Private(require('plugins/enhanced_tilemap/vislib/geoFilter')); - const SearchSource = Private(require('ui/courier/data_source/search_source')); + const SearchSource = Private(SearchSourceProvider); const $state = getAppState(); const UI_STATE_ID = 'popupVis'; @@ -73,7 +74,7 @@ define(function (require) { }); const $popup = $(map.getContainer()).find('.leaflet-popup-content'); - + //A lot can happed between calling fetch and getting a response //Only update popup content if the popup context is still for this fetch if ($popup @@ -86,10 +87,10 @@ define(function (require) { }); return loadHtml; - } + } } } return VisTooltip; - }; -}); \ No newline at end of file + }; +}); diff --git a/public/vis.js b/public/vis.js index fd50fdb..45d3f67 100644 --- a/public/vis.js +++ b/public/vis.js @@ -3,15 +3,15 @@ import 'plugins/enhanced_tilemap/bower_components/angularjs-slider/dist/rzslider import 'plugins/enhanced_tilemap/bower_components/angularjs-slider/dist/rzslider.js'; import 'plugins/enhanced_tilemap/bower_components/angularjs-dropdown-multiselect/dist/angularjs-dropdown-multiselect.min'; import _ from 'lodash'; -import supports from 'ui/utils/supports'; -import AggResponseGeoJsonGeoJsonProvider from 'ui/agg_response/geo_json/geo_json'; -import FilterBarPushFilterProvider from 'ui/filter_bar/push_filter'; -import VisVisTypeProvider from 'ui/vis/vis_type'; -import TemplateVisTypeTemplateVisTypeProvider from 'ui/template_vis_type/template_vis_type'; -import VisSchemasProvider from 'ui/vis/schemas'; +import { supports } from 'ui/utils/supports'; +import { AggResponseGeoJsonProvider } from 'ui/agg_response/geo_json/geo_json'; +import { VisVisTypeProvider } from 'ui/vis/vis_type'; +import { TemplateVisTypeProvider } from 'ui/template_vis_type/template_vis_type'; +import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; +import { VisSchemasProvider } from 'ui/vis/schemas'; define(function (require) { - require('ui/registry/vis_types').register(EnhancedTileMapVisProvider); + VisTypesRegistryProvider.register(EnhancedTileMapVisProvider); require('plugins/enhanced_tilemap/vis.less'); require('plugins/enhanced_tilemap/lib/jquery.minicolors/minicolors'); require('plugins/enhanced_tilemap/directives/bands'); @@ -24,15 +24,15 @@ define(function (require) { function EnhancedTileMapVisProvider(Private, getAppState, courier, config) { const VisType = Private(VisVisTypeProvider); - const TemplateVisType = Private(TemplateVisTypeTemplateVisTypeProvider); + const TemplateVisType = Private(TemplateVisTypeProvider); const Schemas = Private(VisSchemasProvider); - const geoJsonConverter = Private(AggResponseGeoJsonGeoJsonProvider); + const geoJsonConverter = Private(AggResponseGeoJsonProvider); return new TemplateVisType({ name: 'enhanced_tilemap', - title: 'Enhanced Tile map', + title: 'Enhanced Coordinate Map', icon: 'fa-map-marker', - description: 'Tile map plugin that provides better performance, complete geospatial query support, and more features than the built in Tile map.', + description: 'Coordinate map plugin that provides better performance, complete geospatial query support, and more features than the built in Coordinate map.', category: VisType.CATEGORY.MAP, template: require('plugins/enhanced_tilemap/vis.html'), params: { diff --git a/public/visController.js b/public/visController.js index e4d69c4..77105c0 100644 --- a/public/visController.js +++ b/public/visController.js @@ -1,30 +1,34 @@ import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; -import Binder from 'ui/binder'; +import { Binder } from 'ui/binder'; import MapProvider from 'plugins/enhanced_tilemap/vislib/_map'; -import VislibVisTypeBuildChartDataProvider from 'ui/vislib_vis_type/build_chart_data'; +import { VislibVisTypeBuildChartDataProvider } from 'ui/vislib_vis_type/build_chart_data'; import { backwardsCompatible } from './backwardsCompatible'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; +import { ResizeCheckerProvider } from 'ui/vislib/lib/resize_checker'; +import { uiModules } from 'ui/modules'; +import { TileMapTooltipFormatterProvider } from 'ui/agg_response/geo_json/_tooltip_formatter'; define(function (require) { - var module = require('ui/modules').get('kibana/enhanced_tilemap', [ - 'kibana', - 'etm-ui.bootstrap.accordion', - 'rzModule', + var module = uiModules.get('kibana/enhanced_tilemap', [ + 'kibana', + 'etm-ui.bootstrap.accordion', + 'rzModule', 'angularjs-dropdown-multiselect' ]); - + module.controller('KbnEnhancedTilemapVisController', function ( $scope, $rootScope, $element, $timeout, Private, courier, config, getAppState, indexPatterns) { let buildChartData = Private(VislibVisTypeBuildChartDataProvider); - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const queryFilter = Private(FilterBarQueryFilterProvider); const callbacks = Private(require('plugins/enhanced_tilemap/callbacks')); const geoFilter = Private(require('plugins/enhanced_tilemap/vislib/geoFilter')); const POIsProvider = Private(require('plugins/enhanced_tilemap/POIs')); const utils = require('plugins/enhanced_tilemap/utils'); let TileMapMap = Private(MapProvider); - const ResizeChecker = Private(require('ui/vislib/lib/resize_checker')); + const ResizeChecker = Private(ResizeCheckerProvider); const SearchTooltip = Private(require('plugins/enhanced_tilemap/tooltip/searchTooltip')); const VisTooltip = Private(require('plugins/enhanced_tilemap/tooltip/visTooltip')); let map = null; @@ -79,7 +83,7 @@ define(function (require) { $scope.vis.aggs.toDsl = function() { resizeArea(); const dsl = $scope.vis.aggs.origToDsl(); - + //append map collar filter to geohash_grid aggregation _.keys(dsl).forEach(function(key) { if(_.has(dsl[key], "geohash_grid")) { @@ -98,7 +102,7 @@ define(function (require) { function aggFilter(field) { collar = utils.scaleBounds( - map.mapBounds(), + map.mapBounds(), $scope.vis.params.collarScale); var filter = {geo_bounding_box: {}}; filter.geo_bounding_box[field] = collar; @@ -172,7 +176,7 @@ define(function (require) { drawWmsOverlays(); map.addMarkers( - chartData, + chartData, $scope.vis.params, tooltipFormatter, _.get(chartData, 'valueFormatter', _.identity), @@ -189,14 +193,16 @@ define(function (require) { yRatio: _.get(tooltipParams, 'options.yRatio', 0.6) }; const geoField = getGeoField(); - if (_.get(tooltipParams, 'type') === 'search') { + // search directive changed a lot in 5.5 - no longer supported at this time + /*if (_.get(tooltipParams, 'type') === 'search') { tooltip = new SearchTooltip( _.get(tooltipParams, 'options.searchId'), geoField.fieldname, geoField.geotype, options); tooltipFormatter = tooltip.getFormatter(); - } else if (_.get(tooltipParams, 'type') === 'visualization') { + }*/ + if (_.get(tooltipParams, 'type') === 'visualization') { tooltip = new VisTooltip( _.get(tooltipParams, 'options.visId'), geoField.fieldname, @@ -204,7 +210,7 @@ define(function (require) { options); tooltipFormatter = tooltip.getFormatter(); } else { - tooltipFormatter = Private(require('ui/agg_response/geo_json/_tooltip_formatter')); + tooltipFormatter = Private(TileMapTooltipFormatterProvider); } } diff --git a/public/vislib/geoFilter.js b/public/vislib/geoFilter.js index c6587e0..a73f6fd 100644 --- a/public/vislib/geoFilter.js +++ b/public/vislib/geoFilter.js @@ -1,10 +1,12 @@ +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + define(function (require) { const LAT_INDEX = 1; const LON_INDEX = 0; return function GeoFilterFactory(Private) { const _ = require('lodash'); - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const queryFilter = Private(FilterBarQueryFilterProvider); function filterAlias(field, numBoxes) { return field + ": " + numBoxes + " geo filters" @@ -35,10 +37,10 @@ define(function (require) { type = 'geo_shape'; } queryFilter.updateFilter({ - model: { - bool : { + model: { + bool : { should : geoFilters - } + } }, source: existingFilter, type: type, @@ -48,17 +50,17 @@ define(function (require) { let numFilters = 1; if (_.isArray(newFilter)) { numFilters = newFilter.length; - newFilter = { + newFilter = { bool: { should: newFilter } }; } newFilter.meta = { - alias: filterAlias(field, numFilters), - negate: false, - index: indexPatternName, - key: field + alias: filterAlias(field, numFilters), + negate: false, + index: indexPatternName, + key: field }; queryFilter.addFilters(newFilter); } @@ -83,7 +85,7 @@ define(function (require) { const bottomRight = _.get(filter, ['geo_bounding_box', field, 'bottom_right']); if(topLeft && bottomRight) { const bounds = L.latLngBounds( - [topLeft.lat, topLeft.lon], + [topLeft.lat, topLeft.lon], [bottomRight.lat, bottomRight.lon]); features.push(L.rectangle(bounds)); } @@ -105,7 +107,7 @@ define(function (require) { const lon = point[LON_INDEX]; latLngs.push(L.latLng(lat, lon)); }); - if(latLngs.length > 0) + if(latLngs.length > 0) features.push(L.polygon(latLngs)); } else if (_.has(filter, ['geo_shape', field])) { const type = _.get(filter, ['geo_shape', field, 'shape', 'type']); @@ -114,7 +116,7 @@ define(function (require) { const tl = envelope[0]; //topleft const br = envelope[1]; //bottomright const bounds = L.latLngBounds( - [tl[LAT_INDEX], tl[LON_INDEX]], + [tl[LAT_INDEX], tl[LON_INDEX]], [br[LAT_INDEX], br[LON_INDEX]]); features.push(L.rectangle(bounds)); } else if (type.toLowerCase() === 'polygon') { @@ -226,4 +228,4 @@ define(function (require) { rectFilter: rectFilter } } -}); \ No newline at end of file +});