Skip to content

Commit 4b603da

Browse files
authored
Not resetting server log level if level is defined (#83651)
1 parent 938b762 commit 4b603da

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { coreMock } from 'src/core/public/mocks';
1212

1313
describe('ServerLogParamsFields renders', () => {
1414
const mocks = coreMock.createSetup();
15+
const editAction = jest.fn();
1516

1617
test('all params fields is rendered', () => {
1718
const actionParams = {
@@ -22,14 +23,15 @@ describe('ServerLogParamsFields renders', () => {
2223
<ServerLogParamsFields
2324
actionParams={actionParams}
2425
errors={{ message: [] }}
25-
editAction={() => {}}
26+
editAction={editAction}
2627
index={0}
2728
defaultMessage={'test default message'}
2829
docLinks={{ ELASTIC_WEBSITE_URL: '', DOC_LINK_VERSION: '' } as DocLinksStart}
2930
toastNotifications={mocks.notifications.toasts}
3031
http={mocks.http}
3132
/>
3233
);
34+
expect(editAction).not.toHaveBeenCalled();
3335
expect(wrapper.find('[data-test-subj="loggingLevelSelect"]').length > 0).toBeTruthy();
3436
expect(
3537
wrapper.find('[data-test-subj="loggingLevelSelect"]').first().prop('value')

x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export const ServerLogParamsFields: React.FunctionComponent<ActionParamsProps<
2525
];
2626

2727
useEffect(() => {
28-
editAction('level', 'info', index);
28+
if (!actionParams?.level) {
29+
editAction('level', 'info', index);
30+
}
2931
// eslint-disable-next-line react-hooks/exhaustive-deps
3032
}, []);
3133

0 commit comments

Comments
 (0)