Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit c33f023

Browse files
vdavidcoury-clark
authored andcommitted
Outbound requests: Add "Pause polling" button (#47812)
1 parent 2f0942b commit c33f023

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

client/web/src/site-admin/SiteAdminOutboundRequestsPage.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
Button,
1515
Code,
1616
Container,
17+
ErrorAlert,
1718
Icon,
1819
Link,
1920
LoadingSpinner,
@@ -24,7 +25,6 @@ import {
2425
Position,
2526
Text,
2627
Tooltip,
27-
ErrorAlert,
2828
} from '@sourcegraph/wildcard'
2929

3030
import {
@@ -89,6 +89,15 @@ export const SiteAdminOutboundRequestsPage: React.FunctionComponent<
8989
variables: { after: lastId },
9090
pollInterval: OUTBOUND_REQUESTS_PAGE_POLL_INTERVAL_MS,
9191
})
92+
const [polling, setPolling] = useState(true)
93+
const togglePolling = useCallback(() => {
94+
if (polling) {
95+
stopPolling()
96+
} else {
97+
startPolling(OUTBOUND_REQUESTS_PAGE_POLL_INTERVAL_MS)
98+
}
99+
setPolling(!polling)
100+
}, [polling, startPolling, stopPolling])
92101

93102
useEffect(() => {
94103
if (data?.outboundRequests?.nodes?.length && (!lastId || data?.outboundRequests.nodes[0].id > lastId)) {
@@ -137,14 +146,17 @@ export const SiteAdminOutboundRequestsPage: React.FunctionComponent<
137146
return (
138147
<div className="site-admin-outbound-requests-page">
139148
<PageTitle title="Outbound requests - Admin" />
149+
<Button variant="secondary" onClick={togglePolling} className="float-right">
150+
{polling ? 'Pause updating' : 'Resume updating'}
151+
</Button>
140152
<PageHeader
141153
path={[{ text: 'Outbound requests' }]}
142154
headingElement="h2"
143155
description={
144156
<>
145157
This is the log of recent external requests sent by the Sourcegraph instance. Handy for seeing
146158
what's happening between Sourcegraph and other services.{' '}
147-
<strong>The list updates every five seconds.</strong>
159+
{polling ? <strong>The list updates every five seconds.</strong> : null}
148160
</>
149161
}
150162
className="mb-3"

0 commit comments

Comments
 (0)