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

Add SLO cloning functionality #149935

Merged
merged 5 commits into from
Feb 1, 2023

Conversation

CoenWarmer
Copy link
Contributor

@CoenWarmer CoenWarmer commented Jan 31, 2023

Resolves #149917

📝 Summary

This PR adds the functionality to clone an existing SLO. It also adds some more tests for the SLO List page.

Looks like this:

Screen.Recording.2023-01-31.at.14.13.38.mov

✅ Checklist

  • It should be possible to select an existing SLO from the SLO List page and select "Clone"
  • After clicking "Clone" an SLO with the same configuration should appear in the list
  • The name of the newly cloned SLO should be "[Copy] <<Title of existing SLO>>"

@CoenWarmer CoenWarmer added the Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" label Jan 31, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/actionable-observability (Team: Actionable Observability)

@CoenWarmer CoenWarmer added release_note:skip Skip the PR/issue when compiling release notes and removed Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" labels Jan 31, 2023
@CoenWarmer CoenWarmer requested a review from kdelemme January 31, 2023 13:16
@@ -92,7 +92,7 @@ export const sloList: FindSLOResponse = {
},
{
...baseSlo,
id: 'c0f8d669-9177-4706-9098-f397a88173a6',
id: 'c0f8d669-9277-4706-9098-f397a88173a6',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed React was complaining about duplicate ID's when running tests, this fixes that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes good catch I forgot to change the id for this one 🙈

@CoenWarmer CoenWarmer force-pushed the feat/149917-slo-cloning branch from 16ae86e to 8b50209 Compare January 31, 2023 15:14
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observability 574.1KB 574.7KB +614.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Just a remark regarding finally block that sets success to false every time. Otherwise my other nit was addressed before I finished the review :p

Comment on lines +44 to +46
} finally {
setSuccess(false);
setLoading(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think finally is called regardless of the success or failure of the try. So in this case, we always set success to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was experimenting a bit with this pattern... will most likely revert

Comment on lines 51 to 56
const handleCloning = (cloning: boolean) => {
setIsCloning(cloning);
};

const handleDeleting = (deleting: boolean) => {
setIsDeleting(deleting);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: passing the boolean state feels strange when reading the code, especially from the modal component: e.g. onDeleting(true) or onDeleting(false)
Maybe we can keep onDeleting() without boolean that sets the state to true, and the handleClonedOrDeleted can reset both state (deleting and cloning) to false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this was exactly what I thought as well. Tbh, this is going to change if and when we move to React Query: it will have less prop plumbing because we can just listen for the api interaction finishing inside the list component.

@CoenWarmer CoenWarmer merged commit 4cf8f6e into elastic:main Feb 1, 2023
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Feb 1, 2023
@CoenWarmer CoenWarmer deleted the feat/149917-slo-cloning branch February 1, 2023 07:08
kqualters-elastic pushed a commit to kqualters-elastic/kibana that referenced this pull request Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SLO] Implement SLO cloning on SLO List page
5 participants