-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infrastructure UI] Inventory educate about show button (#149981)
Closes [#149615](#149615) ## Summary This PR adds a tooltip educating the user about the filter in the Show drop-down list. Testing - Navigate to the Inventory Page and the new tour should be visible: <img width="708" alt="image" src="https://user-images.githubusercontent.com/14139027/216096889-486f07f0-f182-4f20-a4f4-bb8c535d4af9.png"> - if it's dismissed (after the button is clicked it should not be visible anymore until the session is active - can be tested with page refresh or navigating to a different page and back) - If it's not dismissed it should be persisted per user/browser session - can be also checked with page refresh
- Loading branch information
1 parent
60defc5
commit 45e5776
Showing
6 changed files
with
127 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/infra/public/pages/metrics/inventory_view/components/kubernetes_tour.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { ReactElement } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiTourStep, EuiText, EuiButtonEmpty } from '@elastic/eui'; | ||
import useLocalStorage from 'react-use/lib/useLocalStorage'; | ||
|
||
interface Props { | ||
children: ReactElement; | ||
} | ||
|
||
export const KUBERNETES_TOUR_STORAGE_KEY = 'isKubernetesTourSeen'; | ||
|
||
export const KubernetesTour = ({ children }: Props) => { | ||
const [isTourSeen, setIsTourSeen] = useLocalStorage(KUBERNETES_TOUR_STORAGE_KEY, false); | ||
const markTourAsSeen = () => setIsTourSeen(true); | ||
|
||
return ( | ||
<div> | ||
<EuiTourStep | ||
content={ | ||
<EuiText size="s" color="subdued" data-test-subj="infra-kubernetesTour-text"> | ||
{i18n.translate('xpack.infra.homePage.kubernetesTour.text', { | ||
defaultMessage: | ||
'Click here to see your infrastructure in different ways, including Kubernetes pods.', | ||
})} | ||
</EuiText> | ||
} | ||
isStepOpen={!isTourSeen} | ||
maxWidth={350} | ||
onFinish={markTourAsSeen} | ||
step={1} | ||
stepsTotal={1} | ||
title={i18n.translate('xpack.infra.homePage.kubernetesTour.title', { | ||
defaultMessage: 'Want a different view?', | ||
})} | ||
anchorPosition="downCenter" | ||
footerAction={ | ||
<EuiButtonEmpty | ||
data-test-subj="infra-kubernetesTour-dismiss" | ||
size="s" | ||
color="text" | ||
onClick={markTourAsSeen} | ||
> | ||
{i18n.translate('xpack.infra.homePage.kubernetesTour.dismiss', { | ||
defaultMessage: 'Dismiss', | ||
})} | ||
</EuiButtonEmpty> | ||
} | ||
> | ||
{children} | ||
</EuiTourStep> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters