@backstage-community/plugin-ilert 0.20.0 → 0.21.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 +12 -0
- package/README.md +27 -17
- package/config.d.ts +1 -1
- package/dist/api/client.esm.js +1 -1
- package/dist/api/client.esm.js.map +1 -1
- package/dist/components/Alert/AlertActionsMenu.esm.js +1 -1
- package/dist/components/Alert/AlertActionsMenu.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsPage.esm.js +1 -1
- package/dist/components/AlertsPage/AlertsPage.esm.js.map +1 -1
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js +1 -1
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCard.esm.js +1 -1
- package/dist/components/ILertCard/ILertCard.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js +1 -1
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js.map +1 -1
- package/dist/components/ILertPage/ILertPage.esm.js +2 -2
- package/dist/components/ILertPage/ILertPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js.map +1 -1
- package/dist/components/Service/ServiceActionsMenu.esm.js +1 -1
- package/dist/components/Service/ServiceActionsMenu.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesPage.esm.js +1 -1
- package/dist/components/ServicesPage/ServicesPage.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js +1 -1
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js +1 -1
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-ilert
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 390960e: Backstage version bump to v1.51.1
|
|
8
|
+
|
|
9
|
+
## 0.20.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e02db27: Align plugin copy and docs to ilert naming; update README, config types, and UI wording (alerts).
|
|
14
|
+
|
|
3
15
|
## 0.20.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -2,24 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
[
|
|
5
|
+
[ilert](https://www.ilert.com) The AI-first platform for on-call, incident response, and status pages – eliminating the interrupt tax across your stack.
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
This plugin
|
|
10
|
-
See who is on-call, which incidents are active and trigger incidents directly from backstage for the configured alert sources.
|
|
9
|
+
This plugin integrates ilert into Backstage and provides an overview of operational information such as alerts, on-call schedules, services, and status pages.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
It allows users to:
|
|
13
12
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
- See who is currently on-call
|
|
14
|
+
- View active alerts
|
|
15
|
+
- Trigger alerts directly from Backstage for configured alert sources
|
|
16
|
+
- View services and their current status
|
|
17
|
+
- Access status pages
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
This plugin provides the following functionality:
|
|
22
|
+
|
|
23
|
+
- View details about the current on-call person (including all escalation levels)
|
|
24
|
+
- Override the current on-call assignment
|
|
25
|
+
- View a list of active alerts
|
|
26
|
+
- Trigger a new alert
|
|
27
|
+
- Reassign, acknowledge, or resolve an alert
|
|
28
|
+
- Trigger alert actions
|
|
29
|
+
- Enable or disable an alert source
|
|
30
|
+
- Start immediate maintenance
|
|
31
|
+
- View services and their current status
|
|
32
|
+
- Access configured status pages
|
|
23
33
|
|
|
24
34
|
## Setup instructions
|
|
25
35
|
|
|
@@ -49,9 +59,9 @@ import {
|
|
|
49
59
|
// ...
|
|
50
60
|
```
|
|
51
61
|
|
|
52
|
-
> To force an
|
|
62
|
+
> To force an ilert card for each entity just add the `<EntityILertCard />` component. An instruction card will appear if no integration key is set.
|
|
53
63
|
|
|
54
|
-
## Add
|
|
64
|
+
## Add ilert explorer to the app sidebar
|
|
55
65
|
|
|
56
66
|
Modify your app routes in [`App.tsx`](https://github.com/backstage/backstage/blob/master/packages/app/src/App.tsx) to include the Router component exported by the plugin - for example:
|
|
57
67
|
|
|
@@ -70,7 +80,7 @@ Modify your sidebar in [`Root.tsx`](https://github.com/backstage/backstage/blob/
|
|
|
70
80
|
import { ILertIcon } from '@backstage-community/plugin-ilert';
|
|
71
81
|
<Sidebar>
|
|
72
82
|
// ...
|
|
73
|
-
<SidebarItem icon={ILertIcon} to="ilert" text="
|
|
83
|
+
<SidebarItem icon={ILertIcon} to="ilert" text="ilert" />
|
|
74
84
|
// ...
|
|
75
85
|
</Sidebar>;
|
|
76
86
|
```
|
|
@@ -88,7 +98,7 @@ ilert:
|
|
|
88
98
|
|
|
89
99
|
## Providing the Authorization Header
|
|
90
100
|
|
|
91
|
-
In order to make the API calls, you need to provide a new proxy config which will redirect to the [
|
|
101
|
+
In order to make the API calls, you need to provide a new proxy config which will redirect to the [ilert API](https://api.ilert.com/api-docs/) endpoint. It needs an [Authorization Header](https://api.ilert.com/api-docs/#section/Authentication).
|
|
92
102
|
|
|
93
103
|
Add the proxy configuration in `app-config.yaml`
|
|
94
104
|
|
package/config.d.ts
CHANGED
package/dist/api/client.esm.js
CHANGED
|
@@ -265,7 +265,7 @@ class ILertClient {
|
|
|
265
265
|
body: JSON.stringify({
|
|
266
266
|
start: DateTime.utc().toISO(),
|
|
267
267
|
end: DateTime.utc().plus({ minutes }).toISO(),
|
|
268
|
-
description: `Immediate maintenance window for ${minutes} minutes. Backstage \u2014
|
|
268
|
+
description: `Immediate maintenance window for ${minutes} minutes. Backstage \u2014 ilert plugin.`,
|
|
269
269
|
createdBy: "Backstage",
|
|
270
270
|
timezone: DateTime.local().zoneName,
|
|
271
271
|
alertSources: [{ id: alertSourceId }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.esm.js","sources":["../../src/api/client.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConfigApi, DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { AuthenticationError, ResponseError } from '@backstage/errors';\nimport { DateTime as dt } from 'luxon';\nimport {\n Alert,\n AlertAction,\n AlertResponder,\n AlertSource,\n EscalationPolicy,\n OnCall,\n Schedule,\n Service,\n StatusPage,\n User,\n} from '../types';\nimport {\n EventRequest,\n GetAlertsCountOpts,\n GetAlertsOpts,\n GetServicesOpts,\n GetStatusPagesOpts,\n ILertApi,\n} from './types';\n\n/** @public */\nexport const ilertApiRef = createApiRef<ILertApi>().with({\n id: 'plugin.ilert.service',\n});\n\nconst DEFAULT_PROXY_PATH = '/ilert';\nconst JSON_HEADERS = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n};\n\n/** @public */\nexport class ILertClient implements ILertApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n private readonly proxyPath: string;\n private readonly baseUrl: string;\n\n static fromConfig(\n configApi: ConfigApi,\n discoveryApi: DiscoveryApi,\n fetchApi: FetchApi,\n ) {\n const baseUrl: string =\n configApi.getOptionalString('ilert.baseUrl') ?? 'https://app.ilert.com';\n\n return new ILertClient({\n discoveryApi,\n fetchApi,\n baseUrl,\n proxyPath:\n configApi.getOptionalString('ilert.proxyPath') ?? DEFAULT_PROXY_PATH,\n });\n }\n\n constructor(opts: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n /**\n * URL used by users to access iLert web UI.\n * Example: https://my-org.ilert.com/\n */\n baseUrl: string;\n\n /**\n * Path to use for requests via the proxy, defaults to /ilert/api\n */\n proxyPath: string;\n }) {\n this.discoveryApi = opts.discoveryApi;\n this.fetchApi = opts.fetchApi;\n this.baseUrl = opts.baseUrl;\n this.proxyPath = opts.proxyPath;\n }\n\n private async fetch<T = any>(input: string, init?: RequestInit): Promise<T> {\n const apiUrl = await this.apiUrl();\n\n const response = await this.fetchApi.fetch(`${apiUrl}${input}`, init);\n if (response.status === 401) {\n throw new AuthenticationError(\n 'This request requires HTTP authentication.',\n );\n }\n if (!response.ok || response.status >= 400) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async fetchAlerts(opts?: GetAlertsOpts): Promise<Alert[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts?.maxResults !== undefined) {\n query.append('max-results', String(opts.maxResults));\n }\n if (opts?.startIndex !== undefined) {\n query.append('start-index', String(opts.startIndex));\n }\n if (opts?.alertSources !== undefined && Array.isArray(opts.alertSources)) {\n opts.alertSources.forEach((a: number) => {\n if (a) {\n query.append('alert-source', String(a));\n }\n });\n }\n\n if (opts?.states !== undefined && Array.isArray(opts.states)) {\n opts.states.forEach(state => {\n query.append('state', state);\n });\n }\n const response = await this.fetch(`/api/alerts?${query.toString()}`, init);\n return response;\n }\n\n async fetchAlertsCount(opts?: GetAlertsCountOpts): Promise<number> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts && opts.states && Array.isArray(opts.states)) {\n opts.states.forEach(state => {\n query.append('state', state);\n });\n }\n const response = await this.fetch(\n `/api/alerts/count?${query.toString()}`,\n init,\n );\n\n return response && response.count ? response.count : 0;\n }\n\n async fetchAlert(id: number): Promise<Alert> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(id)}`,\n init,\n );\n\n return response;\n }\n\n async fetchAlertResponders(alert: Alert): Promise<AlertResponder[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/responders`,\n init,\n );\n\n return response;\n }\n\n async fetchAlertActions(alert: Alert): Promise<AlertAction[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/actions`,\n init,\n );\n\n return response;\n }\n\n async acceptAlert(alert: Alert, userName: string): Promise<Alert> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n apiKey: alert.alertSource?.integrationKey || '',\n alertKey: alert.alertKey,\n summary: `from ${userName} via Backstage plugin`,\n eventType: 'ACCEPT',\n }),\n };\n\n await this.fetch('/api/events', init);\n return this.fetchAlert(alert.id);\n }\n\n async resolveAlert(alert: Alert, userName: string): Promise<Alert> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n apiKey: alert.alertSource?.integrationKey || '',\n alertKey: alert.alertKey,\n summary: `from ${userName} via Backstage plugin`,\n eventType: 'RESOLVE',\n }),\n };\n\n await this.fetch('/api/events', init);\n return this.fetchAlert(alert.id);\n }\n\n async assignAlert(alert: Alert, responder: AlertResponder): Promise<Alert> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n };\n\n const query = new URLSearchParams();\n switch (responder.group) {\n case 'ESCALATION_POLICY':\n query.append('policy-id', String(responder.id));\n break;\n case 'ON_CALL_SCHEDULE':\n query.append('schedule-id', String(responder.id));\n break;\n default:\n query.append('user-id', String(responder.id));\n break;\n }\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/assign?${query.toString()}`,\n init,\n );\n\n return response;\n }\n\n async triggerAlertAction(alert: Alert, action: AlertAction): Promise<void> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n webhookId: action.webhookId,\n extensionId: action.extensionId,\n type: action.type,\n name: action.name,\n }),\n };\n\n await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/actions`,\n init,\n );\n }\n\n async createAlert(eventRequest: EventRequest): Promise<boolean> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n apiKey: eventRequest.integrationKey,\n summary: eventRequest.summary,\n details: eventRequest.details,\n eventType: 'ALERT',\n links: [\n {\n href: eventRequest.source,\n text: 'Backstage Url',\n },\n ],\n customDetails: {\n userName: eventRequest.userName,\n },\n }),\n };\n\n const response = await this.fetch('/api/events', init);\n return response;\n }\n\n async fetchAlertSources(): Promise<AlertSource[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch('/api/alert-sources', init);\n\n return response;\n }\n\n async fetchAlertSource(\n idOrIntegrationKey: number | string,\n ): Promise<AlertSource> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alert-sources/${encodeURIComponent(idOrIntegrationKey)}`,\n init,\n );\n\n return response;\n }\n\n async fetchAlertSourceOnCalls(alertSource: AlertSource): Promise<OnCall[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/on-calls?policies=${encodeURIComponent(\n alertSource.escalationPolicy.id,\n )}&expand=user&expand=escalationPolicy&timezone=${dt.local().zoneName}`,\n init,\n );\n\n return response;\n }\n\n async enableAlertSource(alertSource: AlertSource): Promise<AlertSource> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ ...alertSource, active: true }),\n };\n\n const response = await this.fetch(\n `/api/alert-sources/${encodeURIComponent(alertSource.id)}`,\n init,\n );\n\n return response;\n }\n\n async disableAlertSource(alertSource: AlertSource): Promise<AlertSource> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ ...alertSource, active: false }),\n };\n\n const response = await this.fetch(\n `/api/alert-sources/${encodeURIComponent(alertSource.id)}`,\n init,\n );\n\n return response;\n }\n\n async addImmediateMaintenance(\n alertSourceId: number,\n minutes: number,\n ): Promise<void> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n start: dt.utc().toISO(),\n end: dt.utc().plus({ minutes }).toISO(),\n description: `Immediate maintenance window for ${minutes} minutes. Backstage — iLert plugin.`,\n createdBy: 'Backstage',\n timezone: dt.local().zoneName,\n alertSources: [{ id: alertSourceId }],\n }),\n };\n\n const response = await this.fetch('/api/maintenance-windows', init);\n\n return response;\n }\n\n async fetchOnCallSchedules(): Promise<Schedule[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n '/api/schedules?include=currentShift&include=nextShift',\n init,\n );\n\n return response;\n }\n\n async fetchUsers(): Promise<User[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch('/api/users', init);\n\n return response;\n }\n\n async overrideShift(\n scheduleId: number,\n userId: number,\n start: string,\n end: string,\n ): Promise<Schedule> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ user: { id: userId }, start, end }),\n };\n\n const response = await this.fetch(\n `/api/schedules/${encodeURIComponent(scheduleId)}/overrides`,\n init,\n );\n\n return response;\n }\n\n async fetchServices(opts?: GetServicesOpts): Promise<Service[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts?.maxResults !== undefined) {\n query.append('max-results', String(opts.maxResults));\n }\n if (opts?.startIndex !== undefined) {\n query.append('start-index', String(opts.startIndex));\n }\n\n query.append('include', 'uptime');\n\n const response = await this.fetch(\n `/api/services?${query.toString()}`,\n init,\n );\n return response;\n }\n\n async fetchStatusPages(opts?: GetStatusPagesOpts): Promise<StatusPage[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts?.maxResults !== undefined) {\n query.append('max-results', String(opts.maxResults));\n }\n if (opts?.startIndex !== undefined) {\n query.append('start-index', String(opts.startIndex));\n }\n\n query.append('include', 'subscribed');\n\n const response = await this.fetch(\n `/api/status-pages?${query.toString()}`,\n init,\n );\n return response;\n }\n\n getAlertDetailsURL(alert: Alert): string {\n return `${this.baseUrl}/alert/view.jsf?id=${encodeURIComponent(alert.id)}`;\n }\n\n getAlertSourceDetailsURL(alertSource: AlertSource | null): string {\n if (!alertSource) {\n return '';\n }\n return `${this.baseUrl}/source/view.jsf?id=${encodeURIComponent(\n alertSource.id,\n )}`;\n }\n\n getEscalationPolicyDetailsURL(escalationPolicy: EscalationPolicy): string {\n return `${this.baseUrl}/policy/view.jsf?id=${encodeURIComponent(\n escalationPolicy.id,\n )}`;\n }\n\n getScheduleDetailsURL(schedule: Schedule): string {\n return `${this.baseUrl}/schedule/view.jsf?id=${encodeURIComponent(\n schedule.id,\n )}`;\n }\n\n getServiceDetailsURL(service: Service): string {\n return `${this.baseUrl}/service/view.jsf?id=${encodeURIComponent(\n service.id,\n )}`;\n }\n\n getStatusPageDetailsURL(statusPage: StatusPage): string {\n return `${this.baseUrl}/status-page/view.jsf?id=${encodeURIComponent(\n statusPage.id,\n )}`;\n }\n\n getStatusPageURL(statusPage: StatusPage): string {\n return statusPage.domain ? statusPage.domain : statusPage.subdomain;\n }\n\n getUserPhoneNumber(user: User | null) {\n return user?.mobile?.number || user?.landline?.number || '';\n }\n\n getUserInitials(user: User | null) {\n if (!user) {\n return '';\n }\n if (!user.firstName && !user.lastName) {\n return user.username;\n }\n return `${user.firstName} ${user.lastName}`;\n }\n\n private async apiUrl() {\n const proxyUr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A,CAAK,SAAS,CAAA,CAAA,EAAI,KAAK,QAAQ,CAAA,CAAA;AAAA,EAC3C;AAAA,EAEA,MAAc,MAAA,GAAS;AACrB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,OAAO,CAAA;AAC3D,IAAA,OAAO,WAAW,IAAA,CAAK,SAAA;AAAA,EACzB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"client.esm.js","sources":["../../src/api/client.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConfigApi, DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { AuthenticationError, ResponseError } from '@backstage/errors';\nimport { DateTime as dt } from 'luxon';\nimport {\n Alert,\n AlertAction,\n AlertResponder,\n AlertSource,\n EscalationPolicy,\n OnCall,\n Schedule,\n Service,\n StatusPage,\n User,\n} from '../types';\nimport {\n EventRequest,\n GetAlertsCountOpts,\n GetAlertsOpts,\n GetServicesOpts,\n GetStatusPagesOpts,\n ILertApi,\n} from './types';\n\n/** @public */\nexport const ilertApiRef = createApiRef<ILertApi>().with({\n id: 'plugin.ilert.service',\n});\n\nconst DEFAULT_PROXY_PATH = '/ilert';\nconst JSON_HEADERS = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n};\n\n/** @public */\nexport class ILertClient implements ILertApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n private readonly proxyPath: string;\n private readonly baseUrl: string;\n\n static fromConfig(\n configApi: ConfigApi,\n discoveryApi: DiscoveryApi,\n fetchApi: FetchApi,\n ) {\n const baseUrl: string =\n configApi.getOptionalString('ilert.baseUrl') ?? 'https://app.ilert.com';\n\n return new ILertClient({\n discoveryApi,\n fetchApi,\n baseUrl,\n proxyPath:\n configApi.getOptionalString('ilert.proxyPath') ?? DEFAULT_PROXY_PATH,\n });\n }\n\n constructor(opts: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n /**\n * URL used by users to access ilert web UI.\n * Example: https://my-org.ilert.com/\n */\n baseUrl: string;\n\n /**\n * Path to use for requests via the proxy, defaults to /ilert/api\n */\n proxyPath: string;\n }) {\n this.discoveryApi = opts.discoveryApi;\n this.fetchApi = opts.fetchApi;\n this.baseUrl = opts.baseUrl;\n this.proxyPath = opts.proxyPath;\n }\n\n private async fetch<T = any>(input: string, init?: RequestInit): Promise<T> {\n const apiUrl = await this.apiUrl();\n\n const response = await this.fetchApi.fetch(`${apiUrl}${input}`, init);\n if (response.status === 401) {\n throw new AuthenticationError(\n 'This request requires HTTP authentication.',\n );\n }\n if (!response.ok || response.status >= 400) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async fetchAlerts(opts?: GetAlertsOpts): Promise<Alert[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts?.maxResults !== undefined) {\n query.append('max-results', String(opts.maxResults));\n }\n if (opts?.startIndex !== undefined) {\n query.append('start-index', String(opts.startIndex));\n }\n if (opts?.alertSources !== undefined && Array.isArray(opts.alertSources)) {\n opts.alertSources.forEach((a: number) => {\n if (a) {\n query.append('alert-source', String(a));\n }\n });\n }\n\n if (opts?.states !== undefined && Array.isArray(opts.states)) {\n opts.states.forEach(state => {\n query.append('state', state);\n });\n }\n const response = await this.fetch(`/api/alerts?${query.toString()}`, init);\n return response;\n }\n\n async fetchAlertsCount(opts?: GetAlertsCountOpts): Promise<number> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts && opts.states && Array.isArray(opts.states)) {\n opts.states.forEach(state => {\n query.append('state', state);\n });\n }\n const response = await this.fetch(\n `/api/alerts/count?${query.toString()}`,\n init,\n );\n\n return response && response.count ? response.count : 0;\n }\n\n async fetchAlert(id: number): Promise<Alert> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(id)}`,\n init,\n );\n\n return response;\n }\n\n async fetchAlertResponders(alert: Alert): Promise<AlertResponder[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/responders`,\n init,\n );\n\n return response;\n }\n\n async fetchAlertActions(alert: Alert): Promise<AlertAction[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/actions`,\n init,\n );\n\n return response;\n }\n\n async acceptAlert(alert: Alert, userName: string): Promise<Alert> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n apiKey: alert.alertSource?.integrationKey || '',\n alertKey: alert.alertKey,\n summary: `from ${userName} via Backstage plugin`,\n eventType: 'ACCEPT',\n }),\n };\n\n await this.fetch('/api/events', init);\n return this.fetchAlert(alert.id);\n }\n\n async resolveAlert(alert: Alert, userName: string): Promise<Alert> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n apiKey: alert.alertSource?.integrationKey || '',\n alertKey: alert.alertKey,\n summary: `from ${userName} via Backstage plugin`,\n eventType: 'RESOLVE',\n }),\n };\n\n await this.fetch('/api/events', init);\n return this.fetchAlert(alert.id);\n }\n\n async assignAlert(alert: Alert, responder: AlertResponder): Promise<Alert> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n };\n\n const query = new URLSearchParams();\n switch (responder.group) {\n case 'ESCALATION_POLICY':\n query.append('policy-id', String(responder.id));\n break;\n case 'ON_CALL_SCHEDULE':\n query.append('schedule-id', String(responder.id));\n break;\n default:\n query.append('user-id', String(responder.id));\n break;\n }\n\n const response = await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/assign?${query.toString()}`,\n init,\n );\n\n return response;\n }\n\n async triggerAlertAction(alert: Alert, action: AlertAction): Promise<void> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n webhookId: action.webhookId,\n extensionId: action.extensionId,\n type: action.type,\n name: action.name,\n }),\n };\n\n await this.fetch(\n `/api/alerts/${encodeURIComponent(alert.id)}/actions`,\n init,\n );\n }\n\n async createAlert(eventRequest: EventRequest): Promise<boolean> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n apiKey: eventRequest.integrationKey,\n summary: eventRequest.summary,\n details: eventRequest.details,\n eventType: 'ALERT',\n links: [\n {\n href: eventRequest.source,\n text: 'Backstage Url',\n },\n ],\n customDetails: {\n userName: eventRequest.userName,\n },\n }),\n };\n\n const response = await this.fetch('/api/events', init);\n return response;\n }\n\n async fetchAlertSources(): Promise<AlertSource[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch('/api/alert-sources', init);\n\n return response;\n }\n\n async fetchAlertSource(\n idOrIntegrationKey: number | string,\n ): Promise<AlertSource> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/alert-sources/${encodeURIComponent(idOrIntegrationKey)}`,\n init,\n );\n\n return response;\n }\n\n async fetchAlertSourceOnCalls(alertSource: AlertSource): Promise<OnCall[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n `/api/on-calls?policies=${encodeURIComponent(\n alertSource.escalationPolicy.id,\n )}&expand=user&expand=escalationPolicy&timezone=${dt.local().zoneName}`,\n init,\n );\n\n return response;\n }\n\n async enableAlertSource(alertSource: AlertSource): Promise<AlertSource> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ ...alertSource, active: true }),\n };\n\n const response = await this.fetch(\n `/api/alert-sources/${encodeURIComponent(alertSource.id)}`,\n init,\n );\n\n return response;\n }\n\n async disableAlertSource(alertSource: AlertSource): Promise<AlertSource> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ ...alertSource, active: false }),\n };\n\n const response = await this.fetch(\n `/api/alert-sources/${encodeURIComponent(alertSource.id)}`,\n init,\n );\n\n return response;\n }\n\n async addImmediateMaintenance(\n alertSourceId: number,\n minutes: number,\n ): Promise<void> {\n const init = {\n method: 'POST',\n headers: JSON_HEADERS,\n body: JSON.stringify({\n start: dt.utc().toISO(),\n end: dt.utc().plus({ minutes }).toISO(),\n description: `Immediate maintenance window for ${minutes} minutes. Backstage — ilert plugin.`,\n createdBy: 'Backstage',\n timezone: dt.local().zoneName,\n alertSources: [{ id: alertSourceId }],\n }),\n };\n\n const response = await this.fetch('/api/maintenance-windows', init);\n\n return response;\n }\n\n async fetchOnCallSchedules(): Promise<Schedule[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch(\n '/api/schedules?include=currentShift&include=nextShift',\n init,\n );\n\n return response;\n }\n\n async fetchUsers(): Promise<User[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n\n const response = await this.fetch('/api/users', init);\n\n return response;\n }\n\n async overrideShift(\n scheduleId: number,\n userId: number,\n start: string,\n end: string,\n ): Promise<Schedule> {\n const init = {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ user: { id: userId }, start, end }),\n };\n\n const response = await this.fetch(\n `/api/schedules/${encodeURIComponent(scheduleId)}/overrides`,\n init,\n );\n\n return response;\n }\n\n async fetchServices(opts?: GetServicesOpts): Promise<Service[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts?.maxResults !== undefined) {\n query.append('max-results', String(opts.maxResults));\n }\n if (opts?.startIndex !== undefined) {\n query.append('start-index', String(opts.startIndex));\n }\n\n query.append('include', 'uptime');\n\n const response = await this.fetch(\n `/api/services?${query.toString()}`,\n init,\n );\n return response;\n }\n\n async fetchStatusPages(opts?: GetStatusPagesOpts): Promise<StatusPage[]> {\n const init = {\n headers: JSON_HEADERS,\n };\n const query = new URLSearchParams();\n if (opts?.maxResults !== undefined) {\n query.append('max-results', String(opts.maxResults));\n }\n if (opts?.startIndex !== undefined) {\n query.append('start-index', String(opts.startIndex));\n }\n\n query.append('include', 'subscribed');\n\n const response = await this.fetch(\n `/api/status-pages?${query.toString()}`,\n init,\n );\n return response;\n }\n\n getAlertDetailsURL(alert: Alert): string {\n return `${this.baseUrl}/alert/view.jsf?id=${encodeURIComponent(alert.id)}`;\n }\n\n getAlertSourceDetailsURL(alertSource: AlertSource | null): string {\n if (!alertSource) {\n return '';\n }\n return `${this.baseUrl}/source/view.jsf?id=${encodeURIComponent(\n alertSource.id,\n )}`;\n }\n\n getEscalationPolicyDetailsURL(escalationPolicy: EscalationPolicy): string {\n return `${this.baseUrl}/policy/view.jsf?id=${encodeURIComponent(\n escalationPolicy.id,\n )}`;\n }\n\n getScheduleDetailsURL(schedule: Schedule): string {\n return `${this.baseUrl}/schedule/view.jsf?id=${encodeURIComponent(\n schedule.id,\n )}`;\n }\n\n getServiceDetailsURL(service: Service): string {\n return `${this.baseUrl}/service/view.jsf?id=${encodeURIComponent(\n service.id,\n )}`;\n }\n\n getStatusPageDetailsURL(statusPage: StatusPage): string {\n return `${this.baseUrl}/status-page/view.jsf?id=${encodeURIComponent(\n statusPage.id,\n )}`;\n }\n\n getStatusPageURL(statusPage: StatusPage): string {\n return statusPage.domain ? statusPage.domain : statusPage.subdomain;\n }\n\n getUserPhoneNumber(user: User | null) {\n return user?.mobile?.number || user?.landline?.number || '';\n }\n\n getUserInitials(user: User | null) {\n if (!user) {\n return '';\n }\n if (!user.firstName && !user.lastName) {\n return user.username;\n }\n return `${user.firstName} ${user.lastName}`;\n }\n\n private async apiUrl() {\n const proxyUrl = await this.discoveryApi.getBaseUrl('proxy');\n return proxyUrl + this.proxy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AAA,CAAA;AAAA,EAC3C;AAAA,EAEA,MAAc,MAAA,GAAS;AACrB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,OAAO,CAAA;AAC3D,IAAA,OAAO,WAAW,IAAA,CAAK,SAAA;AAAA,EACzB;AACF;;;;"}
|
|
@@ -130,7 +130,7 @@ const AlertActionsMenu = ({
|
|
|
130
130
|
alert.status !== "RESOLVED" ? /* @__PURE__ */ jsx(MenuItem, { onClick: handleResolve, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: "Resolve" }) }, "close") : null,
|
|
131
131
|
alert.status !== "RESOLVED" ? /* @__PURE__ */ jsx(MenuItem, { onClick: handleAssign, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: "Assign" }) }, "assign") : null,
|
|
132
132
|
isLoading ? /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx(Progress, { style: { width: "100%" } }) }, "loading") : actions,
|
|
133
|
-
/* @__PURE__ */ jsx(MenuItem, { onClick: handleCloseMenu, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: ilertApi.getAlertDetailsURL(alert), children: "View in
|
|
133
|
+
/* @__PURE__ */ jsx(MenuItem, { onClick: handleCloseMenu, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: ilertApi.getAlertDetailsURL(alert), children: "View in ilert" }) }) }, "details")
|
|
134
134
|
]
|
|
135
135
|
}
|
|
136
136
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertActionsMenu.esm.js","sources":["../../../src/components/Alert/AlertActionsMenu.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport type { MouseEvent, ReactNode } from 'react';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { useAlertActions } from '../../hooks/useAlertActions';\nimport { Alert, AlertAction } from '../../types';\nimport { AlertAssignModal } from './AlertAssignModal';\n\nimport { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';\nimport { Link, Progress } from '@backstage/core-components';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\n\nexport const AlertActionsMenu = ({\n alert,\n onAlertChanged,\n setIsLoading,\n}: {\n alert: Alert;\n onAlertChanged?: (alert: Alert) => void;\n setIsLoading?: (isLoading: boolean) => void;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const alertApi = useApi(toastApiRef);\n const identityApi = useApi(identityApiRef);\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const callback = onAlertChanged || ((_: Alert): void => {});\n const setProcessing = setIsLoading || ((_: boolean): void => {});\n const [isAssignAlertModalOpened, setIsAssignAlertModalOpened] =\n useState(false);\n\n const [{ alertActions, isLoading }] = useAlertActions(\n alert,\n Boolean(anchorEl),\n );\n\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleCloseMenu = () => {\n setAnchorEl(null);\n };\n\n const handleAccept = async (): Promise<void> => {\n try {\n handleCloseMenu();\n setProcessing(true);\n\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n const { name: userName } = parseEntityRef(userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n const newAlert = await ilertApi.acceptAlert(alert, userName);\n alertApi.post({ title: 'Alert accepted.' });\n\n callback(newAlert);\n setProcessing(false);\n } catch (err) {\n setProcessing(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const handleResolve = async (): Promise<void> => {\n try {\n handleCloseMenu();\n setProcessing(true);\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n const { name: userName } = parseEntityRef(userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n const newAlert = await ilertApi.resolveAlert(alert, userName);\n alertApi.post({ title: 'Alert resolved.' });\n\n callback(newAlert);\n setProcessing(false);\n } catch (err) {\n setProcessing(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const handleAssign = () => {\n handleCloseMenu();\n setIsAssignAlertModalOpened(true);\n };\n\n const handleTriggerAction = (action: AlertAction) => async () => {\n try {\n handleCloseMenu();\n setProcessing(true);\n await ilertApi.triggerAlertAction(alert, action);\n alertApi.post({ title: 'Alert action triggered.' });\n setProcessing(false);\n } catch (err) {\n setProcessing(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const actions: ReactNode[] = alertActions.map(a => {\n const successTrigger = a.history\n ? a.history.find(h => h.success)\n : undefined;\n const triggeredBy =\n successTrigger && successTrigger.actor\n ? `${successTrigger.actor.firstName} ${successTrigger.actor.lastName}`\n : '';\n return (\n <MenuItem\n key={a.webhookId}\n onClick={handleTriggerAction(a)}\n disabled={!!successTrigger}\n >\n <Typography variant=\"inherit\" noWrap>\n {triggeredBy ? `${a.name} (by ${triggeredBy})` : a.name}\n </Typography>\n </MenuItem>\n );\n });\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n size=\"small\"\n >\n <MoreVertIcon />\n </IconButton>\n <Menu\n id={`alert-actions-menu-${alert.id}`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleCloseMenu}\n PaperProps={{\n style: { maxHeight: 48 * 5.5 },\n }}\n >\n {alert.status === 'PENDING' ? (\n <MenuItem key=\"ack\" onClick={handleAccept}>\n <Typography variant=\"inherit\" noWrap>\n Accept\n </Typography>\n </MenuItem>\n ) : null}\n\n {alert.status !== 'RESOLVED' ? (\n <MenuItem key=\"close\" onClick={handleResolve}>\n <Typography variant=\"inherit\" noWrap>\n Resolve\n </Typography>\n </MenuItem>\n ) : null}\n\n {alert.status !== 'RESOLVED' ? (\n <MenuItem key=\"assign\" onClick={handleAssign}>\n <Typography variant=\"inherit\" noWrap>\n Assign\n </Typography>\n </MenuItem>\n ) : null}\n\n {isLoading ? (\n <MenuItem key=\"loading\">\n <Progress style={{ width: '100%' }} />\n </MenuItem>\n ) : (\n actions\n )}\n\n <MenuItem key=\"details\" onClick={handleCloseMenu}>\n <Typography variant=\"inherit\" noWrap>\n <Link to={ilertApi.getAlertDetailsURL(alert)}>View in iLert</Link>\n </Typography>\n </MenuItem>\n </Menu>\n <AlertAssignModal\n alert={alert}\n setIsModalOpened={setIsAssignAlertModalOpened}\n isModalOpened={isAssignAlertModalOpened}\n onAlertChanged={onAlertChanged}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgCO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,KAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAA6B,IAAI,CAAA;AACjE,EAAA,MAAM,QAAA,GAAW,cAAA,KAAmB,CAAC,CAAA,KAAmB;AAAA,EAAC,CAAA,CAAA;AACz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O,MAAA,EAAO,EAAG,CAAA,EAAA,EADxB,SAEd,CAAA,GAEA,OAAA;AAAA,0BAGF,GAAA,CAAC,YAAuB,OAAA,EAAS,eAAA,EAC/B,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,WAAU,MAAA,EAAM,IAAA,EAClC,8BAAC,IAAA,EAAA,EAAK,EAAA,EAAI,SAAS,kBAAA,CAAmB,KAAK,GAAG,QAAA,EAAA,eAAA,EAAa,CAAA,EAC7D,KAHY,SAId;AAAA;AAAA;AAAA,KACF;AAAA,oBACA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,KAAA;AAAA,QACA,gBAAA,EAAkB,2BAAA;AAAA,QAClB,aAAA,EAAe,wBAAA;AAAA,QACf;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AlertActionsMenu.esm.js","sources":["../../../src/components/Alert/AlertActionsMenu.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport type { MouseEvent, ReactNode } from 'react';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { useAlertActions } from '../../hooks/useAlertActions';\nimport { Alert, AlertAction } from '../../types';\nimport { AlertAssignModal } from './AlertAssignModal';\n\nimport { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';\nimport { Link, Progress } from '@backstage/core-components';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\n\nexport const AlertActionsMenu = ({\n alert,\n onAlertChanged,\n setIsLoading,\n}: {\n alert: Alert;\n onAlertChanged?: (alert: Alert) => void;\n setIsLoading?: (isLoading: boolean) => void;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const alertApi = useApi(toastApiRef);\n const identityApi = useApi(identityApiRef);\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const callback = onAlertChanged || ((_: Alert): void => {});\n const setProcessing = setIsLoading || ((_: boolean): void => {});\n const [isAssignAlertModalOpened, setIsAssignAlertModalOpened] =\n useState(false);\n\n const [{ alertActions, isLoading }] = useAlertActions(\n alert,\n Boolean(anchorEl),\n );\n\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleCloseMenu = () => {\n setAnchorEl(null);\n };\n\n const handleAccept = async (): Promise<void> => {\n try {\n handleCloseMenu();\n setProcessing(true);\n\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n const { name: userName } = parseEntityRef(userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n const newAlert = await ilertApi.acceptAlert(alert, userName);\n alertApi.post({ title: 'Alert accepted.' });\n\n callback(newAlert);\n setProcessing(false);\n } catch (err) {\n setProcessing(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const handleResolve = async (): Promise<void> => {\n try {\n handleCloseMenu();\n setProcessing(true);\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n const { name: userName } = parseEntityRef(userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n const newAlert = await ilertApi.resolveAlert(alert, userName);\n alertApi.post({ title: 'Alert resolved.' });\n\n callback(newAlert);\n setProcessing(false);\n } catch (err) {\n setProcessing(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const handleAssign = () => {\n handleCloseMenu();\n setIsAssignAlertModalOpened(true);\n };\n\n const handleTriggerAction = (action: AlertAction) => async () => {\n try {\n handleCloseMenu();\n setProcessing(true);\n await ilertApi.triggerAlertAction(alert, action);\n alertApi.post({ title: 'Alert action triggered.' });\n setProcessing(false);\n } catch (err) {\n setProcessing(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const actions: ReactNode[] = alertActions.map(a => {\n const successTrigger = a.history\n ? a.history.find(h => h.success)\n : undefined;\n const triggeredBy =\n successTrigger && successTrigger.actor\n ? `${successTrigger.actor.firstName} ${successTrigger.actor.lastName}`\n : '';\n return (\n <MenuItem\n key={a.webhookId}\n onClick={handleTriggerAction(a)}\n disabled={!!successTrigger}\n >\n <Typography variant=\"inherit\" noWrap>\n {triggeredBy ? `${a.name} (by ${triggeredBy})` : a.name}\n </Typography>\n </MenuItem>\n );\n });\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n size=\"small\"\n >\n <MoreVertIcon />\n </IconButton>\n <Menu\n id={`alert-actions-menu-${alert.id}`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleCloseMenu}\n PaperProps={{\n style: { maxHeight: 48 * 5.5 },\n }}\n >\n {alert.status === 'PENDING' ? (\n <MenuItem key=\"ack\" onClick={handleAccept}>\n <Typography variant=\"inherit\" noWrap>\n Accept\n </Typography>\n </MenuItem>\n ) : null}\n\n {alert.status !== 'RESOLVED' ? (\n <MenuItem key=\"close\" onClick={handleResolve}>\n <Typography variant=\"inherit\" noWrap>\n Resolve\n </Typography>\n </MenuItem>\n ) : null}\n\n {alert.status !== 'RESOLVED' ? (\n <MenuItem key=\"assign\" onClick={handleAssign}>\n <Typography variant=\"inherit\" noWrap>\n Assign\n </Typography>\n </MenuItem>\n ) : null}\n\n {isLoading ? (\n <MenuItem key=\"loading\">\n <Progress style={{ width: '100%' }} />\n </MenuItem>\n ) : (\n actions\n )}\n\n <MenuItem key=\"details\" onClick={handleCloseMenu}>\n <Typography variant=\"inherit\" noWrap>\n <Link to={ilertApi.getAlertDetailsURL(alert)}>View in ilert</Link>\n </Typography>\n </MenuItem>\n </Menu>\n <AlertAssignModal\n alert={alert}\n setIsModalOpened={setIsAssignAlertModalOpened}\n isModalOpened={isAssignAlertModalOpened}\n onAlertChanged={onAlertChanged}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgCO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,KAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAA6B,IAAI,CAAA;AACjE,EAAA,MAAM,QAAA,GAAW,cAAA,KAAmB,CAAC,CAAA,KAAmB;AAAA,EAAC,CAAA,CAAA;AACzD,EAAA,MAAM,aAAA,GAAgB,YAAA,KAAiB,CAAC,CAAA,KAAqB;AAAA,EAAC,CAAA,CAAA;AAC9D,EAAA,MAAM,CAAC,wBAAA,EAA0B,2BAA2B,CAAA,GAC1D,SAAS,KAAK,CAAA;AAEhB,EAAA,MAAM,CAAC,EAAE,YAAA,EAAc,SAAA,EAAW,CAAA,GAAI,eAAA;AAAA,IACpC,KAAA;AAAA,IACA,QAAQ,QAAQ;AAAA,GAClB;AAEA,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAmC;AACtD,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA;AAAA,EACjC,CAAA;AAEA,EAAA,MAAM,kBAAkB,MAAM;AAC5B,IAAA,WAAA,CAAY,IAAI,CAAA;AAAA,EAClB,CAAA;AAEA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ACF,CAAA;AAEJ;;;;"}
|
|
@@ -51,7 +51,7 @@ const AlertsPage = () => {
|
|
|
51
51
|
refetchAlerts
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
|
-
/* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring
|
|
54
|
+
/* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring ilert into your developer portal." })
|
|
55
55
|
] }),
|
|
56
56
|
/* @__PURE__ */ jsx(
|
|
57
57
|
AlertsTable,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertsPage.esm.js","sources":["../../../src/components/AlertsPage/AlertsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport AddIcon from '@material-ui/icons/Add';\nimport { useState } from 'react';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { AlertsTable } from './AlertsTable';\n\nexport const AlertsPage = () => {\n const [\n { tableState, states, alerts, alertsCount, isLoading, error },\n {\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n onAlertChanged,\n refetchAlerts,\n setIsLoading,\n },\n ] = useAlerts(true);\n\n const [isModalOpened, setIsModalOpened] = useState(false);\n\n const handleCreateNewAlertClick = () => {\n setIsModalOpened(true);\n };\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Alerts\">\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n startIcon={<AddIcon />}\n onClick={handleCreateNewAlertClick}\n >\n Create Alert\n </Button>\n <AlertNewModal\n isModalOpened={isModalOpened}\n setIsModalOpened={setIsModalOpened}\n refetchAlerts={refetchAlerts}\n />\n <SupportButton>\n This helps you to bring
|
|
1
|
+
{"version":3,"file":"AlertsPage.esm.js","sources":["../../../src/components/AlertsPage/AlertsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport AddIcon from '@material-ui/icons/Add';\nimport { useState } from 'react';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { AlertsTable } from './AlertsTable';\n\nexport const AlertsPage = () => {\n const [\n { tableState, states, alerts, alertsCount, isLoading, error },\n {\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n onAlertChanged,\n refetchAlerts,\n setIsLoading,\n },\n ] = useAlerts(true);\n\n const [isModalOpened, setIsModalOpened] = useState(false);\n\n const handleCreateNewAlertClick = () => {\n setIsModalOpened(true);\n };\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Alerts\">\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n startIcon={<AddIcon />}\n onClick={handleCreateNewAlertClick}\n >\n Create Alert\n </Button>\n <AlertNewModal\n isModalOpened={isModalOpened}\n setIsModalOpened={setIsModalOpened}\n refetchAlerts={refetchAlerts}\n />\n <SupportButton>\n This helps you to bring ilert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <AlertsTable\n alerts={alerts}\n alertsCount={alertsCount}\n tableState={tableState}\n states={states}\n onAlertChanged={onAlertChanged}\n onAlertStatesChange={onAlertStatesChange}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA6BO,MAAM,aAAa,MAAM;AAC9B,EAAA,MAAM;AAAA,IACJ,EAAE,UAAA,EAAY,MAAA,EAAQ,MAAA,EAAQ,WAAA,EAAa,WAAW,KAAA,EAAM;AAAA,IAC5D;AAAA,MACE,mBAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA,cAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA;AACF,GACF,GAAI,UAAU,IAAI,CAAA;AAElB,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAS,KAAK,CAAA;AAExD,EAAA,MAAM,4BAA4B,MAAM;AACtC,IAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,EACvB,CAAA;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,SAAS,qBAAA,EAAuB;AACxC,MAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,+BAAA,EAAA,EAAgC,CAAA,EACnC,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAmB,OAAc,CAAA,EACpC,CAAA;AAAA,EAEJ;AAEA,EAAA,4BACG,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,aAAA,EAAA,EAAc,OAAM,QAAA,EACnB,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,WAAA;AAAA,UACR,KAAA,EAAM,SAAA;AAAA,UACN,IAAA,EAAK,OAAA;AAAA,UACL,SAAA,sBAAY,OAAA,EAAA,EAAQ,CAAA;AAAA,UACpB,OAAA,EAAS,yBAAA;AAAA,UACV,QAAA,EAAA;AAAA;AAAA,OAED;AAAA,sBACA,GAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACC,aAAA;AAAA,UACA,gBAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,sBACA,GAAA,CAAC,iBAAc,QAAA,EAAA,2DAAA,EAEf;AAAA,KAAA,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,WAAA;AAAA,QACA,UAAA;AAAA,QACA,MAAA;AAAA,QACA,cAAA;AAAA,QACA,mBAAA;AAAA,QACA,YAAA;AAAA,QACA,mBAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -6,7 +6,7 @@ const MissingAuthorizationHeaderError = () => /* @__PURE__ */ jsx(
|
|
|
6
6
|
EmptyState,
|
|
7
7
|
{
|
|
8
8
|
missing: "info",
|
|
9
|
-
title: "Missing or invalid
|
|
9
|
+
title: "Missing or invalid ilert authorization header",
|
|
10
10
|
description: "The request to fetch data needs a valid authorization header. See README for more details.",
|
|
11
11
|
action: /* @__PURE__ */ jsx(
|
|
12
12
|
Button,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingAuthorizationHeaderError.esm.js","sources":["../../../src/components/Errors/MissingAuthorizationHeaderError.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Button from '@material-ui/core/Button';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingAuthorizationHeaderError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid
|
|
1
|
+
{"version":3,"file":"MissingAuthorizationHeaderError.esm.js","sources":["../../../src/components/Errors/MissingAuthorizationHeaderError.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Button from '@material-ui/core/Button';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingAuthorizationHeaderError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid ilert authorization header\"\n description=\"The request to fetch data needs a valid authorization header. See README for more details.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://github.com/backstage/backstage/blob/master/plugins/ilert/README.md\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAkBO,MAAM,kCAAkC,sBAC7C,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAM,+CAAA;AAAA,IACN,WAAA,EAAY,4FAAA;AAAA,IACZ,MAAA,kBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAQ,WAAA;AAAA,QACR,IAAA,EAAK,4EAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCard.esm.js","sources":["../../../src/components/ILertCard/ILertCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity } from '@backstage/catalog-model';\nimport { ResponseErrorPanel } from '@backstage/core-components';\nimport { AuthenticationError } from '@backstage/errors';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useState } from 'react';\nimport { ILERT_INTEGRATION_KEY_ANNOTATION } from '../../constants';\nimport { useILertEntity } from '../../hooks';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { useAlertSource } from '../../hooks/useAlertSource';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { AlertsTable } from '../AlertsPage';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { ILertCardActionsHeader } from './ILertCardActionsHeader';\nimport { ILertCardEmptyState } from './ILertCardEmptyState';\nimport { ILertCardHeaderStatus } from './ILertCardHeaderStatus';\nimport { ILertCardMaintenanceModal } from './ILertCardMaintenanceModal';\nimport { ILertCardOnCall } from './ILertCardOnCall';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ILERT_INTEGRATION_KEY_ANNOTATION]);\n\nconst useStyles = makeStyles({\n content: {\n paddingLeft: '0 !important',\n paddingRight: '0 !important',\n paddingBottom: '0 !important',\n paddingTop: '0 !important',\n '& div div': {\n boxShadow: 'none !important',\n },\n },\n});\n\n/** @public */\nexport const ILertCard = () => {\n const classes = useStyles();\n const { integrationKey, name } = useILertEntity();\n const [{ alertSource }, { setAlertSource, refetchAlertSource }] =\n useAlertSource(integrationKey);\n const [\n { tableState, states, alerts, alertsCount, isLoading, error },\n {\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n onAlertChanged,\n refetchAlerts,\n setIsLoading,\n },\n ] = useAlerts(false, true, alertSource);\n\n const [isNewAlertModalOpened, setIsNewAlertModalOpened] = useState(false);\n const [isMaintenanceModalOpened, setIsMaintenanceModalOpened] =\n useState(false);\n\n if (error) {\n if (error instanceof AuthenticationError) {\n return <MissingAuthorizationHeaderError />;\n }\n\n return <ResponseErrorPanel error={error} />;\n }\n\n if (!integrationKey) {\n return <ILertCardEmptyState />;\n }\n\n return (\n <>\n <Card data-testid=\"ilert-card\">\n <CardHeader\n title=\"
|
|
1
|
+
{"version":3,"file":"ILertCard.esm.js","sources":["../../../src/components/ILertCard/ILertCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity } from '@backstage/catalog-model';\nimport { ResponseErrorPanel } from '@backstage/core-components';\nimport { AuthenticationError } from '@backstage/errors';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useState } from 'react';\nimport { ILERT_INTEGRATION_KEY_ANNOTATION } from '../../constants';\nimport { useILertEntity } from '../../hooks';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { useAlertSource } from '../../hooks/useAlertSource';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { AlertsTable } from '../AlertsPage';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { ILertCardActionsHeader } from './ILertCardActionsHeader';\nimport { ILertCardEmptyState } from './ILertCardEmptyState';\nimport { ILertCardHeaderStatus } from './ILertCardHeaderStatus';\nimport { ILertCardMaintenanceModal } from './ILertCardMaintenanceModal';\nimport { ILertCardOnCall } from './ILertCardOnCall';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ILERT_INTEGRATION_KEY_ANNOTATION]);\n\nconst useStyles = makeStyles({\n content: {\n paddingLeft: '0 !important',\n paddingRight: '0 !important',\n paddingBottom: '0 !important',\n paddingTop: '0 !important',\n '& div div': {\n boxShadow: 'none !important',\n },\n },\n});\n\n/** @public */\nexport const ILertCard = () => {\n const classes = useStyles();\n const { integrationKey, name } = useILertEntity();\n const [{ alertSource }, { setAlertSource, refetchAlertSource }] =\n useAlertSource(integrationKey);\n const [\n { tableState, states, alerts, alertsCount, isLoading, error },\n {\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n onAlertChanged,\n refetchAlerts,\n setIsLoading,\n },\n ] = useAlerts(false, true, alertSource);\n\n const [isNewAlertModalOpened, setIsNewAlertModalOpened] = useState(false);\n const [isMaintenanceModalOpened, setIsMaintenanceModalOpened] =\n useState(false);\n\n if (error) {\n if (error instanceof AuthenticationError) {\n return <MissingAuthorizationHeaderError />;\n }\n\n return <ResponseErrorPanel error={error} />;\n }\n\n if (!integrationKey) {\n return <ILertCardEmptyState />;\n }\n\n return (\n <>\n <Card data-testid=\"ilert-card\">\n <CardHeader\n title=\"ilert\"\n subheader={\n <ILertCardActionsHeader\n alertSource={alertSource}\n setAlertSource={setAlertSource}\n setIsNewAlertModalOpened={setIsNewAlertModalOpened}\n setIsMaintenanceModalOpened={setIsMaintenanceModalOpened}\n />\n }\n action={<ILertCardHeaderStatus alertSource={alertSource} />}\n />\n <Divider />\n <CardContent className={classes.content}>\n <ILertCardOnCall alertSource={alertSource} />\n <AlertsTable\n alerts={alerts}\n alertsCount={alertsCount}\n tableState={tableState}\n states={states}\n onAlertChanged={onAlertChanged}\n onAlertStatesChange={onAlertStatesChange}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n compact\n />\n </CardContent>\n </Card>\n <AlertNewModal\n isModalOpened={isNewAlertModalOpened}\n setIsModalOpened={setIsNewAlertModalOpened}\n refetchAlerts={refetchAlerts}\n initialAlertSource={alertSource}\n entityName={name}\n />\n <ILertCardMaintenanceModal\n alertSource={alertSource}\n refetchAlertSource={refetchAlertSource}\n isModalOpened={isMaintenanceModalOpened}\n setIsModalOpened={setIsMaintenanceModalOpened}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,0BAAA,GAA6B,CAAC,MAAA,KACzC,OAAA,CAAQ,OAAO,QAAA,CAAS,WAAA,GAAc,gCAAgC,CAAC;AAEzE,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,OAAA,EAAS;AAAA,IACP,WAAA,EAAa,cAAA;AAAA,IACb,YAAA,EAAc,cAAA;AAAA,IACd,aAAA,EAA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33
33
|
const ILertCardEmptyState = () => {
|
|
34
34
|
const classes = useStyles();
|
|
35
35
|
return /* @__PURE__ */ jsxs(Card, { "data-testid": "ilert-empty-card", children: [
|
|
36
|
-
/* @__PURE__ */ jsx(CardHeader, { title: "
|
|
36
|
+
/* @__PURE__ */ jsx(CardHeader, { title: "ilert", className: classes.header }),
|
|
37
37
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
38
38
|
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
39
39
|
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: "No integration key defined for this entity. You can add integration key to your entity YAML as shown in the highlighted example below:" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardEmptyState.esm.js","sources":["../../../src/components/ILertCard/ILertCardEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Button from '@material-ui/core/Button';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst ENTITY_YAML = `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: example\n description: example.com\n annotations:\n ilert.com/integration-key: [INTEGRATION_KEY]\nspec:\n type: website\n lifecycle: production\n owner: guest`;\n\nconst useStyles = makeStyles(theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n header: {\n display: 'inline-block',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n}));\n\nexport const ILertCardEmptyState = () => {\n const classes = useStyles();\n\n return (\n <Card data-testid=\"ilert-empty-card\">\n <CardHeader title=\"
|
|
1
|
+
{"version":3,"file":"ILertCardEmptyState.esm.js","sources":["../../../src/components/ILertCard/ILertCardEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Button from '@material-ui/core/Button';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst ENTITY_YAML = `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: example\n description: example.com\n annotations:\n ilert.com/integration-key: [INTEGRATION_KEY]\nspec:\n type: website\n lifecycle: production\n owner: guest`;\n\nconst useStyles = makeStyles(theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n header: {\n display: 'inline-block',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n}));\n\nexport const ILertCardEmptyState = () => {\n const classes = useStyles();\n\n return (\n <Card data-testid=\"ilert-empty-card\">\n <CardHeader title=\"ilert\" className={classes.header} />\n <Divider />\n <CardContent>\n <Typography variant=\"body1\">\n No integration key defined for this entity. You can add integration\n key to your entity YAML as shown in the highlighted example below:\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[6, 7]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://github.com/backstage/backstage/blob/master/plugins/ilert/README.md\"\n >\n Read more\n </Button>\n </CardContent>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBA,MAAM,WAAA,GAAc,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAA,CAAA;AAYpB,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,YAAA,EAAc,CAAA;AAAA,IACd,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,CAAC,CAAA;AAAA,IAC1B,UAAA,EACE,MAAM,OAAA,CAAQ,IAAA,KAAS,SAAS,MAAA,GAAS,KAAA,CAAM,QAAQ,MAAA,CAAO;AAAA,GAClE;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,cAAA;AAAA,IACT,SAAS,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,CAAA,EAAG,GAAG,GAAG;AAAA;AAEvC,CAAA,CAAE,CAAA;AAEK,MAAM,sBAAsB,MAAM;AACvC,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,aAAA,EAAY,kBAAA,EAChB,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAM,OAAA,EAAQ,SAAA,EAAW,QAAQ,MAAA,EAAQ,CAAA;AAAA,wBACpD,OAAA,EAAA,EAAQ,CAAA;AAAA,yBACR,WAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,QAAA,EAAA,wIAAA,EAG5B,CAAA;AAAA,sBACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,IAAA,EACtB,QAAA,kBAAA,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,WAAA;AAAA,UACN,QAAA,EAAS,MAAA;AAAA,UACT,eAAA,EAAe,IAAA;AAAA,UACf,kBAAA,EAAoB,CAAC,CAAA,EAAG,CAAC,CAAA;AAAA,UACzB,WAAA,EAAa,EAAE,UAAA,EAAY,SAAA,EAAW,UAAU,MAAA;AAAO;AAAA,OACzD,EACF,CAAA;AAAA,sBACA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,WAAA;AAAA,UACR,KAAA,EAAM,SAAA;AAAA,UACN,MAAA,EAAO,QAAA;AAAA,UACP,IAAA,EAAK,4EAAA;AAAA,UACN,QAAA,EAAA;AAAA;AAAA;AAED,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -33,8 +33,8 @@ const ILertPage = () => {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
return /* @__PURE__ */ jsxs(Page, { themeId: "website", children: [
|
|
36
|
-
/* @__PURE__ */ jsxs(Header, { title: "
|
|
37
|
-
/* @__PURE__ */ jsx(HeaderLabel, { label: "Owner", value: "
|
|
36
|
+
/* @__PURE__ */ jsxs(Header, { title: "ilert", type: "tool", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(HeaderLabel, { label: "Owner", value: "ilert" }),
|
|
38
38
|
/* @__PURE__ */ jsx(HeaderLabel, { label: "Lifecycle", value: "Alpha" })
|
|
39
39
|
] }),
|
|
40
40
|
/* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertPage.esm.js","sources":["../../../src/components/ILertPage/ILertPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n Header,\n HeaderLabel,\n HeaderTabs,\n Page,\n} from '@backstage/core-components';\nimport { useState } from 'react';\nimport { AlertsPage } from '../AlertsPage';\nimport { OnCallSchedulesPage } from '../OnCallSchedulesPage';\nimport { ServicesPage } from '../ServicesPage';\nimport { StatusPagesPage } from '../StatusPagePage';\n\n/** @public */\nexport const ILertPage = () => {\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const tabs = [\n { label: 'Who is on call?' },\n { label: 'Alerts' },\n { label: 'Services' },\n { label: 'Status pages' },\n ];\n const renderTab = () => {\n switch (selectedTab) {\n case 0:\n return <OnCallSchedulesPage />;\n case 1:\n return <AlertsPage />;\n case 2:\n return <ServicesPage />;\n case 3:\n return <StatusPagesPage />;\n default:\n return null;\n }\n };\n\n return (\n <Page themeId=\"website\">\n <Header title=\"
|
|
1
|
+
{"version":3,"file":"ILertPage.esm.js","sources":["../../../src/components/ILertPage/ILertPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n Header,\n HeaderLabel,\n HeaderTabs,\n Page,\n} from '@backstage/core-components';\nimport { useState } from 'react';\nimport { AlertsPage } from '../AlertsPage';\nimport { OnCallSchedulesPage } from '../OnCallSchedulesPage';\nimport { ServicesPage } from '../ServicesPage';\nimport { StatusPagesPage } from '../StatusPagePage';\n\n/** @public */\nexport const ILertPage = () => {\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const tabs = [\n { label: 'Who is on call?' },\n { label: 'Alerts' },\n { label: 'Services' },\n { label: 'Status pages' },\n ];\n const renderTab = () => {\n switch (selectedTab) {\n case 0:\n return <OnCallSchedulesPage />;\n case 1:\n return <AlertsPage />;\n case 2:\n return <ServicesPage />;\n case 3:\n return <StatusPagesPage />;\n default:\n return null;\n }\n };\n\n return (\n <Page themeId=\"website\">\n <Header title=\"ilert\" type=\"tool\">\n <HeaderLabel label=\"Owner\" value=\"ilert\" />\n <HeaderLabel label=\"Lifecycle\" value=\"Alpha\" />\n </Header>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabs.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n\n <Content noPadding>{renderTab()}</Content>\n </Page>\n );\n};\n\nexport default ILertPage;\n"],"names":[],"mappings":";;;;;;;;;;;;AA6BO,MAAM,YAAY,MAAM;AAC7B,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAiB,CAAC,CAAA;AACxD,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,EAAE,OAAO,iBAAA,EAAkB;AAAA,IAC3B,EAAE,OAAO,QAAA,EAAS;AAAA,IAClB,EAAE,OAAO,UAAA,EAAW;AAAA,IACpB,EAAE,OAAO,cAAA;AAAe,GAC1B;AACA,EAAA,MAAM,YAAY,MAAM;AACtB,IAAA,QAAQ,WAAA;AAAa,MACnB,KAAK,CAAA;AACH,QAAA,2BAAQ,mBAAA,EAAA,EAAoB,CAAA;AAAA,MAC9B,KAAK,CAAA;AACH,QAAA,2BAAQ,UAAA,EAAA,EAAW,CAAA;AAAA,MACrB,KAAK,CAAA;AACH,QAAA,2BAAQ,YAAA,EAAA,EAAa,CAAA;AAAA,MACvB,KAAK,CAAA;AACH,QAAA,2BAAQ,eAAA,EAAA,EAAgB,CAAA;AAAA,MAC1B;AACE,QAAA,OAAO,IAAA;AAAA;AACX,EACF,CAAA;AAEA,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,SAAA,EACZ,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,MAAA,EAAA,EAAO,KAAA,EAAM,OAAA,EAAQ,IAAA,EAAK,MAAA,EACzB,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,KAAA,EAAM,OAAA,EAAQ,KAAA,EAAM,OAAA,EAAQ,CAAA;AAAA,sBACzC,GAAA,CAAC,WAAA,EAAA,EAAY,KAAA,EAAM,WAAA,EAAY,OAAM,OAAA,EAAQ;AAAA,KAAA,EAC/C,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,aAAA,EAAe,WAAA;AAAA,QACf,QAAA,EAAU,CAAA,KAAA,KAAS,cAAA,CAAe,KAAK,CAAA;AAAA,QACvC,MAAM,IAAA,CAAK,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAA,MAAW;AAAA,UACpC,EAAA,EAAI,MAAM,QAAA,EAAS;AAAA,UACnB;AAAA,SACF,CAAE;AAAA;AAAA,KACJ;AAAA,oBAEA,GAAA,CAAC,OAAA,EAAA,EAAQ,SAAA,EAAS,IAAA,EAAE,qBAAU,EAAE;AAAA,GAAA,EAClC,CAAA;AAEJ;;;;"}
|
|
@@ -14,7 +14,7 @@ const OnCallSchedulesPage = () => {
|
|
|
14
14
|
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ResponseErrorPanel, { error }) });
|
|
15
15
|
}
|
|
16
16
|
return /* @__PURE__ */ jsxs(Content, { children: [
|
|
17
|
-
/* @__PURE__ */ jsx(ContentHeader, { title: "Who is on call?", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring
|
|
17
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: "Who is on call?", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring ilert into your developer portal." }) }),
|
|
18
18
|
/* @__PURE__ */ jsx(
|
|
19
19
|
OnCallSchedulesGrid,
|
|
20
20
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnCallSchedulesPage.esm.js","sources":["../../../src/components/OnCallSchedulesPage/OnCallSchedulesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AuthenticationError } from '@backstage/errors';\nimport { OnCallSchedulesGrid } from './OnCallSchedulesGrid';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { useOnCallSchedules } from '../../hooks/useOnCallSchedules';\nimport {\n Content,\n ContentHeader,\n SupportButton,\n ResponseErrorPanel,\n} from '@backstage/core-components';\n\nexport const OnCallSchedulesPage = () => {\n const [{ onCallSchedules, isLoading, error }, { refetchOnCallSchedules }] =\n useOnCallSchedules();\n\n if (error) {\n if (error instanceof AuthenticationError) {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Who is on call?\">\n <SupportButton>\n This helps you to bring
|
|
1
|
+
{"version":3,"file":"OnCallSchedulesPage.esm.js","sources":["../../../src/components/OnCallSchedulesPage/OnCallSchedulesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AuthenticationError } from '@backstage/errors';\nimport { OnCallSchedulesGrid } from './OnCallSchedulesGrid';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { useOnCallSchedules } from '../../hooks/useOnCallSchedules';\nimport {\n Content,\n ContentHeader,\n SupportButton,\n ResponseErrorPanel,\n} from '@backstage/core-components';\n\nexport const OnCallSchedulesPage = () => {\n const [{ onCallSchedules, isLoading, error }, { refetchOnCallSchedules }] =\n useOnCallSchedules();\n\n if (error) {\n if (error instanceof AuthenticationError) {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Who is on call?\">\n <SupportButton>\n This helps you to bring ilert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <OnCallSchedulesGrid\n onCallSchedules={onCallSchedules}\n isLoading={isLoading}\n refetchOnCallSchedules={refetchOnCallSchedules}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,sBAAsB,MAAM;AACvC,EAAA,MAAM,CAAC,EAAE,eAAA,EAAiB,SAAA,EAAW,KAAA,IAAS,EAAE,sBAAA,EAAwB,CAAA,GACtE,kBAAA,EAAmB;AAErB,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,iBAAiB,mBAAA,EAAqB;AACxC,MAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,+BAAA,EAAA,EAAgC,CAAA,EACnC,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAmB,OAAc,CAAA,EACpC,CAAA;AAAA,EAEJ;AAEA,EAAA,4BACG,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAc,KAAA,EAAM,iBAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,uEAEf,CAAA,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,eAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -41,7 +41,7 @@ const ServiceActionsMenu = ({ service }) => {
|
|
|
41
41
|
PaperProps: {
|
|
42
42
|
style: { maxHeight: 48 * 5.5 }
|
|
43
43
|
},
|
|
44
|
-
children: /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloseMenu, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: ilertApi.getServiceDetailsURL(service), children: "View in
|
|
44
|
+
children: /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloseMenu, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: ilertApi.getServiceDetailsURL(service), children: "View in ilert" }) }) }, "details")
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
47
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceActionsMenu.esm.js","sources":["../../../src/components/Service/ServiceActionsMenu.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport type { MouseEvent } from 'react';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { Service } from '../../types';\n\nimport { Link } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ServiceActionsMenu = ({ service }: { service: Service }) => {\n const ilertApi = useApi(ilertApiRef);\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleCloseMenu = () => {\n setAnchorEl(null);\n };\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n size=\"small\"\n >\n <MoreVertIcon />\n </IconButton>\n <Menu\n id={`service-actions-menu-${service.id}`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleCloseMenu}\n PaperProps={{\n style: { maxHeight: 48 * 5.5 },\n }}\n >\n <MenuItem key=\"details\" onClick={handleCloseMenu}>\n <Typography variant=\"inherit\" noWrap>\n <Link to={ilertApi.getServiceDetailsURL(service)}>\n View in
|
|
1
|
+
{"version":3,"file":"ServiceActionsMenu.esm.js","sources":["../../../src/components/Service/ServiceActionsMenu.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport type { MouseEvent } from 'react';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { Service } from '../../types';\n\nimport { Link } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ServiceActionsMenu = ({ service }: { service: Service }) => {\n const ilertApi = useApi(ilertApiRef);\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleCloseMenu = () => {\n setAnchorEl(null);\n };\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n size=\"small\"\n >\n <MoreVertIcon />\n </IconButton>\n <Menu\n id={`service-actions-menu-${service.id}`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleCloseMenu}\n PaperProps={{\n style: { maxHeight: 48 * 5.5 },\n }}\n >\n <MenuItem key=\"details\" onClick={handleCloseMenu}>\n <Typography variant=\"inherit\" noWrap>\n <Link to={ilertApi.getServiceDetailsURL(service)}>\n View in ilert\n </Link>\n </Typography>\n </MenuItem>\n </Menu>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BO,MAAM,kBAAA,GAAqB,CAAC,EAAE,OAAA,EAAQ,KAA4B;AACvE,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,CAAC,QAAA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|
|
16
16
|
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ResponseErrorPanel, { error }) });
|
|
17
17
|
}
|
|
18
18
|
return /* @__PURE__ */ jsxs(Content, { children: [
|
|
19
|
-
/* @__PURE__ */ jsx(ContentHeader, { title: "Services", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring
|
|
19
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: "Services", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring ilert into your developer portal." }) }),
|
|
20
20
|
/* @__PURE__ */ jsx(
|
|
21
21
|
ServicesTable,
|
|
22
22
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServicesPage.esm.js","sources":["../../../src/components/ServicesPage/ServicesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport { useServices } from '../../hooks/useServices';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { ServicesTable } from './ServicesTable';\n\nexport const ServicesPage = () => {\n const [\n { tableState, services, isLoading, error },\n { onChangePage, onChangeRowsPerPage, setIsLoading },\n ] = useServices(true);\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Services\">\n <SupportButton>\n This helps you to bring
|
|
1
|
+
{"version":3,"file":"ServicesPage.esm.js","sources":["../../../src/components/ServicesPage/ServicesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport { useServices } from '../../hooks/useServices';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { ServicesTable } from './ServicesTable';\n\nexport const ServicesPage = () => {\n const [\n { tableState, services, isLoading, error },\n { onChangePage, onChangeRowsPerPage, setIsLoading },\n ] = useServices(true);\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Services\">\n <SupportButton>\n This helps you to bring ilert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <ServicesTable\n services={services}\n tableState={tableState}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,eAAe,MAAM;AAChC,EAAA,MAAM;AAAA,IACJ,EAAE,UAAA,EAAY,QAAA,EAAU,SAAA,EAAW,KAAA,EAAM;AAAA,IACzC,EAAE,YAAA,EAAc,mBAAA,EAAqB,YAAA;AAAa,GACpD,GAAI,YAAY,IAAI,CAAA;AAEpB,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,SAAS,qBAAA,EAAuB;AACxC,MAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,+BAAA,EAAA,EAAgC,CAAA,EACnC,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAmB,OAAc,CAAA,EACpC,CAAA;AAAA,EAEJ;AAEA,EAAA,4BACG,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAc,KAAA,EAAM,UAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,uEAEf,CAAA,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,QAAA;AAAA,QACA,UAAA;AAAA,QACA,YAAA;AAAA,QACA,mBAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -44,7 +44,7 @@ const StatusPageActionsMenu = ({
|
|
|
44
44
|
style: { maxHeight: 48 * 5.5 }
|
|
45
45
|
},
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */ jsx(MenuItem, { onClick: handleCloseMenu, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: ilertApi.getStatusPageDetailsURL(statusPage), children: "View in
|
|
47
|
+
/* @__PURE__ */ jsx(MenuItem, { onClick: handleCloseMenu, children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: ilertApi.getStatusPageDetailsURL(statusPage), children: "View in ilert" }) }) }, "details"),
|
|
48
48
|
/* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", noWrap: true, children: /* @__PURE__ */ jsx(Link, { to: `https://${ilertApi.getStatusPageURL(statusPage)}`, children: "View status page" }) }) })
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPageActionsMenu.esm.js","sources":["../../../src/components/StatusPage/StatusPageActionsMenu.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport type { MouseEvent } from 'react';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { StatusPage } from '../../types';\n\nimport { Link } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const StatusPageActionsMenu = ({\n statusPage,\n}: {\n statusPage: StatusPage;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleCloseMenu = () => {\n setAnchorEl(null);\n };\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n size=\"small\"\n >\n <MoreVertIcon />\n </IconButton>\n <Menu\n id={`statusPage-actions-menu-${statusPage.id}`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleCloseMenu}\n PaperProps={{\n style: { maxHeight: 48 * 5.5 },\n }}\n >\n <MenuItem key=\"details\" onClick={handleCloseMenu}>\n <Typography variant=\"inherit\" noWrap>\n <Link to={ilertApi.getStatusPageDetailsURL(statusPage)}>\n View in
|
|
1
|
+
{"version":3,"file":"StatusPageActionsMenu.esm.js","sources":["../../../src/components/StatusPage/StatusPageActionsMenu.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport type { MouseEvent } from 'react';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { StatusPage } from '../../types';\n\nimport { Link } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const StatusPageActionsMenu = ({\n statusPage,\n}: {\n statusPage: StatusPage;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleCloseMenu = () => {\n setAnchorEl(null);\n };\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n size=\"small\"\n >\n <MoreVertIcon />\n </IconButton>\n <Menu\n id={`statusPage-actions-menu-${statusPage.id}`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleCloseMenu}\n PaperProps={{\n style: { maxHeight: 48 * 5.5 },\n }}\n >\n <MenuItem key=\"details\" onClick={handleCloseMenu}>\n <Typography variant=\"inherit\" noWrap>\n <Link to={ilertApi.getStatusPageDetailsURL(statusPage)}>\n View in ilert\n </Link>\n </Typography>\n </MenuItem>\n <MenuItem>\n <Typography variant=\"inherit\" noWrap>\n <Link to={`https://${ilertApi.getStatusPageURL(statusPage)}`}>\n View status page\n </Link>\n </Typography>\n </MenuItem>\n </Menu>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BO,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,CAAA,KAEM;AACJ,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAA6B,IAAI,CAAA;AAEjE,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAmC;AACtD,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA;AAAA,EACjC,CAAA;AAEA,EAAA,MAAM,kBAAkB,MAAM;AAC5B,IAAA,WAAA,CAAY,IAAI,CAAA;AAAA,EAClB,CAAA;AAEA,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,YAAA,EAAW,MAAA;AAAA,QACX,eAAA,EAAc,WAAA;AAAA,QACd,eAAA,EAAc,MAAA;AAAA,QACd,OAAA,EAAS,WAAA;AAAA,QACT,IAAA,EAAK,OAAA;AAAA,QAEL,8BAAC,YAAA,EAAA,EAAa;AAAA;AAAA,KAChB;AAAA,oBACA,IAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,CAAA,wBAAA,EAA2B,UAAA,CAAW,EAAE,CAAA,CAAA;AAAA,QAC5C,QAAA;AAAA,QACA,WAAA,EAAW,IAAA;AAAA,QACX,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,QACtB,OAAA,EAAS,eAAA;AAAA,QACT,UAAA,EAAY;AAAA,UACV,KAAA,EAAO,EAAE,SAAA,EAAW,EAAA,GAAK,GAAA;AAAI,SAC/B;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,YAAuB,OAAA,EAAS,eAAA,EAC/B,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,WAAU,MAAA,EAAM,IAAA,EAClC,8BAAC,IAAA,EAAA,EAAK,EAAA,EAAI,SAAS,uBAAA,CAAwB,UAAU,GAAG,QAAA,EAAA,eAAA,EAExD,CAAA,EACF,KALY,SAMd,CAAA;AAAA,8BACC,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,cAAW,OAAA,EAAQ,SAAA,EAAU,QAAM,IAAA,EAClC,QAAA,kBAAA,GAAA,CAAC,QAAK,EAAA,EAAI,CAAA,QAAA,EAAW,SAAS,gBAAA,CAAiB,UAAU,CAAC,CAAA,CAAA,EAAI,QAAA,EAAA,kBAAA,EAE9D,GACF,CAAA,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -16,7 +16,7 @@ const StatusPagesPage = () => {
|
|
|
16
16
|
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ResponseErrorPanel, { error }) });
|
|
17
17
|
}
|
|
18
18
|
return /* @__PURE__ */ jsxs(Content, { children: [
|
|
19
|
-
/* @__PURE__ */ jsx(ContentHeader, { title: "Status pages", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring
|
|
19
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: "Status pages", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring ilert into your developer portal." }) }),
|
|
20
20
|
/* @__PURE__ */ jsx(
|
|
21
21
|
StatusPagesTable,
|
|
22
22
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPagesPage.esm.js","sources":["../../../src/components/StatusPagePage/StatusPagesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport { useStatusPages } from '../../hooks/useStatusPages';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { StatusPagesTable } from './StatusPagesTable';\n\nexport const StatusPagesPage = () => {\n const [\n { tableState, statusPages, isLoading, error },\n { onChangePage, onChangeRowsPerPage, setIsLoading },\n ] = useStatusPages(true);\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Status pages\">\n <SupportButton>\n This helps you to bring
|
|
1
|
+
{"version":3,"file":"StatusPagesPage.esm.js","sources":["../../../src/components/StatusPagePage/StatusPagesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport { useStatusPages } from '../../hooks/useStatusPages';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { StatusPagesTable } from './StatusPagesTable';\n\nexport const StatusPagesPage = () => {\n const [\n { tableState, statusPages, isLoading, error },\n { onChangePage, onChangeRowsPerPage, setIsLoading },\n ] = useStatusPages(true);\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Status pages\">\n <SupportButton>\n This helps you to bring ilert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <StatusPagesTable\n statusPages={statusPages}\n tableState={tableState}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,kBAAkB,MAAM;AACnC,EAAA,MAAM;AAAA,IACJ,EAAE,UAAA,EAAY,WAAA,EAAa,SAAA,EAAW,KAAA,EAAM;AAAA,IAC5C,EAAE,YAAA,EAAc,mBAAA,EAAqB,YAAA;AAAa,GACpD,GAAI,eAAe,IAAI,CAAA;AAEvB,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,SAAS,qBAAA,EAAuB;AACxC,MAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,+BAAA,EAAA,EAAgC,CAAA,EACnC,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAmB,OAAc,CAAA,EACpC,CAAA;AAAA,EAEJ;AAEA,EAAA,4BACG,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAc,KAAA,EAAM,cAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,uEAEf,CAAA,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,WAAA;AAAA,QACA,UAAA;AAAA,QACA,YAAA;AAAA,QACA,mBAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -396,7 +396,7 @@ declare class ILertClient implements ILertApi {
|
|
|
396
396
|
discoveryApi: DiscoveryApi;
|
|
397
397
|
fetchApi: FetchApi;
|
|
398
398
|
/**
|
|
399
|
-
* URL used by users to access
|
|
399
|
+
* URL used by users to access ilert web UI.
|
|
400
400
|
* Example: https://my-org.ilert.com/
|
|
401
401
|
*/
|
|
402
402
|
baseUrl: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-ilert",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A Backstage plugin that integrates towards
|
|
3
|
+
"version": "0.21.0",
|
|
4
|
+
"description": "A Backstage plugin that integrates towards ilert",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
7
7
|
"pluginId": "ilert",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"test": "backstage-cli package test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@backstage/catalog-model": "^1.
|
|
42
|
-
"@backstage/core-components": "^0.18.
|
|
43
|
-
"@backstage/core-plugin-api": "^1.12.
|
|
44
|
-
"@backstage/errors": "^1.3.
|
|
45
|
-
"@backstage/frontend-plugin-api": "^0.
|
|
46
|
-
"@backstage/plugin-catalog-react": "^
|
|
41
|
+
"@backstage/catalog-model": "^1.9.0",
|
|
42
|
+
"@backstage/core-components": "^0.18.10",
|
|
43
|
+
"@backstage/core-plugin-api": "^1.12.6",
|
|
44
|
+
"@backstage/errors": "^1.3.1",
|
|
45
|
+
"@backstage/frontend-plugin-api": "^0.17.1",
|
|
46
|
+
"@backstage/plugin-catalog-react": "^3.0.0",
|
|
47
47
|
"@date-io/luxon": "1.x",
|
|
48
48
|
"@material-ui/core": "^4.12.2",
|
|
49
49
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"react-use": "^17.2.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@backstage/cli": "^0.36.
|
|
59
|
-
"@backstage/dev-utils": "^1.1.
|
|
58
|
+
"@backstage/cli": "^0.36.2",
|
|
59
|
+
"@backstage/dev-utils": "^1.1.23",
|
|
60
60
|
"@testing-library/jest-dom": "^6.0.0",
|
|
61
61
|
"@types/humanize-duration": "^3.18.1",
|
|
62
62
|
"@types/react-dom": "^18.2.19",
|