@@ -5,6 +5,7 @@ import { usePrefixedTranslation } from 'hooks';
55import { useStore } from 'store' ;
66import { Badge , Column , Row } from 'components/base' ;
77import PageHeader from 'components/common/PageHeader' ;
8+ import SubServerStatus from 'components/common/SubServerStatus' ;
89import AccountSection from './AccountSection' ;
910import BatchSection from './BatchSection' ;
1011import OrderFormSection from './OrderFormSection' ;
@@ -34,23 +35,40 @@ const Styled = {
3435
3536const PoolPage : React . FC = ( ) => {
3637 const { l } = usePrefixedTranslation ( 'cmps.pool.PoolPage' ) ;
37- const { accountStore, orderStore, batchStore } = useStore ( ) ;
38+ const { accountStore, orderStore, batchStore, subServerStore } = useStore ( ) ;
3839
3940 useEffect ( ( ) => {
40- accountStore . fetchAccounts ( ) ;
41- orderStore . fetchOrders ( ) ;
42- batchStore . fetchNextBatchInfo ( ) ;
43- if ( ! batchStore . batches . size ) {
44- // fetch batches if there aren't any in the store
45- batchStore . fetchBatches ( ) ;
41+ if (
42+ subServerStore . subServers . pool ?. running &&
43+ ! subServerStore . subServers . pool ?. error
44+ ) {
45+ accountStore . fetchAccounts ( ) ;
46+ orderStore . fetchOrders ( ) ;
47+ batchStore . fetchNextBatchInfo ( ) ;
48+ if ( ! batchStore . batches . size ) {
49+ // fetch batches if there aren't any in the store
50+ batchStore . fetchBatches ( ) ;
51+ }
52+ // start polling when this component is mounted
53+ batchStore . startPolling ( ) ;
4654 }
47- // start polling when this component is mounted
48- batchStore . startPolling ( ) ;
55+
4956 // stop polling when this component is unmounted
5057 return ( ) => {
5158 batchStore . stopPolling ( ) ;
5259 } ;
53- } , [ accountStore , orderStore , batchStore ] ) ;
60+ } , [ accountStore , orderStore , batchStore , subServerStore . subServers . pool ] ) ;
61+
62+ if ( subServerStore . subServers . pool ?. disabled ) {
63+ return < SubServerStatus isDisabled = { true } /> ;
64+ } else if ( subServerStore . subServers . pool ?. error ) {
65+ return (
66+ < SubServerStatus
67+ isDisabled = { false }
68+ errorMessage = { subServerStore . subServers . pool . error }
69+ />
70+ ) ;
71+ }
5472
5573 const title = (
5674 < >
0 commit comments