forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Service groups: Add EuiTour steps for assisting users in creati…
…ng their first service group and provide guidance on the navigation changes (elastic#128068)
- Loading branch information
1 parent
7d29e42
commit cf082dd
Showing
7 changed files
with
252 additions
and
20 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
x-pack/plugins/apm/public/components/app/service_groups/service_group_save/create_button.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,47 @@ | ||
/* | ||
* 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 { EuiButton } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { ServiceGroupsTour } from '../service_groups_tour'; | ||
import { useServiceGroupsTour } from '../use_service_groups_tour'; | ||
|
||
interface Props { | ||
onClick: () => void; | ||
} | ||
|
||
export function CreateButton({ onClick }: Props) { | ||
const { tourEnabled, dismissTour } = useServiceGroupsTour('createGroup'); | ||
return ( | ||
<ServiceGroupsTour | ||
tourEnabled={tourEnabled} | ||
dismissTour={dismissTour} | ||
title={i18n.translate('xpack.apm.serviceGroups.tour.createGroups.title', { | ||
defaultMessage: 'Introducing service groups', | ||
})} | ||
content={i18n.translate( | ||
'xpack.apm.serviceGroups.tour.createGroups.content', | ||
{ | ||
defaultMessage: | ||
'Group services together to build curated inventory views that remove noise and simplify investigations across services. Groups are Kibana space-specific and available for any users with appropriate access.', | ||
} | ||
)} | ||
> | ||
<EuiButton | ||
iconType="plusInCircle" | ||
onClick={() => { | ||
dismissTour(); | ||
onClick(); | ||
}} | ||
> | ||
{i18n.translate('xpack.apm.serviceGroups.createGroupLabel', { | ||
defaultMessage: 'Create group', | ||
})} | ||
</EuiButton> | ||
</ServiceGroupsTour> | ||
); | ||
} |
47 changes: 47 additions & 0 deletions
47
x-pack/plugins/apm/public/components/app/service_groups/service_group_save/edit_button.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,47 @@ | ||
/* | ||
* 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 { EuiButton } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { ServiceGroupsTour } from '../service_groups_tour'; | ||
import { useServiceGroupsTour } from '../use_service_groups_tour'; | ||
|
||
interface Props { | ||
onClick: () => void; | ||
} | ||
|
||
export function EditButton({ onClick }: Props) { | ||
const { tourEnabled, dismissTour } = useServiceGroupsTour('editGroup'); | ||
return ( | ||
<ServiceGroupsTour | ||
tourEnabled={tourEnabled} | ||
dismissTour={dismissTour} | ||
title={i18n.translate('xpack.apm.serviceGroups.tour.editGroups.title', { | ||
defaultMessage: 'Edit this service group', | ||
})} | ||
content={i18n.translate( | ||
'xpack.apm.serviceGroups.tour.editGroups.content', | ||
{ | ||
defaultMessage: | ||
'Use the edit option to change the name, query, or details of this service group.', | ||
} | ||
)} | ||
> | ||
<EuiButton | ||
iconType="pencil" | ||
onClick={() => { | ||
dismissTour(); | ||
onClick(); | ||
}} | ||
> | ||
{i18n.translate('xpack.apm.serviceGroups.editGroupLabel', { | ||
defaultMessage: 'Edit group', | ||
})} | ||
</EuiButton> | ||
</ServiceGroupsTour> | ||
); | ||
} |
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
78 changes: 78 additions & 0 deletions
78
x-pack/plugins/apm/public/components/app/service_groups/service_groups_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,78 @@ | ||
/* | ||
* 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 { EuiButtonEmpty, EuiSpacer, EuiText, EuiTourStep } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import React from 'react'; | ||
import { ElasticDocsLink } from '../../shared/links/elastic_docs_link'; | ||
|
||
export type TourType = 'createGroup' | 'editGroup' | 'serviceGroupCard'; | ||
|
||
interface Props { | ||
title: string; | ||
content: string; | ||
tourEnabled: boolean; | ||
dismissTour: () => void; | ||
children: React.ReactElement; | ||
} | ||
|
||
export function ServiceGroupsTour({ | ||
tourEnabled, | ||
dismissTour, | ||
title, | ||
content, | ||
children, | ||
}: Props) { | ||
return ( | ||
<EuiTourStep | ||
content={ | ||
<> | ||
<EuiText size="s">{content}</EuiText> | ||
<EuiSpacer /> | ||
<FormattedMessage | ||
id="xpack.apm.serviceGroups.tour.content.link" | ||
defaultMessage="Learn more in the {docsLink}." | ||
values={{ | ||
docsLink: ( | ||
<ElasticDocsLink | ||
section="/kibana" | ||
path="/services.html" | ||
target="blank" | ||
> | ||
{i18n.translate( | ||
'xpack.apm.serviceGroups.tour.content.link.docs', | ||
{ | ||
defaultMessage: 'docs', | ||
} | ||
)} | ||
</ElasticDocsLink> | ||
), | ||
}} | ||
/> | ||
</> | ||
} | ||
isStepOpen={tourEnabled} | ||
onFinish={() => {}} | ||
maxWidth={300} | ||
minWidth={300} | ||
step={1} | ||
stepsTotal={1} | ||
title={title} | ||
anchorPosition="leftUp" | ||
footerAction={ | ||
<EuiButtonEmpty color="text" size="xs" onClick={dismissTour}> | ||
{i18n.translate('xpack.apm.serviceGroups.tour.dismiss', { | ||
defaultMessage: 'Dismiss', | ||
})} | ||
</EuiButtonEmpty> | ||
} | ||
> | ||
{children} | ||
</EuiTourStep> | ||
); | ||
} |
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/apm/public/components/app/service_groups/use_service_groups_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,31 @@ | ||
/* | ||
* 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 { useLocalStorage } from '../../../hooks/use_local_storage'; | ||
import { TourType } from './service_groups_tour'; | ||
|
||
const INITIAL_STATE: Record<TourType, boolean> = { | ||
createGroup: true, | ||
editGroup: true, | ||
serviceGroupCard: true, | ||
}; | ||
|
||
export function useServiceGroupsTour(type: TourType) { | ||
const [tourEnabled, setTourEnabled] = useLocalStorage( | ||
'apm.serviceGroupsTour', | ||
INITIAL_STATE | ||
); | ||
|
||
return { | ||
tourEnabled: tourEnabled[type], | ||
dismissTour: () => | ||
setTourEnabled({ | ||
...tourEnabled, | ||
[type]: false, | ||
}), | ||
}; | ||
} |