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.
[Synthetics] Test run detail page header (elastic#148470)
Fixes elastic#145377 Fixes elastic#148472
- Loading branch information
1 parent
c56a73a
commit 987c23b
Showing
23 changed files
with
344 additions
and
57 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
56 changes: 56 additions & 0 deletions
56
...tics/components/monitors_page/overview/overview/overview_errors/overview_errors_count.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,56 @@ | ||
/* | ||
* 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 { useKibana } from '@kbn/kibana-react-plugin/public'; | ||
import React, { useMemo } from 'react'; | ||
import { ReportTypes } from '@kbn/observability-plugin/public'; | ||
import { EuiLoadingContent } from '@elastic/eui'; | ||
import { ClientPluginsStart } from '../../../../../../../plugin'; | ||
|
||
interface MonitorErrorsCountProps { | ||
from: string; | ||
to: string; | ||
locationLabel?: string; | ||
monitorId: string[]; | ||
} | ||
|
||
export const OverviewErrorsCount = ({ | ||
monitorId, | ||
from, | ||
to, | ||
locationLabel, | ||
}: MonitorErrorsCountProps) => { | ||
const { observability } = useKibana<ClientPluginsStart>().services; | ||
|
||
const { ExploratoryViewEmbeddable } = observability; | ||
|
||
const time = useMemo(() => ({ from, to }), [from, to]); | ||
|
||
if (!monitorId) { | ||
return <EuiLoadingContent lines={3} />; | ||
} | ||
|
||
return ( | ||
<ExploratoryViewEmbeddable | ||
align="left" | ||
customHeight="70px" | ||
reportType={ReportTypes.SINGLE_METRIC} | ||
attributes={[ | ||
{ | ||
time, | ||
reportDefinitions: { | ||
'monitor.id': monitorId, | ||
...(locationLabel ? { 'observer.geo.name': [locationLabel] } : {}), | ||
}, | ||
dataType: 'synthetics', | ||
selectedMetricField: 'monitor_errors', | ||
name: 'synthetics-series-1', | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
49 changes: 49 additions & 0 deletions
49
...components/monitors_page/overview/overview/overview_errors/overview_errors_sparklines.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,49 @@ | ||
/* | ||
* 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 { useKibana } from '@kbn/kibana-react-plugin/public'; | ||
import React, { useMemo } from 'react'; | ||
import { useEuiTheme } from '@elastic/eui'; | ||
import { ClientPluginsStart } from '../../../../../../../plugin'; | ||
|
||
interface Props { | ||
from: string; | ||
to: string; | ||
monitorId: string[]; | ||
} | ||
export const OverviewErrorsSparklines = ({ from, to, monitorId }: Props) => { | ||
const { observability } = useKibana<ClientPluginsStart>().services; | ||
|
||
const { ExploratoryViewEmbeddable } = observability; | ||
|
||
const { euiTheme } = useEuiTheme(); | ||
|
||
const time = useMemo(() => ({ from, to }), [from, to]); | ||
|
||
return ( | ||
<ExploratoryViewEmbeddable | ||
reportType="kpi-over-time" | ||
axisTitlesVisibility={{ x: false, yRight: false, yLeft: false }} | ||
legendIsVisible={false} | ||
hideTicks={true} | ||
attributes={[ | ||
{ | ||
time, | ||
seriesType: 'area', | ||
reportDefinitions: { | ||
'monitor.id': monitorId, | ||
}, | ||
dataType: 'synthetics', | ||
selectedMetricField: 'monitor_errors', | ||
name: 'Monitor errors', | ||
color: euiTheme.colors.danger, | ||
operationType: 'unique_count', | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
28 changes: 28 additions & 0 deletions
28
...ynthetics/public/apps/synthetics/components/test_run_details/components/test_run_date.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,28 @@ | ||
/* | ||
* 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 { EuiDescriptionList, EuiLoadingContent } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { useJourneySteps } from '../../monitor_details/hooks/use_journey_steps'; | ||
import { useFormatTestRunAt } from '../../../utils/monitor_test_result/test_time_formats'; | ||
|
||
export const TestRunDate: React.FC = () => { | ||
const { data } = useJourneySteps(); | ||
|
||
let startedAt: string | ReactElement = useFormatTestRunAt(data?.details?.timestamp); | ||
|
||
if (!startedAt) { | ||
startedAt = <EuiLoadingContent lines={1} />; | ||
} | ||
|
||
return <EuiDescriptionList listItems={[{ title: ERROR_DURATION, description: startedAt }]} />; | ||
}; | ||
|
||
const ERROR_DURATION = i18n.translate('xpack.synthetics.testDetails.date', { | ||
defaultMessage: 'Date', | ||
}); |
49 changes: 49 additions & 0 deletions
49
...ck/plugins/synthetics/public/apps/synthetics/components/test_run_details/route_config.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,49 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import React from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { OutPortal } from 'react-reverse-portal'; | ||
import { RouteProps } from '../../routes'; | ||
import { MonitorDetailsStatus } from '../monitor_details/monitor_details_status'; | ||
import { MonitorDetailsLocation } from '../monitor_details/monitor_details_location'; | ||
import { TestRunDate } from './components/test_run_date'; | ||
import { TEST_RUN_DETAILS_ROUTE } from '../../../../../common/constants'; | ||
import { TestRunDetails } from './test_run_details'; | ||
import { MonitorDetailsLinkPortalNode } from '../monitor_add_edit/portals'; | ||
|
||
export const getTestRunDetailsRoute = ( | ||
history: ReturnType<typeof useHistory>, | ||
syntheticsPath: string, | ||
baseTitle: string | ||
): RouteProps => { | ||
return { | ||
title: i18n.translate('xpack.synthetics.testRunDetailsRoute.title', { | ||
defaultMessage: 'Test run details | {baseTitle}', | ||
values: { baseTitle }, | ||
}), | ||
path: TEST_RUN_DETAILS_ROUTE, | ||
component: TestRunDetails, | ||
dataTestSubj: 'syntheticsMonitorTestRunDetailsPage', | ||
pageHeader: { | ||
breadcrumbs: [ | ||
{ | ||
text: <OutPortal node={MonitorDetailsLinkPortalNode} />, | ||
}, | ||
], | ||
pageTitle: ( | ||
<FormattedMessage | ||
id="xpack.synthetics.testRunDetailsRoute.page.title" | ||
defaultMessage="Test run details" | ||
/> | ||
), | ||
rightSideItems: [<TestRunDate />, <MonitorDetailsStatus />, <MonitorDetailsLocation />], | ||
}, | ||
}; | ||
}; |
Oops, something went wrong.