-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Uptime] Display networks requests total (#88672)
- Loading branch information
Showing
12 changed files
with
183 additions
and
53 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
28 changes: 28 additions & 0 deletions
28
...public/components/monitor/synthetics/waterfall/components/network_requests_total.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,28 @@ | ||
/* | ||
* 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 { NetworkRequestsTotal } from './network_requests_total'; | ||
import { render } from '../../../../../lib/helper/rtl_helpers'; | ||
|
||
describe('NetworkRequestsTotal', () => { | ||
it('message in case total is greater than fetched', () => { | ||
const { getByText, getByLabelText } = render( | ||
<NetworkRequestsTotal fetchedNetworkRequests={1000} totalNetworkRequests={1100} /> | ||
); | ||
|
||
expect(getByText('First 1000/1100 network requests')).toBeInTheDocument(); | ||
expect(getByLabelText('Info')).toBeInTheDocument(); | ||
}); | ||
|
||
it('message in case total is equal to fetched requests', () => { | ||
const { getByText } = render( | ||
<NetworkRequestsTotal fetchedNetworkRequests={500} totalNetworkRequests={500} /> | ||
); | ||
|
||
expect(getByText('500 network requests')).toBeInTheDocument(); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
...time/public/components/monitor/synthetics/waterfall/components/network_requests_total.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,44 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
import { EuiIconTip } from '@elastic/eui'; | ||
import { NetworkRequestsTotalStyle } from './styles'; | ||
|
||
interface Props { | ||
totalNetworkRequests: number; | ||
fetchedNetworkRequests: number; | ||
} | ||
|
||
export const NetworkRequestsTotal = ({ totalNetworkRequests, fetchedNetworkRequests }: Props) => { | ||
return ( | ||
<NetworkRequestsTotalStyle size="xs" color="subdued"> | ||
<strong> | ||
{i18n.translate('xpack.uptime.synthetics.waterfall.requestsTotalMessage', { | ||
defaultMessage: '{numNetworkRequests} network requests', | ||
values: { | ||
numNetworkRequests: | ||
totalNetworkRequests > fetchedNetworkRequests | ||
? i18n.translate('xpack.uptime.synthetics.waterfall.requestsTotalMessage.first', { | ||
defaultMessage: 'First {count}', | ||
values: { count: `${fetchedNetworkRequests}/${totalNetworkRequests}` }, | ||
}) | ||
: totalNetworkRequests, | ||
}, | ||
})} | ||
</strong> | ||
{totalNetworkRequests > fetchedNetworkRequests && ( | ||
<EuiIconTip | ||
type={'iInCircle'} | ||
content={i18n.translate('xpack.uptime.synthetics.waterfall.requestsTotalMessage.info', { | ||
defaultMessage: 'Waterfall view only shows up to 1000 requests', | ||
})} | ||
/> | ||
)} | ||
</NetworkRequestsTotalStyle> | ||
); | ||
}; |
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
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
Oops, something went wrong.