Skip to content

Commit

Permalink
[Discover] "View surrounding documents" encodes spaces in filters (#7…
Browse files Browse the repository at this point in the history
…9283) (#79437)

* [Discover] "View surrounding documents" encodes spaces in filters

Closes: #72958

* fix CI

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
alexwizp and kibanamachine authored Oct 5, 2020
1 parent 068f5d0 commit 1802edb
Showing 1 changed file with 16 additions and 16 deletions.
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

0 comments on commit 1802edb

Please sign in to comment.