@axis-backstage/plugin-statuspage 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
1
  class StatuspageClient {
2
+ discoveryApi;
3
+ fetchApi;
8
4
  constructor(options) {
9
- __publicField(this, "discoveryApi");
10
- __publicField(this, "fetchApi");
11
5
  this.discoveryApi = options.discoveryApi;
12
6
  this.fetchApi = options.fetchApi;
13
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StatuspageClient.esm.js","sources":["../../src/api/StatuspageClient.ts"],"sourcesContent":["import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { StatuspageApi } from './StatuspageApi';\nimport {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\n/**\n * The client implementation for the frontend api.\n *\n * @public\n */\nexport class StatuspageClient implements StatuspageApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n /**\n * Fetches link for a statuspage\n *\n * @param name - name of the statuspage instance (from config)\n * @returns the url\n */\n async getLink(name: string): Promise<{ url: string }> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const response = await this.fetchApi.fetch(\n `${baseUrl}/fetch-link/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n const data = await response.json();\n return data;\n }\n throw new Error(\n `Failed to get statuspage link for ${name} with status code ${response.status}`,\n );\n }\n\n /**\n * Returns the components for a statuspage instance\n *\n * @param name - the name of statuspage instance (from config)\n * @returns the components\n */\n async getComponents(name: string): Promise<Component[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const data = await this.fetchApi.fetch(\n `${baseUrl}/fetch-components/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n\n if (data.ok) return data.json();\n throw new Error(`Failed to get statuspage components for ${name}`);\n }\n\n /**\n * Returns the component groups for a statuspage instance\n *\n * @param name - the name of the statuspage instance (from config)\n * @returns the component groups\n */\n async getComponentGroups(name: string): Promise<ComponentGroup[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const data = await this.fetchApi.fetch(\n `${baseUrl}/fetch-component-groups/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n\n if (data.ok) return data.json();\n throw new Error(`Failed to get statuspage component groups for ${name}`);\n }\n}\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,gBAA0C,CAAA;AAAA,EAIrD,YAAY,OAA6D,EAAA;AAHzE,IAAiB,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA,CAAA;AAGf,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA,CAAA;AAAA,GAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QAAQ,IAAwC,EAAA;AACpD,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,YAAY,CAAA,CAAA;AAC/D,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAG,EAAA,OAAO,CAAe,YAAA,EAAA,kBAAA,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CAAA,CAAA;AAC/D,IAAM,MAAA,IAAA,GAAO,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MAC/B,CAAG,EAAA,OAAO,CAA2B,wBAAA,EAAA,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,MAC7D;AAAA,QACE,MAAQ,EAAA,KAAA;AAAA,QACR,OAAS,EAAA;AAAA,UACP,cAAgB,EAAA,kBAAA;AAAA,SAClB;AAAA,OACF;AAAA,KACF,CAAA;AAEA,IAAA,IAAI,IAAK,CAAA,EAAA;AAAI,MAAA,OAAO,KAAK,IAAK,EAAA,CAAA;AAC9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAiD,8CAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,GACzE;AACF;;;;"}
1
+ {"version":3,"file":"StatuspageClient.esm.js","sources":["../../src/api/StatuspageClient.ts"],"sourcesContent":["import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { StatuspageApi } from './StatuspageApi';\nimport {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\n/**\n * The client implementation for the frontend api.\n *\n * @public\n */\nexport class StatuspageClient implements StatuspageApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n /**\n * Fetches link for a statuspage\n *\n * @param name - name of the statuspage instance (from config)\n * @returns the url\n */\n async getLink(name: string): Promise<{ url: string }> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const response = await this.fetchApi.fetch(\n `${baseUrl}/fetch-link/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n const data = await response.json();\n return data;\n }\n throw new Error(\n `Failed to get statuspage link for ${name} with status code ${response.status}`,\n );\n }\n\n /**\n * Returns the components for a statuspage instance\n *\n * @param name - the name of statuspage instance (from config)\n * @returns the components\n */\n async getComponents(name: string): Promise<Component[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const data = await this.fetchApi.fetch(\n `${baseUrl}/fetch-components/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n\n if (data.ok) return data.json();\n throw new Error(`Failed to get statuspage components for ${name}`);\n }\n\n /**\n * Returns the component groups for a statuspage instance\n *\n * @param name - the name of the statuspage instance (from config)\n * @returns the component groups\n */\n async getComponentGroups(name: string): Promise<ComponentGroup[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const data = await this.fetchApi.fetch(\n `${baseUrl}/fetch-component-groups/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n\n if (data.ok) return data.json();\n throw new Error(`Failed to get statuspage component groups for ${name}`);\n }\n}\n"],"names":[],"mappings":"AAYO,MAAM,gBAA0C,CAAA;AAAA,EACpC,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EAEjB,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA,CAAA;AAAA,GAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QAAQ,IAAwC,EAAA;AACpD,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,YAAY,CAAA,CAAA;AAC/D,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAG,EAAA,OAAO,CAAe,YAAA,EAAA,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,MACjD;AAAA,QACE,MAAQ,EAAA,KAAA;AAAA,QACR,O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MAC/B,CAAG,EAAA,OAAO,CAA2B,wBAAA,EAAA,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,MAC7D;AAAA,QACE,MAAQ,EAAA,KAAA;AAAA,QACR,OAAS,EAAA;AAAA,UACP,cAAgB,EAAA,kBAAA;AAAA,SAClB;AAAA,OACF;AAAA,KACF,CAAA;AAEA,IAAA,IAAI,IAAK,CAAA,EAAA;AAAI,MAAA,OAAO,KAAK,IAAK,EAAA,CAAA;AAC9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAiD,8CAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,GACzE;AACF;;;;"}
@@ -1,7 +1,13 @@
1
1
  import React from 'react';
2
2
  import Chip from '@mui/material/Chip';
3
- import { statusColorMap } from './StatuspageComponent.esm.js';
4
3
 
4
+ const statusColorMap = {
5
+ under_maintenance: "info",
6
+ operational: "success",
7
+ degraded_performance: "warning",
8
+ partial_outage: "warning",
9
+ major_outage: "error"
10
+ };
5
11
  const formatStatusString = (status) => status.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
6
12
  const StatusChip = ({ status }) => /* @__PURE__ */ React.createElement(
7
13
  Chip,
@@ -1 +1 @@
1
- {"version":3,"file":"StatusChip.esm.js","sources":["../../src/components/StatusChip.tsx"],"sourcesContent":["import React from 'react';\nimport type { ComponentStatus } from '@axis-backstage/plugin-statuspage-common';\nimport Chip from '@mui/material/Chip';\nimport { statusColorMap } from './StatuspageComponent';\n\ntype StatusChipProps = {\n status: ComponentStatus;\n};\n\nconst formatStatusString = (status: string): string =>\n status\n .split('_')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ');\n\nexport const StatusChip = ({ status }: StatusChipProps) => (\n <Chip\n sx={{ margin: '0 8px' }}\n size=\"small\"\n label={formatStatusString(status)}\n color={statusColorMap[status] || ('default' as any)}\n />\n);\n"],"names":[],"mappings":";;;;AASA,MAAM,kBAAA,GAAqB,CAAC,MAC1B,KAAA,MAAA,CACG,MAAM,GAAG,CAAA,CACT,GAAI,CAAA,CAAA,IAAA,KAAQ,IAAK,CAAA,MAAA,CAAO,CAAC,CAAE,CAAA,WAAA,EAAgB,GAAA,IAAA,CAAK,KAAM,CAAA,CAAC,EAAE,WAAY,EAAC,CACtE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AAEN,MAAM,UAAa,GAAA,CAAC,EAAE,MAAA,EAC3B,qBAAA,KAAA,CAAA,aAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACC,EAAA,EAAI,EAAE,MAAA,EAAQ,OAAQ,EAAA;AAAA,IACtB,IAAK,EAAA,OAAA;AAAA,IACL,KAAA,EAAO,mBAAmB,MAAM,CAAA;AAAA,IAChC,KAAA,EAAO,cAAe,CAAA,MAAM,CAAM,IAAA,SAAA;AAAA,GAAA;AACpC;;;;"}
1
+ {"version":3,"file":"StatusChip.esm.js","sources":["../../src/components/StatusChip.tsx"],"sourcesContent":["import React from 'react';\nimport Chip from '@mui/material/Chip';\nimport type { ComponentStatus } from '@axis-backstage/plugin-statuspage-common';\n\n/**\n * Maps statuspage component statuses to MUI colors.\n *\n */\nconst statusColorMap: { [key in ComponentStatus]: string } = {\n under_maintenance: 'info',\n operational: 'success',\n degraded_performance: 'warning',\n partial_outage: 'warning',\n major_outage: 'error',\n};\n\ntype StatusChipProps = {\n status: ComponentStatus;\n};\n\nconst formatStatusString = (status: string): string =>\n status\n .split('_')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ');\n\nexport const StatusChip = ({ status }: StatusChipProps) => (\n <Chip\n sx={{ margin: '0 8px' }}\n size=\"small\"\n label={formatStatusString(status)}\n color={statusColorMap[status] || ('default' as any)}\n />\n);\n"],"names":[],"mappings":";;;AAQA,MAAM,cAAuD,GAAA;AAAA,EAC3D,iBAAmB,EAAA,MAAA;AAAA,EACnB,WAAa,EAAA,SAAA;AAAA,EACb,oBAAsB,EAAA,SAAA;AAAA,EACtB,cAAgB,EAAA,SAAA;AAAA,EAChB,YAAc,EAAA,OAAA;AAChB,CAAA,CAAA;AAMA,MAAM,kBAAA,GAAqB,CAAC,MAC1B,KAAA,MAAA,CACG,MAAM,GAAG,CAAA,CACT,GAAI,CAAA,CAAA,IAAA,KAAQ,IAAK,CAAA,MAAA,CAAO,CAAC,CAAE,CAAA,WAAA,EAAgB,GAAA,IAAA,CAAK,KAAM,CAAA,CAAC,EAAE,WAAY,EAAC,CACtE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AAEN,MAAM,UAAa,GAAA,CAAC,EAAE,MAAA,EAC3B,qBAAA,KAAA,CAAA,aAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACC,EAAA,EAAI,EAAE,MAAA,EAAQ,OAAQ,EAAA;AAAA,IACtB,IAAK,EAAA,OAAA;AAAA,IACL,KAAA,EAAO,mBAAmB,MAAM,CAAA;AAAA,IAChC,KAAA,EAAO,cAAe,CAAA,MAAM,CAAM,IAAA,SAAA;AAAA,GAAA;AACpC;;;;"}
@@ -5,13 +5,6 @@ import IconButton from '@mui/material/IconButton';
5
5
  import OpenInNewIcon from '@mui/icons-material/OpenInNew';
6
6
  import { useComponents } from '../hooks/useComponents.esm.js';
7
7
 
8
- const statusColorMap = {
9
- under_maintenance: "info",
10
- operational: "success",
11
- degraded_performance: "warning",
12
- partial_outage: "warning",
13
- major_outage: "error"
14
- };
15
8
  const StatuspageComponent = ({ name }) => {
16
9
  const { loading, error, value } = useComponents(name);
17
10
  if (loading) {
@@ -20,13 +13,13 @@ const StatuspageComponent = ({ name }) => {
20
13
  if (error) {
21
14
  return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
22
15
  }
23
- const linkAction = (value == null ? void 0 : value.url) && /* @__PURE__ */ React.createElement(
16
+ const linkAction = value?.url && /* @__PURE__ */ React.createElement(
24
17
  IconButton,
25
18
  {
26
19
  "aria-label": "Go to our statuspage",
27
20
  role: "button",
28
21
  title: "Go to statuspage(.io)",
29
- href: value == null ? void 0 : value.url,
22
+ href: value?.url,
30
23
  target: "_blank"
31
24
  },
32
25
  /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
@@ -34,11 +27,11 @@ const StatuspageComponent = ({ name }) => {
34
27
  return /* @__PURE__ */ React.createElement(InfoCard, { title: "Status of our services", action: linkAction }, /* @__PURE__ */ React.createElement(
35
28
  ComponentGroupsList,
36
29
  {
37
- components: (value == null ? void 0 : value.components) || [],
38
- componentGroups: (value == null ? void 0 : value.componentGroups) || []
30
+ components: value?.components || [],
31
+ componentGroups: value?.componentGroups || []
39
32
  }
40
33
  ));
41
34
  };
42
35
 
43
- export { StatuspageComponent, statusColorMap };
36
+ export { StatuspageComponent };
44
37
  //# sourceMappingURL=StatuspageComponent.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatuspageComponent.esm.js","sources":["../../src/components/StatuspageComponent.tsx"],"sourcesContent":["import React from 'react';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport type { ComponentStatus } from '@axis-backstage/plugin-statuspage-common';\nimport { ComponentGroupsList } from './ComponentGroupsList';\nimport IconButton from '@mui/material/IconButton';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { useComponents } from '../hooks/useComponents';\n\n/**\n * StatuspageComponent props.\n *\n * @public\n */\nexport type StatuspageProps = {\n name: string;\n};\n\n/**\n * Maps statuspage component statuses to MUI colors.\n *\n * @public\n */\nexport const statusColorMap: { [key in ComponentStatus]: string } = {\n under_maintenance: 'info',\n operational: 'success',\n degraded_performance: 'warning',\n partial_outage: 'warning',\n major_outage: 'error',\n};\n\n/**\n * Visualizes a full statuspage.\n *\n * @param name - instance name from app config.\n * @public\n */\nexport const StatuspageComponent = ({ name }: StatuspageProps) => {\n const { loading, error, value } = useComponents(name);\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const linkAction = value?.url && (\n <IconButton\n aria-label=\"Go to our statuspage\"\n role=\"button\"\n title=\"Go to statuspage(.io)\"\n href={value?.url}\n target=\"_blank\"\n >\n <OpenInNewIcon />\n </IconButton>\n );\n\n return (\n <InfoCard title=\"Status of our services\" action={linkAction}>\n <ComponentGroupsList\n components={value?.components || []}\n componentGroups={value?.componentGroups || []}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,cAAuD,GAAA;AAAA,EAClE,iBAAmB,EAAA,MAAA;AAAA,EACnB,WAAa,EAAA,SAAA;AAAA,EACb,oBAAsB,EAAA,SAAA;AAAA,EACtB,cAAgB,EAAA,SAAA;AAAA,EAChB,YAAc,EAAA,OAAA;AAChB,EAAA;AAQO,MAAM,mBAAsB,GAAA,CAAC,EAAE,IAAA,EAA4B,KAAA;AAChE,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,IAAI,CAAA,CAAA;AAEpD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,GACnB;AACA,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA,CAAA;AAAA,GAC3C;AAEA,EAAM,MAAA,UAAA,GAAA,CAAa,+BAAO,GACxB,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAW,EAAA,sBAAA;AAAA,MACX,IAAK,EAAA,QAAA;AAAA,MACL,KAAM,EAAA,uBAAA;AAAA,MACN,MAAM,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA;AAAA,MACb,MAAO,EAAA,QAAA;AAAA,KAAA;AAAA,wCAEN,aAAc,EAAA,IAAA,CAAA;AAAA,GACjB,CAAA;AAGF,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,wBAAA,EAAyB,QAAQ,UAC/C,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAA,CAAY,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,UAAA,KAAc,EAAC;AAAA,MAClC,eAAA,EAAA,CAAiB,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,eAAA,KAAmB,EAAC;AAAA,KAAA;AAAA,GAEhD,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StatuspageComponent.esm.js","sources":["../../src/components/StatuspageComponent.tsx"],"sourcesContent":["import React from 'react';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { ComponentGroupsList } from './ComponentGroupsList';\nimport IconButton from '@mui/material/IconButton';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { useComponents } from '../hooks/useComponents';\n\n/**\n * StatuspageComponent props.\n *\n * @public\n */\nexport type StatuspageProps = {\n name: string;\n};\n\n/**\n * Visualizes a full statuspage.\n *\n * @param name - instance name from app config.\n * @public\n */\nexport const StatuspageComponent = ({ name }: StatuspageProps) => {\n const { loading, error, value } = useComponents(name);\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const linkAction = value?.url && (\n <IconButton\n aria-label=\"Go to our statuspage\"\n role=\"button\"\n title=\"Go to statuspage(.io)\"\n href={value?.url}\n target=\"_blank\"\n >\n <OpenInNewIcon />\n </IconButton>\n );\n\n return (\n <InfoCard title=\"Status of our services\" action={linkAction}>\n <ComponentGroupsList\n components={value?.components || []}\n componentGroups={value?.componentGroups || []}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,mBAAsB,GAAA,CAAC,EAAE,IAAA,EAA4B,KAAA;AAChE,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,IAAI,CAAA,CAAA;AAEpD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,GACnB;AACA,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA,CAAA;AAAA,GAC3C;AAEA,EAAM,MAAA,UAAA,GAAa,OAAO,GACxB,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAW,EAAA,sBAAA;AAAA,MACX,IAAK,EAAA,QAAA;AAAA,MACL,KAAM,EAAA,uBAAA;AAAA,MACN,MAAM,KAAO,EAAA,GAAA;AAAA,MACb,MAAO,EAAA,QAAA;AAAA,KAAA;AAAA,wCAEN,aAAc,EAAA,IAAA,CAAA;AAAA,GACjB,CAAA;AAGF,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,wBAAA,EAAyB,QAAQ,UAC/C,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAY,KAAO,EAAA,UAAA,IAAc,EAAC;AAAA,MAClC,eAAA,EAAiB,KAAO,EAAA,eAAA,IAAmB,EAAC;AAAA,KAAA;AAAA,GAEhD,CAAA,CAAA;AAEJ;;;;"}
@@ -10,10 +10,9 @@ import { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common'
10
10
  import { useComponents } from '../hooks/useComponents.esm.js';
11
11
 
12
12
  const StatuspageEntityCard = () => {
13
- var _a, _b;
14
13
  const { entity } = useEntity();
15
- const [name, wantedComponentsStr] = (_b = (_a = entity.metadata.annotations) == null ? void 0 : _a[STATUSPAGE_ANNOTATION]) == null ? void 0 : _b.split(":");
16
- const wantedComponents = wantedComponentsStr == null ? void 0 : wantedComponentsStr.split(",").map((it) => it.trim());
14
+ const [name, wantedComponentsStr] = entity.metadata.annotations?.[STATUSPAGE_ANNOTATION]?.split(":");
15
+ const wantedComponents = wantedComponentsStr?.split(",").map((it) => it.trim());
17
16
  const { loading, error, value } = useComponents(name);
18
17
  if (loading) {
19
18
  return /* @__PURE__ */ React.createElement(Progress, null);
@@ -27,24 +26,24 @@ const StatuspageEntityCard = () => {
27
26
  if (error) {
28
27
  return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
29
28
  }
30
- const linkAction = (value == null ? void 0 : value.url) && /* @__PURE__ */ React.createElement(
29
+ const linkAction = value?.url && /* @__PURE__ */ React.createElement(
31
30
  IconButton,
32
31
  {
33
32
  "aria-label": "Go to our statuspage",
34
33
  role: "button",
35
34
  title: "Go to statuspage(.io)",
36
- href: value == null ? void 0 : value.url,
35
+ href: value?.url,
37
36
  target: "_blank"
38
37
  },
39
38
  /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
40
39
  );
41
40
  const fullStatuspage = !wantedComponents;
42
- const filteredComponents = (value == null ? void 0 : value.components.filter(
41
+ const filteredComponents = value?.components.filter(
43
42
  (c) => !fullStatuspage && !c.group && wantedComponents.includes(c.id)
44
- )) || [];
45
- const filteredComponentGroups = (value == null ? void 0 : value.componentGroups.filter(
43
+ ) || [];
44
+ const filteredComponentGroups = value?.componentGroups.filter(
46
45
  (c) => fullStatuspage || wantedComponents.includes(c.id)
47
- )) || [];
46
+ ) || [];
48
47
  const noComponents = (!filteredComponents || filteredComponentGroups.length === 0) && filteredComponents && filteredComponents.length === 0;
49
48
  if (noComponents) {
50
49
  return /* @__PURE__ */ React.createElement(InfoCard, { title: "Service Status", action: linkAction }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "#FF5555" }, "The specified statuspage.io components could not be found. Check your annotation."));
@@ -52,7 +51,7 @@ const StatuspageEntityCard = () => {
52
51
  return /* @__PURE__ */ React.createElement(InfoCard, { title: "Service Status", action: linkAction }, filteredComponents && filteredComponents.length > 0 && /* @__PURE__ */ React.createElement(ComponentsTable, { components: filteredComponents }), filteredComponentGroups && filteredComponentGroups.length > 0 && /* @__PURE__ */ React.createElement(
53
52
  ComponentGroupsList,
54
53
  {
55
- components: (value == null ? void 0 : value.components) || [],
54
+ components: value?.components || [],
56
55
  componentGroups: filteredComponentGroups,
57
56
  expanded: !fullStatuspage
58
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StatuspageEntityCard.esm.js","sources":["../../src/components/StatuspageEntityCard.tsx"],"sourcesContent":["import React from 'react';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { ComponentsTable } from './ComponentsTable';\nimport { ComponentGroupsList } from './ComponentGroupsList';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\nimport { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';\nimport { useComponents } from '../hooks/useComponents';\n\n/**\n * Statuspage card intended for the EntityPage. Allows embedding of specific\n * statuspage components and component groups.\n *\n * @public\n */\nexport const StatuspageEntityCard = () => {\n const { entity } = useEntity();\n const [name, wantedComponentsStr] =\n entity.metadata.annotations?.[STATUSPAGE_ANNOTATION]?.split(':')!;\n const wantedComponents = wantedComponentsStr?.split(',').map(it => it.trim());\n\n const { loading, error, value } = useComponents(name);\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const linkAction = value?.url && (\n <IconButton\n aria-label=\"Go to our statuspage\"\n role=\"button\"\n title=\"Go to statuspage(.io)\"\n href={value?.url}\n target=\"_blank\"\n >\n <OpenInNewIcon />\n </IconButton>\n );\n\n const fullStatuspage = !wantedComponents;\n const filteredComponents =\n value?.components.filter(\n c => !fullStatuspage && !c.group && wantedComponents.includes(c.id),\n ) || [];\n const filteredComponentGroups =\n value?.componentGroups.filter(\n c => fullStatuspage || wantedComponents.includes(c.id),\n ) || [];\n const noComponents =\n (!filteredComponents || filteredComponentGroups.length === 0) &&\n filteredComponents &&\n filteredComponents.length === 0;\n\n if (noComponents) {\n return (\n <InfoCard title=\"Service Status\" action={linkAction}>\n <Typography variant=\"body2\" color=\"#FF5555\">\n The specified statuspage.io components could not be found. Check your\n annotation.\n </Typography>\n </InfoCard>\n );\n }\n return (\n <InfoCard title=\"Service Status\" action={linkAction}>\n {filteredComponents && filteredComponents.length > 0 && (\n <ComponentsTable components={filteredComponents} />\n )}\n {filteredComponentGroups && filteredComponentGroups.length > 0 && (\n <ComponentGroupsList\n components={value?.components || []}\n componentGroups={filteredComponentGroups}\n expanded={!fullStatuspage}\n />\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAqBO,MAAM,uBAAuB,MAAM;AArB1C,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAsBE,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAM,MAAA,CAAC,IAAM,EAAA,mBAAmB,CAC9B,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAA,CAAO,SAAS,WAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA8B,qBAA9B,CAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAsD,KAAM,CAAA,GAAA,CAAA,CAAA;AAC9D,EAAA,MAAM,mBAAmB,mBAAqB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,mBAAA,CAAA,KAAA,CAAM,KAAK,GAAI,CAAA,CAAA,EAAA,KAAM,GAAG,IAAK,EAAA,CAAA,CAAA;AAE3E,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,IAAI,CAAA,CAAA;AAEpD,EAAA,IAAI,OAAS,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CACH,CAAC,kBAAsB,IAAA,uBAAA,CAAwB,WAAW,CAC3D,KAAA,kBAAA,IACA,mBAAmB,MAAW,KAAA,CAAA,CAAA;AAEhC,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,gBAAA,EAAiB,MAAQ,EAAA,UAAA,EAAA,kBACtC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,KAAM,EAAA,SAAA,EAAA,EAAU,mFAG5C,CACF,CAAA,CAAA;AAAA,GAEJ;AACA,EAAA,2CACG,QAAS,EAAA,EAAA,KAAA,EAAM,kBAAiB,MAAQ,EAAA,UAAA,EAAA,EACtC,sBAAsB,kBAAmB,CAAA,MAAA,GAAS,CACjD,oBAAA,KAAA,CAAA,aAAA,CAAC,mBAAgB,UAAY,EAAA,kBAAA,EAAoB,GAElD,uBAA2B,IAAA,uBAAA,CAAwB,SAAS,CAC3D,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAA,CAAY,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,UAAA,KAAc,EAAC;AAAA,MAClC,eAAiB,EAAA,uBAAA;AAAA,MACjB,UAAU,CAAC,cAAA;AAAA,KAAA;AAAA,GAGjB,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StatuspageEntityCard.esm.js","sources":["../../src/components/StatuspageEntityCard.tsx"],"sourcesContent":["import React from 'react';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { ComponentsTable } from './ComponentsTable';\nimport { ComponentGroupsList } from './ComponentGroupsList';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\nimport { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';\nimport { useComponents } from '../hooks/useComponents';\n\n/**\n * Statuspage card intended for the EntityPage. Allows embedding of specific\n * statuspage components and component groups.\n *\n * @public\n */\nexport const StatuspageEntityCard = () => {\n const { entity } = useEntity();\n const [name, wantedComponentsStr] =\n entity.metadata.annotations?.[STATUSPAGE_ANNOTATION]?.split(':')!;\n const wantedComponents = wantedComponentsStr?.split(',').map(it => it.trim());\n\n const { loading, error, value } = useComponents(name);\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const linkAction = value?.url && (\n <IconButton\n aria-label=\"Go to our statuspage\"\n role=\"button\"\n title=\"Go to statuspage(.io)\"\n href={value?.url}\n target=\"_blank\"\n >\n <OpenInNewIcon />\n </IconButton>\n );\n\n const fullStatuspage = !wantedComponents;\n const filteredComponents =\n value?.components.filter(\n c => !fullStatuspage && !c.group && wantedComponents.includes(c.id),\n ) || [];\n const filteredComponentGroups =\n value?.componentGroups.filter(\n c => fullStatuspage || wantedComponents.includes(c.id),\n ) || [];\n const noComponents =\n (!filteredComponents || filteredComponentGroups.length === 0) &&\n filteredComponents &&\n filteredComponents.length === 0;\n\n if (noComponents) {\n return (\n <InfoCard title=\"Service Status\" action={linkAction}>\n <Typography variant=\"body2\" color=\"#FF5555\">\n The specified statuspage.io components could not be found. Check your\n annotation.\n </Typography>\n </InfoCard>\n );\n }\n return (\n <InfoCard title=\"Service Status\" action={linkAction}>\n {filteredComponents && filteredComponents.length > 0 && (\n <ComponentsTable components={filteredComponents} />\n )}\n {filteredComponentGroups && filteredComponentGroups.length > 0 && (\n <ComponentGroupsList\n components={value?.components || []}\n componentGroups={filteredComponentGroups}\n expanded={!fullStatuspage}\n />\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAqBO,MAAM,uBAA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;;"}
package/dist/index.esm.js CHANGED
@@ -5,10 +5,6 @@ import 'react';
5
5
  import '@mui/material/Stack';
6
6
  import '@backstage/core-components';
7
7
  import '@mui/material/Chip';
8
- import '@mui/material/IconButton';
9
- import '@mui/icons-material/OpenInNew';
10
- import '@backstage/core-plugin-api';
11
8
  export { statuspageApiRef } from './api/StatuspageApi.esm.js';
12
- import 'react-use/lib/useAsync';
13
9
  export { StatuspageClient } from './api/StatuspageClient.esm.js';
14
10
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -4,10 +4,7 @@ import { rootRouteRef } from './routes.esm.js';
4
4
  import { statuspageApiRef } from './api/StatuspageApi.esm.js';
5
5
  import { StatuspageClient } from './api/StatuspageClient.esm.js';
6
6
 
7
- const isStatuspageAvailable = (entity) => {
8
- var _a;
9
- return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[STATUSPAGE_ANNOTATION]);
10
- };
7
+ const isStatuspageAvailable = (entity) => Boolean(entity.metadata.annotations?.[STATUSPAGE_ANNOTATION]);
11
8
  const statuspagePlugin = createPlugin({
12
9
  id: "statuspage",
13
10
  apis: [
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';\nimport { Entity } from '@backstage/catalog-model';\n\nimport { rootRouteRef } from './routes';\nimport { statuspageApiRef } from './api/StatuspageApi';\nimport { StatuspageClient } from './api/StatuspageClient';\n\n/**\n * Checks availability of a statuspage component\n *\n * @public\n */\nexport const isStatuspageAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[STATUSPAGE_ANNOTATION]);\n\n/**\n * Create the plugin.\n *\n * @public\n */\nexport const statuspagePlugin = createPlugin({\n id: 'statuspage',\n apis: [\n createApiFactory({\n api: statuspageApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new StatuspageClient({ discoveryApi, fetchApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * Routable extension for StatuspageComponent.\n *\n * @public\n */\nexport const StatuspagePage = statuspagePlugin.provide(\n createRoutableExtension({\n name: 'StatuspagePage',\n component: () =>\n import('./components/StatuspageComponent').then(\n m => m.StatuspageComponent,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;;AAoBa,MAAA,qBAAA,GAAwB,CAAC,MAAgB,KAAA;AApBtD,EAAA,IAAA,EAAA,CAAA;AAqBE,EAAA,OAAA,OAAA,CAAA,CAAQ,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,WAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA8B,qBAAsB,CAAA,CAAA,CAAA;AAAA,EAAA;AAOvD,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,gBAAiB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU,CAAA;AAAA,KAClD,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAOM,MAAM,iBAAiB,gBAAiB,CAAA,OAAA;AAAA,EAC7C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,yCAAkC,CAAE,CAAA,IAAA;AAAA,MACzC,OAAK,CAAE,CAAA,mBAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';\nimport { Entity } from '@backstage/catalog-model';\n\nimport { rootRouteRef } from './routes';\nimport { statuspageApiRef } from './api/StatuspageApi';\nimport { StatuspageClient } from './api/StatuspageClient';\n\n/**\n * Checks availability of a statuspage component\n *\n * @public\n */\nexport const isStatuspageAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[STATUSPAGE_ANNOTATION]);\n\n/**\n * Create the plugin.\n *\n * @public\n */\nexport const statuspagePlugin = createPlugin({\n id: 'statuspage',\n apis: [\n createApiFactory({\n api: statuspageApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new StatuspageClient({ discoveryApi, fetchApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * Routable extension for StatuspageComponent.\n *\n * @public\n */\nexport const StatuspagePage = statuspagePlugin.provide(\n createRoutableExtension({\n name: 'StatuspagePage',\n component: () =>\n import('./components/StatuspageComponent').then(\n m => m.StatuspageComponent,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;;AAoBa,MAAA,qBAAA,GAAwB,CAAC,MACpC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,qBAAqB,CAAC,EAAA;AAOvD,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,gBAAiB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU,CAAA;AAAA,KAClD,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAOM,MAAM,iBAAiB,gBAAiB,CAAA,OAAA;AAAA,EAC7C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,yCAAkC,CAAE,CAAA,IAAA;AAAA,MACzC,OAAK,CAAE,CAAA,mBAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axis-backstage/plugin-statuspage",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -11,7 +11,13 @@
11
11
  "directory": "_release/package"
12
12
  },
13
13
  "backstage": {
14
- "role": "frontend-plugin"
14
+ "role": "frontend-plugin",
15
+ "pluginId": "statuspage",
16
+ "pluginPackages": [
17
+ "@axis-backstage/plugin-statuspage",
18
+ "@axis-backstage/plugin-statuspage-backend",
19
+ "@axis-backstage/plugin-statuspage-common"
20
+ ]
15
21
  },
16
22
  "sideEffects": false,
17
23
  "scripts": {
@@ -24,7 +30,7 @@
24
30
  "postpack": "backstage-cli package postpack"
25
31
  },
26
32
  "dependencies": {
27
- "@axis-backstage/plugin-statuspage-common": "^0.3.0",
33
+ "@axis-backstage/plugin-statuspage-common": "^0.4.0",
28
34
  "@backstage/catalog-model": "^1.5.0",
29
35
  "@backstage/core-components": "^0.14.7",
30
36
  "@backstage/core-plugin-api": "^1.9.2",
@@ -37,7 +43,7 @@
37
43
  "react": "^17.0.0 || ^18.0.0"
38
44
  },
39
45
  "devDependencies": {
40
- "@backstage/cli": "^0.26.6",
46
+ "@backstage/cli": "^0.26.10",
41
47
  "@backstage/dev-utils": "^1.0.32",
42
48
  "@testing-library/jest-dom": "^5.10.1"
43
49
  },