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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Christos Nasikas 2021-11-01 10:36:53 +02:00 committed by GitHub
parent 8a39a113a0
commit 2f55e68d02
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 { actionTypeRegistryMock } from '../../../triggers_actions_ui/public/application/action_type_registry.mock';
import { triggersActionsUiMock } from '../../../triggers_actions_ui/public/mocks'; import { triggersActionsUiMock } from '../../../triggers_actions_ui/public/mocks';
import { getConnectorIcon } from './utils'; import { getConnectorIcon, isDeprecatedConnector } from './utils';
describe('Utils', () => { describe('Utils', () => {
describe('getConnectorIcon', () => { describe('getConnectorIcon', () => {
@ -37,4 +37,10 @@ describe('Utils', () => {
expect(getConnectorIcon(mockTriggersActionsUiService, '.not-registered')).toBe(''); 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 // TODO: Remove when the applications are certified
export const isDeprecatedConnector = (connector?: CaseActionConnector): boolean => { export const isDeprecatedConnector = (connector?: CaseActionConnector): boolean => {
if (connector == null) { if (connector == null) {
return true; return false;
} }
if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') { if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') {

View file

@ -5,7 +5,7 @@
* 2.0. * 2.0.
*/ */
import { isRESTApiError, isFieldInvalid } from './helpers'; import { isRESTApiError, isFieldInvalid, isDeprecatedConnector } from './helpers';
describe('helpers', () => { describe('helpers', () => {
describe('isRESTApiError', () => { describe('isRESTApiError', () => {
@ -48,4 +48,10 @@ describe('helpers', () => {
expect(isFieldInvalid('description', [])).toBeFalsy(); 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; ): boolean => error !== undefined && error.length > 0 && field != null;
// TODO: Remove when the applications are certified // TODO: Remove when the applications are certified
export const isDeprecatedConnector = (connector: ServiceNowActionConnector): boolean => { export const isDeprecatedConnector = (connector?: ServiceNowActionConnector): boolean => {
if (connector == null) { if (connector == null) {
return true; return false;
} }
if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') { if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') {