lib/kibana/assets/app/panels/map/module.js in kibana-sinatra-3.0.1.0 vs lib/kibana/assets/app/panels/map/module.js in kibana-sinatra-3.1.0.0
- old
+ new
@@ -143,12 +143,12 @@
// I really don't like this function, too much dom manip. Break out into directive?
$scope.populate_modal = function(request) {
$scope.inspector = angular.toJson(JSON.parse(request.toString()),true);
};
- $scope.build_search = function(field,value) {
- filterSrv.set({type:'terms',field:field,value:value,mandate:"must"});
+ $scope.build_search = function(field, value) {
+ filterSrv.set({type:'field', field:field, query:value, mandate:"must"});
};
});
@@ -159,23 +159,20 @@
elem.html('<center><img src="img/load_big.gif"></center>');
// Receive render events
scope.$on('render',function(){
- render_panel();
+ slow();
});
- // Or if the window is resized
- angular.element(window).bind('resize', function(){
- render_panel();
+ elem.closest('.panel').resize(function () {
+ elem.empty();
});
function render_panel() {
- elem.css({height:scope.row.height});
-
- elem.text('');
-
+ elem.empty();
+ elem.css({height:scope.panel.height||scope.row.height});
$('.jvectormap-zoomin,.jvectormap-zoomout,.jvectormap-label').remove();
require(['./panels/map/lib/map.'+scope.panel.map], function () {
elem.vectorMap({
map: scope.panel.map,
regionStyle: {initial: {fill: '#8c8c8c'}},
@@ -192,23 +189,25 @@
elem.children('.map-legend').show();
var count = _.isUndefined(scope.data[code]) ? 0 : scope.data[code];
elem.children('.map-legend').text(label.text() + ": " + count);
},
onRegionOut: function() {
- $('.map-legend').hide();
+ elem.children('.map-legend').hide();
},
onRegionClick: function(event, code) {
var count = _.isUndefined(scope.data[code]) ? 0 : scope.data[code];
if (count !== 0) {
scope.build_search(scope.panel.field,code);
}
}
});
elem.prepend('<span class="map-legend"></span>');
- $('.map-legend').hide();
+ elem.children('.map-legend').hide();
});
}
+
+ var slow = _.debounce(render_panel, 200);
}
};
});
});
\ No newline at end of file