fix for showing expires even though chain renewed (#11353)
This commit is contained in:
parent
506b38c778
commit
2b9e019c28
@ -98,7 +98,7 @@ function Row ({ chainRecord, highlight = false, id, lastCommittedTimeslice, leas
|
||||
>
|
||||
<span>
|
||||
{estimatedTime}
|
||||
{!!isWithinWeek && !isReservation && (
|
||||
{!!isWithinWeek && !isReservation && chainRecord?.renewalStatus !== ChainRenewalStatus.Renewed && (
|
||||
<StyledMarkWarning
|
||||
content='Expires Soon'
|
||||
/>
|
||||
@ -108,7 +108,7 @@ function Row ({ chainRecord, highlight = false, id, lastCommittedTimeslice, leas
|
||||
<StyledCell
|
||||
$p={highlight}
|
||||
className='media--1200'
|
||||
>{chainRecord?.renewalStatus}</StyledCell>
|
||||
>{chainRecord?.renewalStatus === ChainRenewalStatus.Renewed ? chainRecord.renewalStatusMessage : chainRecord.renewalStatus}</StyledCell>
|
||||
<StyledCell
|
||||
$p={highlight}
|
||||
className='media--1200'
|
||||
|
||||
@ -335,6 +335,7 @@ export interface ChainWorkTaskInformation {
|
||||
lastBlock: number
|
||||
renewal: PotentialRenewal | undefined
|
||||
renewalStatus: string
|
||||
renewalStatusMessage: string
|
||||
type: CoreTimeTypes
|
||||
workload: CoreWorkload | undefined
|
||||
workplan: CoreWorkplan[] | undefined
|
||||
|
||||
@ -138,23 +138,30 @@ function useCoretimeInformationImpl (api: ApiPromise, ready: boolean): CoretimeI
|
||||
|
||||
const potentialRenewal = potentialRenewalsCurrentRegion?.find((renewal) => renewal.task.toString() === taskId);
|
||||
|
||||
let renewalStatus = potentialRenewal ? ChainRenewalStatus.Eligible : ChainRenewalStatus.None;
|
||||
const chainRenewedCore = type === CoreTimeTypes['Bulk Coretime'] && !!workplan?.length;
|
||||
|
||||
let renewalStatus = ChainRenewalStatus.None;
|
||||
let renewalStatusMessage = '';
|
||||
|
||||
if (potentialRenewal) {
|
||||
renewalStatus = ChainRenewalStatus.Eligible;
|
||||
}
|
||||
|
||||
if (chainRenewedCore) {
|
||||
renewalStatus = ChainRenewalStatus.Renewed;
|
||||
renewalStatusMessage = `Next cycle on core ${workplan[0].core}`;
|
||||
}
|
||||
|
||||
const chainRegionEnd = (renewalStatus === ChainRenewalStatus.Renewed ? salesInfo?.regionEnd : salesInfo?.regionBegin);
|
||||
const targetTimeslice = lease?.until || chainRegionEnd;
|
||||
|
||||
const lastBlock = targetTimeslice ? targetTimeslice * coretimeConstants?.relay.blocksPerTimeslice : 0;
|
||||
|
||||
const chainRenewedCore = type === CoreTimeTypes['Bulk Coretime'] && !!workplan?.length;
|
||||
|
||||
if (chainRenewedCore) {
|
||||
renewalStatus = `Next cycle on core ${workplan[0].core}`;
|
||||
}
|
||||
|
||||
return {
|
||||
chainRenewedCore,
|
||||
lastBlock,
|
||||
renewal: potentialRenewal,
|
||||
renewalStatus,
|
||||
renewalStatusMessage,
|
||||
type,
|
||||
workload,
|
||||
workplan
|
||||
|
||||
Loading…
Reference in New Issue
Block a user