Skip to content

Commit

Permalink
[8.8] [Synthetics] Fix complete tests sparkline (#155838) (#156660)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] Fix complete tests sparkline
(#155838)](#155838)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-05-04T09:39:24Z","message":"[Synthetics]
Fix complete tests sparkline
(#155838)","sha":"fffe57dc1db2dc5fa993e8277f1e1ae1dfb05803","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.8.0","v8.9.0"],"number":155838,"url":"https://github.com/elastic/kibana/pull/155838","mergeCommit":{"message":"[Synthetics]
Fix complete tests sparkline
(#155838)","sha":"fffe57dc1db2dc5fa993e8277f1e1ae1dfb05803"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155838","number":155838,"mergeCommit":{"message":"[Synthetics]
Fix complete tests sparkline
(#155838)","sha":"fffe57dc1db2dc5fa993e8277f1e1ae1dfb05803"}}]}]
BACKPORT-->

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
  • Loading branch information
kibanamachine and shahzad31 authored May 4, 2023
1 parent 15c0b0a commit 735918b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';
import { ColumnFilter, ConfigProps, SeriesConfig } from '../../types';
import {
FieldLabels,
Expand Down Expand Up @@ -99,7 +100,7 @@ export function getSyntheticsKPIConfig({ dataView }: ConfigProps): SeriesConfig
label: 'Monitor Errors',
id: 'monitor_errors',
columnType: OPERATION_COLUMN,
field: 'state.id',
field: 'monitor.check_group',
columnFilters: [
{
language: 'kuery',
Expand All @@ -108,9 +109,11 @@ export function getSyntheticsKPIConfig({ dataView }: ConfigProps): SeriesConfig
],
},
{
label: 'Monitor Complete',
id: 'state.up',
field: 'state.up',
label: i18n.translate('xpack.exploratoryView.expView.successful', {
defaultMessage: 'Successful count',
}),
id: 'monitor_successful',
field: 'monitor.check_group',
columnType: OPERATION_COLUMN,
columnFilters: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export function getSyntheticsSingleMetricConfig({ dataView }: ConfigProps): Seri
format: 'number',
},
{
id: 'monitor_complete',
label: i18n.translate('xpack.exploratoryView.expView.complete', {
defaultMessage: 'Complete',
id: 'monitor_successful',
label: i18n.translate('xpack.exploratoryView.expView.successful', {
defaultMessage: 'Successful count',
}),
metricStateOptions: {
titlePosition: 'bottom',
Expand Down
6 changes: 2 additions & 4 deletions x-pack/plugins/observability/public/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ export interface Params {
// so I've recreated this simple version for this purpose.
function SimpleRedirect({ to, redirectToApp }: { to: string; redirectToApp?: string }) {
const {
http: { basePath },
application: { navigateToApp },
} = useKibana().services;
const history = useHistory();
const { search, hash } = useLocation();

if (redirectToApp) {
window.location.replace(
`${window.location.origin}${basePath.prepend(`/app/${redirectToApp}${to}${search}${hash}`)}`
);
navigateToApp(redirectToApp, { path: `/${search}${hash}`, replace: true });
} else if (to) {
history.replace(to);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const MonitorCompleteCount = (props: MonitorCompleteCountProps) => {

return (
<ExploratoryViewEmbeddable
id="monitorCompleteCount"
id="monitorSuccessfulCount"
align="left"
reportType={ReportTypes.SINGLE_METRIC}
attributes={[
Expand All @@ -43,14 +43,17 @@ export const MonitorCompleteCount = (props: MonitorCompleteCountProps) => {
'observer.geo.name': [selectedLocation.label],
},
dataType: 'synthetics',
selectedMetricField: 'monitor_complete',
name: COMPLETE_LABEL,
selectedMetricField: 'monitor_successful',
name: SUCCESSFUL_LABEL,
},
]}
/>
);
};

export const COMPLETE_LABEL = i18n.translate('xpack.synthetics.monitorDetails.summary.complete', {
defaultMessage: 'Complete',
});
export const SUCCESSFUL_LABEL = i18n.translate(
'xpack.synthetics.monitorDetails.summary.successful',
{
defaultMessage: 'Successful',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { useKibana } from '@kbn/kibana-react-plugin/public';
import React from 'react';
import { useEuiTheme } from '@elastic/eui';
import { COMPLETE_LABEL } from './monitor_complete_count';
import { SUCCESSFUL_LABEL } from './monitor_complete_count';
import { ClientPluginsStart } from '../../../../../plugin';
import { useMonitorQueryId } from '../hooks/use_monitor_query_id';
import { useSelectedLocation } from '../hooks/use_selected_location';
Expand All @@ -33,7 +33,7 @@ export const MonitorCompleteSparklines = (props: Props) => {

return (
<ExploratoryViewEmbeddable
id="monitorCompleteSparklines"
id="monitorSuccessfulSparklines"
reportType="kpi-over-time"
axisTitlesVisibility={{ x: false, yRight: false, yLeft: false }}
legendIsVisible={false}
Expand All @@ -47,8 +47,8 @@ export const MonitorCompleteSparklines = (props: Props) => {
'observer.geo.name': [selectedLocation.label],
},
dataType: 'synthetics',
selectedMetricField: 'state.id',
name: COMPLETE_LABEL,
selectedMetricField: 'monitor_successful',
name: SUCCESSFUL_LABEL,
color: euiTheme.colors.success,
operationType: 'unique_count',
},
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -25528,7 +25528,6 @@
"xpack.exploratoryView.expView.alerts.status": "Statut de l'alerte",
"xpack.exploratoryView.expView.avgDuration": "Moy. Durée",
"xpack.exploratoryView.expView.chartTypes.label": "Type de graphique",
"xpack.exploratoryView.expView.complete": "Terminé",
"xpack.exploratoryView.expView.dateRanger.endDate": "Date de fin",
"xpack.exploratoryView.expView.dateRanger.startDate": "Date de début",
"xpack.exploratoryView.expView.errors": "Erreurs",
Expand Down Expand Up @@ -34614,7 +34613,6 @@
"xpack.synthetics.monitorDetails.statusBar.pingType.tcp": "TCP",
"xpack.synthetics.monitorDetails.summary.availability": "Disponibilité",
"xpack.synthetics.monitorDetails.summary.brushArea": "Brosser une zone pour une plus haute fidélité",
"xpack.synthetics.monitorDetails.summary.complete": "Terminé",
"xpack.synthetics.monitorDetails.summary.duration": "Durée",
"xpack.synthetics.monitorDetails.summary.errors": "Erreurs",
"xpack.synthetics.monitorDetails.summary.failedTests": "Tests ayant échoué",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -25509,7 +25509,6 @@
"xpack.exploratoryView.expView.alerts.status": "アラートステータス",
"xpack.exploratoryView.expView.avgDuration": "平均期間",
"xpack.exploratoryView.expView.chartTypes.label": "チャートタイプ",
"xpack.exploratoryView.expView.complete": "完了",
"xpack.exploratoryView.expView.dateRanger.endDate": "終了日",
"xpack.exploratoryView.expView.dateRanger.startDate": "開始日",
"xpack.exploratoryView.expView.errors": "エラー",
Expand Down Expand Up @@ -34593,7 +34592,6 @@
"xpack.synthetics.monitorDetails.statusBar.pingType.tcp": "TCP",
"xpack.synthetics.monitorDetails.summary.availability": "可用性",
"xpack.synthetics.monitorDetails.summary.brushArea": "信頼度を高めるためにエリアを精査",
"xpack.synthetics.monitorDetails.summary.complete": "完了",
"xpack.synthetics.monitorDetails.summary.duration": "期間",
"xpack.synthetics.monitorDetails.summary.errors": "エラー",
"xpack.synthetics.monitorDetails.summary.failedTests": "失敗したテスト",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -25526,7 +25526,6 @@
"xpack.exploratoryView.expView.alerts.status": "告警状态",
"xpack.exploratoryView.expView.avgDuration": "平均持续时间",
"xpack.exploratoryView.expView.chartTypes.label": "图表类型",
"xpack.exploratoryView.expView.complete": "已完成",
"xpack.exploratoryView.expView.dateRanger.endDate": "结束日期",
"xpack.exploratoryView.expView.dateRanger.startDate": "开始日期",
"xpack.exploratoryView.expView.errors": "错误",
Expand Down Expand Up @@ -34610,7 +34609,6 @@
"xpack.synthetics.monitorDetails.statusBar.pingType.tcp": "TCP",
"xpack.synthetics.monitorDetails.summary.availability": "可用性",
"xpack.synthetics.monitorDetails.summary.brushArea": "轻刷某个区域以提高保真度",
"xpack.synthetics.monitorDetails.summary.complete": "已完成",
"xpack.synthetics.monitorDetails.summary.duration": "持续时间",
"xpack.synthetics.monitorDetails.summary.errors": "错误",
"xpack.synthetics.monitorDetails.summary.failedTests": "失败的测试",
Expand Down

0 comments on commit 735918b

Please sign in to comment.