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

Implement UI for Create Alert form #55232

Merged
merged 44 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7de96c7
Updated Alert ui model, fixed form validation and small issues
YulNaumenko Jan 17, 2020
1aade15
Fixed error messages and validation for action params forms
YulNaumenko Jan 17, 2020
3c68e68
Fixed typecheck error
YulNaumenko Jan 17, 2020
9bab832
Moved alert add/edit common fields to alert form
YulNaumenko Jan 22, 2020
1c7ccfa
Fixed type checks
YulNaumenko Jan 22, 2020
eb564ce
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Jan 22, 2020
a675639
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Jan 22, 2020
a332b90
Refactored alert add flyout by splitting it to the form and flyout co…
YulNaumenko Jan 23, 2020
ab87477
Refactored connector add/edit flyouts and created add connector modal
YulNaumenko Jan 28, 2020
d2d7aeb
Refactored add/edit flyout tests
YulNaumenko Jan 28, 2020
12c1242
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Jan 28, 2020
a3b1e71
Fixed test
YulNaumenko Jan 28, 2020
b9c508a
Removed orig files
YulNaumenko Jan 28, 2020
34cf05c
Removed orig file
YulNaumenko Jan 28, 2020
a619f76
Added unit tests for add connector modal dialog
YulNaumenko Jan 28, 2020
1b62630
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Jan 29, 2020
9a27d24
Action Groups idea of implementation
YulNaumenko Jan 29, 2020
69f9a46
Removed action group tabs and set only first action group as default …
YulNaumenko Jan 29, 2020
0a23205
Added missing unit tests
YulNaumenko Jan 29, 2020
552da20
Changed design of the email params form
YulNaumenko Jan 29, 2020
6c75b78
Fixed actions params forms according to latest mockups
YulNaumenko Jan 30, 2020
bbc87cc
Fixed options list for available actions connectors
YulNaumenko Jan 30, 2020
94c0389
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Jan 30, 2020
3bb4f5b
Fixed modal dialog update on action delete
YulNaumenko Jan 30, 2020
1ee1abb
fixed build fail
YulNaumenko Jan 30, 2020
29bd3d1
Added functionality for action types with Message field to Add variables
YulNaumenko Jan 30, 2020
50498f8
Added alertReducer unit tests
YulNaumenko Jan 30, 2020
969fd19
Added create alert functional test
YulNaumenko Jan 31, 2020
78deded
Added types for Params
YulNaumenko Jan 31, 2020
b585af8
Some design fixes
snide Jan 31, 2020
462a0c5
alerts empty prompt
snide Jan 31, 2020
76ff311
Merge branch 'alerts-create-form-ui-flyout' into design/alert-create
YulNaumenko Jan 31, 2020
5fa78d6
Merge pull request #1 from snide/design/alert-create
YulNaumenko Jan 31, 2020
b99f14e
Fixed failing app on save alert and added possibility to hide Change …
YulNaumenko Jan 31, 2020
9992f40
Fixed type check issues
YulNaumenko Feb 1, 2020
42b41fe
Added connector config types
YulNaumenko Feb 1, 2020
174bc33
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Feb 3, 2020
87d6a9b
fixed type check
YulNaumenko Feb 3, 2020
21a0631
Merge remote-tracking branch 'upstream/master' into alerts-create-for…
YulNaumenko Feb 3, 2020
8d332db
Fixed merge issues
YulNaumenko Feb 3, 2020
c0b3195
Fixed type checks
YulNaumenko Feb 3, 2020
5734040
Fixed functional tests and error expression message
YulNaumenko Feb 4, 2020
9e52760
Fixed jest tests
YulNaumenko Feb 4, 2020
5ba502c
Review changes
YulNaumenko Feb 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const App = (appDeps: AppDeps) => {
);
};

export const AppWithoutRouter = ({ sectionsRegex }: any) => {
export const AppWithoutRouter = ({ sectionsRegex }: { sectionsRegex: string }) => {
const { capabilities } = useAppDependencies();
const canShowAlerts = hasShowAlertsCapability(capabilities);
const DEFAULT_SECTION: Section = canShowAlerts ? 'alerts' : 'connectors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import React, { FunctionComponent } from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { TypeRegistry } from '../../type_registry';
import { registerBuiltInActionTypes } from './index';
import { ActionTypeModel, ActionConnector } from '../../../types';
import { ActionTypeModel, ActionParamsProps } from '../../../types';
import { EmailActionParams, EmailActionConnector } from './types';

const ACTION_TYPE_ID = '.email';
let actionTypeModel: ActionTypeModel;
Expand Down Expand Up @@ -40,43 +41,15 @@ describe('connector validation', () => {
name: 'email',
config: {
from: '[email protected]',
port: '2323',
port: 2323,
host: 'localhost',
test: 'test',
},
} as ActionConnector;
} as EmailActionConnector;

expect(actionTypeModel.validateConnector(actionConnector)).toEqual({
errors: {
from: [],
service: [],
port: [],
host: [],
user: [],
password: [],
},
});

delete actionConnector.config.test;
actionConnector.config.host = 'elastic.co';
actionConnector.config.port = 8080;
expect(actionTypeModel.validateConnector(actionConnector)).toEqual({
errors: {
from: [],
service: [],
port: [],
host: [],
user: [],
password: [],
},
});
delete actionConnector.config.host;
delete actionConnector.config.port;
actionConnector.config.service = 'testService';
expect(actionTypeModel.validateConnector(actionConnector)).toEqual({
errors: {
from: [],
service: [],
port: [],
host: [],
user: [],
Expand All @@ -97,12 +70,11 @@ describe('connector validation', () => {
config: {
from: '[email protected]',
},
} as ActionConnector;
} as EmailActionConnector;

expect(actionTypeModel.validateConnector(actionConnector)).toEqual({
errors: {
from: [],
service: ['Service is required.'],
port: ['Port is required.'],
host: ['Host is required.'],
user: [],
Expand Down Expand Up @@ -168,14 +140,13 @@ describe('EmailActionConnectorFields renders', () => {
config: {
from: '[email protected]',
},
} as ActionConnector;
} as EmailActionConnector;
const wrapper = mountWithIntl(
<ConnectorFields
action={actionConnector}
errors={{ from: [], service: [], port: [], host: [], user: [], password: [] }}
errors={{ from: [], port: [], host: [], user: [], password: [] }}
editActionConfig={() => {}}
editActionSecrets={() => {}}
hasErrors={false}
/>
);
expect(wrapper.find('[data-test-subj="emailFromInput"]').length > 0).toBeTruthy();
Expand All @@ -198,19 +169,22 @@ describe('EmailParamsFields renders', () => {
if (!actionTypeModel.actionParamsFields) {
return;
}
const ParamsFields = actionTypeModel.actionParamsFields;
const ParamsFields = actionTypeModel.actionParamsFields as FunctionComponent<
ActionParamsProps<EmailActionParams>
>;
const actionParams = {
cc: [],
bcc: [],
to: ['[email protected]'],
subject: 'test',
message: 'test message',
};
const wrapper = mountWithIntl(
<ParamsFields
action={actionParams}
errors={{}}
actionParams={actionParams}
errors={{ to: [], cc: [], bcc: [], subject: [], message: [] }}
editAction={() => {}}
index={0}
hasErrors={false}
/>
);
expect(wrapper.find('[data-test-subj="toEmailAddressInput"]').length > 0).toBeTruthy();
Expand All @@ -220,8 +194,6 @@ describe('EmailParamsFields renders', () => {
.first()
.prop('selectedOptions')
).toStrictEqual([{ label: '[email protected]' }]);
expect(wrapper.find('[data-test-subj="ccEmailAddressInput"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="bccEmailAddressInput"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="emailSubjectInput"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="emailMessageInput"]').length > 0).toBeTruthy();
});
Expand Down
Loading