Skip to content

Commit

Permalink
Hide error message with css
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Jun 23, 2021
1 parent 72f6202 commit cf6f927
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions x-pack/plugins/cases/public/components/connector_selector/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React, { useCallback } from 'react';
import { isEmpty } from 'lodash/fp';
import { EuiFormRow } from '@elastic/eui';
import styled from 'styled-components';

import { FieldHook, getFieldValidityAndErrorMessage } from '../../common/shared_imports';
import { ConnectorsDropdown } from '../configure_cases/connectors_dropdown';
Expand All @@ -24,6 +25,13 @@ interface ConnectorSelectorProps {
handleChange?: (newValue: string) => void;
hideConnectorServiceNowSir?: boolean;
}

const EuiFormRowWrapper = styled(EuiFormRow)`
.euiFormErrorText {
display: none;
}
`;

export const ConnectorSelector = ({
connectors,
dataTestSubj,
Expand All @@ -47,7 +55,7 @@ export const ConnectorSelector = ({
);

return isEdit ? (
<EuiFormRow
<EuiFormRowWrapper
data-test-subj={dataTestSubj}
describedByIds={idAria ? [idAria] : undefined}
error={errorMessage}
Expand All @@ -65,6 +73,6 @@ export const ConnectorSelector = ({
onChange={onChange}
selectedConnector={isEmpty(field.value) ? 'none' : field.value}
/>
</EuiFormRow>
</EuiFormRowWrapper>
) : null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Swimlane validator', () => {
mappings: {},
},
};
expect(connectorValidator(invalidConnector)).toEqual({ message: '' });
expect(connectorValidator(invalidConnector)).toEqual({ message: 'Invalid connector' });
});

test('it returns an error message if the connector is of type alerts', () => {
Expand All @@ -40,7 +40,7 @@ describe('Swimlane validator', () => {
connectorType: SwimlaneConnectorType.Alerts,
},
};
expect(connectorValidator(invalidConnector)).toEqual({ message: '' });
expect(connectorValidator(invalidConnector)).toEqual({ message: 'Invalid connector' });
});

test.each([SwimlaneConnectorType.Cases, SwimlaneConnectorType.All])(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const connectorValidator = (
} = connector;
if (connectorType === SwimlaneConnectorType.Alerts || isAnyRequiredFieldNotSet(mappings)) {
return {
message: '',
message: 'Invalid connector',
};
}
};

0 comments on commit cf6f927

Please sign in to comment.