-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[App Search] Added the log retention panel to the Settings page #82982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly very minor nit change requests and some rambling from me
} | ||
); | ||
|
||
const API_STORED = (minAgeDays: number | null | undefined) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems weird to have null and undefined as a type option here, although I'm not sure we can do anything about it since I assume this is data coming from the server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's weird, I agree.
logRetentionSettings.retentionPolicy?.isDefault | ||
) { | ||
return renderOrReturnMessage(messages.defaultPolicy); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting an uncovered branch line on line 39 - I assume basically Jest wants to know what happens if all our if branches are skipped and it passes through to the very end, which is unlikely to happen in a real world scenario. Probably not really worth covering right now / something to look at later as tech debt. If you'd like me to look at this after your PRs get in today, LMK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that as well and couldn't quite figure out what the failure was all about.
...ons/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts
Outdated
Show resolved
Hide resolved
...ons/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts
Outdated
Show resolved
Hide resolved
determineTooltipContent(API_MESSAGES, true, { | ||
...BASE_SETTINGS, | ||
enabled: false, | ||
disabledAt: 'Thu, 05 Nov 2020 18:57:28 +0000', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a change request, just an aside: using current dates for tests is always somewhat amusing because they end up acting as a time capsule when looking back at code. Like, someone will come in here 5 years from now and be like "oh I guess this code is 5 years old haha". Personally, I like using Jan 1 1970 as a clear way of saying in a test "this is an arbitrary/mock date".
...rch/public/applications/app_search/components/settings/log_retention/log_retention_panel.tsx
Outdated
Show resolved
Hide resolved
...ublic/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx
Outdated
Show resolved
Hide resolved
...ublic/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx
Outdated
Show resolved
Hide resolved
...ublic/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx
Outdated
Show resolved
Hide resolved
it('renders API switch off when apiLogRetention is false in LogRetentionLogic ', () => { | ||
setMockValues({ | ||
isLogRetentionUpdating: false, | ||
logRetention: mockLogRetention({ | ||
api: { | ||
enabled: false, | ||
}, | ||
}), | ||
}); | ||
|
||
const logRetentionPanel = shallow(<LogRetentionPanel />); | ||
expect( | ||
logRetentionPanel.find(`[data-test-subj="LogRetentionPanelAPISwitch"]`).prop('checked') | ||
).toEqual(false); | ||
}); | ||
|
||
it('renders API switch on when apiLogRetention is true in LogRetentionLogic ', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Not a change request] It might be interesting (later, as tech debt) to combine these two tests into a single test that tests both true/false. Might save on some setup time and combines the tests conceptually. I'd have to DRY out a rerender helper of some kind though.
const logRetentionPanel = shallow(<LogRetentionPanel />);
setMockValues({ ... });
logRetentionPanel.setProps({}); // rerenders/updates component
expect(switchIsChecked).toEqual(false);
setMockValues({ ... });
logRetentionPanel.setProps({}); // rerenders/updates component
expect(switchIsChecked).toEqual(true);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
…h/components/settings/log_retention/messaging/determine_tooltip_content.test.ts Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
@constancecchen I think I got all of the blocking feedback. I especially appreciated the accessibility help! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for the speedy changes!
💚 Build SucceededMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
…tic#82982) * Added LogRententionPanel * i18n * fix axe failure * Update x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts Co-authored-by: Constance <constancecchen@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Constance <constancecchen@users.noreply.github.com> * PR Feeback: interpolation * Apply suggestions from code review Co-authored-by: Constance <constancecchen@users.noreply.github.com> Co-authored-by: Constance <constancecchen@users.noreply.github.com>
…kibana into bootstrap-node-details-overlay * 'bootstrap-node-details-overlay' of github.com:phillipb/kibana: (49 commits) [Security Solution] Fix DNS Network table query (elastic#82778) [Workplace Search] Consolidate groups routes (elastic#83015) Adds cloud links to user menu (elastic#82803) [Security Solution][Detections] - follow up cleanup on auto refresh rules (elastic#83023) [App Search] Added the log retention panel to the Settings page (elastic#82982) [Maps] show icon when layer is filtered by time and allow layers to ignore global time range (elastic#83006) [DOCS] Consolidates drilldown pages (elastic#82081) [Maps] add on-prem EMS config (elastic#82525) migrate i18n mixin to KP (elastic#81799) [bundle optimization] fix imports of react-use lib (elastic#82847) [Discover] Add metric on adding filter (elastic#82961) [Lens] Performance refactoring for indexpattern fast lookup and Operation support matrix computation (elastic#82829) skip flaky suite (elastic#82804) Fix SO query for searching across spaces (elastic#83025) renaming built-in alerts to Stack Alerts (elastic#82873) [TSVB] Disable using top_hits in pipeline aggregations (elastic#82278) [Visualizations] Remove kui usage (elastic#82810) [Visualizations] Make the icon buttons labels more descriptive (elastic#82585) [Lens] Do not reset formatting when switching between custom ranges and auto histogram (elastic#82694) Fix ilm navigation (elastic#81664) ...
…na into alerts/stack-alerts-public * 'alerts/stack-alerts-public' of github.com:gmmorris/kibana: [Security Solution] Fix DNS Network table query (elastic#82778) [Workplace Search] Consolidate groups routes (elastic#83015) Adds cloud links to user menu (elastic#82803) [Security Solution][Detections] - follow up cleanup on auto refresh rules (elastic#83023) [App Search] Added the log retention panel to the Settings page (elastic#82982) [Maps] show icon when layer is filtered by time and allow layers to ignore global time range (elastic#83006) [DOCS] Consolidates drilldown pages (elastic#82081) [Maps] add on-prem EMS config (elastic#82525) migrate i18n mixin to KP (elastic#81799) [bundle optimization] fix imports of react-use lib (elastic#82847) [Discover] Add metric on adding filter (elastic#82961) [Lens] Performance refactoring for indexpattern fast lookup and Operation support matrix computation (elastic#82829) skip flaky suite (elastic#82804) Fix SO query for searching across spaces (elastic#83025) renaming built-in alerts to Stack Alerts (elastic#82873) [TSVB] Disable using top_hits in pipeline aggregations (elastic#82278) [Visualizations] Remove kui usage (elastic#82810) [Visualizations] Make the icon buttons labels more descriptive (elastic#82585) [Lens] Do not reset formatting when switching between custom ranges and auto histogram (elastic#82694) :
Summary
This PR adds the log retention section to the App Search Settings page.
Options can be enabled, but can not yet be disabled, as they require the next PR, which will add a modal.
In the meantime, you can navigate directly to the stand-alone UI to enable and disable options.
Checklist
Delete any items that are not applicable to this PR.
For maintainers