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

Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal #76482

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Sep 2, 2020

Summary

Fix #75795

Fix a bug causing legacy saved object imports to only show one confirmation modal when multiple objects needed a override confirmation in Request action when conflict occurs mode

Checklist

@pgayvallet pgayvallet added Feature:Saved Objects release_note:fix v7.10.0 v7.9.2 Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Sep 2, 2020
Comment on lines -283 to +282
await awaitEachItemInParallel(docTypes.indexPatterns, async (indexPatternDoc) => {
// As the confirmation opens a modal, and as we only allow one modal at a time
// (opening a new one close the previous with a rejection)
// we can't do that in parallel
for (const indexPatternDoc of docTypes.indexPatterns) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, this was present for a very long time (since core's ModalService presence), as we are dismissing any previous modal when opening a new one

open: (mount: MountPoint, options: OverlayModalOpenOptions = {}): OverlayRef => {
// If there is an active modal, close it before opening a new one.
if (this.activeModal) {
this.activeModal.close();
this.cleanupDom();
}

The awaitEachItemInParallel was causing multiple modals to eventually open at the same time, dismissing the previous one when the next one kicked in.

Using a sort of confirmation queue here to pool the modal promises and only open the next one when the previous one is answered by the user is a nightmare, as some confirmations modal are opened as down as savedobject loaders underlying implementations in some cases. As this is only impacting the legacy imports, removing the parallel work and doing one object at a time was the only sane option.

From a quick manual benchmark, it doesn't even impact the process time that much.

Copy link
Contributor

Choose a reason for hiding this comment

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

So the modern approach won't be affected by this fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea. the modern approach is not impacted by this bug, and is not relying on this mechanism to prompt user confirmations, so the PR has no impact on it

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

page load bundle size

id value diff baseline
savedObjectsManagement 225.9KB +1.4KB 224.5KB

History

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

@pgayvallet pgayvallet marked this pull request as ready for review September 2, 2020 12:29
@pgayvallet pgayvallet requested a review from a team as a code owner September 2, 2020 12:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

// with is why we call clickConfirmOnModal with ensureHidden: false in previous statement
// but as the initial popin can take a few ms before fading, we need to wait a little
// to avoid clicking twice on the same modal.
await delay(1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

can be a source of flakiness.... ok, we will see

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, there is a risk here. But I just couldn't find any better solution for these blinking confirmation modals

await delay(1000);
await PageObjects.common.clickConfirmOnModal(false);

const isSuccessful = await testSubjects.exists('importSavedObjectsSuccess');
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: can be combined with an assertion as await testSubjects.exists('importSavedObjectsSuccess');

Comment on lines -283 to +282
await awaitEachItemInParallel(docTypes.indexPatterns, async (indexPatternDoc) => {
// As the confirmation opens a modal, and as we only allow one modal at a time
// (opening a new one close the previous with a rejection)
// we can't do that in parallel
for (const indexPatternDoc of docTypes.indexPatterns) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So the modern approach won't be affected by this fix?

@pgayvallet pgayvallet merged commit 210d6f2 into elastic:master Sep 3, 2020
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Sep 3, 2020
… last confirm modal (elastic#76482)

* Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal

* eslint

* fix for loops
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Sep 3, 2020
… last confirm modal (elastic#76482)

* Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal

* eslint

* fix for loops
pgayvallet added a commit that referenced this pull request Sep 3, 2020
… last confirm modal (#76482) (#76598)

* Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal

* eslint

* fix for loops
pgayvallet added a commit that referenced this pull request Sep 3, 2020
… last confirm modal (#76482) (#76597)

* Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal

* eslint

* fix for loops
jloleysens added a commit to jloleysens/kibana that referenced this pull request Sep 3, 2020
…nes/processors-forms-k-s

* 'master' of github.com:elastic/kibana: (216 commits)
  [Ingest Manager] Split Registry errors into Connection & Response (elastic#76558)
  [Security Solution] add an excess validation instead of the exact match (elastic#76472)
  Introduce TS incremental builds & move src/test_utils to TS project  (elastic#76082)
  fix bad merge (elastic#76629)
  [Newsfeed] Ensure the version format when calling the API (elastic#76381)
  remove server_extensions mixin (elastic#76606)
  Remove legacy applications and legacy mode (elastic#75987)
  [Discover] Fix sidebar element focus behavior when adding / removing columns (elastic#75749)
  Replace FetchOptions with ISearchOptions (elastic#76538)
  Move streams utils to the core  (elastic#76397)
  [Ingest Manager] Wording & linking improvements (elastic#76284)
  remove legacy kibana plugin (elastic#76064)
  [Form lib] Fix regression on field not being validated after reset to its default value. (elastic#76379)
  Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal (elastic#76482)
  [APM] Service maps layout enhancements (elastic#76481)
  [Security Solution][Detection Engine] Remove RuleTypeSchema in favor of Type for TypeScript (elastic#76586)
  [Security Solution][Exceptions] - Updates enum schema and tests (elastic#76544)
  Index Pattern class - remove toJSON and toString (elastic#76246)
  skip failing suite (elastic#76581)
  Split up and clarify Enterprise Search codeowners (elastic#76580)
  ...

# Conflicts:
#	x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx
#	x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx
jloleysens added a commit to jloleysens/kibana that referenced this pull request Sep 3, 2020
…oleysens/kibana into ingest-pipelines/processors-forms-k-s

* 'ingest-pipelines/processors-forms-k-s' of github.com:jloleysens/kibana: (216 commits)
  [Ingest Manager] Split Registry errors into Connection & Response (elastic#76558)
  [Security Solution] add an excess validation instead of the exact match (elastic#76472)
  Introduce TS incremental builds & move src/test_utils to TS project  (elastic#76082)
  fix bad merge (elastic#76629)
  [Newsfeed] Ensure the version format when calling the API (elastic#76381)
  remove server_extensions mixin (elastic#76606)
  Remove legacy applications and legacy mode (elastic#75987)
  [Discover] Fix sidebar element focus behavior when adding / removing columns (elastic#75749)
  Replace FetchOptions with ISearchOptions (elastic#76538)
  Move streams utils to the core  (elastic#76397)
  [Ingest Manager] Wording & linking improvements (elastic#76284)
  remove legacy kibana plugin (elastic#76064)
  [Form lib] Fix regression on field not being validated after reset to its default value. (elastic#76379)
  Legacy SO import: Fix bug causing multiple overrides to only show the last confirm modal (elastic#76482)
  [APM] Service maps layout enhancements (elastic#76481)
  [Security Solution][Detection Engine] Remove RuleTypeSchema in favor of Type for TypeScript (elastic#76586)
  [Security Solution][Exceptions] - Updates enum schema and tests (elastic#76544)
  Index Pattern class - remove toJSON and toString (elastic#76246)
  skip failing suite (elastic#76581)
  Split up and clarify Enterprise Search codeowners (elastic#76580)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Saved Objects release_note:fix Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.9.2 v7.10.0
Projects
None yet
4 participants