Skip to content

Commit

Permalink
replaced all editor heights with a clearer indication of the source o…
Browse files Browse the repository at this point in the history
…f common heights
  • Loading branch information
jloleysens committed Aug 25, 2020
1 parent 91d5f8b commit a30dfc8
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '../../../../../../../shared_imports';

import { TextEditor } from '../../field_components';
import { to, from } from '../shared';
import { to, from, EDITOR_PX_HEIGHT } from '../shared';

const ignoreFailureConfig: FieldConfig = {
defaultValue: false,
Expand Down Expand Up @@ -64,7 +64,7 @@ export const CommonProcessorFields: FunctionComponent = () => {
componentProps={{
editorProps: {
languageId: 'painless',
height: 75,
height: EDITOR_PX_HEIGHT.extraSmall,
options: {
lineNumbers: 'off',
minimap: { enabled: false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
const { emptyField, isJsonField } = fieldValidators;

import { XJsonEditor } from '../field_components';
import { EDITOR_PX_HEIGHT } from './shared';

const customConfig: FieldConfig = {
type: FIELD_TYPES.TEXT,
Expand Down Expand Up @@ -78,7 +79,7 @@ export const Custom: FunctionComponent<Props> = ({ defaultOptions }) => {
componentProps={{
editorProps: {
'data-test-subj': 'processorOptionsEditor',
height: 300,
height: EDITOR_PX_HEIGHT.large,
'aria-label': i18n.translate(
'xpack.ingestPipelines.pipelineEditor.customForm.optionsFieldAriaLabel',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {

import { FieldNameField } from './common_fields/field_name_field';
import { IgnoreMissingField } from './common_fields/ignore_missing_field';
import { EDITOR_PX_HEIGHT } from './shared';

const { emptyField } = fieldValidators;

Expand Down Expand Up @@ -80,7 +81,7 @@ export const Dissect: FunctionComponent = () => {
component={TextEditor}
componentProps={{
editorProps: {
height: 75,
height: EDITOR_PX_HEIGHT.extraSmall,
options: { minimap: { enabled: false } },
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FIELD_TYPES, fieldValidators, UseField } from '../../../../../../shared
import { XJsonEditor } from '../field_components';

import { FieldNameField } from './common_fields/field_name_field';
import { FieldsConfig, to } from './shared';
import { FieldsConfig, to, EDITOR_PX_HEIGHT } from './shared';

const { emptyField, isJsonField } = fieldValidators;

Expand Down Expand Up @@ -67,7 +67,7 @@ export const Foreach: FunctionComponent = () => {
component={XJsonEditor}
componentProps={{
editorProps: {
height: 200,
height: EDITOR_PX_HEIGHT.medium,
'aria-label': i18n.translate(
'xpack.ingestPipelines.pipelineEditor.foreachForm.optionsFieldAriaLabel',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { XJsonEditor } from '../field_components';

import { FieldNameField } from './common_fields/field_name_field';
import { IgnoreMissingField } from './common_fields/ignore_missing_field';
import { FieldsConfig, to, from } from './shared';
import { FieldsConfig, to, from, EDITOR_PX_HEIGHT } from './shared';

const { emptyField, isJsonField } = fieldValidators;

Expand Down Expand Up @@ -110,7 +110,7 @@ export const Grok: FunctionComponent = () => {
config={fieldsConfig.pattern_definitions}
componentProps={{
editorProps: {
height: 200,
height: EDITOR_PX_HEIGHT.medium,
'aria-label': i18n.translate(
'xpack.ingestPipelines.pipelineEditor.grokForm.patternDefinitionsAriaLabel',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../..

import { TextEditor } from '../field_components';

import { FieldsConfig } from './shared';
import { EDITOR_PX_HEIGHT, FieldsConfig } from './shared';
import { FieldNameField } from './common_fields/field_name_field';
import { IgnoreMissingField } from './common_fields/ignore_missing_field';
import { TargetField } from './common_fields/target_field';
Expand Down Expand Up @@ -78,7 +78,7 @@ export const Gsub: FunctionComponent = () => {
component={TextEditor}
componentProps={{
editorProps: {
height: 75,
height: EDITOR_PX_HEIGHT.extraSmall,
options: { minimap: { enabled: false } },
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { XJsonEditor } from '../field_components';

import { TargetField } from './common_fields/target_field';

import { FieldsConfig, to, from } from './shared';
import { FieldsConfig, to, from, EDITOR_PX_HEIGHT } from './shared';

const { emptyField, isJsonField } = fieldValidators;

Expand Down Expand Up @@ -177,7 +177,7 @@ export const Inference: FunctionComponent = () => {
component={XJsonEditor}
componentProps={{
editorProps: {
height: 200,
height: EDITOR_PX_HEIGHT.medium,
options: { minimap: { enabled: false } },
},
}}
Expand All @@ -192,7 +192,7 @@ export const Inference: FunctionComponent = () => {
component={XJsonEditor}
componentProps={{
editorProps: {
height: 200,
height: EDITOR_PX_HEIGHT.medium,
options: { minimap: { enabled: false } },
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../..

import { XJsonEditor, TextEditor } from '../field_components';

import { FieldsConfig, to, from, FormFieldsComponent } from './shared';
import { FieldsConfig, to, from, FormFieldsComponent, EDITOR_PX_HEIGHT } from './shared';

const { isJsonField, emptyField } = fieldValidators;

Expand Down Expand Up @@ -147,7 +147,7 @@ export const Script: FormFieldsComponent = ({ initialFieldValues }) => {
component={TextEditor}
componentProps={{
editorProps: {
height: 100,
height: EDITOR_PX_HEIGHT.medium,
'aria-label': i18n.translate(
'xpack.ingestPipelines.pipelineEditor.scriptForm.sourceFieldAriaLabel',
{
Expand All @@ -169,7 +169,7 @@ export const Script: FormFieldsComponent = ({ initialFieldValues }) => {
component={XJsonEditor}
componentProps={{
editorProps: {
height: 150,
height: EDITOR_PX_HEIGHT.medium,
'aria-label': i18n.translate(
'xpack.ingestPipelines.pipelineEditor.scriptForm.paramsFieldAriaLabel',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export const from = {
undefinedIfValue: (value: any) => (v: boolean) => (v === value ? undefined : v),
};

export const EDITOR_PX_HEIGHT = {
extraSmall: 75,
small: 100,
medium: 200,
large: 300,
};

export type FieldsConfig = Record<string, FieldConfig>;

export type FormFieldsComponent = FunctionComponent<{ initialFieldValues?: Record<string, any> }>;

0 comments on commit a30dfc8

Please sign in to comment.