Skip to content

Commit

Permalink
Kibana 7.0.0 URL field formatter doesn't render relative hyperlinks p…
Browse files Browse the repository at this point in the history
…roperly (#52874)

Closes #35235
  • Loading branch information
alexwizp authored Dec 13, 2019
1 parent 4801647 commit dc1a26b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/legacy/ui/public/field_editor/field_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ export class FieldEditor extends PureComponent {
}

saveField = async () => {
const fieldFormat = this.state.field.format;
const field = this.state.field.toActualField();
const { indexPattern } = this.props;
const { fieldFormatId } = this.state;
Expand Down Expand Up @@ -727,7 +726,7 @@ export class FieldEditor extends PureComponent {
if (!fieldFormatId) {
indexPattern.fieldFormatMap[field.name] = undefined;
} else {
indexPattern.fieldFormatMap[field.name] = fieldFormat;
indexPattern.fieldFormatMap[field.name] = field.format;
}

return indexPattern.save()
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/data/common/field_formats/field_format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ export abstract class FieldFormat {
[HTML_CONTEXT_TYPE]: htmlContentTypeSetup(this, this.htmlConvert),
};
}

static isInstanceOfFieldFormat(fieldFormat: any): fieldFormat is FieldFormat {
return Boolean(fieldFormat && fieldFormat.convert);
}
}

export type IFieldFormat = PublicMethodsOf<FieldFormat>;
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/data/public/index_patterns/fields/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export class Field implements IFieldType {
if (!type) type = getKbnFieldType('unknown');

let format = spec.format;
if (!format || !(format instanceof FieldFormat)) {

if (!FieldFormat.isInstanceOfFieldFormat(format)) {
const fieldFormats = getFieldFormats();

format =
Expand Down

0 comments on commit dc1a26b

Please sign in to comment.