@@ -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
3030import {
@@ -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