Skip to content

Commit 620fa25

Browse files
[Discover] "View surrounding documents" encodes spaces in filters (elastic#79283)
* [Discover] "View surrounding documents" encodes spaces in filters Closes: elastic#72958 * fix CI Co-authored-by: Kibana Machine <[email protected]>
1 parent 1fac129 commit 620fa25

File tree

1 file changed

+16
-16
lines changed
  • src/plugins/discover/public/application/angular/doc_table/components

1 file changed

+16
-16
lines changed

src/plugins/discover/public/application/angular/doc_table/components/table_row.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
*/
1919

2020
import { find, template } from 'lodash';
21+
import { stringify } from 'query-string';
2122
import $ from 'jquery';
2223
import rison from 'rison-node';
2324
import '../../doc_viewer';
2425

2526
import openRowHtml from './table_row/open.html';
2627
import detailsHtml from './table_row/details.html';
2728

28-
import { dispatchRenderComplete } from '../../../../../../kibana_utils/public';
29+
import { dispatchRenderComplete, url } from '../../../../../../kibana_utils/public';
2930
import { DOC_HIDE_TIME_COLUMN_SETTING } from '../../../../../common';
3031
import cellTemplateHtml from '../components/table_row/cell.html';
3132
import truncateByHeightTemplateHtml from '../components/table_row/truncate_by_height.html';
@@ -49,7 +50,7 @@ interface LazyScope extends ng.IScope {
4950
[key: string]: any;
5051
}
5152

52-
export function createTableRowDirective($compile: ng.ICompileService, $httpParamSerializer: any) {
53+
export function createTableRowDirective($compile: ng.ICompileService) {
5354
const cellTemplate = template(noWhiteSpace(cellTemplateHtml));
5455
const truncateByHeightTemplate = template(noWhiteSpace(truncateByHeightTemplateHtml));
5556

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

116117
$scope.getContextAppHref = () => {
117-
const path = `#/context/${encodeURIComponent($scope.indexPattern.id)}/${encodeURIComponent(
118-
$scope.row._id
119-
)}`;
120118
const globalFilters: any = getServices().filterManager.getGlobalFilters();
121119
const appFilters: any = getServices().filterManager.getAppFilters();
122-
const hash = $httpParamSerializer({
123-
_g: encodeURI(
124-
rison.encode({
120+
121+
const hash = stringify(
122+
url.encodeQuery({
123+
_g: rison.encode({
125124
filters: globalFilters || [],
126-
})
127-
),
128-
_a: encodeURI(
129-
rison.encode({
125+
}),
126+
_a: rison.encode({
130127
columns: $scope.columns,
131128
filters: (appFilters || []).map(esFilters.disableFilter),
132-
})
133-
),
134-
});
129+
}),
130+
}),
131+
{ encode: false, sort: false }
132+
);
135133

136-
return `${path}?${hash}`;
134+
return `#/context/${encodeURIComponent($scope.indexPattern.id)}/${encodeURIComponent(
135+
$scope.row._id
136+
)}?${hash}`;
137137
};
138138

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

0 commit comments

Comments
 (0)