Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions client/web/src/site-admin/SiteAdminOutboundRequestsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Button,
Code,
Container,
ErrorAlert,
Icon,
Link,
LoadingSpinner,
Expand All @@ -24,7 +25,6 @@ import {
Position,
Text,
Tooltip,
ErrorAlert,
} from '@sourcegraph/wildcard'

import {
Expand Down Expand Up @@ -89,6 +89,15 @@ export const SiteAdminOutboundRequestsPage: React.FunctionComponent<
variables: { after: lastId },
pollInterval: OUTBOUND_REQUESTS_PAGE_POLL_INTERVAL_MS,
})
const [polling, setPolling] = useState(true)
const togglePolling = useCallback(() => {
if (polling) {
stopPolling()
} else {
startPolling(OUTBOUND_REQUESTS_PAGE_POLL_INTERVAL_MS)
}
setPolling(!polling)
}, [polling, startPolling, stopPolling])

useEffect(() => {
if (data?.outboundRequests?.nodes?.length && (!lastId || data?.outboundRequests.nodes[0].id > lastId)) {
Expand Down Expand Up @@ -137,14 +146,17 @@ export const SiteAdminOutboundRequestsPage: React.FunctionComponent<
return (
<div className="site-admin-outbound-requests-page">
<PageTitle title="Outbound requests - Admin" />
<Button variant="secondary" onClick={togglePolling} className="float-right">
{polling ? 'Pause updating' : 'Resume updating'}
</Button>
<PageHeader
path={[{ text: 'Outbound requests' }]}
headingElement="h2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text below mentions "The list updates every five seconds." - Should we update this as well when the updates are paused?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm removing that when you stop polling. It's totally fancy now. ✨

description={
<>
This is the log of recent external requests sent by the Sourcegraph instance. Handy for seeing
what's happening between Sourcegraph and other services.{' '}
<strong>The list updates every five seconds.</strong>
{polling ? <strong>The list updates every five seconds.</strong> : null}
</>
}
className="mb-3"
Expand Down