Skip to content

Commit

Permalink
[Discover] "View surrounding documents" encodes spaces in filters
Browse files Browse the repository at this point in the history
Closes: #72958
  • Loading branch information
alexwizp committed Oct 2, 2020
1 parent ea6bec6 commit b0d65f1
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { find, template } from 'lodash';
import { stringify } from 'query-string';
import $ from 'jquery';
import rison from 'rison-node';
import '../../doc_viewer';
Expand Down Expand Up @@ -49,7 +50,7 @@ interface LazyScope extends ng.IScope {
[key: string]: any;
}

export function createTableRowDirective($compile: ng.ICompileService, $httpParamSerializer: any) {
export function createTableRowDirective($compile: ng.ICompileService) {
const cellTemplate = template(noWhiteSpace(cellTemplateHtml));
const truncateByHeightTemplate = template(noWhiteSpace(truncateByHeightTemplateHtml));

Expand Down Expand Up @@ -114,26 +115,25 @@ export function createTableRowDirective($compile: ng.ICompileService, $httpParam
};

$scope.getContextAppHref = () => {
const path = `#/context/${encodeURIComponent($scope.indexPattern.id)}/${encodeURIComponent(
$scope.row._id
)}`;
const globalFilters: any = getServices().filterManager.getGlobalFilters();
const appFilters: any = getServices().filterManager.getAppFilters();
const hash = $httpParamSerializer({
_g: encodeURI(
rison.encode({

const hash = stringify(
{
_g: rison.encode({
filters: globalFilters || [],
})
),
_a: encodeURI(
rison.encode({
}),
_a: rison.encode({
columns: $scope.columns,
filters: (appFilters || []).map(esFilters.disableFilter),
})
),
});
}),
},
{ encode: false }
);

return `${path}?${hash}`;
return `#/context/${encodeURIComponent($scope.indexPattern.id)}/${encodeURIComponent(
$scope.row._id
)}?${hash}`;
};

// create a tr element that lists the value for each *column*
Expand Down

0 comments on commit b0d65f1

Please sign in to comment.