Skip to content

Commit

Permalink
[Fleet] Set code editor height to solve an overlap in default policy …
Browse files Browse the repository at this point in the history
…settings (#113763) (#113907)

Co-authored-by: Cristina Amico <[email protected]>
  • Loading branch information
kibanamachine and criamico authored Oct 5, 2021
1 parent 5c15a98 commit fa2b832
Showing 1 changed file with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ import {
EuiFieldPassword,
EuiCodeBlock,
} from '@elastic/eui';
import styled from 'styled-components';

import type { RegistryVarsEntry } from '../../../../types';
import { CodeEditor } from '../../../../../../../../../../src/plugins/kibana_react/public';

import { MultiTextInput } from './multi_text_input';

const FixedHeightDiv = styled.div`
height: 300px;
`;

export const PackagePolicyInputVarField: React.FunctionComponent<{
varDef: RegistryVarsEntry;
value: any;
Expand Down Expand Up @@ -55,31 +60,34 @@ export const PackagePolicyInputVarField: React.FunctionComponent<{
<pre>{value}</pre>
</EuiCodeBlock>
) : (
<CodeEditor
languageId="yaml"
width="100%"
height="300px"
value={value}
onChange={onChange}
options={{
minimap: {
enabled: false,
},
ariaLabel: i18n.translate('xpack.fleet.packagePolicyField.yamlCodeEditor', {
defaultMessage: 'YAML Code Editor',
}),
scrollBeyondLastLine: false,
wordWrap: 'off',
wrappingIndent: 'indent',
tabSize: 2,
// To avoid left margin
lineNumbers: 'off',
lineNumbersMinChars: 0,
glyphMargin: false,
folding: false,
lineDecorationsWidth: 0,
}}
/>
<FixedHeightDiv>
<CodeEditor
languageId="yaml"
width="100%"
height="300px"
value={value}
onChange={onChange}
options={{
minimap: {
enabled: false,
},
ariaLabel: i18n.translate('xpack.fleet.packagePolicyField.yamlCodeEditor', {
defaultMessage: 'YAML Code Editor',
}),
scrollBeyondLastLine: false,
wordWrap: 'off',
wrappingIndent: 'indent',
tabSize: 2,
// To avoid left margin
lineNumbers: 'off',
lineNumbersMinChars: 0,
glyphMargin: false,
folding: false,
lineDecorationsWidth: 0,
overviewRulerBorder: false,
}}
/>
</FixedHeightDiv>
);
case 'bool':
return (
Expand Down

0 comments on commit fa2b832

Please sign in to comment.