Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Map bounding box controls #6863

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ui/public/filter_bar/__tests__/push_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,18 @@ describe('Filter Bar pushFilter()', function () {
expect($state.filters[0].meta.negate).to.be(true);
expect($state.filters[0].meta.index).to.be('myIndex');

});
it('should modify the existing filters of the same type instead of making another one', function () {
pushFilter(filter, false, 'myIndex');
expect($state.filters[1].meta.negate).to.be(false);
expect($state.filters[0].meta).to.be.an(Object);
const sameTypeFilter = {query: { quiery_string: 'rada'}};
const diffTypeFilter = {foo: { bar: 'foo'}};
pushFilter(diffTypeFilter, false, 'myIndex');
expect($state.filters.length).to.be(2);
pushFilter(sameTypeFilter, false, 'myIndex');
expect($state.filters.length).to.be(2);
expect($state.filters[0].query).to.equal(sameTypeFilter.query);

});


Expand Down
19 changes: 16 additions & 3 deletions src/ui/public/filter_bar/push_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,23 @@ export default function () {
// Hierarchical and tabular data set their aggConfigResult parameter
// differently because of how the point is rewritten between the two. So
// we need to check if the point.orig is set, if not use try the point.aggConfigResult
var filters = _.clone($state.filters || []);
var pendingFilter = { meta: { negate: negate, index: index }};
const filters = _.clone($state.filters || []);
const pendingFilter = { meta: { negate: negate, index: index }};
_.extend(pendingFilter, filter);
filters.push(pendingFilter);
const filterKey = _.keys(filter)[0];
let filterAdded = false;

filters.forEach(function (filt) {
if (filt.hasOwnProperty(filterKey)) {
_.assign(filt, pendingFilter);
filterAdded = true;
}
});

if (!filterAdded) {
filters.push(pendingFilter);
}

$state.filters = filters;
};
};
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/vislib_vis_type/vislib_renderbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = function VislibRenderbotFactory(Private) {
VislibRenderbot.prototype.buildChartData = buildChartData;
VislibRenderbot.prototype.render = function (esResponse) {
this.chartData = this.buildChartData(esResponse);
this.chartData.title = this.vis.title || '';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This in my experience has never been undefined, it's usually 'New Visualization' when I would expect that, put the OR for safekeeping.
Added this when I thought the filters were panel specific and started implementing this for that, found out they weren't and left this piece for the future since it shouldn't be undefined anyway.

this.vislibVis.render(this.chartData, this.uiState);
};

Expand Down