Skip to content

Commit

Permalink
add new view and UI updates to show missing futures warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeyTM committed Sep 15, 2023
1 parent d3f07cf commit 328ca9a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/hardhat-plugin/src/ui/UiEventHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DeploymentResult,
DeploymentResultType,
DeploymentStartEvent,
DeploymentWarningsEvent,
ExecutionEventListener,
ExecutionEventResult,
ExecutionEventResultType,
Expand Down Expand Up @@ -68,6 +69,7 @@ export class UiEventHandler implements ExecutionEventListener {
moduleName: null,
batches: [],
result: null,
warnings: [],
};

constructor(private _deploymentParams: DeploymentParameters = {}) {}
Expand Down Expand Up @@ -333,6 +335,13 @@ export class UiEventHandler implements ExecutionEventListener {
};
}

public deploymentWarnings(event: DeploymentWarningsEvent): void {
this.state = {
...this.state,
warnings: [...this.state.warnings, ...event.warnings],
};
}

public setModuleId(event: SetModuleIdEvent): void {
this.state = {
...this.state,
Expand Down
5 changes: 5 additions & 0 deletions packages/hardhat-plugin/src/ui/VerboseEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DeploymentExecutionStateCompleteEvent,
DeploymentExecutionStateInitializeEvent,
DeploymentStartEvent,
DeploymentWarningsEvent,
ExecutionEventListener,
ExecutionEventNetworkInteractionType,
ExecutionEventResultType,
Expand Down Expand Up @@ -251,6 +252,10 @@ export class VerboseEventHandler implements ExecutionEventListener {
console.log(`Deployment complete`);
}

public deploymentWarnings(event: DeploymentWarningsEvent): void {
console.log(`Deployment produced warnings:\n${event.warnings.join(" -")}`);
}

public setModuleId(event: SetModuleIdEvent): void {
console.log(`Starting validation for module: ${event.moduleName}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UiState } from "../../types";
import { BatchExecution } from "./BatchExecution";
import { FinalStatus } from "./FinalStatus";
import { SummarySection } from "./SummarySection";
import { Warnings } from "./Warnings";
import { viewEverythingExecutedAlready } from "./views";

export const ExecutionPanel = ({
Expand All @@ -19,6 +20,7 @@ export const ExecutionPanel = ({
if (viewEverythingExecutedAlready(state)) {
return (
<Box flexDirection="column">
{state.warnings.length > 0 && <Warnings state={state} />}
<FinalStatus state={state} />
</Box>
);
Expand All @@ -27,6 +29,7 @@ export const ExecutionPanel = ({
return (
<Box flexDirection="column">
<SummarySection state={state} deployParams={deployParams} />
{state.warnings.length > 0 && <Warnings state={state} />}
<BatchExecution state={state} />
<FinalStatus state={state} />
</Box>
Expand Down
23 changes: 23 additions & 0 deletions packages/hardhat-plugin/src/ui/components/execution/Warnings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Box, Newline, Text } from "ink";

import { UiState } from "../../types";

export const Warnings = ({ state: { warnings } }: { state: UiState }) => {
return (
<>
<Box
paddingBottom={1}
borderStyle="single"
flexDirection="column"
borderColor="yellowBright"
>
<Text bold>
Warning, deployment missing previously executed futures:
</Text>
<Newline />

{...warnings.map((warning) => <Text> - {warning}</Text>)}
</Box>
</>
);
};
1 change: 1 addition & 0 deletions packages/hardhat-plugin/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export interface UiState {
moduleName: string | null;
batches: UiBatches;
result: DeploymentResult<string, IgnitionModuleResult<string>> | null;
warnings: string[];
}

export interface AddressMap {
Expand Down

0 comments on commit 328ca9a

Please sign in to comment.