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

[APM] Adds button group to navigate to "All services" #142911

Merged
merged 14 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('APM deep links', () => {
cy.getByTestSubj('nav-search-input').type('APM');
cy.contains('APM');
cy.contains('APM / Services');
cy.contains('APM / Service groups');
cy.contains('APM / Traces');
cy.contains('APM / Service Map');

Expand All @@ -28,6 +29,11 @@ describe('APM deep links', () => {
cy.contains('APM / Services').click({ force: true });
cy.url().should('include', '/apm/services');

cy.getByTestSubj('nav-search-input').type('APM');
// navigates to service groups page
cy.contains('APM / Service groups').click({ force: true });
cy.url().should('include', '/apm/service-groups');

cy.getByTestSubj('nav-search-input').type('APM');
// navigates to traces page
cy.contains('APM / Traces').click({ force: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Service inventory - header filters', () => {
specialServiceName,
})
);
cy.dismissServiceGroupsTour();
});

after(() => {
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ Cypress.Commands.add(
}
);

Cypress.Commands.add('dismissServiceGroupsTour', () => {
window.localStorage.setItem(
'apm.serviceGroupsTour',
JSON.stringify({
createGroup: false,
editGroup: false,
})
);
});

// A11y configuration

const axeConfig = {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ declare namespace Cypress {
}): void;
updateAdvancedSettings(settings: Record<string, unknown>): void;
getByTestSubj(selector: string): Chainable<JQuery<Element>>;
dismissServiceGroupsTour(): void;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@
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';
// 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');
// 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.',
}
)}
// <ServiceGroupsTour
Copy link
Contributor

Choose a reason for hiding this comment

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

@ogupte could this be removed instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, i'll remove it while working on alerts integration

// 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"
data-test-subj="apmCreateServiceGroupButton"
onClick={() => {
// dismissTour();
onClick();
}}
>
<EuiButton
iconType="plusInCircle"
data-test-subj="apmCreateServiceGroupButton"
onClick={() => {
dismissTour();
onClick();
}}
>
{i18n.translate('xpack.apm.serviceGroups.createGroupLabel', {
defaultMessage: 'Create group',
})}
</EuiButton>
</ServiceGroupsTour>
{i18n.translate('xpack.apm.serviceGroups.createGroupLabel', {
defaultMessage: 'Create group',
})}
</EuiButton>
// </ServiceGroupsTour>
);
}
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>
);
}
Loading