@@ -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 SubServerRequired from 'components/common/SubServerRequired' ;
89import AccountSection from './AccountSection' ;
910import BatchSection from './BatchSection' ;
1011import OrderFormSection from './OrderFormSection' ;
@@ -34,18 +35,24 @@ 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 ( ) ;
@@ -63,23 +70,25 @@ const PoolPage: React.FC = () => {
6370
6471 const { Wrapper, Row, Col } = Styled ;
6572 return (
66- < Wrapper >
67- < PageHeader
68- title = { title }
69- exportTip = { l ( 'exportTip' ) }
70- onExportClick = { orderStore . exportLeases }
71- />
72- < Row >
73- < Col cols = { 4 } colsXl = { 3 } >
74- < AccountSection />
75- < OrderFormSection />
76- </ Col >
77- < Col >
78- < BatchSection />
79- < OrderListSection />
80- </ Col >
81- </ Row >
82- </ Wrapper >
73+ < SubServerRequired status = { subServerStore . subServers . pool } >
74+ < Wrapper >
75+ < PageHeader
76+ title = { title }
77+ exportTip = { l ( 'exportTip' ) }
78+ onExportClick = { orderStore . exportLeases }
79+ />
80+ < Row >
81+ < Col cols = { 4 } colsXl = { 3 } >
82+ < AccountSection />
83+ < OrderFormSection />
84+ </ Col >
85+ < Col >
86+ < BatchSection />
87+ < OrderListSection />
88+ </ Col >
89+ </ Row >
90+ </ Wrapper >
91+ </ SubServerRequired >
8392 ) ;
8493} ;
8594
0 commit comments