@axis-backstage/plugin-statuspage 0.5.1 → 0.6.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.
|
@@ -47,8 +47,7 @@ class StatuspageClient {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
if (data.ok)
|
|
51
|
-
return data.json();
|
|
50
|
+
if (data.ok) return data.json();
|
|
52
51
|
throw new Error(`Failed to get statuspage components for ${name}`);
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
@@ -68,8 +67,7 @@ class StatuspageClient {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
);
|
|
71
|
-
if (data.ok)
|
|
72
|
-
return data.json();
|
|
70
|
+
if (data.ok) return data.json();
|
|
73
71
|
throw new Error(`Failed to get statuspage component groups for ${name}`);
|
|
74
72
|
}
|
|
75
73
|
}
|
|
@@ -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,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EAEjB,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA,CAAA;AAAA,GAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QAAQ,IAAwC,EAAA;AACpD,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,YAAY,CAAA,CAAA;AAC/D,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAG,EAAA,OAAO,CAAe,YAAA,EAAA,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,MACjD;AAAA,QACE,MAAQ,EAAA,KAAA;AAAA,QACR,OAAS,EAAA;AAAA,UACP,cAAgB,EAAA,kBAAA;AAAA,SAClB;AAAA,OACF;AAAA,KACF,CAAA;AACA,IAAA,IAAI,SAAS,EAAI,EAAA;AACf,MAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACjC,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AACA,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAqC,kCAAA,EAAA,IAAI,CAAqB,kBAAA,EAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,KAC/E,CAAA;AAAA,GACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,cAAc,IAAoC,EAAA;AACtD,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,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
|
|
1
|
+
{"version":3,"file":"StatuspageClient.esm.js","sources":["../../src/api/StatuspageClient.ts"],"sourcesContent":["import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { StatuspageApi } from './StatuspageApi';\nimport {\n Component,\n ComponentGroup,\n} from '@axis-backstage/plugin-statuspage-common';\n\n/**\n * The client implementation for the frontend api.\n *\n * @public\n */\nexport class StatuspageClient implements StatuspageApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n /**\n * Fetches link for a statuspage\n *\n * @param name - name of the statuspage instance (from config)\n * @returns the url\n */\n async getLink(name: string): Promise<{ url: string }> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const response = await this.fetchApi.fetch(\n `${baseUrl}/fetch-link/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n const data = await response.json();\n return data;\n }\n throw new Error(\n `Failed to get statuspage link for ${name} with status code ${response.status}`,\n );\n }\n\n /**\n * Returns the components for a statuspage instance\n *\n * @param name - the name of statuspage instance (from config)\n * @returns the components\n */\n async getComponents(name: string): Promise<Component[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const data = await this.fetchApi.fetch(\n `${baseUrl}/fetch-components/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n\n if (data.ok) return data.json();\n throw new Error(`Failed to get statuspage components for ${name}`);\n }\n\n /**\n * Returns the component groups for a statuspage instance\n *\n * @param name - the name of the statuspage instance (from config)\n * @returns the component groups\n */\n async getComponentGroups(name: string): Promise<ComponentGroup[]> {\n const baseUrl = await this.discoveryApi.getBaseUrl('statuspage');\n const data = await this.fetchApi.fetch(\n `${baseUrl}/fetch-component-groups/${encodeURIComponent(name)}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n\n if (data.ok) return data.json();\n throw new Error(`Failed to get statuspage component groups for ${name}`);\n }\n}\n"],"names":[],"mappings":"AAYO,MAAM,gBAA0C,CAAA;AAAA,EACpC,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EAEjB,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe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AAA,kBAAA;AAAA,SAClB;AAAA,OACF;AAAA,KACF,CAAA;AAEA,IAAA,IAAI,IAAK,CAAA,EAAA,EAAW,OAAA,IAAA,CAAK,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,EAAW,OAAA,IAAA,CAAK,IAAK,EAAA,CAAA;AAC9B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAiD,8CAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,GACzE;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axis-backstage/plugin-statuspage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"postpack": "backstage-cli package postpack"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@axis-backstage/plugin-statuspage-common": "^0.
|
|
34
|
-
"@backstage/catalog-model": "^1.
|
|
35
|
-
"@backstage/core-components": "^0.14.
|
|
36
|
-
"@backstage/core-plugin-api": "^1.9.
|
|
37
|
-
"@backstage/plugin-catalog-react": "^1.12.
|
|
33
|
+
"@axis-backstage/plugin-statuspage-common": "^0.5.0",
|
|
34
|
+
"@backstage/catalog-model": "^1.6.0",
|
|
35
|
+
"@backstage/core-components": "^0.14.10",
|
|
36
|
+
"@backstage/core-plugin-api": "^1.9.3",
|
|
37
|
+
"@backstage/plugin-catalog-react": "^1.12.3",
|
|
38
38
|
"@mui/icons-material": "^5.15.7",
|
|
39
39
|
"@mui/material": "^5.15.7",
|
|
40
40
|
"react-use": "^17.2.4"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"react": "^17.0.0 || ^18.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@backstage/cli": "^0.
|
|
47
|
-
"@backstage/dev-utils": "^1.0.
|
|
46
|
+
"@backstage/cli": "^0.27.0",
|
|
47
|
+
"@backstage/dev-utils": "^1.0.37",
|
|
48
48
|
"@testing-library/jest-dom": "^5.10.1"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|