Skip to content

Commit

Permalink
revert siem changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed May 6, 2020
1 parent 93eaa01 commit f1ffe64
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
3 changes: 0 additions & 3 deletions x-pack/plugins/siem/public/lib/connectors/jira/flyout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,3 @@ export const JiraConnectorFlyout = withConnectorFlyout<JiraActionConnector>({
configKeys: ['projectKey'],
connectorActionTypeId: '.jira',
});

// eslint-disable-next-line import/no-default-export
export { JiraConnectorFlyout as default };
4 changes: 2 additions & 2 deletions x-pack/plugins/siem/public/lib/connectors/jira/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { lazy } from 'react';
import {
ValidationResult,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
Expand All @@ -14,6 +13,7 @@ import { connector } from './config';
import { createActionType } from '../utils';
import logo from './logo.svg';
import { JiraActionConnector } from './types';
import { JiraConnectorFlyout } from './flyout';
import * as i18n from './translations';

interface Errors {
Expand Down Expand Up @@ -50,5 +50,5 @@ export const getActionType = createActionType({
selectMessage: i18n.JIRA_DESC,
actionTypeTitle: connector.name,
validateConnector,
actionConnectorFields: lazy(() => import('./flyout')),
actionConnectorFields: JiraConnectorFlyout,
});
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,3 @@ export const ServiceNowConnectorFlyout = withConnectorFlyout<ServiceNowActionCon
secretKeys: ['username', 'password'],
connectorActionTypeId: '.servicenow',
});

// eslint-disable-next-line import/no-default-export
export { ServiceNowConnectorFlyout as default };
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { lazy } from 'react';
import {
ValidationResult,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../triggers_actions_ui/public/types';

import { connector } from './config';
import { createActionType } from '../utils';
import logo from './logo.svg';
import { ServiceNowActionConnector } from './types';
import { ServiceNowConnectorFlyout } from './flyout';
import * as i18n from './translations';

interface Errors {
Expand Down Expand Up @@ -43,5 +44,5 @@ export const getActionType = createActionType({
selectMessage: i18n.SERVICENOW_DESC,
actionTypeTitle: connector.name,
validateConnector,
actionConnectorFields: lazy(() => import('./flyout')),
actionConnectorFields: ServiceNowConnectorFlyout,
});
3 changes: 1 addition & 2 deletions x-pack/plugins/siem/public/lib/connectors/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/* eslint-disable @kbn/eslint/no-restricted-paths */

import { ActionType } from '../../../../triggers_actions_ui/public';
import { IErrorObject } from '../../../../triggers_actions_ui/public/types';
import { ExternalIncidentServiceConfiguration } from '../../../../actions/server/builtin_action_types/case/types';

import { ActionType as ThirdPartySupportedActions, CaseField } from '../../../../case/common/api';
Expand Down Expand Up @@ -43,7 +42,7 @@ export interface ActionConnectorValidationErrors {
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;

export interface ConnectorFlyoutFormProps<T> {
errors: IErrorObject;
errors: { [key: string]: string[] };
action: T;
onChangeSecret: (key: string, value: string) => void;
onBlurSecret: (key: string) => void;
Expand Down
12 changes: 11 additions & 1 deletion x-pack/plugins/siem/public/lib/connectors/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import {
ActionTypeModel,
ValidationResult,
ActionParamsProps,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../triggers_actions_ui/public/types';

Expand All @@ -30,7 +31,7 @@ export const createActionType = ({
validateConnector,
validateParams = connectorParamsValidator,
actionConnectorFields,
actionParamsFields = null,
actionParamsFields = ConnectorParamsFields,
}: Optional<ActionTypeModel, 'validateParams' | 'actionParamsFields'>) => (): ActionTypeModel => {
return {
id,
Expand Down Expand Up @@ -58,6 +59,15 @@ export const createActionType = ({
};
};

const ConnectorParamsFields: React.FunctionComponent<ActionParamsProps<ActionConnectorParams>> = ({
actionParams,
editAction,
index,
errors,
}) => {
return null;
};

const connectorParamsValidator = (actionParams: ActionConnectorParams): ValidationResult => {
return { errors: {} };
};
Expand Down
14 changes: 8 additions & 6 deletions x-pack/plugins/triggers_actions_ui/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ export interface ActionTypeModel<ActionConnector = any, ActionParams = any> {
actionTypeTitle?: string;
validateConnector: (connector: any) => ValidationResult;
validateParams: (actionParams: any) => ValidationResult;
actionConnectorFields: React.LazyExoticComponent<
ComponentType<ActionConnectorFieldsProps<ActionConnector>>
> | null;
actionParamsFields: React.LazyExoticComponent<
ComponentType<ActionParamsProps<ActionParams>>
> | null;
actionConnectorFields:
| React.FunctionComponent<any>
| React.LazyExoticComponent<ComponentType<ActionConnectorFieldsProps<ActionConnector>>>
| null;
actionParamsFields:
| React.FunctionComponent<any>
| React.LazyExoticComponent<ComponentType<ActionParamsProps<ActionParams>>>
| null;
}

export interface ValidationResult {
Expand Down

0 comments on commit f1ffe64

Please sign in to comment.