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

[Observability Onboarding] Add customizable header for quickstart flows #188340

Merged

Conversation

justinkambic
Copy link
Contributor

@justinkambic justinkambic commented Jul 15, 2024

Summary

Resolves #186397.

Adds a new customizable header for onboarding quickstart flows.

To add a new header, one must specify a logo type or EuiIconType, along with headlineCopy and descriptionCopy, and put a new entry in the headerContent record, and a corresponding case in the customHeaderProps helper function I have defined. When routes that require custom headers are defined, the function will pick up the necessary props and return them to the HeaderSection component where they're used to render a CustomHeaderSection. Otherwise, the component will render the default header.

If the consuming code specifies a SupportedLogo type, it's rendered as an EuiIcon. Otherwise, if an EuiIconType is specified, it renders as an avatar, per the design.

Code is WIP.

Adds new headers for quickstart flows

Kubernetes

image

OpenTelemetry

image

Autodetect

image

@justinkambic justinkambic added release_note:enhancement Team:obs-ux-logs Observability Logs User Experience Team v8.16.0 labels Jul 15, 2024
@justinkambic justinkambic self-assigned this Jul 15, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@justinkambic justinkambic force-pushed the 186397/kubernetes-setup-header branch from d129791 to fbcb8ba Compare July 16, 2024 15:20
@justinkambic justinkambic marked this pull request as ready for review July 16, 2024 15:27
@justinkambic justinkambic requested review from a team as code owners July 16, 2024 15:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)

@justinkambic justinkambic changed the title [Observability Onboarding] [WIP] Add dedicated header for Kubernetes quickstart flow [Observability Onboarding] Add dedicated header for Kubernetes quickstart flow Jul 16, 2024
@justinkambic justinkambic force-pushed the 186397/kubernetes-setup-header branch from 4b0a833 to 1505c58 Compare July 16, 2024 16:42
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Jul 16, 2024
@flash1293
Copy link
Contributor

Just tested and this doesn't work when answering the first question, then clicking the tile - I think it's because it's checking the path for kubernetes, not kubernetes/?category=infra.

In general, it's not explicitly stated in the issue (sorry for that), but by my understanding the idea was to have that header for all the flows, is that right @sileschristian ?

@justinkambic
Copy link
Contributor Author

this doesn't work when answering the first question, then clicking the tile

Sorry I overlooked this. I should've marked this as a draft, I am adding some unit tests that have not been pushed yet. I was hoping to have that available by now but I am doing SDH for infra services this week so I am delayed on everything else I was doing. Thanks for uncovering the issue, I will address it and re-ping when it's ready.

@sileschristian
Copy link

In general, it's not explicitly stated in the issue (sorry for that), but by my understanding the idea was to have that header for all the flows, is that right @sileschristian ?

Yes. To be consistent that was the idea. Since we were working on the K8s, I opened just an issue for this one. But this should be for the rest (Otel, Firehose, Auto-detect, etc)

@justinkambic
Copy link
Contributor Author

But this should be for the rest (Otel, Firehose, Auto-detect, etc)

Ok, let's merge this as a first step and then I will follow up and refactor this header to be general. Do we have copy for the other flows? Or should it keep the generic description text and just change the "Setting up {FLOW}", and have the logo update for whichever flow is covered?

@justinkambic justinkambic force-pushed the 186397/kubernetes-setup-header branch from e37f192 to 5f45981 Compare July 19, 2024 15:10
@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 19, 2024

⏳ Build in-progress

History

  • 💛 Build #222447 was flaky e37f192417f9effc808bff76857785bbc6babd31

cc @justinkambic

@justinkambic justinkambic changed the title [Observability Onboarding] Add dedicated header for Kubernetes quickstart flow [Observability Onboarding] Add customizable header for quickstart flows Jul 24, 2024
@justinkambic justinkambic force-pushed the 186397/kubernetes-setup-header branch from 3a9ee5f to 3a0c019 Compare July 24, 2024 20:14
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner July 26, 2024 15:07
Copy link
Contributor

@thomheymann thomheymann left a comment

Choose a reason for hiding this comment

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

Very nice, this looks so much better than the previous design and makes it clearer which Quickstart flow the user is on.

Couple comments regarding the implementation below

Comment on lines 71 to 84
function toAvatarSize(size?: EuiIconProps['size']): EuiAvatarProps['size'] {
switch (size) {
case 's':
return 's';
case 'm':
return 'm';
case 'l':
return 'l';
case 'xl':
return 'xl';
default:
return 'xl';
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of this switch statement? It looks like they're all the same values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Essentially just making TypeScript happy because you cannot provide an EuiIconProps to EuiAvatarProps size as they have different values defined.

Basically, we want to accept xxl as a size for icons, but EuiAvatar doesn't support this size, so in cases where we want the avatar we can only accept xl. Maybe better to avoid supplying the EUI types, or inverting the rendering by accepting an avatar from the parent.

Copy link
Contributor

@thomheymann thomheymann Jul 29, 2024

Choose a reason for hiding this comment

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

Wouldn't it be easier to just restrict the type of your LogoIcon components' size prop accordingly instead of trying to convert between the two?

If it's important that the prop works for both components (EuiIcon and EuiAvatar) you can use the intersection: EuiIconProps['size'] & EuiAvatarProps['size'].

If the prop is only used by EuiAvatar then simply use EuiAvatarProps['size']

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the parent component accepts a size prop that was previously only EuiIconProps['size'], but now we need to provide that to the Avatar component, whose size is a subset. I think you're right we should accept an intersection and we can use a type guard to infer the right type in the parent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know your thoughts on db27dde and if you think we can further clean it up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great, much simpler!

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 this is overcomplicating things a bit and I'm not sure if managing these icons and descriptions in a central location is desirable.

Is it not possible to restructure the render tree so that it reflects the designs?

Each Quickstart flow should define its own title, description and icon.

So instead of what we currently have:

  <PageHeaderThatNeedsToKnowAboutAllPossibleRoutes />
  <Route path="/auto-detect">
    <AutoDetectPanel />
  </Route>
  <Route path="/kubernetes">
    <SystemLogsPanel />
  </Route>
  <Route>
    <OnboardingFlowForm />
  </Route>

We can simply let each page render its own header:

  <Route path="/auto-detect">
    <CustomHeader />
    <AutoDetectPanel />
  </Route>
  <Route path="/kubernetes">
    <CustomHeader />
    <SystemLogsPanel />
  </Route>
  <Route>
    <PageHeader />
    <OnboardingFlowForm />
  </Route>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is acceptable as well. I was trying to make the changes backward compatible with the existing design but I am fine with re-implementing it in this way.

Copy link
Contributor Author

@justinkambic justinkambic Jul 30, 2024

Choose a reason for hiding this comment

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

I explored this solution and the code is much cleaner:

        <EuiPageTemplate.Section paddingSize="xl" color="subdued" restrictWidth>
          <Routes>
            <Route path="/auto-detect">
              <AutoDetectHeader />
              <AutoDetectPanel />
            </Route>
            <Route path="/systemLogs">
              <Header />
              <BackButton />
              <SystemLogsPanel />
            </Route>
            <Route path="/customLogs">
              <Header />
              <BackButton />
              <CustomLogsPanel />
            </Route>
            <Route path="/kubernetes">
              <KubernetesHeader />
              <KubernetesPanel />
            </Route>
            <Route path="/otel-logs">
              <OtelHeader />
              <OtelLogsPanel />
            </Route>
            <Route>
              <Header />
              <OnboardingFlowForm />
            </Route>
          </Routes>
          <EuiSpacer size="xl" />
        </EuiPageTemplate.Section>

Unfortunately, nesting the header section inside the route kind of messes up a lot of the page layout:

image

EDIT: having thought about this some more, we could make a top-level page component that we provide with children within the routes if we wanted, and allow it to receive custom headers like I've shown above. This would help us avoid having to repeat the page template code for each route.

Copy link
Contributor

@thomheymann thomheymann Jul 30, 2024

Choose a reason for hiding this comment

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

I don't think we need to hack any CSS, you are seeing these issues because your routes are already inside the EuiPageTemplate.Section when they should sit a level above.

In the new designs there are two different layouts. The first layout is the landing page with the background image and the second one is the layout for the quickstart flows with the icon and back button.

I would first create a component for both of these layouts which utilise the EuiPageTemplate components. Then each page can use whichever layout it needs using its own entry point:

App

<Routes>
  <Route path="/auto-detect">
    <AutoDetectPage />
  </Route>
  <Route path="/kubernetes">
    <KubernetesPage />
  </Route>
  <Route>
    <LandingPage />
  </Route>
</Routes>

KubernetesPage / AutoDetectPage

These entry points are optional, if you don't want to create a separate component for each page this markup could also sit directly in the App component inside each route. The point is that we have a reusable component for the different layouts in the designs that hides away the complexity / custom CSS.

<QuickstartPageLayout icon="kubernetes" title="Kubernetes">
  Kubernetes steps
</QuickstartPageLayout>

QuickstartPageLayout

<EuiPageTemplate>
  <EuiPageTemplate.Section>
    Header
  </EuiPageTemplate.Section>
  <EuiPageTemplate.Section>
    <BackButton />
    {children}
  </EuiPageTemplate.Section>
</EuiPageTemplate>

Copy link
Contributor Author

@justinkambic justinkambic Jul 31, 2024

Choose a reason for hiding this comment

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

I don't think we need to hack any CSS, you are seeing these issues because your routes are already inside the EuiPageTemplate.Section when they should sit a level above.

Yes you're right of course, sorry. I was over my EoD and in a rush and when this didn't work right away I quickly posted a comment to keep the conversation going. I came back later with an edit that is very much in line with the solution you proposed here.

I'll ping again when I've implemented this and I agree it'll be much cleaner. Thanks for all the feedback!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thomheymann think we are ok for another look here.

@justinkambic justinkambic force-pushed the 186397/kubernetes-setup-header branch from a13c72b to c9da466 Compare July 30, 2024 14:40
@justinkambic justinkambic requested review from thomheymann and removed request for a team July 31, 2024 19:43
Copy link
Contributor

@mykolaharmash mykolaharmash left a comment

Choose a reason for hiding this comment

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

Looks great ✨ Added a few discussion points, but nothing major.

Also, not for this change, but we need to remove the second OTel header above the stepper (created an issue)

Copy link
Contributor

Choose a reason for hiding this comment

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

Appreciate tests 🙏 We've gotten out of habit writing them in onboarding haha. One thing though, I think "should render ..." kind of tests fit better with Storybooks. It takes care of the rendering part automatically plus we get a visual playground to test a component with different props. I don't mind keeping it this way, but feel free to change if you think Storybooks would indeed work better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we have a storybook flow set up already? If so I'm happy to port, but I don't want to set storybook up as part of this patch. Agree it would be nice-to-have!

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I thought storybooks are setup globaly for all of Kibana, but you might be right that we don't have them for onboarding 😔

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 should add them though, would be a nice dev quality of life enhancement.

@justinkambic justinkambic enabled auto-merge (squash) August 1, 2024 17:04
@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 1, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #86 / task_manager with mget task claimer migrations 8.5.0 migrates active tasks to set enabled to true

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityOnboarding 225 235 +10

Async chunks

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

id before after diff
observabilityOnboarding 243.7KB 246.5KB +2.8KB

History

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

cc @justinkambic

Copy link
Contributor

@mykolaharmash mykolaharmash left a comment

Choose a reason for hiding this comment

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

Looks great, thank you @justinkambic!

@justinkambic justinkambic merged commit b833c67 into elastic:main Aug 2, 2024
24 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 2, 2024
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 ci:project-deploy-observability Create an Observability project release_note:enhancement Team:obs-ux-logs Observability Logs User Experience Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Observability Onboarding] Add K8s page header to the quick start flow
9 participants