Skip to content

Commit

Permalink
chore(statusPage): fix circular dependency (#152)
Browse files Browse the repository at this point in the history
Moved the "statusColorMap" to the file where it is used to avoid a
circular dependency chain:

Co-authored-by: Niklas Aronsson <niklasar@axis.com>
  • Loading branch information
anicke and Niklas Aronsson authored Jul 11, 2024
1 parent a30ae43 commit 6d21448
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-ears-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@axis-backstage/plugin-statuspage': patch
---

Fix circular dependencies
15 changes: 13 additions & 2 deletions plugins/statuspage/src/components/StatusChip.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
14 changes: 0 additions & 14 deletions plugins/statuspage/src/components/StatuspageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
*
Expand Down

0 comments on commit 6d21448

Please sign in to comment.