Skip to content

Commit

Permalink
fix(website): CAN-569 (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosampler authored Oct 15, 2024
1 parent 9b2015a commit 1f319a2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
15 changes: 12 additions & 3 deletions packages/website/src/components/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AlertDescription,
AlertIcon,
AlertTitle,
Flex,
} from '@chakra-ui/react';

type Props = {
Expand All @@ -30,9 +31,17 @@ export function Alert({
borderColor="gray.700"
{...rest}
>
<AlertIcon />
{title && <AlertTitle>{title}</AlertTitle>}
{children && <AlertDescription>{children}</AlertDescription>}
<Flex flexDirection="row" alignItems="center" width="100%">
<AlertIcon />
<>
{title && <AlertTitle>{title}</AlertTitle>}
{children && (
<AlertDescription width="100%" wordBreak="break-word">
{children}
</AlertDescription>
)}
</>
</Flex>
</ChakraAlert>
);
}
37 changes: 33 additions & 4 deletions packages/website/src/features/Deploy/QueueFromGitOpsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,16 @@ export default function QueueFromGitOps() {
const hasDeployers = Boolean(
cannonDefInfo.def?.getDeployers()?.length ?? 0 > 0
);

const canTomlBeDeployedUsingWebsite = Boolean(
cannonfileUrlInput &&
cannonDefInfo?.def &&
!cannonDefInfo.def.allActionNames.some(
(item) => item.startsWith('deploy.') || item.startsWith('contract.')
)
);

// This condition checks if the cannonfile requires to enter a value in the "Previous Package" input
const tomlRequiresPrevPackage = Boolean(
cannonfileUrlInput &&
cannonDefInfo?.def &&
Expand All @@ -552,7 +562,8 @@ export default function QueueFromGitOps() {
(onChainPrevPkgQuery.isFetched &&
!prevDeployLocation &&
tomlRequiresPrevPackage &&
!previousPackageInput);
!previousPackageInput) ||
canTomlBeDeployedUsingWebsite;

const PreviewButton = ({ message }: { message?: string }) => (
<Tooltip label={message}>
Expand Down Expand Up @@ -891,17 +902,20 @@ export default function QueueFromGitOps() {
</Alert>
)}
{buildState.skippedSteps.length > 0 && (
<Flex flexDir="column" mt="6">
<AlertCannon my={2} status="error">
<Text mb="2" fontWeight="bold">
This safe will not be able to complete the following operations:
</Text>
{buildState.skippedSteps.map((s, i) => (
<Text fontFamily="monospace" key={i} mb="2">
<strong>{`[${s.name}]: `}</strong>
{s.err.toString()}
{s.name.startsWith('deploy.') ||
s.name.startsWith('contract.')
? 'Is not possible to build and deploy a contract from source code from the website. You should first build your cannonfile using the CLI and continue the deployment from a partial build.'
: s.err.toString()}
</Text>
))}
</Flex>
</AlertCannon>
)}

{!!buildState.result?.deployerSteps?.length && (
Expand Down Expand Up @@ -982,6 +996,21 @@ export default function QueueFromGitOps() {
)}
</Box>
)}

{writeToIpfsMutationRes?.data?.mainUrl &&
multicallTxn?.data &&
stager.safeTxn &&
(buildState.result?.safeSteps.length || 0) > 0 &&
buildState.skippedSteps.length > 0 && (
<AlertCannon borderless status="warning" mt="0">
We have detected transactions in your Cannonfile that cannot be
executed, which may lead to undesired effects on your
deployment. We advise you not to proceed unless you are
absolutely certain of what you are doing, as this will result in
a partial deployment package.
</AlertCannon>
)}

{writeToIpfsMutationRes?.isLoading && (
<Alert mt="6" status="info" bg="gray.800">
<Spinner mr={3} boxSize={4} />
Expand Down

0 comments on commit 1f319a2

Please sign in to comment.