[Discover] Encode context link filter part (#63831)

* Encode filter part of the URI for context

* Add functional test agent filter with whitespace
This commit is contained in:
Matthias Wilhelm 2020-05-13 11:48:56 +02:00 committed by GitHub
parent 9a13779c4f
commit e6254f1f7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View file

@ -112,13 +112,17 @@ export function createTableRowDirective($compile: ng.ICompileService, $httpParam
const globalFilters: any = getServices().filterManager.getGlobalFilters();
const appFilters: any = getServices().filterManager.getAppFilters();
const hash = $httpParamSerializer({
_g: rison.encode({
filters: globalFilters || [],
}),
_a: rison.encode({
columns: $scope.columns,
filters: (appFilters || []).map(esFilters.disableFilter),
}),
_g: encodeURI(
rison.encode({
filters: globalFilters || [],
})
),
_a: encodeURI(
rison.encode({
columns: $scope.columns,
filters: (appFilters || []).map(esFilters.disableFilter),
})
),
});
return `${path}?${hash}`;

View file

@ -23,6 +23,10 @@ const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
['extension', 'jpg'],
['geo.src', 'IN'],
[
'agent',
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24',
],
];
export default function({ getService, getPageObjects }) {
@ -56,7 +60,7 @@ export default function({ getService, getPageObjects }) {
await browser.goBack();
await PageObjects.discover.waitForDocTableLoadingComplete();
const hitCount = await PageObjects.discover.getHitCount();
expect(hitCount).to.be('1,556');
expect(hitCount).to.be('522');
});
});
}