[CCR] Replace EuiCodeEditor with EuiCodeBlock (#100122) (#100415)

This commit is contained in:
Alison Goryachev 2021-05-20 15:57:43 -04:00 committed by GitHub
parent e72ddfa483
commit 6d234d1765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 21 deletions

View file

@ -379,16 +379,12 @@ describe('<FollowerIndicesList />', () => {
test('should have a section to render the follower index shards stats', async () => {
await actions.clickFollowerIndexAt(0);
expect(exists('followerIndexDetail.shardsStatsSection')).toBe(true);
});
test('should render a EuiCodeEditor for each shards stats', async () => {
await actions.clickFollowerIndexAt(0);
const codeBlocks = find('shardsStats');
const codeEditors = component.find(`EuiCodeEditor`);
expect(codeEditors.length).toBe(index1.shards.length);
codeEditors.forEach((codeEditor, i) => {
expect(JSON.parse(codeEditor.props().value)).toEqual(index1.shards[i]);
expect(codeBlocks.length).toBe(index1.shards.length);
codeBlocks.forEach((codeBlock, i) => {
expect(JSON.parse(codeBlock.props().children)).toEqual(index1.shards[i]);
});
});
});

View file

@ -12,7 +12,7 @@ import {
EuiButton,
EuiButtonEmpty,
EuiCallOut,
EuiCodeEditor,
EuiCodeBlock,
EuiDescriptionList,
EuiDescriptionListDescription,
EuiDescriptionListTitle,
@ -356,18 +356,9 @@ export class DetailPanel extends Component {
</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiCodeEditor
mode="json"
theme="textmate"
width="100%"
isReadOnly
setOptions={{ maxLines: Infinity }}
value={JSON.stringify(shard, null, 2)}
editorProps={{
$blockScrolling: Infinity,
}}
data-test-subj={`shardsStats${i}`}
/>
<EuiCodeBlock language="json" data-test-subj="shardsStats">
{JSON.stringify(shard, null, 2)}
</EuiCodeBlock>
</Fragment>
))}
</section>