Skip to content

Commit

Permalink
[Cases] Do not show deprecated callout on deleted connectors (#116615) (
Browse files Browse the repository at this point in the history
#116912)

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Christos Nasikas <[email protected]>
  • Loading branch information
kibanamachine and cnasikas authored Nov 1, 2021
1 parent a2c77e1 commit 7986541
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
8 changes: 7 additions & 1 deletion x-pack/plugins/cases/public/components/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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);
});
});
});
2 changes: 1 addition & 1 deletion x-pack/plugins/cases/public/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { isRESTApiError, isFieldInvalid } from './helpers';
import { isRESTApiError, isFieldInvalid, isDeprecatedConnector } from './helpers';

describe('helpers', () => {
describe('isRESTApiError', () => {
Expand Down Expand Up @@ -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);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 7986541

Please sign in to comment.