Skip to content

Commit

Permalink
removed usage of context in ibm and jira
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Sep 29, 2020
1 parent ecf2dcd commit 71c85ce
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { EuiFlexGroup } from '@elastic/eui';
import { EuiFlexItem } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';

import { useActionsConnectorsContext } from '../../../context/actions_connectors_context';
import { ActionParamsProps } from '../../../../types';
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
Expand All @@ -28,14 +27,15 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
errors,
messageVariables,
actionConnector,
http,
toastNotifications,
}) => {
const { title, description, comments, issueType, priority, labels, savedObjectId } =
actionParams.subActionParams || {};

const [issueTypesSelectOptions, setIssueTypesSelectOptions] = useState<EuiSelectOption[]>([]);
const [firstLoad, setFirstLoad] = useState(false);
const [prioritiesSelectOptions, setPrioritiesSelectOptions] = useState<EuiSelectOption[]>([]);
const { http, toastNotifications } = useActionsConnectorsContext();

useEffect(() => {
setFirstLoad(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { i18n } from '@kbn/i18n';

import { ActionParamsProps } from '../../../../types';
import { useActionsConnectorsContext } from '../../../context/actions_connectors_context';
import { ResilientActionParams } from './types';
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
Expand All @@ -32,9 +31,10 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
errors,
messageVariables,
actionConnector,
http,
toastNotifications,
}) => {
const [firstLoad, setFirstLoad] = useState(false);
const { http, toastNotifications } = useActionsConnectorsContext();
const { title, description, comments, incidentTypes, severityCode, savedObjectId } =
actionParams.subActionParams || {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ export const ActionForm = ({
messageVariables={messageVariables}
defaultMessage={defaultActionMessage ?? undefined}
docLinks={docLinks}
http={http}
toastNotifications={toastNotifications}
actionConnector={actionConnector}
/>
</Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const TestConnectorForm = ({
onExecutAction,
isExecutingAction,
}: ConnectorAddFlyoutProps) => {
const { actionTypeRegistry, docLinks } = useActionsConnectorsContext();
const { actionTypeRegistry, docLinks, http, toastNotifications } = useActionsConnectorsContext();
const actionTypeModel = actionTypeRegistry.get(connector.actionTypeId);
const ParamsFieldsComponent = actionTypeModel.actionParamsFields;

Expand Down Expand Up @@ -74,6 +74,8 @@ export const TestConnectorForm = ({
}
messageVariables={[]}
docLinks={docLinks}
http={http}
toastNotifications={toastNotifications}
actionConnector={connector}
/>
</Suspense>
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/triggers_actions_ui/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export interface ActionParamsProps<TParams> {
messageVariables?: ActionVariable[];
defaultMessage?: string;
docLinks: DocLinksStart;
http?: HttpSetup;
toastNotifications: ToastsSetup;
actionConnector?: ActionConnector;
}

Expand Down

0 comments on commit 71c85ce

Please sign in to comment.