Skip to content

Commit

Permalink
[7.5] Kibana 7.0.0 URL field formatter doesn't render relative hyperl…
Browse files Browse the repository at this point in the history
…inks properly

Closes: elastic#35235 (fix for 7.5)
  • Loading branch information
alexwizp committed Dec 24, 2019
1 parent fe21d22 commit b356371
Showing 1 changed file with 21 additions and 33 deletions.
54 changes: 21 additions & 33 deletions src/legacy/ui/public/visualize/loader/pipeline_helpers/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,40 +129,28 @@ export const getFormat: FormatFactory = (mapping = {}) => {
});
return new IpRangeFormat();
} else if (isTermsFieldFormat(mapping) && mapping.params) {
const params = mapping.params;
const { params } = mapping;
const convert = (val: string, type: string) => {
if (val === '__other__') {
return params.otherBucketLabel;
}
if (val === '__missing__') {
return params.missingBucketLabel;
}

const format = getFieldFormat(params.id, params);
const parsedUrl = {
origin: window.location.origin,
pathname: window.location.pathname,
basePath: chrome.getBasePath(),
};

return format.getConverterFor(type)(val, undefined, undefined, parsedUrl);
};

return {
getConverterFor: (type: string) => {
const format = getFieldFormat(params.id, mapping.params);
return (val: string) => {
if (val === '__other__') {
return params.otherBucketLabel;
}
if (val === '__missing__') {
return params.missingBucketLabel;
}
const parsedUrl = {
origin: window.location.origin,
pathname: window.location.pathname,
basePath: chrome.getBasePath(),
};
return format.convert(val, undefined, undefined, parsedUrl);
};
},
convert: (val: string, type: string) => {
const format = getFieldFormat(params.id, mapping.params);
if (val === '__other__') {
return params.otherBucketLabel;
}
if (val === '__missing__') {
return params.missingBucketLabel;
}
const parsedUrl = {
origin: window.location.origin,
pathname: window.location.pathname,
basePath: chrome.getBasePath(),
};
return format.convert(val, type, undefined, parsedUrl);
},
convert,
getConverterFor: (type: string) => (val: string) => convert(val, type),
};
} else {
return getFieldFormat(id, mapping.params);
Expand Down

0 comments on commit b356371

Please sign in to comment.