From ed438a3ba5d89467f4dc8c5ce974b042a65d0812 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 27 Oct 2022 11:18:12 +0100 Subject: [PATCH] add more specific error handling for github actions Previously the errorApi would post a message to the page. However it was unclear which plugin was causing the error. Instead this renders a panel with the full error. Signed-off-by: Brian Fletcher --- .changeset/calm-clouds-smoke.md | 5 +++++ .../src/components/Cards/RecentWorkflowRunsCard.tsx | 6 ++++++ plugins/github-actions/src/components/useWorkflowRuns.ts | 4 +++- yarn.lock | 8 ++++---- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .changeset/calm-clouds-smoke.md diff --git a/.changeset/calm-clouds-smoke.md b/.changeset/calm-clouds-smoke.md new file mode 100644 index 0000000000..1209c6e071 --- /dev/null +++ b/.changeset/calm-clouds-smoke.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-actions': patch +--- + +Add error panel when the plugin fails. diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx index 89fd40da33..59d64af9c9 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx @@ -29,6 +29,7 @@ import { useRouteRef, } from '@backstage/core-plugin-api'; import { + ErrorPanel, InfoCard, InfoCardVariants, Link, @@ -76,6 +77,11 @@ export const RecentWorkflowRunsCard = (props: { const githubHost = hostname || 'github.com'; const routeLink = useRouteRef(buildRouteRef); + + if (error) { + return ; + } + return (