Skip to content

Commit

Permalink
Remove highlighting from the review step of the Index Template wizard…
Browse files Browse the repository at this point in the history
…, for requests beyond a certain size. This will prevent the syntax highlighting from slowing down Kibana when reviewing large requests. (elastic#53549) (elastic#53599)
  • Loading branch information
cjcenizal authored Dec 19, 2019
1 parent 9d7917c commit c1d47fb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ export const StepReview: React.FunctionComponent<StepProps> = ({ template, updat
const templateString = JSON.stringify(serializedTemplate, null, 2);
const request = `${endpoint}\n${templateString}`;

// Beyond a certain point, highlighting the syntax will bog down performance to unacceptable
// levels. This way we prevent that happening for very large requests.
const language = request.length < 60000 ? 'json' : undefined;

return (
<div data-test-subj="requestTab">
<EuiSpacer size="m" />
Expand All @@ -178,7 +182,7 @@ export const StepReview: React.FunctionComponent<StepProps> = ({ template, updat

<EuiSpacer size="m" />

<EuiCodeBlock language="json" isCopyable>
<EuiCodeBlock language={language} isCopyable>
{request}
</EuiCodeBlock>
</div>
Expand Down

0 comments on commit c1d47fb

Please sign in to comment.