-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graph): expose functions to render pdv & error page
- Loading branch information
Showing
4 changed files
with
110 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* eslint-disable @nx/enforce-module-boundaries */ | ||
// nx-ignore-next-line | ||
import { ErrorRenderer } from '@nx/graph/ui-components'; | ||
import { GraphError } from 'nx/src/command-line/graph/graph'; | ||
/* eslint-enable @nx/enforce-module-boundaries */ | ||
|
||
export type ErrorPageProps = { | ||
message: string | JSX.Element; | ||
stack?: string; | ||
errors: GraphError[]; | ||
}; | ||
|
||
export function ErrorPage({ message, stack, errors }: ErrorPageProps) { | ||
return ( | ||
<div className="mx-auto mb-8 w-full max-w-6xl flex-grow px-8"> | ||
<h1 className="mb-4 text-4xl dark:text-slate-100">Error</h1> | ||
<div> | ||
<ErrorWithStack message={message} stack={stack} /> | ||
</div> | ||
{errors && ( | ||
<div> | ||
<p className="text-md mb-4 dark:text-slate-200"> | ||
Nx encountered the following issues while processing the project | ||
graph:{' '} | ||
</p> | ||
<div> | ||
<ErrorRenderer errors={errors} /> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
function ErrorWithStack({ | ||
message, | ||
stack, | ||
}: { | ||
message: string | JSX.Element; | ||
stack?: string; | ||
}) { | ||
return ( | ||
<div> | ||
<p className="mb-4 text-lg dark:text-slate-100">{message}</p> | ||
{stack && <p className="text-sm">Error message: {stack}</p>} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters