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

[Guided onboarding] Update header button logic #144634

Merged
merged 32 commits into from
Nov 14, 2022

Conversation

yuliacech
Copy link
Contributor

@yuliacech yuliacech commented Nov 4, 2022

Summary

Fixes #141129
Fixes #144515

This PR introduces a new state to the guided onboarding plugin. The state keeps track of the creationDate and of the overall status of the plugin. The creation date allows us to detect an "active" period during which the header button will be displayed more prominently in the header. Currently, the active period is set to 30 days. During this time, if the user has not started any guide or skipped the guide on the landing page, the header button will be displayed and when clicked, redirect the user to the landing page to start/continue a guide. The button is hidden when the user completed a guide or they quit before completion.
Also this PR adds a check for Cloud deployments and prevents the code from sending any API requests when not on Cloud, because guided onboarding is disabled on prem.

Screenshot

Screenshot 2022-11-10 at 18 42 18

Checklist

@yuliacech yuliacech added release_note:skip Skip the PR/issue when compiling release notes Team:Journey/Onboarding Platform Journey Onboarding team labels Nov 4, 2022
@yuliacech yuliacech force-pushed the guided_onboarding/8.6_button_logic branch 2 times, most recently from 59ae0d3 to f6be0a0 Compare November 8, 2022 15:49
@yuliacech yuliacech force-pushed the guided_onboarding/8.6_button_logic branch from f6be0a0 to 5165618 Compare November 8, 2022 15:52
Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Nice work @yuliacech! Just took an initial glance through, as I know you are still working on a few things. This approach makes sense to me overall. Did not test locally yet. I will take another pass tomorrow.

// https://github.com/elastic/kibana/issues/139799, https://github.com/elastic/kibana/issues/139798

// if there is no active guide
if (!pluginState || !pluginState.activeGuide || !pluginState.activeGuide.isActive) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the isActive flag anymore since the plugin state provides the activeGuide? In other words, would the activeGuide ever not be active? 🤔

Copy link
Contributor Author

@yuliacech yuliacech Nov 10, 2022

Choose a reason for hiding this comment

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

I thought about that too, but I think we still need the flag isActive because guides are a separate saved object type and we keep all guides with their states in there. The only way to know which is the active guide is by querying the flag. Alternatively, we could keep an ID of the active guide in the plugin state SO, but I think the query works pretty well and is an already "tested" approach.


await updateComponentWithState(component, mockInProgressTestGuideState, false);
describe('when not in active period', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to add a test that the button is still visible if a guide is in progress and not in the active period?

const { id, status } = step;

if (status === 'ready_to_complete') {
return await api.completeGuideStep(guideState?.guideId, id);
return await api.completeGuideStep(pluginState!.activeGuide!.guideId!, id);
Copy link
Contributor

@alisonelizabeth alisonelizabeth Nov 10, 2022

Choose a reason for hiding this comment

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

[nit] Maybe extract this on L91 since it's used in a few places:

const guideId = pluginState!.activeGuide!.guideId!

@@ -0,0 +1,35 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this file be renamed plugin_state_utils.test.ts?

} from '../saved_objects';

// hard code the duration to 30 days for now
const activePeriodDurationInMilliseconds = 30 * 24 * 60 * 60 * 1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we open up a separate issue to make this configurable?

* Side Public License, v 1.
*/

import { GuideState } from '@kbn/guided-onboarding';
Copy link
Contributor

@alisonelizabeth alisonelizabeth Nov 10, 2022

Choose a reason for hiding this comment

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

Can you remind me again why GuideState lives in a package and not in the plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We needed GuideState in the Home plugin and then moved some of the code from the Home plugin into a package, so the types have to be in the package too.

@yuliacech yuliacech marked this pull request as ready for review November 10, 2022 16:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/platform-onboarding (Team:Journey/Onboarding)

@yuliacech yuliacech changed the title [Guided onboarding] (WIP) Update header button logic [Guided onboarding] Update header button logic Nov 10, 2022
@yuliacech yuliacech requested a review from a team as a code owner November 10, 2022 16:49
Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

limits.yml

net diff is 1kb, update_limits is padding 15kb.

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback! Verified changes locally and everything worked as expected.

I have one question about the "quit" behavior - my memory is a little fuzzy 😅, but I thought the button would be hidden in the scenario where the user quit a guide. Can you confirm with design? I'm OK to merge as-is and follow up later if necessary.

@yuliacech yuliacech enabled auto-merge (squash) November 14, 2022 13:57
Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

LGTM in CI green

@alisonelizabeth
Copy link
Contributor

@elasticmachine merge upstream

@stephmilovic
Copy link
Contributor

@elasticmachine merge upstream

@stephmilovic
Copy link
Contributor

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
guidedOnboarding 37 43 +6

Async chunks

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

id before after diff
home 158.0KB 158.0KB +52.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
guidedOnboarding 1 3 +2

Page load bundle

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

id before after diff
guidedOnboarding 26.2KB 27.4KB +1.2KB
Unknown metric groups

API count

id before after diff
guidedOnboarding 37 43 +6

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 441 447 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
securitySolution 518 524 +6
total +20

History

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

@yuliacech yuliacech merged commit 879b101 into elastic:main Nov 14, 2022
@kibanamachine kibanamachine added v8.6.0 backport:skip This commit does not require backporting labels Nov 14, 2022
jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 15, 2022
* main: (65 commits)
  Migrate server-side `Root` and `Server` to packages (elastic#144990)
  [Discover] Handle no data views state for `esQuery` alert (elastic#145052)
  [ML] Allow updates for number of allocations and priority for trained model deployments (elastic#144704)
  [api-docs] 2022-11-15 Daily api_docs build (elastic#145203)
  [Security solution] remove guided onboarding feature flag (elastic#144247)
  [DOCS] Automate final case APIs (elastic#145007)
  [Enterprise Search] Name and description flyout for connectors (elastic#143827)
  [Guided onboarding] Update header button logic (elastic#144634)
  [Lens] Multi metric partition charts (elastic#143966)
  [Dashboard] [Controls] Add unmapped runtime field support to options list (elastic#144947)
  [Security Solution] Add Task Metric Collection to New Tasks (elastic#145181)
  [TriggersActionsUi] disable jest config in CI (elastic#145186)
  [TableListView] Enhance tag filtering (elastic#142108)
  [Cloud Posture] Compliance by CIS section table (elastic#145114)
  [8.6][Session View] Fix hidden alert flyout  in session view (elastic#145141)
  [customIntegrations] async load all components (elastic#145166)
  Fix time for logs smoke tests in integration test (elastic#145130)
  [RAM] Update rule status (elastic#140882)
  Update babel (main) (elastic#145060)
  [Actionable Observability] Add context.alertDetailsUrl variable to action connector template for APM rule types (elastic#144791)
  ...
@yuliacech yuliacech deleted the guided_onboarding/8.6_button_logic branch November 22, 2022 09:35
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:Journey/Onboarding Platform Journey Onboarding team v8.6.0
Projects
None yet
8 participants