-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Adds button group to navigate to "All services" (#142911)
* [APM] Adds button group to navigate to "All services" (#142084) * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * Adds button group legend, fixes spacing and translation IDs * makes the button group part of the page template * addresses feedback * addressed feedback: - Use 'All services' as the default landing page - swap order of button group -> All services, Service groups - move tour from the create button to service group half of the button group - have service groups always enabled but marked Beta - removed some branching logic in routes / page templates - add 'Send feedback' link - fixed service count in cards * fixes tests and deep links * change button group to single type Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
0344e89
commit 18e37cf
Showing
24 changed files
with
319 additions
and
345 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
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
78 changes: 78 additions & 0 deletions
78
x-pack/plugins/apm/public/components/app/service_groups/service_groups_button_group.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 { EuiButtonGroup } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { ServiceGroupsTour } from './service_groups_tour'; | ||
import { useServiceGroupsTour } from './use_service_groups_tour'; | ||
|
||
const buttonGroupOptions = { | ||
allServices: { | ||
option: { | ||
id: 'allServices', | ||
label: i18n.translate('xpack.apm.serviceGroups.buttonGroup.allServices', { | ||
defaultMessage: 'All services', | ||
}), | ||
}, | ||
pathname: '/services', | ||
}, | ||
serviceGroups: { | ||
option: { | ||
id: 'serviceGroups', | ||
label: i18n.translate( | ||
'xpack.apm.serviceGroups.buttonGroup.serviceGroups', | ||
{ defaultMessage: 'Service groups' } | ||
), | ||
}, | ||
pathname: '/service-groups', | ||
}, | ||
}; | ||
|
||
type SelectedNavButton = keyof typeof buttonGroupOptions; | ||
|
||
export function ServiceGroupsButtonGroup({ | ||
selectedNavButton, | ||
}: { | ||
selectedNavButton: SelectedNavButton; | ||
}) { | ||
const history = useHistory(); | ||
const { tourEnabled, dismissTour } = useServiceGroupsTour('createGroup'); | ||
return ( | ||
<ServiceGroupsTour | ||
tourEnabled={tourEnabled} | ||
dismissTour={dismissTour} | ||
anchorPosition="leftUp" | ||
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.', | ||
} | ||
)} | ||
> | ||
<EuiButtonGroup | ||
color="primary" | ||
options={[ | ||
buttonGroupOptions.allServices.option, | ||
buttonGroupOptions.serviceGroups.option, | ||
]} | ||
idSelected={selectedNavButton as string} | ||
onChange={(id) => { | ||
const { pathname } = buttonGroupOptions[id as SelectedNavButton]; | ||
history.push({ pathname }); | ||
}} | ||
legend={i18n.translate('xpack.apm.servicesGroups.buttonGroup.legend', { | ||
defaultMessage: 'View all services or service groups', | ||
})} | ||
/> | ||
</ServiceGroupsTour> | ||
); | ||
} |
Oops, something went wrong.