-
Notifications
You must be signed in to change notification settings - Fork 8.5k
SR: SLM retention UI #45193
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
SR: SLM retention UI #45193
Conversation
|
Pinging @elastic/es-ui |
💚 Build Succeeded |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
70261e5 to
b2b9fc1
Compare
💔 Build Failed |
💚 Build Succeeded |
💔 Build Failed |
|
@elasticmachine merge upstream |
💚 Build Succeeded |
|
Looking at the tests now. |
cuff-links
left a comment
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 ran the tests locally. They work. I had some comments/nits but they aren't enough to block the PR on. Good Job.
Bamieh
left a comment
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've left a few comments for i18n related things. Thank you
x-pack/legacy/plugins/snapshot_restore/public/app/services/text/text.ts
Outdated
Show resolved
Hide resolved
...public/app/sections/home/policy_list/policy_retention_schedule/policy_retention_schedule.tsx
Outdated
Show resolved
Hide resolved
...public/app/sections/home/policy_list/policy_retention_schedule/policy_retention_schedule.tsx
Outdated
Show resolved
Hide resolved
...ck/legacy/plugins/snapshot_restore/public/app/components/policy_form/steps/step_settings.tsx
Outdated
Show resolved
Hide resolved
|
@Bamieh thanks for the review! I believe I addressed all of the issues you found with |
💚 Build Succeeded |
Bamieh
left a comment
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.
i18n LGTM!
jloleysens
left a comment
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.
This looks really great @alisonelizabeth ! I read through the code and will do a manual test before submitting my final review, but wanted to submit these comments so long. There is nothing I could identify as a major blocker so these are mostly suggestions and questions.
|
|
||
| export const deserializeTime = (time: string) => { | ||
| const timeUnits = Object.values(TIME_UNITS); | ||
| const timeChars = time.split(''); |
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.
Don't think this .split is necessary. String.prototype has a an indexOf method:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
|
|
||
| {/** Expiration field */} | ||
| {renderExpireAfterField()} | ||
| {/** Retention count fields */} |
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.
Nit: I'd say the code is self-documented in this case 😃
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
|
|
||
| {/* Retention summary */} |
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.
Thanks for this comment! 👍
|
|
||
| type OnSuccessCallback = () => void; | ||
|
|
||
| export const PolicyUpdateRetentionProvider: React.FunctionComponent<Props> = ({ children }) => { |
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.
Suggestion: Maybe this could be PolicyRetentionModalProvider? Just think having ModalProvider in the name would good. WDYT?
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.
good point, changed to UpdateRetentionModalProvider
...public/app/sections/home/policy_list/policy_retention_schedule/policy_retention_schedule.tsx
Show resolved
Hide resolved
| }); | ||
| } | ||
|
|
||
| public getTimeUnitLabel(timeUnit = TIME_UNITS.SECOND, timeValue = '0') { |
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.
Will we ever call just getTimeUnitLabel() and have a label 0 seconds? Just wondering whether the defaults are meaningful here and if we shouldn't require these values to be provided by consumers of this service.
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.
good point, fixed
|
|
||
| if ( | ||
| retention && | ||
| retention.minCount && |
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.
Can minCount or maxCount ever be 0?
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.
no, it must be at least 1
|
|
||
| // We need to skip the tests until react 16.9.0 is released | ||
| // which supports asynchronous code inside act() | ||
| describe.skip('<PolicyAdd />', () => { |
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.
Just to clarify, none of the tests are currently running in CI - are we manually testing for now?
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.
that's correct. we can remove the skip once we upgrade to react 16.9.0.
|
@jloleysens thanks for the initial review! I believe I addressed all of your comments. |
jloleysens
left a comment
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.
Great work, looks good! Summary of manual testing. Once again now major issues encountered:
Small note: The linked cron schedule docs go here: https://www.elastic.co/guide/en/elastic-stack-overview/master/trigger-schedule.html#schedule-cron which looks like it's been moved :c but you can still get there.
💔 Build Failed |
|
Thanks @jloleysens! Great catch on the docs link. I updated it to the correct link. |
💔 Build Failed |
💚 Build Succeeded |
|
@alisonelizabeth Is this the right place to add this comment or you want me to create new defect? Snapshot retention policy defined from Kibana UI is not working as expected. Snapshots are not getting purged though retention policy expired. Tested for 1 hour and 1 day. |
|
Hi @uvenukadasula! Can you please open a "Bug report" issue in the Kibana repo here and provide steps to reproduce? Thanks! |
This PR adds the ability to configure snapshot retention as part of the create policy wizard.
I considered integrating the form lib into this, but ultimately decided it would be better addressed in a separate PR (if we decide to do it), as it would involve refactoring the existing code.
I am also still working with Gail on the copy, so there will likely be some text changes to come.
Release notes
This feature adds the ability to configure snapshot retention when creating a Snapshot Lifecycle Management policy within the Snapshot and Restore app. If a policy has retention configured, users have the ability to update the
slm.retention_schedulecluster setting through the UI. Policy statistics were also added to the policy details panel.Testing locally
You will need to create a repository first, before creating a policy. For a shared filesystem repo, you need to specify a
path.repoin ES. For example:yarn es snapshot -E path.repo=/tmp/es-backupsFor more information, see the SR docs.
Screenshots
Policy tab
If a policy with retention exists, but the
slm.retention_schedulecluster setting has not be set, a callout will display.A user has the ability to edit the
slm.retention_schedulecluster setting if they have policies with retention.The
slm.retention_schedulecluster setting panel will not render, if there are no policies configured with retention.Retention schedule modal (supports simple and advanced cron editor)
Snapshot retention step
Validation

Review step
Added retention to summary and request tabsDetails panel
Added policy stats and retention details (if configured)