-
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
[SLOs] Fix cloning SLO by opening pre filled form #172927
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
/ci |
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.
May I suggest we leverage sloCreateWithEncodedForm(encodedForm)
to open the form with prefilled values. It would remove the need for the isClone
, and we won't have to load the sloId
in order to fill the form. You can see an example of this when we handle errors in the use_create_slo
optimistic update: https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability/public/hooks/slo/use_create_slo.ts#L87-L89
I think we would get the same result, but in a couple of lines and less code complexity in the form
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
9e7f8e0
to
5f1cabe
Compare
navigateToUrl( | ||
basePath.prepend( | ||
paths.observability.sloCreateWithEncodedForm( | ||
encode({ ...slo, name: `[Copy] ${slo.name}`, id: 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.
@shahzad31 Just out of curiosity in the previous implementation we were using id: uuidv4()
. I guess we are calling uuidv4()
when clicking on the Create SLO
button, right?
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 because we were actually creating an SLO in memory. In new implementation we are just redirecting user to the pre filled form.
@@ -33,7 +33,7 @@ export function SloEditPage() { | |||
const { sloId } = useParams<{ sloId: string | undefined }>(); | |||
const { hasAtLeast } = useLicense(); | |||
const hasRightLicense = hasAtLeast('platinum'); | |||
const { data: slo, isInitialLoading } = useFetchSloDetails({ sloId }); |
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.
@shahzad31 Why is this not needed anymore?
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 was un-necessarily blocking rendering of the form, causing empty page splash before form opens
))} | ||
<EuiFlexGrid columns={columns} gutterSize="m"> | ||
{sloList | ||
.filter((slo) => slo.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.
@shahzad31 Ok I see you keep only the slos that have summary, which is ok. I am just trying to understand what is the purpose of doing so. Did you notice a bug without the filtering line you added?
Can we actually have slos that do not have summary? I had the impression that there will always be a summary, cause we are creating a temp summary document at the very beginning until the actual summary document is indexed, no?
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 but this is to prevent the same bug we are trying to fix, where we did optimistic update to make add an SLO entry in the UI.
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.
Ok I see!
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.
@shahzad31 I like it! I tested it locally and it works as expected. I tried to clone an SLO from both SLO lists page (card view & list view) and SLO details page and all good.
@shahzad31 I would like your opinion regarding my comment here. Basically when we clone a group by SLO, we end up with many SLO clones (depending on the number of SLO instances) versus one SLO clone (the instance we want to clone). Do you want me to create an issue |
Everything has been addressed as per review
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
(cherry picked from commit 3419469)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…173504) # Backport This will backport the following commits from `main` to `8.12`: - [[SLOs] Fix cloning SLO by opening pre filled form (#172927)](#172927) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-12-18T10:52:32Z","message":"[SLOs] Fix cloning SLO by opening pre filled form (#172927)","sha":"3419469e39e0bb4443267bc80fb2500629c772ba","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","Team:obs-ux-management","v8.13.0"],"number":172927,"url":"https://github.com/elastic/kibana/pull/172927","mergeCommit":{"message":"[SLOs] Fix cloning SLO by opening pre filled form (#172927)","sha":"3419469e39e0bb4443267bc80fb2500629c772ba"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/172927","number":172927,"mergeCommit":{"message":"[SLOs] Fix cloning SLO by opening pre filled form (#172927)","sha":"3419469e39e0bb4443267bc80fb2500629c772ba"}}]}] BACKPORT--> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
Summary
Fixes #171939
Fix cloning SLO by opening pre filled form !!
SLO.CLone.mov