[Cases] Do not show deprecated callout on deleted connectors (#116615) (#116911)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
This commit is contained in:
Kibana Machine 2021-11-01 07:13:16 -04:00 committed by GitHub
parent 5cb1b27526
commit 244d949982
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 5 deletions

View file

@ -7,7 +7,7 @@
import { actionTypeRegistryMock } from '../../../triggers_actions_ui/public/application/action_type_registry.mock';
import { triggersActionsUiMock } from '../../../triggers_actions_ui/public/mocks';
import { getConnectorIcon } from './utils';
import { getConnectorIcon, isDeprecatedConnector } from './utils';
describe('Utils', () => {
describe('getConnectorIcon', () => {
@ -37,4 +37,10 @@ describe('Utils', () => {
expect(getConnectorIcon(mockTriggersActionsUiService, '.not-registered')).toBe('');
});
});
describe('isDeprecatedConnector', () => {
it('returns false if the connector is not defined', () => {
expect(isDeprecatedConnector()).toBe(false);
});
});
});

View file

@ -80,7 +80,7 @@ export const getConnectorIcon = (
// TODO: Remove when the applications are certified
export const isDeprecatedConnector = (connector?: CaseActionConnector): boolean => {
if (connector == null) {
return true;
return false;
}
if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { isRESTApiError, isFieldInvalid } from './helpers';
import { isRESTApiError, isFieldInvalid, isDeprecatedConnector } from './helpers';
describe('helpers', () => {
describe('isRESTApiError', () => {
@ -48,4 +48,10 @@ describe('helpers', () => {
expect(isFieldInvalid('description', [])).toBeFalsy();
});
});
describe('isDeprecatedConnector', () => {
it('returns false if the connector is not defined', () => {
expect(isDeprecatedConnector()).toBe(false);
});
});
});

View file

@ -28,9 +28,9 @@ export const isFieldInvalid = (
): boolean => error !== undefined && error.length > 0 && field != null;
// TODO: Remove when the applications are certified
export const isDeprecatedConnector = (connector: ServiceNowActionConnector): boolean => {
export const isDeprecatedConnector = (connector?: ServiceNowActionConnector): boolean => {
if (connector == null) {
return true;
return false;
}
if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') {