@@ -30,7 +30,6 @@ import {
3030 PalletBrokerRegionRecord ,
3131 PalletBrokerSaleInfoRecord ,
3232 PalletBrokerScheduleItem ,
33- PalletBrokerStatusRecord ,
3433 PolkadotRuntimeParachainsAssignerCoretimeCoreDescriptor ,
3534 PolkadotRuntimeParachainsParasParaLifecycle ,
3635} from '@polkadot/types/lookup' ;
@@ -64,7 +63,6 @@ import {
6463 extractRegionInfo ,
6564 extractReservationInfo ,
6665 extractSaleInfo ,
67- extractStatusInfo ,
6866 extractWorkloadInfo ,
6967 extractWorkplanInfo ,
7068 sortByCore ,
@@ -83,7 +81,7 @@ export class CoretimeService extends AbstractService {
8381 return extractRegionInfo ( [ region [ 0 ] , region [ 1 ] ] ) ;
8482 } ) ;
8583
86- return coreId ? regionsInfo . filter ( ( region ) => region . core === coreId ) : regionsInfo ;
84+ return typeof coreId === 'number' ? regionsInfo . filter ( ( region ) => region . core === coreId ) : regionsInfo ;
8785 } ;
8886
8987 private getAndDecodeLeases = async ( api : ApiDecoration < 'promise' > ) : Promise < TLeaseInfo [ ] > => {
@@ -122,7 +120,7 @@ export class CoretimeService extends AbstractService {
122120 } ) ,
123121 ) ;
124122
125- return coreId ? wplsInfo . filter ( ( workplan ) => workplan . core === coreId ) : wplsInfo ;
123+ return typeof coreId === 'number' ? wplsInfo . filter ( ( workplan ) => workplan . core === coreId ) : wplsInfo ;
126124 } ;
127125
128126 private getAndDecodeSaleInfo = async ( api : ApiDecoration < 'promise' > ) : Promise < TSaleInfo | null > => {
@@ -140,11 +138,11 @@ export class CoretimeService extends AbstractService {
140138 }
141139 } ;
142140
143- private getAndDecodeStatus = async ( api : ApiDecoration < 'promise' > ) : Promise < Record < string , unknown > > => {
144- const status = await api . query . broker . status ( ) ;
141+ // private getAndDecodeStatus = async (api: ApiDecoration<'promise'>): Promise<TStatusInfo > => {
142+ // const status = await api.query.broker.status();
145143
146- return extractStatusInfo ( status as unknown as Option < PalletBrokerStatusRecord > ) ;
147- } ;
144+ // return extractStatusInfo(status as unknown as Option<PalletBrokerStatusRecord>);
145+ // };
148146
149147 private getAndDecodeConfiguration = async ( api : ApiDecoration < 'promise' > ) : Promise < TConfigInfo > => {
150148 const configuration = await api . query . broker . configuration ( ) ;
@@ -166,7 +164,9 @@ export class CoretimeService extends AbstractService {
166164 renewals . map ( ( renewal ) => extractPotentialRenewalInfo ( renewal [ 1 ] , renewal [ 0 ] ) ) ,
167165 ) ;
168166
169- return coreId ? potentialRenewalsInfo . filter ( ( renewal ) => renewal . core === coreId ) : potentialRenewalsInfo ;
167+ return typeof coreId === 'number'
168+ ? potentialRenewalsInfo . filter ( ( renewal ) => renewal . core === coreId )
169+ : potentialRenewalsInfo ;
170170 } ;
171171
172172 private getAndDecodeReservations = async ( api : ApiDecoration < 'promise' > ) : Promise < TReservationInfo [ ] > => {
@@ -470,7 +470,9 @@ export class CoretimeService extends AbstractService {
470470
471471 if ( coreId ) {
472472 const coreType = systemParas . includes ( workload [ 0 ] . info . task )
473- ? 'reservation'
473+ ? workload [ 0 ] . info . task === 'Pool'
474+ ? 'ondemand'
475+ : 'reservation'
474476 : leases . map ( ( f ) => f . task ) . includes ( workload [ 0 ] . info . task )
475477 ? 'lease'
476478 : 'bulk' ;
@@ -494,7 +496,9 @@ export class CoretimeService extends AbstractService {
494496 } else {
495497 workload . map ( ( wl ) => {
496498 const coreType = systemParas . includes ( wl . info . task )
497- ? 'reservation'
499+ ? wl . info . task === 'Pool'
500+ ? 'ondemand'
501+ : 'reservation'
498502 : leases . map ( ( f ) => f . task ) . includes ( wl . info . task )
499503 ? 'lease'
500504 : 'bulk' ;
0 commit comments