Merge branch 'master' into fix/wiggle-chart
This commit is contained in:
commit
3930d5c199
|
@ -31,7 +31,7 @@
|
|||
"bluebird": "~2.1.3",
|
||||
"bootstrap": "~3.3.1",
|
||||
"d3": "~3.4.8",
|
||||
"elasticsearch": "~3.1.1",
|
||||
"elasticsearch": "~4.1.0",
|
||||
"Faker": "~1.1.0",
|
||||
"FileSaver": "*",
|
||||
"font-awesome": "~4.2.0",
|
||||
|
@ -55,6 +55,7 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"resolutions": {
|
||||
"angular-bootstrap": "~0.12"
|
||||
"angular-bootstrap": "~0.12",
|
||||
"elasticsearch": "~4.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,9 @@ define(function (require) {
|
|||
features: features,
|
||||
properties: {
|
||||
min: _.min(values),
|
||||
max: _.max(values)
|
||||
max: _.max(values),
|
||||
zoom: _.deepGet(geoAgg, 'params.mapZoom'),
|
||||
center: _.deepGet(geoAgg, 'params.mapCenter')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,6 +34,14 @@ define(function (require) {
|
|||
default: true,
|
||||
write: _.noop
|
||||
},
|
||||
{
|
||||
name: 'mapZoom',
|
||||
write: _.noop
|
||||
},
|
||||
{
|
||||
name: 'mapCenter',
|
||||
write: _.noop
|
||||
},
|
||||
{
|
||||
name: 'precision',
|
||||
default: defaultPrecision,
|
||||
|
|
|
@ -86,6 +86,14 @@ define(function (require) {
|
|||
};
|
||||
};
|
||||
|
||||
Vis.prototype.createEditableVis = function () {
|
||||
return this._editableVis || (this._editableVis = this.clone());
|
||||
};
|
||||
|
||||
Vis.prototype.getEditableVis = function () {
|
||||
return this._editableVis || undefined;
|
||||
};
|
||||
|
||||
Vis.prototype.clone = function () {
|
||||
return new Vis(this.indexPattern, this.getState());
|
||||
};
|
||||
|
|
|
@ -5,13 +5,11 @@ define(function (require) {
|
|||
var L = require('leaflet');
|
||||
require('leaflet-heat');
|
||||
require('leaflet-draw');
|
||||
|
||||
var Chart = Private(require('components/vislib/visualizations/_chart'));
|
||||
|
||||
require('css!components/vislib/styles/main');
|
||||
|
||||
var defaultMapCenter = [15, 5];
|
||||
var Chart = Private(require('components/vislib/visualizations/_chart'));
|
||||
var defaultMapZoom = 2;
|
||||
var defaultMapCenter = [15, 5];
|
||||
|
||||
// Convenience function to turn around the LngLat recieved from ES
|
||||
function cloneAndReverse(arr) {
|
||||
|
@ -37,11 +35,15 @@ define(function (require) {
|
|||
|
||||
TileMap.Super.apply(this, arguments);
|
||||
|
||||
|
||||
// track the map objects
|
||||
this.maps = [];
|
||||
this.originalConfig = chartData || {};
|
||||
_.assign(this, this.originalConfig);
|
||||
|
||||
this._attr.mapZoom = _.deepGet(this.geoJson, 'properties.zoom') || defaultMapZoom;
|
||||
this._attr.mapCenter = _.deepGet(this.geoJson, 'properties.center') || defaultMapCenter;
|
||||
|
||||
// add allmin and allmax to geoJson
|
||||
var allMinMax = this.getMinMax(handler.data.data);
|
||||
this.geoJson.properties.allmin = allMinMax.min;
|
||||
|
@ -68,9 +70,6 @@ define(function (require) {
|
|||
var worldBounds = L.latLngBounds([-90, -220], [90, 220]);
|
||||
|
||||
return function (selection) {
|
||||
self._attr.mapZoom = self._attr.mapZoom || defaultMapZoom;
|
||||
self._attr.mapCenter = self._attr.mapCenter || defaultMapCenter;
|
||||
|
||||
selection.each(function () {
|
||||
// add leaflet latLngs to properties for tooltip
|
||||
self.addLatLng(self.geoJson);
|
||||
|
@ -130,6 +129,12 @@ define(function (require) {
|
|||
self._attr.mapZoom = map.getZoom();
|
||||
self._attr.mapCenter = map.getCenter();
|
||||
|
||||
self.events.emit('mapMoveEnd', {
|
||||
chart: self.originalConfig,
|
||||
zoom: self._attr.mapZoom,
|
||||
center: self._attr.mapCenter
|
||||
});
|
||||
|
||||
map.removeLayer(featureLayer);
|
||||
|
||||
featureLayer = self.markerType(map).addTo(map);
|
||||
|
|
|
@ -103,20 +103,16 @@ define(function (require) {
|
|||
|
||||
$scope.title = inflection.singularize(serviceObj.title);
|
||||
|
||||
es.mget({
|
||||
body: {
|
||||
docs: [{
|
||||
_index: config.file.kibana_index,
|
||||
_type: service.type,
|
||||
_id: $routeParams.id
|
||||
}]
|
||||
}
|
||||
es.get({
|
||||
index: config.file.kibana_index,
|
||||
type: service.type,
|
||||
id: $routeParams.id
|
||||
})
|
||||
.then(function (resp) {
|
||||
$scope.obj = resp.docs[0];
|
||||
$scope.link = service.urlFor($scope.obj._id);
|
||||
.then(function (obj) {
|
||||
$scope.obj = obj;
|
||||
$scope.link = service.urlFor(obj._id);
|
||||
|
||||
var fields = _.reduce($scope.obj._source, createField, []);
|
||||
var fields = _.reduce(obj._source, createField, []);
|
||||
if (service.Class) readObjectClass(fields, service.Class);
|
||||
$scope.fields = _.sortBy(fields, 'name');
|
||||
})
|
||||
|
|
|
@ -40,6 +40,22 @@ define(function (require) {
|
|||
|
||||
pushFilter(filter, false, indexPatternName);
|
||||
},
|
||||
mapMoveEnd: function (event) {
|
||||
var agg = _.deepGet(event, 'chart.geohashGridAgg');
|
||||
if (!agg) return;
|
||||
|
||||
agg.params.mapZoom = event.zoom;
|
||||
agg.params.mapCenter = [event.center.lat, event.center.lng];
|
||||
|
||||
var editableVis = agg.vis.getEditableVis();
|
||||
if (!editableVis) return;
|
||||
|
||||
var editableAgg = editableVis.aggs.byId[agg.id];
|
||||
if (editableAgg) {
|
||||
editableAgg.params.mapZoom = event.zoom;
|
||||
editableAgg.params.mapCenter = [event.center.lat, event.center.lng];
|
||||
}
|
||||
},
|
||||
mapZoomEnd: function (event) {
|
||||
var agg = _.deepGet(event, 'chart.geohashGridAgg');
|
||||
if (!agg || !agg.params.autoPrecision) return;
|
||||
|
|
|
@ -68,7 +68,7 @@ define(function (require) {
|
|||
var savedVis = $route.current.locals.savedVis;
|
||||
|
||||
var vis = savedVis.vis;
|
||||
var editableVis = vis.clone();
|
||||
var editableVis = vis.createEditableVis();
|
||||
vis.requesting = function () {
|
||||
var requesting = editableVis.requesting;
|
||||
requesting.call(vis);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
define(function (require) {
|
||||
require('elasticsearch');
|
||||
var _ = require('lodash');
|
||||
|
||||
var es; // share the client amoungst all apps
|
||||
require('modules')
|
||||
|
@ -10,7 +11,29 @@ define(function (require) {
|
|||
es = esFactory({
|
||||
host: configFile.elasticsearch,
|
||||
log: 'info',
|
||||
requestTimeout: 0
|
||||
requestTimeout: 0,
|
||||
plugins: [function (Client, config) {
|
||||
|
||||
// esFactory automatically injects the AngularConnector to the config
|
||||
// https://github.com/elastic/elasticsearch-js/blob/master/src/lib/connectors/angular.js
|
||||
_(CustomAngularConnector).inherits(config.connectionClass);
|
||||
function CustomAngularConnector(host, config) {
|
||||
CustomAngularConnector.Super.call(this, host, config);
|
||||
|
||||
var originalRequest = this.request;
|
||||
this.request = function (params) {
|
||||
if (String(params.method).toUpperCase() === 'GET') {
|
||||
params.query = params.query || {};
|
||||
params.query._ = Date.now();
|
||||
}
|
||||
|
||||
return originalRequest.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
config.connectionClass = CustomAngularConnector;
|
||||
|
||||
}]
|
||||
});
|
||||
|
||||
return es;
|
||||
|
|
|
@ -86,7 +86,7 @@ define(function (require) {
|
|||
|
||||
// props
|
||||
expect(props).to.be.an('object');
|
||||
expect(props).to.only.have.keys('min', 'max');
|
||||
expect(props).to.have.keys('min', 'max');
|
||||
|
||||
// props.min
|
||||
expect(props.min).to.be.a('number');
|
||||
|
|
|
@ -1839,7 +1839,9 @@ define(function (require) {
|
|||
],
|
||||
'properties': {
|
||||
'min': 1,
|
||||
'max': 608
|
||||
'max': 608,
|
||||
'zoom': 2,
|
||||
'center': [5, 15]
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ define(function (require) {
|
|||
describe('#read', function () {
|
||||
it('gets the proper dimensions for the element', function () {
|
||||
var dimensions = checker.read();
|
||||
var windowWidth = window.innerWidth;
|
||||
var windowWidth = document.documentElement.clientWidth;
|
||||
|
||||
expect(dimensions.w).to.equal(windowWidth);
|
||||
expect(dimensions.h).to.equal(0);
|
||||
|
|
|
@ -25,7 +25,6 @@ define(function (require) {
|
|||
mapType: type
|
||||
};
|
||||
|
||||
|
||||
module('TileMapFactory');
|
||||
inject(function (Private) {
|
||||
vis = Private(require('vislib_fixtures/_vis_fixture'))(visLibParams);
|
||||
|
|
Loading…
Reference in a new issue