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

[Fleet] Prompt user of unsaved changes in package policy edit page #135219

Merged

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Jun 27, 2022

Summary

Related to #133740

That PR add a prompt when the user try to leave the package policy editor pages with unsaved changes, this is particularly important as we added a new flow with custom pipelines where user are redirect from the editor page to the ingest pipeline UI.

UI Changes

Screen Shot 2022-06-27 at 2 11 24 PM

How to test?

Try to edit an integration:

  • if no changes are made you should be able to click cancel without prompt
  • if some changes are made you should see a prompt when clicking cancel
  • you should be able to save and be redirected without seeing the prompt

@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.4.0 labels Jun 27, 2022
@nchaulet nchaulet requested a review from a team as a code owner June 27, 2022 13:15
@nchaulet nchaulet self-assigned this Jun 27, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic
Copy link
Contributor

It would be nice to make the style consistent with other modals, like move Are you sure you want to leave? to the title, and put a . after Changes will be lost, change the Confirm button label to something clearer like Leave page

image

@nchaulet
Copy link
Member Author

nchaulet commented Jun 27, 2022

It would be nice to make the style consistent with other modals, like move Are you sure you want to leave? to the title, and put a . after Changes will be lost, change the Confirm button label to something clearer like Leave page

@juliaElastic the scoped history block method do not give us a lot of options here, we could only set the message, but I can at least add the . at the end.

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@nchaulet
Copy link
Member Author

@juliaElastic Actually I was able to provide a custom modal by playing a little with the history.block method
Screen Shot 2022-06-27 at 11 31 32 AM

@nchaulet nchaulet force-pushed the feature-edit-package-policy-history-block branch from 019d376 to a388a3d Compare June 27, 2022 15:33
@nchaulet nchaulet requested review from a team as code owners June 27, 2022 18:10
@nchaulet nchaulet requested review from pzl and dasansol92 June 27, 2022 18:10
@nchaulet
Copy link
Member Author

@elastic/kibana-core I had to change the navigateToUrl method to support state do you think that change make sense? Do you think it make more sense to add this in a separate PR?

@@ -320,7 +320,7 @@ export class ApplicationService {
navigateToApp,
navigateToUrl: async (
url: string,
{ skipAppLeave = false, forceRedirect = false }: NavigateToUrlOptions = {}
{ skipAppLeave = false, forceRedirect = false, state }: NavigateToUrlOptions = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the associated unit test here:

describe('navigateToUrl with options', () => {

Copy link
Member Author

Choose a reason for hiding this comment

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

I just added it

@nchaulet nchaulet requested a review from pgayvallet June 28, 2022 12:16
Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM

@nchaulet
Copy link
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 728 730 +2

Async chunks

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

id before after diff
fleet 834.2KB 835.6KB +1.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 298.6KB 298.6KB +16.0B
Unknown metric groups

API count

id before after diff
core 2533 2534 +1

History

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

cc @nchaulet

@nchaulet nchaulet merged commit 8440cec into elastic:main Jun 29, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 29, 2022
@nchaulet nchaulet deleted the feature-edit-package-policy-history-block branch June 29, 2022 14:24
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 Team:Fleet Team label for Observability Data Collection Fleet team v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants