@axis-backstage/plugin-statuspage 0.3.3 → 0.4.0

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.
@@ -0,0 +1,8 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+
3
+ const statuspageApiRef = createApiRef({
4
+ id: "plugin.statuspage"
5
+ });
6
+
7
+ export { statuspageApiRef };
8
+ //# sourceMappingURL=StatuspageApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatuspageApi.esm.js","sources":["../../src/api/StatuspageApi.ts"],"sourcesContent":["import { createApiRef } from '@backstage/core-plugin-api';\n\nimport type {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\n/**\n * The definition for the statuspage api.\n *\n * @public\n */\nexport type StatuspageApi = {\n getComponents(name: string): Promise<Component[]>;\n getComponentGroups(name: string): Promise<ComponentGroup[]>;\n getLink(name: string): Promise<{ url: string }>;\n};\n\n/**\n * The apiref for the statuspage plugin.\n *\n * @public\n */\nexport const statuspageApiRef = createApiRef<StatuspageApi>({\n id: 'plugin.statuspage',\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,mBAAmB,YAA4B,CAAA;AAAA,EAC1D,EAAI,EAAA,mBAAA;AACN,CAAC;;;;"}
@@ -0,0 +1,84 @@
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
+ class StatuspageClient {
8
+ constructor(options) {
9
+ __publicField(this, "discoveryApi");
10
+ __publicField(this, "fetchApi");
11
+ this.discoveryApi = options.discoveryApi;
12
+ this.fetchApi = options.fetchApi;
13
+ }
14
+ /**
15
+ * Fetches link for a statuspage
16
+ *
17
+ * @param name - name of the statuspage instance (from config)
18
+ * @returns the url
19
+ */
20
+ async getLink(name) {
21
+ const baseUrl = await this.discoveryApi.getBaseUrl("statuspage");
22
+ const response = await this.fetchApi.fetch(
23
+ `${baseUrl}/fetch-link/${encodeURIComponent(name)}`,
24
+ {
25
+ method: "GET",
26
+ headers: {
27
+ "Content-Type": "application/json"
28
+ }
29
+ }
30
+ );
31
+ if (response.ok) {
32
+ const data = await response.json();
33
+ return data;
34
+ }
35
+ throw new Error(
36
+ `Failed to get statuspage link for ${name} with status code ${response.status}`
37
+ );
38
+ }
39
+ /**
40
+ * Returns the components for a statuspage instance
41
+ *
42
+ * @param name - the name of statuspage instance (from config)
43
+ * @returns the components
44
+ */
45
+ async getComponents(name) {
46
+ const baseUrl = await this.discoveryApi.getBaseUrl("statuspage");
47
+ const data = await this.fetchApi.fetch(
48
+ `${baseUrl}/fetch-components/${encodeURIComponent(name)}`,
49
+ {
50
+ method: "GET",
51
+ headers: {
52
+ "Content-Type": "application/json"
53
+ }
54
+ }
55
+ );
56
+ if (data.ok)
57
+ return data.json();
58
+ throw new Error(`Failed to get statuspage components for ${name}`);
59
+ }
60
+ /**
61
+ * Returns the component groups for a statuspage instance
62
+ *
63
+ * @param name - the name of the statuspage instance (from config)
64
+ * @returns the component groups
65
+ */
66
+ async getComponentGroups(name) {
67
+ const baseUrl = await this.discoveryApi.getBaseUrl("statuspage");
68
+ const data = await this.fetchApi.fetch(
69
+ `${baseUrl}/fetch-component-groups/${encodeURIComponent(name)}`,
70
+ {
71
+ method: "GET",
72
+ headers: {
73
+ "Content-Type": "application/json"
74
+ }
75
+ }
76
+ );
77
+ if (data.ok)
78
+ return data.json();
79
+ throw new Error(`Failed to get statuspage component groups for ${name}`);
80
+ }
81
+ }
82
+
83
+ export { StatuspageClient };
84
+ //# sourceMappingURL=StatuspageClient.esm.js.map
@@ -0,0 +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 statu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AA;AAC/D,IAAM,MAAA,IAAA,GAAO,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MAC/B,CAAG,EAAA,OAAO,CAAqB,kBAAA,EAAA,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,MACvD;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,CAA2C,wCAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,GACnE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mBAAmB,IAAyC,EAAA;AAChE,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,YAAY,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;;;;"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import Accordion from '@mui/material/Accordion';
3
+ import AccordionDetails from '@mui/material/AccordionDetails';
4
+ import AccordionSummary from '@mui/material/AccordionSummary';
5
+ import Typography from '@mui/material/Typography';
6
+ import { styled } from '@mui/material/styles';
7
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
8
+ import { ComponentsTable } from './ComponentsTable.esm.js';
9
+ import { ComponentGroupStatusChips } from './ComponentGroupStatusChips.esm.js';
10
+
11
+ const DenseAccordion = styled(Accordion)({
12
+ margin: "2px",
13
+ borderRadius: "2px"
14
+ });
15
+ const DenseAccordionSummary = styled(AccordionSummary)({
16
+ "&.Mui-expanded": {
17
+ minHeight: "48px !important"
18
+ }
19
+ });
20
+ const ComponentGroupCard = ({
21
+ components,
22
+ componentGroup,
23
+ expanded = false
24
+ }) => {
25
+ return /* @__PURE__ */ React.createElement(DenseAccordion, { key: componentGroup.id, defaultExpanded: expanded }, /* @__PURE__ */ React.createElement(DenseAccordionSummary, { expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null) }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1" }, componentGroup.name), /* @__PURE__ */ React.createElement(ComponentGroupStatusChips, { components })), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement(ComponentsTable, { components })));
26
+ };
27
+
28
+ export { ComponentGroupCard };
29
+ //# sourceMappingURL=ComponentGroupCard.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentGroupCard.esm.js","sources":["../../src/components/ComponentGroupCard.tsx"],"sourcesContent":["import React from 'react';\nimport Accordion from '@mui/material/Accordion';\nimport AccordionDetails from '@mui/material/AccordionDetails';\nimport AccordionSummary from '@mui/material/AccordionSummary';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport { ComponentsTable } from './ComponentsTable';\nimport { ComponentGroupStatusChips } from './ComponentGroupStatusChips';\nimport type {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\nexport type ComponentGroupProps = {\n components: Component[];\n componentGroup: ComponentGroup;\n expanded?: boolean;\n};\n\nconst DenseAccordion = styled(Accordion)({\n margin: '2px',\n borderRadius: '2px',\n});\n\nconst DenseAccordionSummary = styled(AccordionSummary)({\n '&.Mui-expanded': {\n minHeight: '48px !important',\n },\n});\n\nexport const ComponentGroupCard = ({\n components,\n componentGroup,\n expanded = false,\n}: ComponentGroupProps) => {\n return (\n <DenseAccordion key={componentGroup.id} defaultExpanded={expanded}>\n <DenseAccordionSummary expandIcon={<ExpandMoreIcon />}>\n <Typography variant=\"subtitle1\">{componentGroup.name}</Typography>\n <ComponentGroupStatusChips components={components} />\n </DenseAccordionSummary>\n <AccordionDetails>\n <ComponentsTable components={components} />\n </AccordionDetails>\n </DenseAccordion>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,cAAA,GAAiB,MAAO,CAAA,SAAS,CAAE,CAAA;AAAA,EACvC,MAAQ,EAAA,KAAA;AAAA,EACR,YAAc,EAAA,KAAA;AAChB,CAAC,CAAA,CAAA;AAED,MAAM,qBAAA,GAAwB,MAAO,CAAA,gBAAgB,CAAE,CAAA;AAAA,EACrD,gBAAkB,EAAA;AAAA,IAChB,SAAW,EAAA,iBAAA;AAAA,GACb;AACF,CAAC,CAAA,CAAA;AAEM,MAAM,qBAAqB,CAAC;AAAA,EACjC,UAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAW,GAAA,KAAA;AACb,CAA2B,KAAA;AACzB,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,GAAK,EAAA,cAAA,CAAe,EAAI,EAAA,eAAA,EAAiB,QACvD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,qBAAsB,EAAA,EAAA,UAAA,kBAAa,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,qBAChD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAA,EAAa,cAAe,CAAA,IAAK,CACrD,kBAAA,KAAA,CAAA,aAAA,CAAC,6BAA0B,UAAwB,EAAA,CACrD,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,UAAA,EAAwB,CAC3C,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import Grid from '@mui/material/Unstable_Grid2';
3
+ import { StatusChip } from './StatusChip.esm.js';
4
+
5
+ const ComponentGroupStatusChips = ({
6
+ components
7
+ }) => /* @__PURE__ */ React.createElement(React.Fragment, null, components.some((component) => component.status !== "operational") ? components.filter((component) => component.status !== "operational").map((component) => /* @__PURE__ */ React.createElement(Grid, { padding: 0, alignSelf: "center", key: component.id }, /* @__PURE__ */ React.createElement(StatusChip, { status: component.status }))) : /* @__PURE__ */ React.createElement(Grid, { padding: 0, alignSelf: "center" }, /* @__PURE__ */ React.createElement(StatusChip, { status: "operational" })));
8
+
9
+ export { ComponentGroupStatusChips };
10
+ //# sourceMappingURL=ComponentGroupStatusChips.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentGroupStatusChips.esm.js","sources":["../../src/components/ComponentGroupStatusChips.tsx"],"sourcesContent":["import React from 'react';\nimport Grid from '@mui/material/Unstable_Grid2';\nimport { ComponentsTableProps } from './ComponentsTable';\nimport { StatusChip } from './StatusChip';\n\nexport const ComponentGroupStatusChips = ({\n components,\n}: ComponentsTableProps) => (\n <>\n {components.some(component => component.status !== 'operational') ? (\n components\n .filter(component => component.status !== 'operational')\n .map(component => (\n <Grid padding={0} alignSelf=\"center\" key={component.id}>\n <StatusChip status={component.status} />\n </Grid>\n ))\n ) : (\n <Grid padding={0} alignSelf=\"center\">\n <StatusChip status=\"operational\" />\n </Grid>\n )}\n </>\n);\n"],"names":[],"mappings":";;;;AAKO,MAAM,4BAA4B,CAAC;AAAA,EACxC,UAAA;AACF,CACE,qBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,WAAW,IAAK,CAAA,CAAA,SAAA,KAAa,UAAU,MAAW,KAAA,aAAa,IAC9D,UACG,CAAA,MAAA,CAAO,eAAa,SAAU,CAAA,MAAA,KAAW,aAAa,CACtD,CAAA,GAAA,CAAI,+BACF,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,CAAG,EAAA,SAAA,EAAU,UAAS,GAAK,EAAA,SAAA,CAAU,sBACjD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,QAAQ,SAAU,CAAA,MAAA,EAAQ,CACxC,CACD,CAAA,uCAEF,IAAK,EAAA,EAAA,OAAA,EAAS,GAAG,SAAU,EAAA,QAAA,EAAA,sCACzB,UAAW,EAAA,EAAA,MAAA,EAAO,aAAc,EAAA,CACnC,CAEJ;;;;"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import Stack from '@mui/material/Stack';
3
+ import { ComponentGroupCard } from './ComponentGroupCard.esm.js';
4
+
5
+ const ComponentGroupsList = ({
6
+ components,
7
+ componentGroups,
8
+ expanded
9
+ }) => {
10
+ return /* @__PURE__ */ React.createElement(Stack, { paddingTop: "10px" }, componentGroups.map((componentGroup) => /* @__PURE__ */ React.createElement(
11
+ ComponentGroupCard,
12
+ {
13
+ key: componentGroup.id,
14
+ componentGroup,
15
+ components: components.filter((c) => c.group_id === componentGroup.id),
16
+ expanded
17
+ }
18
+ )));
19
+ };
20
+
21
+ export { ComponentGroupsList };
22
+ //# sourceMappingURL=ComponentGroupsList.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentGroupsList.esm.js","sources":["../../src/components/ComponentGroupsList.tsx"],"sourcesContent":["import React from 'react';\nimport Stack from '@mui/material/Stack';\nimport { ComponentGroupCard } from './ComponentGroupCard';\nimport type {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\nexport type ComponentGroupListProps = {\n components: Component[];\n componentGroups: ComponentGroup[];\n expanded?: boolean;\n};\n\nexport const ComponentGroupsList = ({\n components,\n componentGroups,\n expanded,\n}: ComponentGroupListProps) => {\n return (\n <Stack paddingTop=\"10px\">\n {componentGroups.map(componentGroup => (\n <ComponentGroupCard\n key={componentGroup.id}\n componentGroup={componentGroup}\n components={components.filter(c => c.group_id === componentGroup.id)}\n expanded={expanded}\n />\n ))}\n </Stack>\n );\n};\n"],"names":[],"mappings":";;;;AAcO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AACF,CAA+B,KAAA;AAC7B,EAAA,2CACG,KAAM,EAAA,EAAA,UAAA,EAAW,MACf,EAAA,EAAA,eAAA,CAAgB,IAAI,CACnB,cAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,KAAK,cAAe,CAAA,EAAA;AAAA,MACpB,cAAA;AAAA,MACA,YAAY,UAAW,CAAA,MAAA,CAAO,OAAK,CAAE,CAAA,QAAA,KAAa,eAAe,EAAE,CAAA;AAAA,MACnE,QAAA;AAAA,KAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Table } from '@backstage/core-components';
3
+ import { StatusChip } from './StatusChip.esm.js';
4
+
5
+ const ComponentsTable = ({ components }) => {
6
+ const columns = [
7
+ { title: "System", field: "name", id: "id" },
8
+ {
9
+ title: "Status",
10
+ field: "status",
11
+ render: (rowData) => /* @__PURE__ */ React.createElement(StatusChip, { status: rowData.status }),
12
+ align: "right"
13
+ }
14
+ ];
15
+ return /* @__PURE__ */ React.createElement(
16
+ Table,
17
+ {
18
+ options: {
19
+ search: false,
20
+ paging: false,
21
+ header: false,
22
+ padding: "dense",
23
+ toolbar: false
24
+ },
25
+ columns,
26
+ data: components.map(({ name, status, id }) => ({ name, status, id }))
27
+ }
28
+ );
29
+ };
30
+
31
+ export { ComponentsTable };
32
+ //# sourceMappingURL=ComponentsTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentsTable.esm.js","sources":["../../src/components/ComponentsTable.tsx"],"sourcesContent":["import React from 'react';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport type { Component } from '@axis-backstage/plugin-statuspage-common';\nimport { StatusChip } from './StatusChip';\n\nexport type ComponentsTableProps = {\n components: Component[];\n};\n\nexport const ComponentsTable = ({ components }: ComponentsTableProps) => {\n // Columns definition\n const columns: TableColumn[] = [\n { title: 'System', field: 'name', id: 'id' },\n {\n title: 'Status',\n field: 'status',\n render: (rowData: any) => <StatusChip status={rowData.status} />,\n align: 'right',\n },\n ];\n\n return (\n <Table\n options={{\n search: false,\n paging: false,\n header: false,\n padding: 'dense',\n toolbar: false,\n }}\n columns={columns}\n data={components.map(({ name, status, id }) => ({ name, status, id }))}\n />\n );\n};\n"],"names":[],"mappings":";;;;AASO,MAAM,eAAkB,GAAA,CAAC,EAAE,UAAA,EAAuC,KAAA;AAEvE,EAAA,MAAM,OAAyB,GAAA;AAAA,IAC7B,EAAE,KAAO,EAAA,QAAA,EAAU,KAAO,EAAA,MAAA,EAAQ,IAAI,IAAK,EAAA;AAAA,IAC3C;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,QAAQ,CAAC,OAAA,yCAAkB,UAAW,EAAA,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA,CAAA;AAAA,MAC9D,KAAO,EAAA,OAAA;AAAA,KACT;AAAA,GACF,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA;AAAA,QACP,MAAQ,EAAA,KAAA;AAAA,QACR,MAAQ,EAAA,KAAA;AAAA,QACR,MAAQ,EAAA,KAAA;AAAA,QACR,OAAS,EAAA,OAAA;AAAA,QACT,OAAS,EAAA,KAAA;AAAA,OACX;AAAA,MACA,OAAA;AAAA,MACA,IAAM,EAAA,UAAA,CAAW,GAAI,CAAA,CAAC,EAAE,IAAA,EAAM,MAAQ,EAAA,EAAA,EAAU,MAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAK,CAAA,CAAA;AAAA,KAAA;AAAA,GACvE,CAAA;AAEJ;;;;"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import Chip from '@mui/material/Chip';
3
+ import { statusColorMap } from './StatuspageComponent.esm.js';
4
+
5
+ const formatStatusString = (status) => status.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
6
+ const StatusChip = ({ status }) => /* @__PURE__ */ React.createElement(
7
+ Chip,
8
+ {
9
+ sx: { margin: "0 8px" },
10
+ size: "small",
11
+ label: formatStatusString(status),
12
+ color: statusColorMap[status] || "default"
13
+ }
14
+ );
15
+
16
+ export { StatusChip };
17
+ //# sourceMappingURL=StatusChip.esm.js.map
@@ -0,0 +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;;;;"}
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { Progress, ResponseErrorPanel, InfoCard } from '@backstage/core-components';
3
+ import { ComponentGroupsList } from './ComponentGroupsList.esm.js';
4
+ import IconButton from '@mui/material/IconButton';
5
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew';
6
+ import { useComponents } from '../hooks/useComponents.esm.js';
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
+ const StatuspageComponent = ({ name }) => {
16
+ const { loading, error, value } = useComponents(name);
17
+ if (loading) {
18
+ return /* @__PURE__ */ React.createElement(Progress, null);
19
+ }
20
+ if (error) {
21
+ return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
22
+ }
23
+ const linkAction = (value == null ? void 0 : value.url) && /* @__PURE__ */ React.createElement(
24
+ IconButton,
25
+ {
26
+ "aria-label": "Go to our statuspage",
27
+ role: "button",
28
+ title: "Go to statuspage(.io)",
29
+ href: value == null ? void 0 : value.url,
30
+ target: "_blank"
31
+ },
32
+ /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
33
+ );
34
+ return /* @__PURE__ */ React.createElement(InfoCard, { title: "Status of our services", action: linkAction }, /* @__PURE__ */ React.createElement(
35
+ ComponentGroupsList,
36
+ {
37
+ components: (value == null ? void 0 : value.components) || [],
38
+ componentGroups: (value == null ? void 0 : value.componentGroups) || []
39
+ }
40
+ ));
41
+ };
42
+
43
+ export { StatuspageComponent, statusColorMap };
44
+ //# sourceMappingURL=StatuspageComponent.esm.js.map
@@ -0,0 +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,S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A,CAAA;AAEJ;;;;"}
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { Progress, ResponseErrorPanel, InfoCard } from '@backstage/core-components';
3
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew';
4
+ import { useEntity } from '@backstage/plugin-catalog-react';
5
+ import { ComponentsTable } from './ComponentsTable.esm.js';
6
+ import { ComponentGroupsList } from './ComponentGroupsList.esm.js';
7
+ import IconButton from '@mui/material/IconButton';
8
+ import Typography from '@mui/material/Typography';
9
+ import { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';
10
+ import { useComponents } from '../hooks/useComponents.esm.js';
11
+
12
+ const StatuspageEntityCard = () => {
13
+ var _a, _b;
14
+ 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());
17
+ const { loading, error, value } = useComponents(name);
18
+ if (loading) {
19
+ return /* @__PURE__ */ React.createElement(Progress, null);
20
+ }
21
+ if (error) {
22
+ return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
23
+ }
24
+ if (loading) {
25
+ return /* @__PURE__ */ React.createElement(Progress, null);
26
+ }
27
+ if (error) {
28
+ return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
29
+ }
30
+ const linkAction = (value == null ? void 0 : value.url) && /* @__PURE__ */ React.createElement(
31
+ IconButton,
32
+ {
33
+ "aria-label": "Go to our statuspage",
34
+ role: "button",
35
+ title: "Go to statuspage(.io)",
36
+ href: value == null ? void 0 : value.url,
37
+ target: "_blank"
38
+ },
39
+ /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
40
+ );
41
+ const fullStatuspage = !wantedComponents;
42
+ const filteredComponents = (value == null ? void 0 : value.components.filter(
43
+ (c) => !fullStatuspage && !c.group && wantedComponents.includes(c.id)
44
+ )) || [];
45
+ const filteredComponentGroups = (value == null ? void 0 : value.componentGroups.filter(
46
+ (c) => fullStatuspage || wantedComponents.includes(c.id)
47
+ )) || [];
48
+ const noComponents = (!filteredComponents || filteredComponentGroups.length === 0) && filteredComponents && filteredComponents.length === 0;
49
+ if (noComponents) {
50
+ 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."));
51
+ }
52
+ 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
+ ComponentGroupsList,
54
+ {
55
+ components: (value == null ? void 0 : value.components) || [],
56
+ componentGroups: filteredComponentGroups,
57
+ expanded: !fullStatuspage
58
+ }
59
+ ));
60
+ };
61
+
62
+ export { StatuspageEntityCard };
63
+ //# sourceMappingURL=StatuspageEntityCard.esm.js.map
@@ -0,0 +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,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,UAAA,KAAc,EAAC;AAAA,MAClC,eAAiB,EAAA,uBAAA;AAAA,MACjB,UAAU,CAAC,cAAA;AAAA,KAAA;AAAA,GAGjB,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,20 @@
1
+ import { useApi } from '@backstage/core-plugin-api';
2
+ import { statuspageApiRef } from '../api/StatuspageApi.esm.js';
3
+ import useAsync from 'react-use/lib/useAsync';
4
+
5
+ const useComponents = (name) => {
6
+ const statuspageApi = useApi(statuspageApiRef);
7
+ return useAsync(async () => {
8
+ const components = await statuspageApi.getComponents(name);
9
+ const componentGroups = await statuspageApi.getComponentGroups(name);
10
+ const { url } = await statuspageApi.getLink(name);
11
+ return {
12
+ components,
13
+ componentGroups,
14
+ url
15
+ };
16
+ }, [name]);
17
+ };
18
+
19
+ export { useComponents };
20
+ //# sourceMappingURL=useComponents.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComponents.esm.js","sources":["../../src/hooks/useComponents.ts"],"sourcesContent":["import { useApi } from '@backstage/core-plugin-api';\nimport { statuspageApiRef } from '../api/StatuspageApi';\nimport useAsync from 'react-use/lib/useAsync';\nimport {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\nexport const useComponents = (name: string) => {\n const statuspageApi = useApi(statuspageApiRef);\n\n return useAsync(async (): Promise<{\n components: Component[];\n componentGroups: ComponentGroup[];\n url?: string;\n }> => {\n const components = await statuspageApi.getComponents(name);\n const componentGroups = await statuspageApi.getComponentGroups(name);\n const { url } = await statuspageApi.getLink(name);\n return {\n components,\n componentGroups,\n url,\n };\n }, [name]);\n};\n"],"names":[],"mappings":";;;;AAQa,MAAA,aAAA,GAAgB,CAAC,IAAiB,KAAA;AAC7C,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA,CAAA;AAE7C,EAAA,OAAO,SAAS,YAIV;AACJ,IAAA,MAAM,UAAa,GAAA,MAAM,aAAc,CAAA,aAAA,CAAc,IAAI,CAAA,CAAA;AACzD,IAAA,MAAM,eAAkB,GAAA,MAAM,aAAc,CAAA,kBAAA,CAAmB,IAAI,CAAA,CAAA;AACnE,IAAA,MAAM,EAAE,GAAI,EAAA,GAAI,MAAM,aAAA,CAAc,QAAQ,IAAI,CAAA,CAAA;AAChD,IAAO,OAAA;AAAA,MACL,UAAA;AAAA,MACA,eAAA;AAAA,MACA,GAAA;AAAA,KACF,CAAA;AAAA,GACF,EAAG,CAAC,IAAI,CAAC,CAAA,CAAA;AACX;;;;"}
package/dist/index.d.ts CHANGED
@@ -100,4 +100,4 @@ declare class StatuspageClient implements StatuspageApi {
100
100
  getComponentGroups(name: string): Promise<ComponentGroup[]>;
101
101
  }
102
102
 
103
- export { StatuspageApi, StatuspageClient, StatuspageEntityCard, StatuspagePage, StatuspageProps, isStatuspageAvailable, statuspageApiRef, statuspagePlugin };
103
+ export { type StatuspageApi, StatuspageClient, StatuspageEntityCard, StatuspagePage, type StatuspageProps, isStatuspageAvailable, statuspageApiRef, statuspagePlugin };
package/dist/index.esm.js CHANGED
@@ -1,319 +1,14 @@
1
- import { createRouteRef, createApiRef, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension, useApi } from '@backstage/core-plugin-api';
2
- import { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';
3
- import React from 'react';
4
- import { Progress, ResponseErrorPanel, InfoCard, Table } from '@backstage/core-components';
5
- import OpenInNewIcon from '@mui/icons-material/OpenInNew';
6
- import { useEntity } from '@backstage/plugin-catalog-react';
7
- import Chip from '@mui/material/Chip';
8
- import Stack from '@mui/material/Stack';
9
- import Accordion from '@mui/material/Accordion';
10
- import AccordionDetails from '@mui/material/AccordionDetails';
11
- import AccordionSummary from '@mui/material/AccordionSummary';
12
- import Typography from '@mui/material/Typography';
13
- import { styled } from '@mui/material/styles';
14
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
15
- import Grid from '@mui/material/Unstable_Grid2';
16
- import IconButton from '@mui/material/IconButton';
17
- import useAsync from 'react-use/lib/useAsync';
18
-
19
- const rootRouteRef = createRouteRef({
20
- id: "statuspage"
21
- });
22
-
23
- const statuspageApiRef = createApiRef({
24
- id: "plugin.statuspage"
25
- });
26
-
27
- var __defProp = Object.defineProperty;
28
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
29
- var __publicField = (obj, key, value) => {
30
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31
- return value;
32
- };
33
- class StatuspageClient {
34
- constructor(options) {
35
- __publicField(this, "discoveryApi");
36
- __publicField(this, "fetchApi");
37
- this.discoveryApi = options.discoveryApi;
38
- this.fetchApi = options.fetchApi;
39
- }
40
- /**
41
- * Fetches link for a statuspage
42
- *
43
- * @param name - name of the statuspage instance (from config)
44
- * @returns the url
45
- */
46
- async getLink(name) {
47
- const baseUrl = await this.discoveryApi.getBaseUrl("statuspage");
48
- const response = await this.fetchApi.fetch(
49
- `${baseUrl}/fetch-link/${encodeURIComponent(name)}`,
50
- {
51
- method: "GET",
52
- headers: {
53
- "Content-Type": "application/json"
54
- }
55
- }
56
- );
57
- if (response.ok) {
58
- const data = await response.json();
59
- return data;
60
- }
61
- throw new Error(
62
- `Failed to get statuspage link for ${name} with status code ${response.status}`
63
- );
64
- }
65
- /**
66
- * Returns the components for a statuspage instance
67
- *
68
- * @param name - the name of statuspage instance (from config)
69
- * @returns the components
70
- */
71
- async getComponents(name) {
72
- const baseUrl = await this.discoveryApi.getBaseUrl("statuspage");
73
- const data = await this.fetchApi.fetch(
74
- `${baseUrl}/fetch-components/${encodeURIComponent(name)}`,
75
- {
76
- method: "GET",
77
- headers: {
78
- "Content-Type": "application/json"
79
- }
80
- }
81
- );
82
- if (data.ok)
83
- return data.json();
84
- throw new Error(`Failed to get statuspage components for ${name}`);
85
- }
86
- /**
87
- * Returns the component groups for a statuspage instance
88
- *
89
- * @param name - the name of the statuspage instance (from config)
90
- * @returns the component groups
91
- */
92
- async getComponentGroups(name) {
93
- const baseUrl = await this.discoveryApi.getBaseUrl("statuspage");
94
- const data = await this.fetchApi.fetch(
95
- `${baseUrl}/fetch-component-groups/${encodeURIComponent(name)}`,
96
- {
97
- method: "GET",
98
- headers: {
99
- "Content-Type": "application/json"
100
- }
101
- }
102
- );
103
- if (data.ok)
104
- return data.json();
105
- throw new Error(`Failed to get statuspage component groups for ${name}`);
106
- }
107
- }
108
-
109
- const isStatuspageAvailable = (entity) => {
110
- var _a;
111
- return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[STATUSPAGE_ANNOTATION]);
112
- };
113
- const statuspagePlugin = createPlugin({
114
- id: "statuspage",
115
- apis: [
116
- createApiFactory({
117
- api: statuspageApiRef,
118
- deps: {
119
- discoveryApi: discoveryApiRef,
120
- fetchApi: fetchApiRef
121
- },
122
- factory: ({ discoveryApi, fetchApi }) => new StatuspageClient({ discoveryApi, fetchApi })
123
- })
124
- ],
125
- routes: {
126
- root: rootRouteRef
127
- }
128
- });
129
- const StatuspagePage = statuspagePlugin.provide(
130
- createRoutableExtension({
131
- name: "StatuspagePage",
132
- component: () => Promise.resolve().then(function () { return StatuspageComponent$1; }).then(
133
- (m) => m.StatuspageComponent
134
- ),
135
- mountPoint: rootRouteRef
136
- })
137
- );
138
-
139
- const ComponentGroupStatusChips = ({
140
- components
141
- }) => /* @__PURE__ */ React.createElement(React.Fragment, null, components.some((component) => component.status !== "operational") ? components.filter((component) => component.status !== "operational").map((component) => /* @__PURE__ */ React.createElement(Grid, { padding: 0, alignSelf: "center", key: component.id }, /* @__PURE__ */ React.createElement(StatusChip, { status: component.status }))) : /* @__PURE__ */ React.createElement(Grid, { padding: 0, alignSelf: "center" }, /* @__PURE__ */ React.createElement(StatusChip, { status: "operational" })));
142
-
143
- const DenseAccordion = styled(Accordion)({
144
- margin: "2px",
145
- borderRadius: "2px"
146
- });
147
- const DenseAccordionSummary = styled(AccordionSummary)({
148
- "&.Mui-expanded": {
149
- minHeight: "48px !important"
150
- }
151
- });
152
- const ComponentGroupCard = ({
153
- components,
154
- componentGroup,
155
- expanded = false
156
- }) => {
157
- return /* @__PURE__ */ React.createElement(DenseAccordion, { key: componentGroup.id, defaultExpanded: expanded }, /* @__PURE__ */ React.createElement(DenseAccordionSummary, { expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null) }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1" }, componentGroup.name), /* @__PURE__ */ React.createElement(ComponentGroupStatusChips, { components })), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement(ComponentsTable, { components })));
158
- };
159
-
160
- const ComponentGroupsList = ({
161
- components,
162
- componentGroups,
163
- expanded
164
- }) => {
165
- return /* @__PURE__ */ React.createElement(Stack, { paddingTop: "10px" }, componentGroups.map((componentGroup) => /* @__PURE__ */ React.createElement(
166
- ComponentGroupCard,
167
- {
168
- key: componentGroup.id,
169
- componentGroup,
170
- components: components.filter((c) => c.group_id === componentGroup.id),
171
- expanded
172
- }
173
- )));
174
- };
175
-
176
- const useComponents = (name) => {
177
- const statuspageApi = useApi(statuspageApiRef);
178
- return useAsync(async () => {
179
- const components = await statuspageApi.getComponents(name);
180
- const componentGroups = await statuspageApi.getComponentGroups(name);
181
- const { url } = await statuspageApi.getLink(name);
182
- return {
183
- components,
184
- componentGroups,
185
- url
186
- };
187
- }, [name]);
188
- };
189
-
190
- const statusColorMap = {
191
- under_maintenance: "info",
192
- operational: "success",
193
- degraded_performance: "warning",
194
- partial_outage: "warning",
195
- major_outage: "error"
196
- };
197
- const StatuspageComponent = ({ name }) => {
198
- const { loading, error, value } = useComponents(name);
199
- if (loading) {
200
- return /* @__PURE__ */ React.createElement(Progress, null);
201
- }
202
- if (error) {
203
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
204
- }
205
- const linkAction = (value == null ? void 0 : value.url) && /* @__PURE__ */ React.createElement(
206
- IconButton,
207
- {
208
- "aria-label": "Go to our statuspage",
209
- role: "button",
210
- title: "Go to statuspage(.io)",
211
- href: value == null ? void 0 : value.url,
212
- target: "_blank"
213
- },
214
- /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
215
- );
216
- return /* @__PURE__ */ React.createElement(InfoCard, { title: "Status of our services", action: linkAction }, /* @__PURE__ */ React.createElement(
217
- ComponentGroupsList,
218
- {
219
- components: (value == null ? void 0 : value.components) || [],
220
- componentGroups: (value == null ? void 0 : value.componentGroups) || []
221
- }
222
- ));
223
- };
224
-
225
- var StatuspageComponent$1 = /*#__PURE__*/Object.freeze({
226
- __proto__: null,
227
- statusColorMap: statusColorMap,
228
- StatuspageComponent: StatuspageComponent
229
- });
230
-
231
- const formatStatusString = (status) => status.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
232
- const StatusChip = ({ status }) => /* @__PURE__ */ React.createElement(
233
- Chip,
234
- {
235
- sx: { margin: "0 8px" },
236
- size: "small",
237
- label: formatStatusString(status),
238
- color: statusColorMap[status] || "default"
239
- }
240
- );
241
-
242
- const ComponentsTable = ({ components }) => {
243
- const columns = [
244
- { title: "System", field: "name", id: "id" },
245
- {
246
- title: "Status",
247
- field: "status",
248
- render: (rowData) => /* @__PURE__ */ React.createElement(StatusChip, { status: rowData.status }),
249
- align: "right"
250
- }
251
- ];
252
- return /* @__PURE__ */ React.createElement(
253
- Table,
254
- {
255
- options: {
256
- search: false,
257
- paging: false,
258
- header: false,
259
- padding: "dense",
260
- toolbar: false
261
- },
262
- columns,
263
- data: components.map(({ name, status, id }) => ({ name, status, id }))
264
- }
265
- );
266
- };
267
-
268
- const StatuspageEntityCard = () => {
269
- var _a, _b;
270
- const { entity } = useEntity();
271
- const [name, wantedComponentsStr] = (_b = (_a = entity.metadata.annotations) == null ? void 0 : _a[STATUSPAGE_ANNOTATION]) == null ? void 0 : _b.split(":");
272
- const wantedComponents = wantedComponentsStr == null ? void 0 : wantedComponentsStr.split(",").map((it) => it.trim());
273
- const { loading, error, value } = useComponents(name);
274
- if (loading) {
275
- return /* @__PURE__ */ React.createElement(Progress, null);
276
- }
277
- if (error) {
278
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
279
- }
280
- if (loading) {
281
- return /* @__PURE__ */ React.createElement(Progress, null);
282
- }
283
- if (error) {
284
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
285
- }
286
- const linkAction = (value == null ? void 0 : value.url) && /* @__PURE__ */ React.createElement(
287
- IconButton,
288
- {
289
- "aria-label": "Go to our statuspage",
290
- role: "button",
291
- title: "Go to statuspage(.io)",
292
- href: value == null ? void 0 : value.url,
293
- target: "_blank"
294
- },
295
- /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
296
- );
297
- const fullStatuspage = !wantedComponents;
298
- const filteredComponents = (value == null ? void 0 : value.components.filter(
299
- (c) => !fullStatuspage && !c.group && wantedComponents.includes(c.id)
300
- )) || [];
301
- const filteredComponentGroups = (value == null ? void 0 : value.componentGroups.filter(
302
- (c) => fullStatuspage || wantedComponents.includes(c.id)
303
- )) || [];
304
- const noComponents = (!filteredComponents || filteredComponentGroups.length === 0) && filteredComponents && filteredComponents.length === 0;
305
- if (noComponents) {
306
- 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."));
307
- }
308
- 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(
309
- ComponentGroupsList,
310
- {
311
- components: (value == null ? void 0 : value.components) || [],
312
- componentGroups: filteredComponentGroups,
313
- expanded: !fullStatuspage
314
- }
315
- ));
316
- };
317
-
318
- export { StatuspageClient, StatuspageEntityCard, StatuspagePage, isStatuspageAvailable, statuspageApiRef, statuspagePlugin };
1
+ export { StatuspagePage, isStatuspageAvailable, statuspagePlugin } from './plugin.esm.js';
2
+ export { StatuspageEntityCard } from './components/StatuspageEntityCard.esm.js';
3
+ import './components/ComponentGroupCard.esm.js';
4
+ import 'react';
5
+ import '@mui/material/Stack';
6
+ import '@backstage/core-components';
7
+ import '@mui/material/Chip';
8
+ import '@mui/material/IconButton';
9
+ import '@mui/icons-material/OpenInNew';
10
+ import '@backstage/core-plugin-api';
11
+ export { statuspageApiRef } from './api/StatuspageApi.esm.js';
12
+ import 'react-use/lib/useAsync';
13
+ export { StatuspageClient } from './api/StatuspageClient.esm.js';
319
14
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/api/StatuspageApi.ts","../src/api/StatuspageClient.ts","../src/plugin.ts","../src/components/ComponentGroupStatusChips.tsx","../src/components/ComponentGroupCard.tsx","../src/components/ComponentGroupsList.tsx","../src/hooks/useComponents.ts","../src/components/StatuspageComponent.tsx","../src/components/StatusChip.tsx","../src/components/ComponentsTable.tsx","../src/components/StatuspageEntityCard.tsx"],"sourcesContent":["import { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'statuspage',\n});\n","import { createApiRef } from '@backstage/core-plugin-api';\n\nimport type {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\n/**\n * The definition for the statuspage api.\n *\n * @public\n */\nexport type StatuspageApi = {\n getComponents(name: string): Promise<Component[]>;\n getComponentGroups(name: string): Promise<ComponentGroup[]>;\n getLink(name: string): Promise<{ url: string }>;\n};\n\n/**\n * The apiref for the statuspage plugin.\n *\n * @public\n */\nexport const statuspageApiRef = createApiRef<StatuspageApi>({\n id: 'plugin.statuspage',\n});\n","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","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","import React from 'react';\nimport Grid from '@mui/material/Unstable_Grid2';\nimport { ComponentsTableProps } from './ComponentsTable';\nimport { StatusChip } from './StatusChip';\n\nexport const ComponentGroupStatusChips = ({\n components,\n}: ComponentsTableProps) => (\n <>\n {components.some(component => component.status !== 'operational') ? (\n components\n .filter(component => component.status !== 'operational')\n .map(component => (\n <Grid padding={0} alignSelf=\"center\" key={component.id}>\n <StatusChip status={component.status} />\n </Grid>\n ))\n ) : (\n <Grid padding={0} alignSelf=\"center\">\n <StatusChip status=\"operational\" />\n </Grid>\n )}\n </>\n);\n","import React from 'react';\nimport Accordion from '@mui/material/Accordion';\nimport AccordionDetails from '@mui/material/AccordionDetails';\nimport AccordionSummary from '@mui/material/AccordionSummary';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport { ComponentsTable } from './ComponentsTable';\nimport { ComponentGroupStatusChips } from './ComponentGroupStatusChips';\nimport type {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\nexport type ComponentGroupProps = {\n components: Component[];\n componentGroup: ComponentGroup;\n expanded?: boolean;\n};\n\nconst DenseAccordion = styled(Accordion)({\n margin: '2px',\n borderRadius: '2px',\n});\n\nconst DenseAccordionSummary = styled(AccordionSummary)({\n '&.Mui-expanded': {\n minHeight: '48px !important',\n },\n});\n\nexport const ComponentGroupCard = ({\n components,\n componentGroup,\n expanded = false,\n}: ComponentGroupProps) => {\n return (\n <DenseAccordion key={componentGroup.id} defaultExpanded={expanded}>\n <DenseAccordionSummary expandIcon={<ExpandMoreIcon />}>\n <Typography variant=\"subtitle1\">{componentGroup.name}</Typography>\n <ComponentGroupStatusChips components={components} />\n </DenseAccordionSummary>\n <AccordionDetails>\n <ComponentsTable components={components} />\n </AccordionDetails>\n </DenseAccordion>\n );\n};\n","import React from 'react';\nimport Stack from '@mui/material/Stack';\nimport { ComponentGroupCard } from './ComponentGroupCard';\nimport type {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\nexport type ComponentGroupListProps = {\n components: Component[];\n componentGroups: ComponentGroup[];\n expanded?: boolean;\n};\n\nexport const ComponentGroupsList = ({\n components,\n componentGroups,\n expanded,\n}: ComponentGroupListProps) => {\n return (\n <Stack paddingTop=\"10px\">\n {componentGroups.map(componentGroup => (\n <ComponentGroupCard\n key={componentGroup.id}\n componentGroup={componentGroup}\n components={components.filter(c => c.group_id === componentGroup.id)}\n expanded={expanded}\n />\n ))}\n </Stack>\n );\n};\n","import { useApi } from '@backstage/core-plugin-api';\nimport { statuspageApiRef } from '../api/StatuspageApi';\nimport useAsync from 'react-use/lib/useAsync';\nimport {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\nexport const useComponents = (name: string) => {\n const statuspageApi = useApi(statuspageApiRef);\n\n return useAsync(async (): Promise<{\n components: Component[];\n componentGroups: ComponentGroup[];\n url?: string;\n }> => {\n const components = await statuspageApi.getComponents(name);\n const componentGroups = await statuspageApi.getComponentGroups(name);\n const { url } = await statuspageApi.getLink(name);\n return {\n components,\n componentGroups,\n url,\n };\n }, [name]);\n};\n","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","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","import React from 'react';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport type { Component } from '@axis-backstage/plugin-statuspage-common';\nimport { StatusChip } from './StatusChip';\n\nexport type ComponentsTableProps = {\n components: Component[];\n};\n\nexport const ComponentsTable = ({ components }: ComponentsTableProps) => {\n // Columns definition\n const columns: TableColumn[] = [\n { title: 'System', field: 'name', id: 'id' },\n {\n title: 'Status',\n field: 'status',\n render: (rowData: any) => <StatusChip status={rowData.status} />,\n align: 'right',\n },\n ];\n\n return (\n <Table\n options={{\n search: false,\n paging: false,\n header: false,\n padding: 'dense',\n toolbar: false,\n }}\n columns={columns}\n data={components.map(({ name, status, id }) => ({ name, status, id }))}\n />\n );\n};\n","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":";;;;;;;;;;;;;;;;;;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,YAAA;AACN,CAAC,CAAA;;ACmBM,MAAM,mBAAmB,YAA4B,CAAA;AAAA,EAC1D,EAAI,EAAA,mBAAA;AACN,CAAC;;;;;;;;ACbM,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,CAA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AA,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":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,38 @@
1
+ import { createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
2
+ import { STATUSPAGE_ANNOTATION } from '@axis-backstage/plugin-statuspage-common';
3
+ import { rootRouteRef } from './routes.esm.js';
4
+ import { statuspageApiRef } from './api/StatuspageApi.esm.js';
5
+ import { StatuspageClient } from './api/StatuspageClient.esm.js';
6
+
7
+ const isStatuspageAvailable = (entity) => {
8
+ var _a;
9
+ return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[STATUSPAGE_ANNOTATION]);
10
+ };
11
+ const statuspagePlugin = createPlugin({
12
+ id: "statuspage",
13
+ apis: [
14
+ createApiFactory({
15
+ api: statuspageApiRef,
16
+ deps: {
17
+ discoveryApi: discoveryApiRef,
18
+ fetchApi: fetchApiRef
19
+ },
20
+ factory: ({ discoveryApi, fetchApi }) => new StatuspageClient({ discoveryApi, fetchApi })
21
+ })
22
+ ],
23
+ routes: {
24
+ root: rootRouteRef
25
+ }
26
+ });
27
+ const StatuspagePage = statuspagePlugin.provide(
28
+ createRoutableExtension({
29
+ name: "StatuspagePage",
30
+ component: () => import('./components/StatuspageComponent.esm.js').then(
31
+ (m) => m.StatuspageComponent
32
+ ),
33
+ mountPoint: rootRouteRef
34
+ })
35
+ );
36
+
37
+ export { StatuspagePage, isStatuspageAvailable, statuspagePlugin };
38
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +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;;;;"}
@@ -0,0 +1,8 @@
1
+ import { createRouteRef } from '@backstage/core-plugin-api';
2
+
3
+ const rootRouteRef = createRouteRef({
4
+ id: "statuspage"
5
+ });
6
+
7
+ export { rootRouteRef };
8
+ //# sourceMappingURL=routes.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["import { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'statuspage',\n});\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,YAAA;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@axis-backstage/plugin-statuspage",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
8
8
  "access": "public",
9
9
  "main": "dist/index.esm.js",
10
- "types": "dist/index.d.ts"
10
+ "types": "dist/index.d.ts",
11
+ "directory": "_release/package"
11
12
  },
12
13
  "backstage": {
13
14
  "role": "frontend-plugin"
@@ -23,11 +24,11 @@
23
24
  "postpack": "backstage-cli package postpack"
24
25
  },
25
26
  "dependencies": {
26
- "@axis-backstage/plugin-statuspage-common": "^0.2.0",
27
- "@backstage/catalog-model": "^1.4.3",
28
- "@backstage/core-components": "^0.13.10",
29
- "@backstage/core-plugin-api": "^1.8.2",
30
- "@backstage/plugin-catalog-react": "^1.9.3",
27
+ "@axis-backstage/plugin-statuspage-common": "^0.3.0",
28
+ "@backstage/catalog-model": "^1.5.0",
29
+ "@backstage/core-components": "^0.14.7",
30
+ "@backstage/core-plugin-api": "^1.9.2",
31
+ "@backstage/plugin-catalog-react": "^1.12.0",
31
32
  "@mui/icons-material": "^5.15.7",
32
33
  "@mui/material": "^5.15.7",
33
34
  "react-use": "^17.2.4"
@@ -36,12 +37,13 @@
36
37
  "react": "^17.0.0 || ^18.0.0"
37
38
  },
38
39
  "devDependencies": {
39
- "@backstage/cli": "^0.25.1",
40
- "@backstage/dev-utils": "^1.0.26",
40
+ "@backstage/cli": "^0.26.6",
41
+ "@backstage/dev-utils": "^1.0.32",
41
42
  "@testing-library/jest-dom": "^5.10.1"
42
43
  },
43
44
  "files": [
44
45
  "dist"
45
46
  ],
46
- "module": "./dist/index.esm.js"
47
- }
47
+ "module": "./dist/index.esm.js",
48
+ "directory": "_release/package"
49
+ }
package/CHANGELOG.md DELETED
@@ -1,42 +0,0 @@
1
- # @axis-backstage/plugin-statuspage
2
-
3
- ## 0.3.3
4
-
5
- ### Patch Changes
6
-
7
- - ae965c0: Fix broken workspace dependencies
8
-
9
- ## 0.3.2
10
-
11
- ### Patch Changes
12
-
13
- - 60b6270: Fix broken release
14
-
15
- ## 0.3.1
16
-
17
- ### Patch Changes
18
-
19
- - 73b296f: Better README and small UI-fixes
20
-
21
- ## 0.3.0
22
-
23
- ### Minor Changes
24
-
25
- - 32683b9: StatuspageEntityCard was route mounted incorrectly, which broke the component in certain cases.
26
-
27
- ## 0.2.1
28
-
29
- ### Patch Changes
30
-
31
- - 050e48d: Replace all Mui Grid v1 with v2
32
-
33
- ## 0.2.0
34
-
35
- ### Minor Changes
36
-
37
- - b445aaa: Initial Release of the Statuspage Plugin
38
-
39
- ### Patch Changes
40
-
41
- - Updated dependencies [b445aaa]
42
- - @axis-backstage/plugin-statuspage-common@0.2.0