fix for showing expires even though chain renewed (#11353)

This commit is contained in:
Daria 2025-03-05 11:15:41 +13:00 committed by GitHub
parent 506b38c778
commit 2b9e019c28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 10 deletions

View File

@ -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'

View File

@ -335,6 +335,7 @@ export interface ChainWorkTaskInformation {
lastBlock: number
renewal: PotentialRenewal | undefined
renewalStatus: string
renewalStatusMessage: string
type: CoreTimeTypes
workload: CoreWorkload | undefined
workplan: CoreWorkplan[] | undefined

View File

@ -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