From 6d214485ab1305436ab7d553b9094eb758604ea3 Mon Sep 17 00:00:00 2001 From: anicke Date: Thu, 11 Jul 2024 14:48:52 +0200 Subject: [PATCH] chore(statusPage): fix circular dependency (#152) Moved the "statusColorMap" to the file where it is used to avoid a circular dependency chain: Co-authored-by: Niklas Aronsson --- .changeset/hot-ears-press.md | 5 +++++ plugins/statuspage/src/components/StatusChip.tsx | 15 +++++++++++++-- .../src/components/StatuspageComponent.tsx | 14 -------------- 3 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 .changeset/hot-ears-press.md diff --git a/.changeset/hot-ears-press.md b/.changeset/hot-ears-press.md new file mode 100644 index 00000000..cba9e9f6 --- /dev/null +++ b/.changeset/hot-ears-press.md @@ -0,0 +1,5 @@ +--- +'@axis-backstage/plugin-statuspage': patch +--- + +Fix circular dependencies diff --git a/plugins/statuspage/src/components/StatusChip.tsx b/plugins/statuspage/src/components/StatusChip.tsx index cf816629..d277f594 100644 --- a/plugins/statuspage/src/components/StatusChip.tsx +++ b/plugins/statuspage/src/components/StatusChip.tsx @@ -1,7 +1,18 @@ import React from 'react'; -import type { ComponentStatus } from '@axis-backstage/plugin-statuspage-common'; import Chip from '@mui/material/Chip'; -import { statusColorMap } from './StatuspageComponent'; +import type { ComponentStatus } from '@axis-backstage/plugin-statuspage-common'; + +/** + * Maps statuspage component statuses to MUI colors. + * + */ +const statusColorMap: { [key in ComponentStatus]: string } = { + under_maintenance: 'info', + operational: 'success', + degraded_performance: 'warning', + partial_outage: 'warning', + major_outage: 'error', +}; type StatusChipProps = { status: ComponentStatus; diff --git a/plugins/statuspage/src/components/StatuspageComponent.tsx b/plugins/statuspage/src/components/StatuspageComponent.tsx index 2a69a575..a03236cf 100644 --- a/plugins/statuspage/src/components/StatuspageComponent.tsx +++ b/plugins/statuspage/src/components/StatuspageComponent.tsx @@ -4,7 +4,6 @@ import { Progress, ResponseErrorPanel, } from '@backstage/core-components'; -import type { ComponentStatus } from '@axis-backstage/plugin-statuspage-common'; import { ComponentGroupsList } from './ComponentGroupsList'; import IconButton from '@mui/material/IconButton'; import OpenInNewIcon from '@mui/icons-material/OpenInNew'; @@ -19,19 +18,6 @@ export type StatuspageProps = { name: string; }; -/** - * Maps statuspage component statuses to MUI colors. - * - * @public - */ -export const statusColorMap: { [key in ComponentStatus]: string } = { - under_maintenance: 'info', - operational: 'success', - degraded_performance: 'warning', - partial_outage: 'warning', - major_outage: 'error', -}; - /** * Visualizes a full statuspage. *