fix(governance,environment,proposals): network upgrade proposal urls include block height (#4704)

This commit is contained in:
Sam Keen 2023-09-06 11:56:18 +01:00 committed by GitHub
parent 2a0811863f
commit e9173796f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 11 deletions

View File

@ -183,7 +183,7 @@ context(
.first() .first()
.find('[data-testid="view-proposal-btn"]') .find('[data-testid="view-proposal-btn"]')
.click(); .click();
cy.url().should('contain', '/protocol-upgrades/v1'); cy.url().should('contain', '/protocol-upgrades/v1/2015942');
cy.getByTestId('protocol-upgrade-proposal').within(() => { cy.getByTestId('protocol-upgrade-proposal').within(() => {
cy.get('h1').should('have.text', 'Vega Release v1'); cy.get('h1').should('have.text', 'Vega Release v1');
cy.getByTestId('protocol-upgrade-block-height').should( cy.getByTestId('protocol-upgrade-block-height').should(
@ -243,7 +243,7 @@ context(
); );
cy.getByTestId('external-link') cy.getByTestId('external-link')
.should('have.attr', 'href') .should('have.attr', 'href')
.and('contain', '/proposals/protocol-upgrade/v1'); .and('contain', '/proposals/protocol-upgrade/v1/2015942');
}); });
// estimate does not display possibly due to mocks or Cypress unless the proposal is clicked on several times // estimate does not display possibly due to mocks or Cypress unless the proposal is clicked on several times

View File

@ -67,7 +67,7 @@ export const ProtocolUpgradeProposalsListItem = ({
<Link <Link
to={`${Routes.PROTOCOL_UPGRADES}/${stripFullStops( to={`${Routes.PROTOCOL_UPGRADES}/${stripFullStops(
proposal.vegaReleaseTag proposal.vegaReleaseTag
)}`} )}/${proposal.upgradeBlockHeight}`}
> >
<Button data-testid="view-proposal-btn">{t('viewDetails')}</Button> <Button data-testid="view-proposal-btn">{t('viewDetails')}</Button>
</Link> </Link>

View File

@ -279,7 +279,7 @@ const routerConfig = [
], ],
}, },
{ {
path: `${Routes.PROTOCOL_UPGRADES}/:proposalReleaseTag`, path: `${Routes.PROTOCOL_UPGRADES}/:proposalReleaseTag/:proposalBlockHeight`,
element: <LazyProtocolUpgradeProposal />, element: <LazyProtocolUpgradeProposal />,
}, },
{ {

View File

@ -127,7 +127,7 @@ export const TOKEN_GOVERNANCE = '/proposals';
export const TOKEN_PROPOSALS = '/proposals'; export const TOKEN_PROPOSALS = '/proposals';
export const TOKEN_PROPOSAL = '/proposals/:id'; export const TOKEN_PROPOSAL = '/proposals/:id';
export const TOKEN_PROTOCOL_UPGRADE_PROPOSAL = export const TOKEN_PROTOCOL_UPGRADE_PROPOSAL =
'/proposals/protocol-upgrade/:tag'; '/proposals/protocol-upgrade/:tag/:blockHeight';
export const TOKEN_VALIDATOR = '/validators/:id'; export const TOKEN_VALIDATOR = '/validators/:id';
/** /**
@ -135,12 +135,12 @@ export const TOKEN_VALIDATOR = '/validators/:id';
*/ */
export const useProtocolUpgradeProposalLink = () => { export const useProtocolUpgradeProposalLink = () => {
const governance = useLinks(DApp.Token); const governance = useLinks(DApp.Token);
return (releaseTag: string) => return (releaseTag: string, blockHeight: string) =>
governance( governance(
TOKEN_PROTOCOL_UPGRADE_PROPOSAL.replace( TOKEN_PROTOCOL_UPGRADE_PROPOSAL.replace(
':tag', ':tag',
stripFullStops(releaseTag) stripFullStops(releaseTag)
) ).replace(':blockHeight', blockHeight)
); );
}; };

View File

@ -73,7 +73,7 @@ export const ProtocolUpgradeCountdown = ({
return ( return (
<a <a
href={detailsLink(data.vegaReleaseTag)} href={detailsLink(data.vegaReleaseTag, data.upgradeBlockHeight)}
target="_blank" target="_blank"
rel="noreferrer nofollow noopener" rel="noreferrer nofollow noopener"
> >

View File

@ -77,8 +77,8 @@ export const ProtocolUpgradeInProgressNotification = () => {
{t( {t(
'Trading and other network activity has stopped until the upgrade is complete.' 'Trading and other network activity has stopped until the upgrade is complete.'
)}{' '} )}{' '}
{vegaReleaseTag && ( {vegaReleaseTag && upgradeBlockHeight && (
<ExternalLink href={detailsLink(vegaReleaseTag)}> <ExternalLink href={detailsLink(vegaReleaseTag, upgradeBlockHeight)}>
{t('View details')} {t('View details')}
</ExternalLink> </ExternalLink>
)} )}

View File

@ -79,7 +79,7 @@ export const ProtocolUpgradeProposalNotification = ({
{t( {t(
'Trading activity will be interrupted, manage your risk appropriately.' 'Trading activity will be interrupted, manage your risk appropriately.'
)}{' '} )}{' '}
<ExternalLink href={detailsLink(vegaReleaseTag)}> <ExternalLink href={detailsLink(vegaReleaseTag, upgradeBlockHeight)}>
{t('View details')} {t('View details')}
</ExternalLink> </ExternalLink>
</div> </div>