@axis-backstage/plugin-statuspage 0.10.1 → 0.11.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @axis-backstage/plugin-statuspage
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d29962b: Add support for the new frontend system (NFS). The plugin can now be imported from the `./alpha` entry point and registered as a feature in a new-system app.
8
+
9
+ The plugin provides three extensions out of the box:
10
+
11
+ - `api:statuspage` — registers the `StatuspageClient`
12
+ - `page:statuspage` — mounts the full statuspage at `/statuspage`
13
+ - `entity-card:statuspage` — renders the `StatuspageEntityCard` on entity pages
14
+
15
+ Configure the instance name for the page extension in `app-config.yaml`:
16
+
17
+ ```yaml
18
+ app:
19
+ extensions:
20
+ - page:statuspage:
21
+ config:
22
+ name: mystatuspageinstance
23
+ ```
24
+
25
+ ### Patch Changes
26
+
27
+ - d29962b: Use EntityInfoCard as the entity card wrapper
28
+
29
+ ## 0.10.2
30
+
31
+ ### Patch Changes
32
+
33
+ - 36858a7: Bumped to backstage 1.50.2
34
+ - Updated dependencies [36858a7]
35
+ - @axis-backstage/plugin-statuspage-common@0.9.1
36
+
3
37
  ## 0.10.1
4
38
 
5
39
  ### Patch Changes
package/README.md CHANGED
@@ -101,3 +101,39 @@ The `component_id` could be the id of either a component or a component group. T
101
101
 
102
102
  <Route path="/statuspage" element={<StatuspagePage name="myid" />} />
103
103
  ```
104
+
105
+ ## New Frontend System
106
+
107
+ 1. First, install the plugin into your app:
108
+
109
+ ```bash
110
+ # From your Backstage root directory
111
+ yarn --cwd packages/app add @axis-backstage/plugin-statuspage
112
+ ```
113
+
114
+ 2. If [feature discovery](https://backstage.io/docs/frontend-system/architecture/app/#feature-discovery) is enabled in your app, the plugin will be automatically discovered. If not, add it manually:
115
+
116
+ ```ts
117
+ // packages/app/src/App.tsx
118
+ import statuspagePlugin from '@axis-backstage/plugin-statuspage/alpha';
119
+
120
+ const app = createApp({
121
+ features: [
122
+ // ...
123
+ statuspagePlugin,
124
+ ],
125
+ });
126
+ ```
127
+
128
+ 3. Configure the statuspage instance name for the page extension in `app-config.yaml`:
129
+
130
+ ```yaml
131
+ # app-config.yaml
132
+ app:
133
+ extensions:
134
+ - page:statuspage:
135
+ config:
136
+ name: mystatuspageinstance
137
+ ```
138
+
139
+ The `StatuspageEntityCard` is automatically added to entity pages via the `entity-card:statuspage` extension. No additional wiring in `EntityPage.tsx` is needed. The entity annotation setup remains the same — see [Integration with the Catalog](#integration-with-the-catalog) above.
@@ -0,0 +1,94 @@
1
+ import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
2
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
3
+ import * as react from 'react';
4
+ import * as _backstage_filter_predicates from '@backstage/filter-predicates';
5
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
6
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
7
+
8
+ /**
9
+ * Frontend plugin that allows visualization of component statuses from statuspage.io.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{
14
+ root: _backstage_core_plugin_api.RouteRef<undefined>;
15
+ }, {}, {
16
+ "api:statuspage": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
17
+ kind: "api";
18
+ name: undefined;
19
+ config: {};
20
+ configInput: {};
21
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
22
+ inputs: {};
23
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
24
+ }>;
25
+ "entity-card:statuspage": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
26
+ kind: "entity-card";
27
+ name: undefined;
28
+ config: {
29
+ filter: _backstage_filter_predicates.FilterPredicate | undefined;
30
+ type: "content" | "info" | undefined;
31
+ };
32
+ configInput: {
33
+ filter?: _backstage_filter_predicates.FilterPredicate | undefined;
34
+ type?: "content" | "info" | undefined;
35
+ };
36
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
37
+ optional: true;
38
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
39
+ optional: true;
40
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_plugin_catalog_react_alpha.EntityCardType, "catalog.entity-card-type", {
41
+ optional: true;
42
+ }>;
43
+ inputs: {};
44
+ params: {
45
+ loader: () => Promise<JSX.Element>;
46
+ filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
47
+ type?: _backstage_plugin_catalog_react_alpha.EntityCardType;
48
+ };
49
+ }>;
50
+ "page:statuspage": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
51
+ config: {
52
+ name: string;
53
+ path: string | undefined;
54
+ title: string | undefined;
55
+ };
56
+ configInput: {
57
+ name?: string | undefined;
58
+ path?: string | undefined | undefined;
59
+ title?: string | undefined | undefined;
60
+ };
61
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
62
+ optional: true;
63
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.title", {
64
+ optional: true;
65
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
66
+ optional: true;
67
+ }>;
68
+ inputs: {
69
+ pages: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
70
+ optional: true;
71
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.title", {
72
+ optional: true;
73
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.IconElement, "core.icon", {
74
+ optional: true;
75
+ }>, {
76
+ singleton: false;
77
+ optional: false;
78
+ internal: false;
79
+ }>;
80
+ };
81
+ kind: "page";
82
+ name: undefined;
83
+ params: {
84
+ path: string;
85
+ title?: string;
86
+ icon?: _backstage_frontend_plugin_api.IconElement;
87
+ loader?: () => Promise<react.JSX.Element>;
88
+ routeRef?: _backstage_frontend_plugin_api.RouteRef;
89
+ noHeader?: boolean;
90
+ };
91
+ }>;
92
+ }>;
93
+
94
+ export { _default as default };
@@ -0,0 +1,58 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { ApiBlueprint, fetchApiRef, discoveryApiRef, PageBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
3
+ import { statuspageApiRef } from './api/StatuspageApi.esm.js';
4
+ import { StatuspageClient } from './api/StatuspageClient.esm.js';
5
+ import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
6
+ import { rootRouteRef } from './routes.esm.js';
7
+ import { z } from 'zod';
8
+
9
+ const statuspageApi = ApiBlueprint.make({
10
+ params: (defineParams) => defineParams({
11
+ api: statuspageApiRef,
12
+ deps: {
13
+ discoveryApi: discoveryApiRef,
14
+ fetchApi: fetchApiRef
15
+ },
16
+ factory: ({ discoveryApi, fetchApi }) => new StatuspageClient({ discoveryApi, fetchApi })
17
+ })
18
+ });
19
+ const statuspagePage = PageBlueprint.makeWithOverrides({
20
+ configSchema: {
21
+ /**
22
+ * The name of the statuspage instance as configured in `app-config.yaml`.
23
+ *
24
+ * @example
25
+ * ```yaml
26
+ * # app-config.yaml
27
+ * app:
28
+ * extensions:
29
+ * - page:statuspage:
30
+ * config:
31
+ * name: mystatuspageinstance
32
+ * ```
33
+ */
34
+ name: z.string().default("")
35
+ },
36
+ factory(originalFactory, { config }) {
37
+ return originalFactory({
38
+ path: "/statuspage",
39
+ routeRef: rootRouteRef,
40
+ loader: async () => import('./components/StatuspageComponent.esm.js').then((m) => /* @__PURE__ */ jsx(m.StatuspageComponent, { name: config.name }))
41
+ });
42
+ }
43
+ });
44
+ const statuspageEntityCard = EntityCardBlueprint.make({
45
+ params: {
46
+ loader: async () => import('./components/StatuspageEntityCard.esm.js').then((m) => /* @__PURE__ */ jsx(m.StatuspageEntityCard, {}))
47
+ }
48
+ });
49
+ var alpha = createFrontendPlugin({
50
+ pluginId: "statuspage",
51
+ extensions: [statuspageApi, statuspagePage, statuspageEntityCard],
52
+ routes: {
53
+ root: rootRouteRef
54
+ }
55
+ });
56
+
57
+ export { alpha as default };
58
+ //# sourceMappingURL=alpha.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/**\n * Frontend plugin that allows visualization of component statuses from statuspage.io.\n *\n * @packageDocumentation\n */\n\nimport {\n ApiBlueprint,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport { statuspageApiRef } from './api/StatuspageApi';\nimport { StatuspageClient } from './api/StatuspageClient';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { rootRouteRef } from './routes';\nimport { z } from 'zod';\n\nconst statuspageApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: statuspageApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new StatuspageClient({ discoveryApi, fetchApi }),\n }),\n});\n\nconst statuspagePage = PageBlueprint.makeWithOverrides({\n configSchema: {\n /**\n * The name of the statuspage instance as configured in `app-config.yaml`.\n *\n * @example\n * ```yaml\n * # app-config.yaml\n * app:\n * extensions:\n * - page:statuspage:\n * config:\n * name: mystatuspageinstance\n * ```\n */\n name: z.string().default(''),\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n path: '/statuspage',\n routeRef: rootRouteRef,\n loader: async () =>\n import('./components/StatuspageComponent').then(m => (\n <m.StatuspageComponent name={config.name} />\n )),\n });\n },\n});\n\nconst statuspageEntityCard = EntityCardBlueprint.make({\n params: {\n loader: async () =>\n import('./components/StatuspageEntityCard').then(m => (\n <m.StatuspageEntityCard />\n )),\n },\n});\n\nexport default createFrontendPlugin({\n pluginId: 'statuspage',\n extensions: [statuspageApi, statuspagePage, statuspageEntityCard],\n routes: {\n root: rootRouteRef,\n },\n});\n"],"names":[],"mappings":";;;;;;;;AAmBA,MAAM,aAAA,GAAgB,aAAa,IAAA,CAAK;AAAA,EACtC,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,gBAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,gBAAA,CAAiB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,GAClD;AACL,CAAC,CAAA;AAED,MAAM,cAAA,GAAiB,cAAc,iBAAA,CAAkB;AAAA,EACrD,YAAA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcZ,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,EAAE;AAAA,GAC7B;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,IAAA,EAAM,aAAA;AAAA,MACN,QAAA,EAAU,YAAA;AAAA,MACV,MAAA,EAAQ,YACN,OAAO,yCAAkC,EAAE,IAAA,CAAK,CAAA,CAAA,qBAC9C,GAAA,CAAC,CAAA,CAAE,mBAAA,EAAF,EAAsB,IAAA,EAAM,MAAA,CAAO,MAAM,CAC3C;AAAA,KACJ,CAAA;AAAA,EACH;AACF,CAAC,CAAA;AAED,MAAM,oBAAA,GAAuB,oBAAoB,IAAA,CAAK;AAAA,EACpD,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ,YACN,OAAO,0CAAmC,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBAC/C,GAAA,CAAC,CAAA,CAAE,oBAAA,EAAF,EAAuB,CACzB;AAAA;AAEP,CAAC,CAAA;AAED,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,YAAA;AAAA,EACV,UAAA,EAAY,CAAC,aAAA,EAAe,cAAA,EAAgB,oBAAoB,CAAA;AAAA,EAChE,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA;AAEV,CAAC,CAAA;;;;"}
@@ -1 +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;AACN,CAAC;;;;"}
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,YAAA,CAA4B;AAAA,EAC1D,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -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,EACpC,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QAAQ,IAAwC,EAAA;AACpD,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,YAAY,CAAA;AAC/D,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAG,EAAA,OAAO,CAAe,YAAA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AA,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;AAAA;AAClB;AACF,KACF;AAEA,IAAA,IAAI,IAAK,CAAA,EAAA,EAAW,OAAA,IAAA,CAAK,IAAK,EAAA;AAC9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAiD,8CAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA;AAE3E;;;;"}
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,gBAAA,CAA0C;AAAA,EACpC,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAAA,EAA6D;AACvE,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QAAQ,IAAA,EAAwC;AACpD,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,YAAY,CAAA;AAC/D,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,QAAA,CAAS,KAAA;AAAA,MACnC,CAAA,EAAG,OAAO,CAAA,YAAA,EAAe,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,MACjD;AAAA,QACE,MAAA,EAAQ,KAAA;AAAA,QACR,OAAA,EAAS;AAAA,UACP,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AACA,IAAA,IAAI,SAAS,EAAA,EAAI;AACf,MAAA,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,IAAA,EAAK;AACjC,MAAA,OAAO,IAA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C9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,8CAAA,EAAiD,IAAI,CAAA,CAAE,CAAA;AAAA,EACzE;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentGroupCard.esm.js","sources":["../../src/components/ComponentGroupCard.tsx"],"sourcesContent":["import 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":";;;;;;;;;;AAmBA,MAAM,cAAA,GAAiB,MAAO,CAAA,SAAS,CAAE,CAAA;AAAA,EACvC,MAAQ,EAAA,KAAA;AAAA,EACR,YAAc,EAAA;AAChB,CAAC,CAAA;AAED,MAAM,qBAAA,GAAwB,MAAO,CAAA,gBAAgB,CAAE,CAAA;AAAA,EACrD,gBAAkB,EAAA;AAAA,IAChB,SAAW,EAAA;AAAA;AAEf,CAAC,CAAA;AAEM,MAAM,qBAAqB,CAAC;AAAA,EACjC,UAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAW,GAAA;AACb,CAA2B,KAAA;AACzB,EACE,uBAAA,IAAA,CAAC,cAAuC,EAAA,EAAA,eAAA,EAAiB,QACvD,EAAA,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,qBAAsB,EAAA,EAAA,UAAA,kBAAa,GAAA,CAAA,cAAA,EAAA,EAAe,CACjD,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,WAAa,EAAA,QAAA,EAAA,cAAA,CAAe,IAAK,EAAA,CAAA;AAAA,sBACrD,GAAA,CAAC,6BAA0B,UAAwB,EAAA;AAAA,KACrD,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,gBAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,YAAwB,CAC3C,EAAA;AAAA,GAAA,EAAA,EAPmB,eAAe,EAQpC,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ComponentGroupCard.esm.js","sources":["../../src/components/ComponentGroupCard.tsx"],"sourcesContent":["import 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":";;;;;;;;;;AAmBA,MAAM,cAAA,GAAiB,MAAA,CAAO,SAAS,CAAA,CAAE;AAAA,EACvC,MAAA,EAAQ,KAAA;AAAA,EACR,YAAA,EAAc;AAChB,CAAC,CAAA;AAED,MAAM,qBAAA,GAAwB,MAAA,CAAO,gBAAgB,CAAA,CAAE;AAAA,EACrD,gBAAA,EAAkB;AAAA,IAChB,SAAA,EAAW;AAAA;AAEf,CAAC,CAAA;AAEM,MAAM,qBAAqB,CAAC;AAAA,EACjC,UAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAA,GAAW;AACb,CAAA,KAA2B;AACzB,EAAA,uBACE,IAAA,CAAC,cAAA,EAAA,EAAuC,eAAA,EAAiB,QAAA,EACvD,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,qBAAA,EAAA,EAAsB,UAAA,kBAAY,GAAA,CAAC,cAAA,EAAA,EAAe,CAAA,EACjD,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,WAAA,EAAa,QAAA,EAAA,cAAA,CAAe,IAAA,EAAK,CAAA;AAAA,sBACrD,GAAA,CAAC,6BAA0B,UAAA,EAAwB;AAAA,KAAA,EACrD,CAAA;AAAA,oBACA,GAAA,CAAC,gBAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,YAAwB,CAAA,EAC3C;AAAA,GAAA,EAAA,EAPmB,eAAe,EAQpC,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentGroupStatusChips.esm.js","sources":["../../src/components/ComponentGroupStatusChips.tsx"],"sourcesContent":["import 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":";;;;AAIO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,CACE,qBAAA,GAAA,CAAA,QAAA,EAAA,EACG,qBAAW,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,GAAA,CAAA,IAAA,EAAA,EAAK,SAAS,CAAG,EAAA,SAAA,EAAU,UAC1B,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,QAAQ,SAAU,CAAA,MAAA,EAAQ,KADE,SAAU,CAAA,EAEpD,CACD,CAEH,mBAAA,GAAA,CAAC,QAAK,OAAS,EAAA,CAAA,EAAG,WAAU,QAC1B,EAAA,QAAA,kBAAA,GAAA,CAAC,cAAW,MAAO,EAAA,aAAA,EAAc,GACnC,CAEJ,EAAA;;;;"}
1
+ {"version":3,"file":"ComponentGroupStatusChips.esm.js","sources":["../../src/components/ComponentGroupStatusChips.tsx"],"sourcesContent":["import 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":";;;;AAIO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,CAAA,qBACE,GAAA,CAAA,QAAA,EAAA,EACG,qBAAW,IAAA,CAAK,CAAA,SAAA,KAAa,UAAU,MAAA,KAAW,aAAa,IAC9D,UAAA,CACG,MAAA,CAAO,eAAa,SAAA,CAAU,MAAA,KAAW,aAAa,CAAA,CACtD,GAAA,CAAI,+BACH,GAAA,CAAC,IAAA,EAAA,EAAK,SAAS,CAAA,EAAG,SAAA,EAAU,UAC1B,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,QAAQ,SAAA,CAAU,MAAA,EAAQ,KADE,SAAA,CAAU,EAEpD,CACD,CAAA,mBAEH,GAAA,CAAC,QAAK,OAAA,EAAS,CAAA,EAAG,WAAU,QAAA,EAC1B,QAAA,kBAAA,GAAA,CAAC,cAAW,MAAA,EAAO,aAAA,EAAc,GACnC,CAAA,EAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentGroupsList.esm.js","sources":["../../src/components/ComponentGroupsList.tsx"],"sourcesContent":["import 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":";;;;AAaO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,EAAA,2BACG,KAAM,EAAA,EAAA,UAAA,EAAW,MACf,EAAA,QAAA,EAAA,eAAA,CAAgB,IAAI,CACnB,cAAA,qBAAA,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MAEC,cAAA;AAAA,MACA,YAAY,UAAW,CAAA,MAAA,CAAO,OAAK,CAAE,CAAA,QAAA,KAAa,eAAe,EAAE,CAAA;AAAA,MACnE;AAAA,KAAA;AAAA,IAHK,cAAe,CAAA;AAAA,GAKvB,CACH,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ComponentGroupsList.esm.js","sources":["../../src/components/ComponentGroupsList.tsx"],"sourcesContent":["import 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":";;;;AAaO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA,KAA+B;AAC7B,EAAA,2BACG,KAAA,EAAA,EAAM,UAAA,EAAW,MAAA,EACf,QAAA,EAAA,eAAA,CAAgB,IAAI,CAAA,cAAA,qBACnB,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MAEC,cAAA;AAAA,MACA,YAAY,UAAA,CAAW,MAAA,CAAO,OAAK,CAAA,CAAE,QAAA,KAAa,eAAe,EAAE,CAAA;AAAA,MACnE;AAAA,KAAA;AAAA,IAHK,cAAA,CAAe;AAAA,GAKvB,CAAA,EACH,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentsTable.esm.js","sources":["../../src/components/ComponentsTable.tsx"],"sourcesContent":["import { 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":";;;;AAQO,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,yBAAkB,UAAW,EAAA,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA,CAAA;AAAA,MAC9D,KAAO,EAAA;AAAA;AACT,GACF;AAEA,EACE,uBAAA,GAAA;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;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;AAAA;AAAA,GACvE;AAEJ;;;;"}
1
+ {"version":3,"file":"ComponentsTable.esm.js","sources":["../../src/components/ComponentsTable.tsx"],"sourcesContent":["import { 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":";;;;AAQO,MAAM,eAAA,GAAkB,CAAC,EAAE,UAAA,EAAW,KAA4B;AAEvE,EAAA,MAAM,OAAA,GAAyB;AAAA,IAC7B,EAAE,KAAA,EAAO,QAAA,EAAU,KAAA,EAAO,MAAA,EAAQ,IAAI,IAAA,EAAK;AAAA,IAC3C;AAAA,MACE,KAAA,EAAO,QAAA;AAAA,MACP,KAAA,EAAO,QAAA;AAAA,MACP,QAAQ,CAAC,OAAA,yBAAkB,UAAA,EAAA,EAAW,MAAA,EAAQ,QAAQ,MAAA,EAAQ,CAAA;AAAA,MAC9D,KAAA,EAAO;AAAA;AACT,GACF;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS;AAAA,QACP,MAAA,EAAQ,KAAA;AAAA,QACR,MAAA,EAAQ,KAAA;AAAA,QACR,MAAA,EAAQ,KAAA;AAAA,QACR,OAAA,EAAS,OAAA;AAAA,QACT,OAAA,EAAS;AAAA,OACX;AAAA,MACA,OAAA;AAAA,MACA,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,EAAA,EAAG,MAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAG,CAAE;AAAA;AAAA,GACvE;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StatusChip.esm.js","sources":["../../src/components/StatusChip.tsx"],"sourcesContent":["import 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":";;;AAOA,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;AAChB,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;AAEN,MAAM,UAAa,GAAA,CAAC,EAAE,MAAA,EAC3B,qBAAA,GAAA;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;AAAA;AACpC;;;;"}
1
+ {"version":3,"file":"StatusChip.esm.js","sources":["../../src/components/StatusChip.tsx"],"sourcesContent":["import 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":";;;AAOA,MAAM,cAAA,GAAuD;AAAA,EAC3D,iBAAA,EAAmB,MAAA;AAAA,EACnB,WAAA,EAAa,SAAA;AAAA,EACb,oBAAA,EAAsB,SAAA;AAAA,EACtB,cAAA,EAAgB,SAAA;AAAA,EAChB,YAAA,EAAc;AAChB,CAAA;AAMA,MAAM,kBAAA,GAAqB,CAAC,MAAA,KAC1B,MAAA,CACG,MAAM,GAAG,CAAA,CACT,GAAA,CAAI,CAAA,IAAA,KAAQ,IAAA,CAAK,MAAA,CAAO,CAAC,CAAA,CAAE,WAAA,EAAY,GAAI,IAAA,CAAK,KAAA,CAAM,CAAC,EAAE,WAAA,EAAa,CAAA,CACtE,IAAA,CAAK,GAAG,CAAA;AAEN,MAAM,UAAA,GAAa,CAAC,EAAE,MAAA,EAAO,qBAClC,GAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACC,EAAA,EAAI,EAAE,MAAA,EAAQ,OAAA,EAAQ;AAAA,IACtB,IAAA,EAAK,OAAA;AAAA,IACL,KAAA,EAAO,mBAAmB,MAAM,CAAA;AAAA,IAChC,KAAA,EAAO,cAAA,CAAe,MAAM,CAAA,IAAM;AAAA;AACpC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StatuspageComponent.esm.js","sources":["../../src/components/StatuspageComponent.tsx"],"sourcesContent":["import {\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":";;;;;;;AAyBO,MAAM,mBAAsB,GAAA,CAAC,EAAE,IAAA,EAA4B,KAAA;AAChE,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,IAAI,CAAA;AAEpD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAEnB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAM,MAAA,UAAA,GAAa,OAAO,GACxB,oBAAA,GAAA;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,MAEP,8BAAC,aAAc,EAAA,EAAA;AAAA;AAAA,GACjB;AAGF,EAAA,uBACG,GAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,wBAAA,EAAyB,QAAQ,UAC/C,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAY,KAAO,EAAA,UAAA,IAAc,EAAC;AAAA,MAClC,eAAA,EAAiB,KAAO,EAAA,eAAA,IAAmB;AAAC;AAAA,GAEhD,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StatuspageComponent.esm.js","sources":["../../src/components/StatuspageComponent.tsx"],"sourcesContent":["import {\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":";;;;;;;AAyBO,MAAM,mBAAA,GAAsB,CAAC,EAAE,IAAA,EAAK,KAAuB;AAChE,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAM,GAAI,cAAc,IAAI,CAAA;AAEpD,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AACA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,uBAAO,GAAA,CAAC,sBAAmB,KAAA,EAAc,CAAA;AAAA,EAC3C;AAEA,EAAA,MAAM,UAAA,GAAa,OAAO,GAAA,oBACxB,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAW,sBAAA;AAAA,MACX,IAAA,EAAK,QAAA;AAAA,MACL,KAAA,EAAM,uBAAA;AAAA,MACN,MAAM,KAAA,EAAO,GAAA;AAAA,MACb,MAAA,EAAO,QAAA;AAAA,MAEP,8BAAC,aAAA,EAAA,EAAc;AAAA;AAAA,GACjB;AAGF,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAM,wBAAA,EAAyB,QAAQ,UAAA,EAC/C,QAAA,kBAAA,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAY,KAAA,EAAO,UAAA,IAAc,EAAC;AAAA,MAClC,eAAA,EAAiB,KAAA,EAAO,eAAA,IAAmB;AAAC;AAAA,GAC9C,EACF,CAAA;AAEJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Progress, ResponseErrorPanel, InfoCard } from '@backstage/core-components';
2
+ import { Progress, ResponseErrorPanel } from '@backstage/core-components';
3
3
  import OpenInNewIcon from '@mui/icons-material/OpenInNew';
4
- import { useEntity } from '@backstage/plugin-catalog-react';
4
+ import { useEntity, EntityInfoCard } from '@backstage/plugin-catalog-react';
5
5
  import { ComponentsTable } from './ComponentsTable.esm.js';
6
6
  import { ComponentGroupsList } from './ComponentGroupsList.esm.js';
7
7
  import IconButton from '@mui/material/IconButton';
@@ -46,9 +46,9 @@ const StatuspageEntityCard = () => {
46
46
  ) || [];
47
47
  const noComponents = (!filteredComponents || filteredComponentGroups.length === 0) && filteredComponents && filteredComponents.length === 0;
48
48
  if (noComponents) {
49
- return /* @__PURE__ */ jsx(InfoCard, { title: "Service Status", action: linkAction, children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "#FF5555", children: "The specified statuspage.io components could not be found. Check your annotation." }) });
49
+ return /* @__PURE__ */ jsx(EntityInfoCard, { title: "Service Status", headerActions: linkAction, children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "#FF5555", children: "The specified statuspage.io components could not be found. Check your annotation." }) });
50
50
  }
51
- return /* @__PURE__ */ jsxs(InfoCard, { title: "Service Status", action: linkAction, children: [
51
+ return /* @__PURE__ */ jsxs(EntityInfoCard, { title: "Service Status", headerActions: linkAction, children: [
52
52
  filteredComponents && filteredComponents.length > 0 && /* @__PURE__ */ jsx(ComponentsTable, { components: filteredComponents }),
53
53
  filteredComponentGroups && filteredComponentGroups.length > 0 && /* @__PURE__ */ jsx(
54
54
  ComponentGroupsList,
@@ -1 +1 @@
1
- {"version":3,"file":"StatuspageEntityCard.esm.js","sources":["../../src/components/StatuspageEntityCard.tsx"],"sourcesContent":["import {\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":";;;;;;;;;;;AAoBO,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,CAAC,IAAM,EAAA,mBAAmB,CAC9B,GAAA,MAAA,CAAO,SAAS,WAAc,GAAA,qBAAqB,CAAG,EAAA,KAAA,CAAM,GAAG,CAAA;AACjE,EAAM,MAAA,gBAAA,GAAmB,qBAAqB,KAAM,CAAA,GAAG,EAAE,GAAI,CAAA,CAAA,EAAA,KAAM,EAAG,CAAA,IAAA,EAAM,CAAA;AAE5E,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,IAAI,CAAA;AAEpD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAEnB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAEnB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAM,MAAA,UAAA,GAAa,OAAO,GACxB,oBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,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,MAAA,GAAS,CAC3D,oBAAA,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY,KAAO,EAAA,UAAA,IAAc,EAAC;AAAA,QAClC,eAAiB,EAAA,uBAAA;AAAA,QACjB,UAAU,CAAC;AAAA;AAAA;AACb,GAEJ,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StatuspageEntityCard.esm.js","sources":["../../src/components/StatuspageEntityCard.tsx"],"sourcesContent":["import { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { EntityInfoCard } from '@backstage/plugin-catalog-react';\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 <EntityInfoCard title=\"Service Status\" headerActions={linkAction}>\n <Typography variant=\"body2\" color=\"#FF5555\">\n The specified statuspage.io components could not be found. Check your\n annotation.\n </Typography>\n </EntityInfoCard>\n );\n }\n return (\n <EntityInfoCard title=\"Service Status\" headerActions={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 </EntityInfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAiBO,MAAM,uBAAuB,MAAM;AACxC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,CAAC,IAAA,EAAM,mBAAmB,CAAA,GAC9B,MAAA,CAAO,SAAS,WAAA,GAAc,qBAAqB,CAAA,EAAG,KAAA,CAAM,GAAG,CAAA;AACjE,EAAA,MAAM,gBAAA,GAAmB,qBAAqB,KAAA,CAAM,GAAG,EAAE,GAAA,CAAI,CAAA,EAAA,KAAM,EAAA,CAAG,IAAA,EAAM,CAAA;AAE5E,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAM,GAAI,cAAc,IAAI,CAAA;AAEpD,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AACA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,uBAAO,GAAA,CAAC,sBAAmB,KAAA,EAAc,CAAA;AAAA,EAC3C;AAEA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EA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AAA,EAAe,KAAA,EAAM,gBAAA,EAAiB,eAAe,UAAA,EACnD,QAAA,EAAA;AAAA,IAAA,kBAAA,IAAsB,mBAAmB,MAAA,GAAS,CAAA,oBACjD,GAAA,CAAC,eAAA,EAAA,EAAgB,YAAY,kBAAA,EAAoB,CAAA;AAAA,IAElD,uBAAA,IAA2B,uBAAA,CAAwB,MAAA,GAAS,CAAA,oBAC3D,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY,KAAA,EAAO,UAAA,IAAc,EAAC;AAAA,QAClC,eAAA,EAAiB,uBAAA;AAAA,QACjB,UAAU,CAAC;AAAA;AAAA;AACb,GAAA,EAEJ,CAAA;AAEJ;;;;"}
@@ -1 +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;AAE7C,EAAA,OAAO,SAAS,YAIV;AACJ,IAAA,MAAM,UAAa,GAAA,MAAM,aAAc,CAAA,aAAA,CAAc,IAAI,CAAA;AACzD,IAAA,MAAM,eAAkB,GAAA,MAAM,aAAc,CAAA,kBAAA,CAAmB,IAAI,CAAA;AACnE,IAAA,MAAM,EAAE,GAAI,EAAA,GAAI,MAAM,aAAA,CAAc,QAAQ,IAAI,CAAA;AAChD,IAAO,OAAA;AAAA,MACL,UAAA;AAAA,MACA,eAAA;AAAA,MACA;AAAA,KACF;AAAA,GACF,EAAG,CAAC,IAAI,CAAC,CAAA;AACX;;;;"}
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":";;;;AAQO,MAAM,aAAA,GAAgB,CAAC,IAAA,KAAiB;AAC7C,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAE7C,EAAA,OAAO,SAAS,YAIV;AACJ,IAAA,MAAM,UAAA,GAAa,MAAM,aAAA,CAAc,aAAA,CAAc,IAAI,CAAA;AACzD,IAAA,MAAM,eAAA,GAAkB,MAAM,aAAA,CAAc,kBAAA,CAAmB,IAAI,CAAA;AACnE,IAAA,MAAM,EAAE,GAAA,EAAI,GAAI,MAAM,aAAA,CAAc,QAAQ,IAAI,CAAA;AAChD,IAAA,OAAO;AAAA,MACL,UAAA;AAAA,MACA,eAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA;AACX;;;;"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,14 @@ import { Entity } from '@backstage/catalog-model';
5
5
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
6
6
  import { Component, ComponentGroup } from '@axis-backstage/plugin-statuspage-common';
7
7
 
8
+ /**
9
+ * Statuspage card intended for the EntityPage. Allows embedding of specific
10
+ * statuspage components and component groups.
11
+ *
12
+ * @public
13
+ */
14
+ declare const StatuspageEntityCard: () => react_jsx_runtime.JSX.Element;
15
+
8
16
  /**
9
17
  * StatuspageComponent props.
10
18
  *
@@ -35,14 +43,6 @@ declare const statuspagePlugin: _backstage_core_plugin_api.BackstagePlugin<{
35
43
  */
36
44
  declare const StatuspagePage: ({ name }: StatuspageProps) => react_jsx_runtime.JSX.Element;
37
45
 
38
- /**
39
- * Statuspage card intended for the EntityPage. Allows embedding of specific
40
- * statuspage components and component groups.
41
- *
42
- * @public
43
- */
44
- declare const StatuspageEntityCard: () => react_jsx_runtime.JSX.Element;
45
-
46
46
  /**
47
47
  * The definition for the statuspage api.
48
48
  *
@@ -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,MACpC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,qBAAqB,CAAC;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;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,gBAAiB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,KAClD;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA;AAEV,CAAC;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;AAAA,KACT;AAAA,IACF,UAAY,EAAA;AAAA,GACb;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":";;;;;;AAoBO,MAAM,qBAAA,GAAwB,CAAC,MAAA,KACpC,OAAA,CAAQ,OAAO,QAAA,CAAS,WAAA,GAAc,qBAAqB,CAAC;AAOvD,MAAM,mBAAmB,YAAA,CAAa;AAAA,EAC3C,EAAA,EAAI,YAAA;AAAA,EACJ,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,gBAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,YAAA,EAAc,eAAA;AAAA,QACd,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,gBAAA,CAAiB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,KAClD;AAAA,GACH;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA;AAEV,CAAC;AAOM,MAAM,iBAAiB,gBAAA,CAAiB,OAAA;AAAA,EAC7C,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,yCAAkC,CAAA,CAAE,IAAA;AAAA,MACzC,OAAK,CAAA,CAAE;AAAA,KACT;AAAA,IACF,UAAA,EAAY;AAAA,GACb;AACH;;;;"}
@@ -1 +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;AACN,CAAC;;;;"}
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,cAAA,CAAe;AAAA,EACzC,EAAA,EAAI;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,8 +1,32 @@
1
1
  {
2
2
  "name": "@axis-backstage/plugin-statuspage",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
+ "exports": {
5
+ ".": {
6
+ "import": "./dist/index.esm.js",
7
+ "types": "./dist/index.d.ts",
8
+ "default": "./dist/index.esm.js"
9
+ },
10
+ "./alpha": {
11
+ "backstage": "@backstage/FrontendPlugin",
12
+ "import": "./dist/alpha.esm.js",
13
+ "types": "./dist/alpha.d.ts",
14
+ "default": "./dist/alpha.esm.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
4
18
  "main": "dist/index.esm.js",
5
19
  "types": "dist/index.d.ts",
20
+ "typesVersions": {
21
+ "*": {
22
+ "alpha": [
23
+ "dist/alpha.d.ts"
24
+ ],
25
+ "package.json": [
26
+ "package.json"
27
+ ]
28
+ }
29
+ },
6
30
  "license": "Apache-2.0",
7
31
  "publishConfig": {
8
32
  "access": "public",
@@ -17,7 +41,10 @@
17
41
  "@axis-backstage/plugin-statuspage",
18
42
  "@axis-backstage/plugin-statuspage-backend",
19
43
  "@axis-backstage/plugin-statuspage-common"
20
- ]
44
+ ],
45
+ "features": {
46
+ "./alpha": "@backstage/FrontendPlugin"
47
+ }
21
48
  },
22
49
  "sideEffects": false,
23
50
  "scripts": {
@@ -30,14 +57,16 @@
30
57
  "postpack": "backstage-cli package postpack"
31
58
  },
32
59
  "dependencies": {
33
- "@axis-backstage/plugin-statuspage-common": "^0.9.0",
34
- "@backstage/catalog-model": "^1.7.6",
35
- "@backstage/core-components": "^0.18.6",
36
- "@backstage/core-plugin-api": "^1.12.1",
37
- "@backstage/plugin-catalog-react": "^1.21.4",
60
+ "@axis-backstage/plugin-statuspage-common": "^0.9.1",
61
+ "@backstage/catalog-model": "^1.8.0",
62
+ "@backstage/core-components": "^0.18.9",
63
+ "@backstage/core-plugin-api": "^1.12.5",
64
+ "@backstage/frontend-plugin-api": "^0.16.2",
65
+ "@backstage/plugin-catalog-react": "^2.1.4",
38
66
  "@mui/icons-material": "^5.15.7",
39
67
  "@mui/material": "^5.15.7",
40
- "react-use": "^17.2.4"
68
+ "react-use": "^17.2.4",
69
+ "zod": "^4.3.6"
41
70
  },
42
71
  "peerDependencies": {
43
72
  "@types/react": "^17.0.0 || ^18.0.0",
@@ -46,20 +75,13 @@
46
75
  "react-router-dom": "^6.3.0"
47
76
  },
48
77
  "devDependencies": {
49
- "@backstage/cli": "^0.35.1",
50
- "@backstage/dev-utils": "^1.1.18",
78
+ "@backstage/cli": "^0.36.1",
79
+ "@backstage/dev-utils": "^1.1.22",
51
80
  "@testing-library/jest-dom": "^6.0.0"
52
81
  },
53
82
  "files": [
54
83
  "dist"
55
84
  ],
56
- "typesVersions": {
57
- "*": {
58
- "package.json": [
59
- "package.json"
60
- ]
61
- }
62
- },
63
85
  "module": "./dist/index.esm.js",
64
86
  "directory": "_release/package"
65
87
  }