Skip to content

Commit

Permalink
[7.17] [Uptime] handle null duration on ping list (#125438) (#125556)
Browse files Browse the repository at this point in the history
* [Uptime] handle null duration on ping list (#125438)

* uptime - handle null duration

* adjust types

* Update x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts

* raise per page of synthetics monitors

* Remove tooltip

(cherry picked from commit 52e9c51)

# Conflicts:
#	x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx
#	x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx
#	x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts

* Update x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.tsx
  • Loading branch information
dominiqueclarke authored Feb 14, 2022
1 parent 251ff95 commit dc3fe64
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/uptime/common/runtime_types/ping/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ export type Tls = t.TypeOf<typeof TlsType>;

export const MonitorType = t.intersection([
t.type({
duration: t.type({
us: t.number,
}),
id: t.string,
status: t.string,
type: t.string,
}),
t.partial({
duration: t.type({
us: t.number,
}),
check_group: t.string,
ip: t.string,
name: t.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('PingList component', () => {
type: 'io',
},
monitor: {
duration: { us: 1370 },
id: 'auto-tcp-0X81440A68E839814D',
ip: '255.255.255.0',
name: '',
Expand Down Expand Up @@ -161,9 +160,6 @@ describe('PingList component', () => {
"type": "io",
},
"monitor": Object {
"duration": Object {
"us": 1370,
},
"id": "auto-tcp-0X81440A68E839814D",
"ip": "255.255.255.0",
"name": "",
Expand All @@ -186,6 +182,13 @@ describe('PingList component', () => {
});
});

describe('duration column', () => {
it('shows -- when duration is null', () => {
const { getByTestId } = render(<PingList />);
expect(getByTestId('ping-list-duration-unavailable-tool-tip')).toBeInTheDocument();
});
});

describe('formatDuration', () => {
it('returns zero for < 1 millisecond', () => {
expect(formatDuration(984)).toBe('0 ms');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ export const PingList = () => {
name: i18n.translate('xpack.uptime.pingList.durationMsColumnLabel', {
defaultMessage: 'Duration',
}),
render: (duration: number) => formatDuration(duration),
render: (duration: number | null) =>
duration ? (
formatDuration(duration)
) : (
<span data-test-subj="ping-list-duration-unavailable-tool-tip">{'--'}</span>
),
},
{
field: 'error.type',
Expand Down

0 comments on commit dc3fe64

Please sign in to comment.