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

[7.x] [Discover] "View surrounding documents" encodes spaces in filters (#79283) #79437

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
*/

import { find, template } from 'lodash';
import { stringify } from 'query-string';
import $ from 'jquery';
import rison from 'rison-node';
import '../../doc_viewer';

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

import { dispatchRenderComplete } from '../../../../../../kibana_utils/public';
import { dispatchRenderComplete, url } from '../../../../../../kibana_utils/public';
import { DOC_HIDE_TIME_COLUMN_SETTING } from '../../../../../common';
import cellTemplateHtml from '../components/table_row/cell.html';
import truncateByHeightTemplateHtml from '../components/table_row/truncate_by_height.html';
Expand All @@ -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(
url.encodeQuery({
_g: rison.encode({
filters: globalFilters || [],
})
),
_a: encodeURI(
rison.encode({
}),
_a: rison.encode({
columns: $scope.columns,
filters: (appFilters || []).map(esFilters.disableFilter),
})
),
});
}),
}),
{ encode: false, sort: 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