Remove highlighting from the review step of the Index Template wizard, for requests beyond a certain size. This will prevent the syntax highlighting from slowing down Kibana when reviewing large requests. (#53549)

This commit is contained in:
CJ Cenizal 2019-12-19 07:33:18 -08:00 committed by GitHub
parent dd1faba7e3
commit 194f2ca6ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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" />
@ -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>