forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Service overview tab and route (elastic#81972)
Placeholder tab and route for service overview page. Fixes elastic#81718.
- Loading branch information
Showing
5 changed files
with
324 additions
and
4 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
246 changes: 246 additions & 0 deletions
246
x-pack/plugins/apm/public/components/app/service_overview/index.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,246 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { useTrackPageview } from '../../../../../observability/public'; | ||
import { ErrorOverviewLink } from '../../shared/Links/apm/ErrorOverviewLink'; | ||
import { ServiceMapLink } from '../../shared/Links/apm/ServiceMapLink'; | ||
import { TransactionOverviewLink } from '../../shared/Links/apm/TransactionOverviewLink'; | ||
|
||
const rowHeight = 310; | ||
const latencyChartRowHeight = 230; | ||
|
||
const Row = styled(EuiFlexItem)` | ||
height: ${rowHeight}px; | ||
`; | ||
|
||
const LatencyChartRow = styled(EuiFlexItem)` | ||
height: ${latencyChartRowHeight}px; | ||
`; | ||
|
||
const TableLinkFlexItem = styled(EuiFlexItem)` | ||
& > a { | ||
text-align: right; | ||
} | ||
`; | ||
|
||
interface ServiceOverviewProps { | ||
serviceName: string; | ||
} | ||
|
||
export function ServiceOverview({ serviceName }: ServiceOverviewProps) { | ||
useTrackPageview({ app: 'apm', path: 'service_overview' }); | ||
useTrackPageview({ app: 'apm', path: 'service_overview', delay: 15000 }); | ||
|
||
return ( | ||
<EuiFlexGroup direction="column" gutterSize="s"> | ||
<EuiFlexItem> | ||
<EuiFlexGroup | ||
gutterSize="xs" | ||
style={{ marginTop: 16, marginBottom: 8 }} | ||
> | ||
<EuiFlexItem grow={2}> | ||
<EuiPanel>Search bar</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiPanel>Comparison picker</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiPanel>Date picker</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
<LatencyChartRow> | ||
<EuiPanel> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate('xpack.apm.serviceOverview.latencyChartTitle', { | ||
defaultMessage: 'Latency', | ||
})} | ||
</h2> | ||
</EuiTitle> | ||
</EuiPanel> | ||
</LatencyChartRow> | ||
<Row> | ||
<EuiFlexGroup gutterSize="s"> | ||
<EuiFlexItem grow={4}> | ||
<EuiPanel> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.trafficChartTitle', | ||
{ | ||
defaultMessage: 'Traffic', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={6}> | ||
<EuiPanel> | ||
<EuiFlexGroup justifyContent="spaceBetween"> | ||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.transactionsTableTitle', | ||
{ | ||
defaultMessage: 'Transactions', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<TableLinkFlexItem> | ||
<TransactionOverviewLink serviceName={serviceName}> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.transactionsTableLinkText', | ||
{ | ||
defaultMessage: 'View transactions', | ||
} | ||
)} | ||
</TransactionOverviewLink> | ||
</TableLinkFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</Row> | ||
<Row> | ||
<EuiFlexGroup gutterSize="s"> | ||
<EuiFlexItem grow={4}> | ||
<EuiPanel> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.errorRateChartTitle', | ||
{ | ||
defaultMessage: 'Error rate', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={6}> | ||
<EuiPanel> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.errorsTableTitle', | ||
{ | ||
defaultMessage: 'Errors', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<TableLinkFlexItem> | ||
<ErrorOverviewLink serviceName={serviceName}> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.errorsTableLinkText', | ||
{ | ||
defaultMessage: 'View errors', | ||
} | ||
)} | ||
</ErrorOverviewLink> | ||
</TableLinkFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</Row> | ||
<Row> | ||
<EuiFlexGroup gutterSize="s"> | ||
<EuiFlexItem grow={4}> | ||
<EuiPanel> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.averageDurationBySpanTypeChartTitle', | ||
{ | ||
defaultMessage: 'Average duration by span type', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={6}> | ||
<EuiPanel> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.dependenciesTableTitle', | ||
{ | ||
defaultMessage: 'Dependencies', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<TableLinkFlexItem> | ||
<ServiceMapLink serviceName={serviceName}> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.dependenciesTableLinkText', | ||
{ | ||
defaultMessage: 'View service map', | ||
} | ||
)} | ||
</ServiceMapLink> | ||
</TableLinkFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</Row> | ||
<Row> | ||
<EuiFlexGroup gutterSize="s"> | ||
<EuiFlexItem grow={4}> | ||
<EuiPanel> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.instancesLatencyDistributionChartTitle', | ||
{ | ||
defaultMessage: 'Instances latency distribution', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={6}> | ||
<EuiPanel> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
{i18n.translate( | ||
'xpack.apm.serviceOverview.instancesTableTitle', | ||
{ | ||
defaultMessage: 'Instances', | ||
} | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</Row> | ||
</EuiFlexGroup> | ||
); | ||
} |
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import React, { ReactNode } from 'react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import { MockApmPluginContextWrapper } from '../../../context/ApmPluginContext/MockApmPluginContext'; | ||
import { ServiceOverview } from './'; | ||
|
||
function Wrapper({ children }: { children?: ReactNode }) { | ||
return ( | ||
<MemoryRouter> | ||
<MockApmPluginContextWrapper>{children}</MockApmPluginContextWrapper> | ||
</MemoryRouter> | ||
); | ||
} | ||
|
||
describe('ServiceOverview', () => { | ||
it('renders', () => { | ||
expect(() => | ||
render(<ServiceOverview serviceName="test service name" />, { | ||
wrapper: Wrapper, | ||
}) | ||
).not.toThrowError(); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/apm/public/components/shared/Links/apm/service_overview_link.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,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React from 'react'; | ||
import { APMLink, APMLinkExtendProps } from './APMLink'; | ||
|
||
interface ServiceOverviewLinkProps extends APMLinkExtendProps { | ||
serviceName: string; | ||
} | ||
|
||
export function ServiceOverviewLink({ | ||
serviceName, | ||
...rest | ||
}: ServiceOverviewLinkProps) { | ||
return <APMLink path={`/services/${serviceName}/overview`} {...rest} />; | ||
} |