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

[FieldFormatters] Use default values for URL formatter #113141

Merged
merged 2 commits into from Sep 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -148,6 +148,7 @@ export class UrlFormatEditor extends DefaultFormatEditor<
const { formatParams, format } = this.props;
const { error, samples, sampleConverterType } = this.state;

const urlType = formatParams.type ?? format.getParamDefaults().type;
return (
<Fragment>
<EuiFormRow
Expand All @@ -157,7 +158,7 @@ export class UrlFormatEditor extends DefaultFormatEditor<
>
<EuiSelect
data-test-subj="urlEditorType"
value={formatParams.type}
value={urlType}
options={(format.type as typeof UrlFormat).urlTypes.map((type: UrlType) => {
return {
value: type.kind,
Expand All @@ -170,7 +171,7 @@ export class UrlFormatEditor extends DefaultFormatEditor<
/>
</EuiFormRow>

{formatParams.type === 'a' ? (
{urlType === 'a' ? (
<EuiFormRow
label={
<FormattedMessage
Expand Down Expand Up @@ -258,7 +259,7 @@ export class UrlFormatEditor extends DefaultFormatEditor<
/>
</EuiFormRow>

{formatParams.type === 'img' && this.renderWidthHeightParameters()}
{urlType === 'img' && this.renderWidthHeightParameters()}

<FormatEditorSamples samples={samples} sampleType={sampleConverterType} />
</Fragment>
Expand Down