Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Jan 13, 2020
1 parent 70b7a78 commit 5d03a46
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiText } from '@elastic/eui';
import React from 'react';

import * as RuleI18n from '../../translations';

export const OptionalFieldLabel = (
<EuiText color="subdued" size="xs">
{RuleI18n.OPTIONAL_FIELD}
</EuiText>
);
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ const timeTypeOptions = [
{ value: 'h', text: I18n.HOURS },
];

// move optional label to the end of input
const StyledLabelAppend = styled(EuiFlexItem)`
&.euiFlexItem.euiFlexItem--flexGrowZero {
margin-left: 31px;
}
`;

const StyledEuiFormRow = styled(EuiFormRow)`
max-width: none;
Expand Down Expand Up @@ -107,9 +114,9 @@ export const ScheduleItem = ({ dataTestSubj, field, idAria, isDisabled }: Schedu
<EuiFlexItem grow={false} component="span">
{field.label}
</EuiFlexItem>
<EuiFlexItem grow={false} component="span">
<StyledLabelAppend grow={false} component="span">
{field.labelAppend}
</EuiFlexItem>
</StyledLabelAppend>
</EuiFlexGroup>
),
[field.label, field.labelAppend]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

import * as RuleI18n from '../../translations';
import { IMitreEnterpriseAttack } from '../../types';
import {
FIELD_TYPES,
Expand All @@ -18,17 +15,12 @@ import {
ERROR_CODE,
} from '../shared_imports';
import { isMitreAttackInvalid } from '../mitre/helpers';
import { OptionalFieldLabel } from '../optional_field_label';
import { isUrlInvalid } from './helpers';
import * as I18n from './translations';

const { emptyField } = fieldValidators;

const OptionalFieldLabel = (
<EuiText color="subdued" size="xs">
{RuleI18n.OPTIONAL_FIELD}
</EuiText>
);

export const schema: FormSchema = {
name: {
type: FIELD_TYPES.TEXT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiText } from '@elastic/eui';
import React from 'react';
import { i18n } from '@kbn/i18n';

import * as RuleI18n from '../../translations';
import { OptionalFieldLabel } from '../optional_field_label';
import { FormSchema } from '../shared_imports';

export const schema: FormSchema = {
Expand All @@ -33,7 +31,7 @@ export const schema: FormSchema = {
defaultMessage: 'Additional look-back',
}
),
labelAppend: <EuiText size="xs">{RuleI18n.OPTIONAL_FIELD}</EuiText>,
labelAppend: OptionalFieldLabel,
helpText: i18n.translate(
'xpack.siem.detectionEngine.createRule.stepScheduleRule.fieldAdditionalLookBackHelpText',
{
Expand Down

0 comments on commit 5d03a46

Please sign in to comment.