Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Alerting][Connectors] Refactor Jira: Generic Implementation (phase one) #73778

Merged
merged 67 commits into from
Sep 9, 2020
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
944b7dd
Create schema
cnasikas Jul 28, 2020
7dad0fb
Create types
cnasikas Jul 29, 2020
0fa0a3e
Transform comments on ServiceNow
cnasikas Jul 30, 2020
aa21313
Fix service
cnasikas Jul 30, 2020
d466e33
Fix validators
cnasikas Jul 30, 2020
c7a63bd
Fix api
cnasikas Jul 30, 2020
2dbe4e8
Fix init
cnasikas Jul 30, 2020
ae3d43a
Init jira ui
cnasikas Jul 30, 2020
d4895bf
Add cases mappings ui
cnasikas Jul 30, 2020
66babbd
Add types (ui)
cnasikas Jul 30, 2020
9f73f58
Add logo
cnasikas Jul 30, 2020
312306f
Add translations (ui)
cnasikas Jul 30, 2020
c2d9712
Add config (ui)
cnasikas Jul 30, 2020
89f5ce5
Create jira connector flyout
cnasikas Jul 30, 2020
7550f46
Create jira alerts flyout
cnasikas Jul 30, 2020
992cf52
Unregister jira connector from security solutions
cnasikas Jul 30, 2020
cc0f84b
Register jira (ui)
cnasikas Jul 30, 2020
5f2a7d7
Filter out non jira case connectors
cnasikas Jul 30, 2020
5267b9f
Implement getCreateIssueMetadata subAction
cnasikas Jul 30, 2020
155986e
Get create issue metadata (ui)
cnasikas Jul 30, 2020
9d95483
Return issue types by name
cnasikas Jul 31, 2020
94c8908
Fetch and populate create issue fields
cnasikas Jul 31, 2020
a00c63a
Push to jira from alerts
cnasikas Aug 2, 2020
3241645
Improve types
cnasikas Aug 4, 2020
cc2af4c
Remove jira from lib
cnasikas Aug 4, 2020
e37d3e7
Improve error reporting
cnasikas Aug 4, 2020
b90acfe
Get default issueType from metadata
cnasikas Aug 4, 2020
e73bc82
Update Jira incident
cnasikas Aug 4, 2020
a1841f2
Support the new API for getting create issue metadata
cnasikas Aug 4, 2020
ecf52b9
Show loading spinner when fetching issue metadata
cnasikas Aug 4, 2020
355acde
Support generics
cnasikas Aug 24, 2020
3a348fc
Fix types
cnasikas Aug 24, 2020
349b6d5
Change desc
cnasikas Aug 24, 2020
77cc488
Create issue type and fields sub actions
cnasikas Aug 25, 2020
cf74bd0
Use new api
cnasikas Aug 25, 2020
8214217
Remove create issue metadata endpoint
cnasikas Aug 25, 2020
f802d4e
Reset fields when changing connector or issueType
cnasikas Aug 25, 2020
7c7bbd1
Improve layout
cnasikas Aug 25, 2020
7d1b8ad
Improve service tests
cnasikas Aug 25, 2020
4ec6e26
Improve api tests
cnasikas Aug 26, 2020
675451b
Create jira_connectors test
cnasikas Aug 26, 2020
140a051
Create jira (ui) test
cnasikas Aug 26, 2020
7afdc5e
Create jira_params test
cnasikas Aug 26, 2020
fef9f15
Add basic integration test
cnasikas Aug 26, 2020
b93bd9f
Add AbortController
cnasikas Aug 30, 2020
ee04cd8
Rename subactions
cnasikas Aug 30, 2020
cf317a4
Add toast notification on error
cnasikas Aug 31, 2020
fa7125c
Improve UX
cnasikas Aug 31, 2020
56ebeaa
Change license
cnasikas Aug 31, 2020
b4f6a7c
Improve README
cnasikas Aug 31, 2020
dfaadca
Fix translations
cnasikas Aug 31, 2020
7610b83
Improvements
cnasikas Aug 31, 2020
a2f2040
Fixes
cnasikas Sep 1, 2020
8dba023
Validate 403 status code
cnasikas Sep 2, 2020
53fb03e
Change maybe to nullable
cnasikas Sep 2, 2020
8be3a5b
Fix grammar
cnasikas Sep 2, 2020
ce33e1b
Improve filtering in case of null dereference
cnasikas Sep 2, 2020
d3a1112
Improve UI
cnasikas Sep 2, 2020
6b8339a
Improve README
cnasikas Sep 4, 2020
1a43d83
Move common types and schema to case folder
cnasikas Sep 4, 2020
c9d843b
Remove findIncidents function
cnasikas Sep 4, 2020
97a67c2
Refactor for inclusive language
cnasikas Sep 4, 2020
f2723d9
Make actionConnector optional
cnasikas Sep 4, 2020
ccd74cb
Move case mappings to its own folder
cnasikas Sep 4, 2020
e8c3a25
Fix i18n
cnasikas Sep 4, 2020
caabc6e
Improve UX when editing an alert
cnasikas Sep 7, 2020
627a3f2
Improve imports
cnasikas Sep 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Get create issue metadata (ui)
  • Loading branch information
cnasikas committed Sep 9, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 155986ed381bafbc3781bfc703cecf3ff64c4694
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { HttpSetup } from 'kibana/public';
import { BASE_ACTION_API_PATH } from '../../../constants';

export async function getCreateIssueMetadata({
http,
connectorId,
}: {
http: HttpSetup;
connectorId: string;
}): Promise<Record<string, unknown>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'getCreateIssueMetadata', subActionParams: {} },
}),
});
}
Original file line number Diff line number Diff line change
@@ -12,18 +12,23 @@ import { EuiFlexGroup } from '@elastic/eui';
import { EuiFlexItem } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
import { EuiTitle } from '@elastic/eui';

import { useAppDependencies } from '../../../app_context';
import { ActionParamsProps } from '../../../../types';
import { JiraActionParams } from './types';
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
import { JiraActionParams } from './types';
import { getCreateIssueMetadata } from './api';

const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionParams>> = ({
actionParams,
editAction,
index,
errors,
messageVariables,
actionConnector,
}) => {
const { http } = useAppDependencies();
const { title, description, comments, issueType, priority, labels, savedObjectId } =
actionParams.subActionParams || {};

@@ -62,6 +67,21 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
editAction('subActionParams', newProps, index);
};

useEffect(() => {
let cancel = false;
const fetchData = async () => {
const createIssueMetadata = await getCreateIssueMetadata({
http,
connectorId: actionConnector.id,
});
console.log('createIssueMetadata', createIssueMetadata);
};
fetchData();
return () => {
cancel = true;
};
}, [http, actionConnector]);

useEffect(() => {
if (!actionParams.subAction) {
editAction('subAction', 'pushToService', index);
Original file line number Diff line number Diff line change
@@ -311,6 +311,7 @@ export const ActionForm = ({
messageVariables={messageVariables}
defaultMessage={defaultActionMessage ?? undefined}
docLinks={docLinks}
actionConnector={actionConnector}
/>
</Suspense>
) : null}
1 change: 1 addition & 0 deletions x-pack/plugins/triggers_actions_ui/public/types.ts
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ export interface ActionParamsProps<TParams> {
messageVariables?: ActionVariable[];
defaultMessage?: string;
docLinks: DocLinksStart;
actionConnector: ActionConnector;
cnasikas marked this conversation as resolved.
Show resolved Hide resolved
}

export interface Pagination {