Skip to content

Commit

Permalink
Not resetting server log level if level is defined (#83651) (#85014)
Browse files Browse the repository at this point in the history
# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.tsx
  • Loading branch information
ymao1 authored Dec 4, 2020
1 parent 579e18e commit d86faf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { coreMock } from 'src/core/public/mocks';

describe('ServerLogParamsFields renders', () => {
const mocks = coreMock.createSetup();
const editAction = jest.fn();

test('all params fields is rendered', () => {
const actionParams = {
Expand All @@ -22,14 +23,15 @@ describe('ServerLogParamsFields renders', () => {
<ServerLogParamsFields
actionParams={actionParams}
errors={{ message: [] }}
editAction={() => {}}
editAction={editAction}
index={0}
defaultMessage={'test default message'}
docLinks={{ ELASTIC_WEBSITE_URL: '', DOC_LINK_VERSION: '' } as DocLinksStart}
toastNotifications={mocks.notifications.toasts}
http={mocks.http}
/>
);
expect(editAction).not.toHaveBeenCalled();
expect(wrapper.find('[data-test-subj="loggingLevelSelect"]').length > 0).toBeTruthy();
expect(
wrapper.find('[data-test-subj="loggingLevelSelect"]').first().prop('value')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const ServerLogParamsFields: React.FunctionComponent<ActionParamsProps<
];

useEffect(() => {
editAction('level', 'info', index);
if (!actionParams?.level) {
editAction('level', 'info', index);
}
if (!message && defaultMessage && defaultMessage.length > 0) {
editAction('message', defaultMessage, index);
}
Expand Down

0 comments on commit d86faf4

Please sign in to comment.