@pagerduty/backstage-plugin 0.18.0 → 0.20.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/alpha/api.esm.js.map +1 -1
  3. package/dist/api/client.esm.js +97 -2
  4. package/dist/api/client.esm.js.map +1 -1
  5. package/dist/components/PagerDutyPage/AccountContext.esm.js +56 -0
  6. package/dist/components/PagerDutyPage/AccountContext.esm.js.map +1 -0
  7. package/dist/components/PagerDutyPage/AutomaticMappingsDialog.esm.js +243 -0
  8. package/dist/components/PagerDutyPage/AutomaticMappingsDialog.esm.js.map +1 -0
  9. package/dist/components/PagerDutyPage/MappingsDialog.esm.js +244 -0
  10. package/dist/components/PagerDutyPage/MappingsDialog.esm.js.map +1 -0
  11. package/dist/components/PagerDutyPage/MappingsTable/AutoMappingsButton.esm.js +74 -0
  12. package/dist/components/PagerDutyPage/MappingsTable/AutoMappingsButton.esm.js.map +1 -0
  13. package/dist/components/PagerDutyPage/MappingsTable/EmptyTableState.esm.js +26 -0
  14. package/dist/components/PagerDutyPage/MappingsTable/EmptyTableState.esm.js.map +1 -0
  15. package/dist/components/PagerDutyPage/MappingsTable/FilterRow.esm.js +67 -0
  16. package/dist/components/PagerDutyPage/MappingsTable/FilterRow.esm.js.map +1 -0
  17. package/dist/components/PagerDutyPage/MappingsTable/MappingToast.esm.js +69 -0
  18. package/dist/components/PagerDutyPage/MappingsTable/MappingToast.esm.js.map +1 -0
  19. package/dist/components/PagerDutyPage/MappingsTable/MappingsTable.esm.js +202 -0
  20. package/dist/components/PagerDutyPage/MappingsTable/MappingsTable.esm.js.map +1 -0
  21. package/dist/components/PagerDutyPage/MappingsTable/MappingsTableContent.esm.js +231 -0
  22. package/dist/components/PagerDutyPage/MappingsTable/MappingsTableContent.esm.js.map +1 -0
  23. package/dist/components/PagerDutyPage/MappingsTable/ServiceCell.esm.js +31 -0
  24. package/dist/components/PagerDutyPage/MappingsTable/ServiceCell.esm.js.map +1 -0
  25. package/dist/components/PagerDutyPage/MappingsTable/StatusCell.esm.js +112 -0
  26. package/dist/components/PagerDutyPage/MappingsTable/StatusCell.esm.js.map +1 -0
  27. package/dist/components/PagerDutyPage/MappingsTable/TableSkeleton.esm.js +50 -0
  28. package/dist/components/PagerDutyPage/MappingsTable/TableSkeleton.esm.js.map +1 -0
  29. package/dist/components/PagerDutyPage/MappingsTable/hooks/useConfirmMappings.esm.js +70 -0
  30. package/dist/components/PagerDutyPage/MappingsTable/hooks/useConfirmMappings.esm.js.map +1 -0
  31. package/dist/components/PagerDutyPage/ServiceMappingComponent.esm.js +67 -44
  32. package/dist/components/PagerDutyPage/ServiceMappingComponent.esm.js.map +1 -1
  33. package/dist/components/PagerDutyPage/index.esm.js +27 -12
  34. package/dist/components/PagerDutyPage/index.esm.js.map +1 -1
  35. package/dist/components/TriggerButton/index.esm.js +1 -1
  36. package/dist/components/TriggerButton/index.esm.js.map +1 -1
  37. package/dist/hooks/useDebounce.esm.js +13 -0
  38. package/dist/hooks/useDebounce.esm.js.map +1 -0
  39. package/dist/hooks/{index.esm.js → usePagerDutyEntity.esm.js} +1 -1
  40. package/dist/hooks/usePagerDutyEntity.esm.js.map +1 -0
  41. package/dist/index.d.ts +101 -4
  42. package/dist/package.json.esm.js +2 -2
  43. package/package.json +13 -13
  44. package/dist/components/PagerDutyPage/MappingTable.esm.js +0 -282
  45. package/dist/components/PagerDutyPage/MappingTable.esm.js.map +0 -1
  46. package/dist/hooks/index.esm.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -5,7 +5,8 @@ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
5
5
  import { DiscoveryApi, FetchApi, ConfigApi } from '@backstage/core-plugin-api';
6
6
  import { ReactNode } from 'react';
7
7
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
8
- import { PagerDutySetting, PagerDutyEntityMappingsResponse, PagerDutyServiceResponse, PagerDutyIncidentsResponse, PagerDutyChangeEventsResponse, PagerDutyServiceStandardsResponse, PagerDutyServiceMetricsResponse, PagerDutyUser } from '@pagerduty/backstage-plugin-common';
8
+ import { PagerDutySetting, PagerDutyEnhancedEntityMappingsResponse, PagerDutyServiceResponse, PagerDutyIncidentsResponse, PagerDutyChangeEventsResponse, PagerDutyService, PagerDutyTeam, PagerDutyServiceStandardsResponse, PagerDutyServiceMetricsResponse, PagerDutyUser, AutoMatchStartResponse, AutoMatchStatusResponse } from '@pagerduty/backstage-plugin-common';
9
+ export { AutoMatchBackstageComponent, AutoMatchEntityMapping, AutoMatchEntityMappingsResponse, AutoMatchPagerDutyService, AutoMatchScoreBreakdown, AutoMatchStatistics } from '@pagerduty/backstage-plugin-common';
9
10
 
10
11
  /** @public */
11
12
  declare const isPluginApplicableToEntity$1: (entity: Entity) => boolean;
@@ -78,10 +79,24 @@ interface PagerDutyApi {
78
79
  */
79
80
  storeSettings(settings: PagerDutySetting[]): Promise<Response>;
80
81
  /**
81
- * Fetches all entity mappings.
82
+ * Fetches entity mappings with pagination and search support.
82
83
  *
83
84
  */
84
- getEntityMappings(): Promise<PagerDutyEntityMappingsResponse>;
85
+ getEntityMappingsWithPagination(options: {
86
+ offset: number;
87
+ limit: number;
88
+ filters?: {
89
+ name?: string;
90
+ serviceName?: string;
91
+ status?: string;
92
+ teamName?: string;
93
+ };
94
+ sort?: {
95
+ column: string;
96
+ direction: 'ascending' | 'descending';
97
+ };
98
+ account?: string;
99
+ }): Promise<PagerDutyEnhancedEntityMappingsResponse>;
85
100
  /**
86
101
  * Stores the service mapping in the database.
87
102
  *
@@ -105,6 +120,16 @@ interface PagerDutyApi {
105
120
  *
106
121
  */
107
122
  removeServiceMapping(entityRef: string): Promise<boolean>;
123
+ /**
124
+ * Stores multiple service mappings in the database.
125
+ *
126
+ */
127
+ storeBulkServiceMappings(mappings: Array<{
128
+ serviceId: string;
129
+ integrationKey: string;
130
+ entityRef: string;
131
+ account: string;
132
+ }>): Promise<Response>;
108
133
  /**
109
134
  * Fetches the service for the provided pager duty Entity.
110
135
  *
@@ -130,6 +155,26 @@ interface PagerDutyApi {
130
155
  *
131
156
  */
132
157
  getChangeEventsByServiceId(serviceId: string, account?: string): Promise<PagerDutyChangeEventsResponse>;
158
+ /**
159
+ * Fetches a list of PagerDuty services.
160
+ *
161
+ */
162
+ getAllServices(): Promise<PagerDutyService[]>;
163
+ /**
164
+ * Fetches a list of PagerDuty teams.
165
+ *
166
+ * @param account - The account ID to filter teams by
167
+ */
168
+ getAllTeams(account?: string): Promise<PagerDutyTeam[]>;
169
+ /**
170
+ * Fetches a filtered list of PagerDuty services.
171
+ *
172
+ * @param teamIds - Optional array of team IDs to filter by
173
+ * @param query - Optional search query for service name or ID
174
+ * @param limit - Optional maximum number of results (default: 100)
175
+ * @param account - The account ID to filter services by
176
+ */
177
+ getFilteredServices(teamIds?: string[], query?: string, limit?: number, account?: string): Promise<PagerDutyService[]>;
133
178
  /**
134
179
  * Fetches a list of standards for a provided service.
135
180
  *
@@ -149,6 +194,25 @@ interface PagerDutyApi {
149
194
  * Triggers an incident to whoever is on-call.
150
195
  */
151
196
  triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response>;
197
+ /**
198
+ * Starts an async auto-match job and returns a jobId to poll.
199
+ */
200
+ startAutoMatchEntityMappings(options: {
201
+ team?: string;
202
+ threshold: number;
203
+ account?: string;
204
+ }): Promise<AutoMatchStartResponse>;
205
+ /**
206
+ * Fetches the current status (and result, when complete) of an auto-match job.
207
+ */
208
+ getAutoMatchStatus(jobId: string): Promise<AutoMatchStatusResponse>;
209
+ /**
210
+ * Fetches the list of configured PagerDuty accounts.
211
+ */
212
+ getAccounts(): Promise<Array<{
213
+ id: string;
214
+ isDefault: boolean;
215
+ }>>;
152
216
  }
153
217
  /** @public */
154
218
  type PagerDutyClientApiDependencies = {
@@ -173,7 +237,24 @@ declare class PagerDutyClient implements PagerDutyApi {
173
237
  getServiceByPagerDutyEntity(pagerDutyEntity: PagerDutyEntity): Promise<PagerDutyServiceResponse>;
174
238
  getSetting(id: string): Promise<PagerDutySetting>;
175
239
  storeSettings(settings: PagerDutySetting[]): Promise<Response>;
176
- getEntityMappings(): Promise<PagerDutyEntityMappingsResponse>;
240
+ getEntityMappingsWithPagination(options: {
241
+ offset: number;
242
+ limit: number;
243
+ filters?: {
244
+ name?: string;
245
+ serviceName?: string;
246
+ status?: string;
247
+ teamName?: string;
248
+ };
249
+ sort?: {
250
+ column: string;
251
+ direction: 'ascending' | 'descending';
252
+ };
253
+ account?: string;
254
+ }): Promise<PagerDutyEnhancedEntityMappingsResponse>;
255
+ getAllServices(): Promise<PagerDutyService[]>;
256
+ getAllTeams(account?: string): Promise<PagerDutyTeam[]>;
257
+ getFilteredServices(teamIds?: string[], query?: string, limit?: number, account?: string): Promise<PagerDutyService[]>;
177
258
  storeServiceMapping(serviceId: string, integrationKey: string, backstageEntityRef: string, account: string): Promise<Response>;
178
259
  getEntityMapping(entityRef: string): Promise<{
179
260
  mapping: {
@@ -183,6 +264,12 @@ declare class PagerDutyClient implements PagerDutyApi {
183
264
  account: string;
184
265
  };
185
266
  }>;
267
+ storeBulkServiceMappings(mappings: Array<{
268
+ serviceId: string;
269
+ integrationKey: string;
270
+ entityRef: string;
271
+ account: string;
272
+ }>): Promise<Response>;
186
273
  removeServiceMapping(entityRef: string): Promise<boolean>;
187
274
  getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse>;
188
275
  getServiceById(serviceId: string, account?: string): Promise<PagerDutyServiceResponse>;
@@ -192,6 +279,16 @@ declare class PagerDutyClient implements PagerDutyApi {
192
279
  getServiceMetricsByServiceId(serviceId: string, account?: string): Promise<PagerDutyServiceMetricsResponse>;
193
280
  getOnCallByPolicyId(policyId: string, account?: string): Promise<PagerDutyUser[]>;
194
281
  triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response>;
282
+ startAutoMatchEntityMappings(options: {
283
+ team?: string;
284
+ threshold: number;
285
+ account?: string;
286
+ }): Promise<AutoMatchStartResponse>;
287
+ getAutoMatchStatus(jobId: string): Promise<AutoMatchStatusResponse>;
288
+ getAccounts(): Promise<Array<{
289
+ id: string;
290
+ isDefault: boolean;
291
+ }>>;
195
292
  private findByUrl;
196
293
  private request;
197
294
  }
@@ -1,6 +1,6 @@
1
1
  var name = "@pagerduty/backstage-plugin";
2
2
  var description = "A Backstage plugin that integrates towards PagerDuty";
3
- var version = "0.18.0";
3
+ var version = "0.20.0";
4
4
  var main = "dist/index.esm.js";
5
5
  var types = "dist/index.d.ts";
6
6
  var license = "Apache-2.0";
@@ -49,7 +49,7 @@ var dependencies = {
49
49
  "@backstage/plugin-catalog-react": "backstage:^",
50
50
  "@backstage/plugin-home-react": "backstage:^",
51
51
  "@backstage/theme": "backstage:^",
52
- "@backstage/ui": "backstage:^",
52
+ "@backstage/ui": "^0.14.3",
53
53
  "@emotion/react": "^11.11.4",
54
54
  "@emotion/styled": "^11.11.5",
55
55
  "@material-ui/core": "^4.12.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagerduty/backstage-plugin",
3
3
  "description": "A Backstage plugin that integrates towards PagerDuty",
4
- "version": "0.18.0",
4
+ "version": "0.20.0",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -44,16 +44,16 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@backstage/catalog-model": "^1.7.6",
47
- "@backstage/core-compat-api": "^0.5.5",
48
- "@backstage/core-components": "^0.18.4",
49
- "@backstage/core-plugin-api": "^1.12.1",
47
+ "@backstage/core-compat-api": "^0.5.7",
48
+ "@backstage/core-components": "^0.18.6",
49
+ "@backstage/core-plugin-api": "^1.12.2",
50
50
  "@backstage/errors": "^1.2.7",
51
- "@backstage/frontend-plugin-api": "^0.13.2",
52
- "@backstage/plugin-catalog": "^1.32.1",
53
- "@backstage/plugin-catalog-react": "^1.21.4",
54
- "@backstage/plugin-home-react": "^0.1.33",
51
+ "@backstage/frontend-plugin-api": "^0.13.4",
52
+ "@backstage/plugin-catalog": "^1.32.2",
53
+ "@backstage/plugin-catalog-react": "^1.21.6",
54
+ "@backstage/plugin-home-react": "^0.1.34",
55
55
  "@backstage/theme": "^0.7.1",
56
- "@backstage/ui": "^0.10.0",
56
+ "@backstage/ui": "^0.14.3",
57
57
  "@emotion/react": "^11.11.4",
58
58
  "@emotion/styled": "^11.11.5",
59
59
  "@material-ui/core": "^4.12.2",
@@ -62,7 +62,7 @@
62
62
  "@mui/icons-material": "^5.15.19",
63
63
  "@mui/material": "^5.15.19",
64
64
  "@mui/x-date-pickers": "^7.6.1",
65
- "@pagerduty/backstage-plugin-common": "~0.2.6",
65
+ "@pagerduty/backstage-plugin-common": "~0.4.0",
66
66
  "@tanstack/react-query": "^5.40.1",
67
67
  "luxon": "^3.4.1",
68
68
  "material-react-table": "^2.13.0",
@@ -75,9 +75,9 @@
75
75
  "react-router-dom": "^6.3.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@backstage/cli": "^0.35.1",
79
- "@backstage/core-app-api": "^1.19.3",
80
- "@backstage/frontend-defaults": "^0.3.4",
78
+ "@backstage/cli": "^0.35.3",
79
+ "@backstage/core-app-api": "^1.19.4",
80
+ "@backstage/frontend-defaults": "^0.3.6",
81
81
  "@backstage/test-utils": "^1.7.14",
82
82
  "@testing-library/jest-dom": "^6.6.3",
83
83
  "@types/copyfiles": "^2",
@@ -1,282 +0,0 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useState, useEffect, useMemo } from 'react';
3
- import { useMaterialReactTable, MRT_EditActionButtons, MaterialReactTable } from 'material-react-table';
4
- import { Typography, Box, DialogTitle, DialogContent, DialogActions } from '@material-ui/core';
5
- import { Flex, TooltipTrigger, ButtonIcon, Tooltip } from '@backstage/ui';
6
- import { QueryClient, QueryClientProvider, useMutation } from '@tanstack/react-query';
7
- import { Edit, OpenInBrowser } from '@mui/icons-material';
8
- import { useApi } from '@backstage/core-plugin-api';
9
- import { pagerDutyApiRef } from '../../api/client.esm.js';
10
-
11
- function getColorFromStatus(status) {
12
- switch (status) {
13
- case "InSync":
14
- return "green";
15
- case "OutOfSync":
16
- return "red";
17
- case "NotMapped":
18
- return "orange";
19
- default:
20
- return "gray";
21
- }
22
- }
23
- function makeReadable(status) {
24
- switch (status) {
25
- case "InSync":
26
- return "In Sync";
27
- case "OutOfSync":
28
- return "Out of Sync";
29
- case "NotMapped":
30
- return "Not Mapped";
31
- default:
32
- return "Refresh to Update";
33
- }
34
- }
35
- const MappingTable = ({
36
- mappings,
37
- catalogEntities
38
- }) => {
39
- const DenseTable = () => {
40
- const [validationErrors, setValidationErrors] = useState({});
41
- const [entityOptions, setEntityOptions] = useState(
42
- []
43
- );
44
- const pagerDutyApi = useApi(pagerDutyApiRef);
45
- useEffect(() => {
46
- getEntityOptions();
47
- }, []);
48
- const columns = useMemo(
49
- () => [
50
- {
51
- id: "serviceId",
52
- accessorKey: "serviceId",
53
- header: "Service ID",
54
- visibleInShowHideMenu: false,
55
- enableEditing: false,
56
- Edit: () => null,
57
- Cell: ({ cell }) => /* @__PURE__ */ jsx(Typography, { variant: "body1", style: { fontWeight: 600 }, children: cell.getValue() })
58
- },
59
- {
60
- id: "integrationKey",
61
- accessorKey: "integrationKey",
62
- header: "Integration Key",
63
- visibleInShowHideMenu: false,
64
- enableEditing: false,
65
- Edit: () => null
66
- },
67
- {
68
- id: "serviceName",
69
- accessorKey: "serviceName",
70
- header: "PagerDuty Service",
71
- enableEditing: false
72
- },
73
- {
74
- id: "account",
75
- accessorKey: "account",
76
- header: "Account",
77
- enableEditing: false,
78
- Edit: () => null
79
- },
80
- {
81
- id: "team",
82
- accessorKey: "team",
83
- header: "Team",
84
- enableEditing: false
85
- },
86
- {
87
- id: "escalationPolicy",
88
- accessorKey: "escalationPolicy",
89
- header: "Escalation Policy",
90
- enableEditing: false
91
- },
92
- {
93
- id: "entityRef",
94
- accessorKey: "entityRef",
95
- header: "Mapping",
96
- visibleInShowHideMenu: false,
97
- editVariant: "select",
98
- editSelectOptions: entityOptions,
99
- muiEditTextFieldProps: {
100
- select: true,
101
- error: !!validationErrors?.state,
102
- helperText: validationErrors?.state,
103
- multiline: true,
104
- type: "range"
105
- }
106
- },
107
- {
108
- id: "entityName",
109
- accessorKey: "entityName",
110
- header: "Mapped Entity Name",
111
- enableEditing: false,
112
- Edit: () => null
113
- },
114
- {
115
- id: "status",
116
- accessorKey: "status",
117
- header: "Status",
118
- enableEditing: false,
119
- Edit: () => null,
120
- Cell: ({ cell }) => /* @__PURE__ */ jsx(
121
- Box,
122
- {
123
- component: "span",
124
- bgcolor: getColorFromStatus(cell.getValue()),
125
- borderRadius: "0.25rem",
126
- color: "white",
127
- p: "0.25rem",
128
- children: makeReadable(cell.getValue())
129
- }
130
- )
131
- },
132
- {
133
- id: "serviceUrl",
134
- accessorKey: "serviceUrl",
135
- header: "Service URL",
136
- visibleInShowHideMenu: false,
137
- enableEditing: false,
138
- Edit: () => null
139
- }
140
- ],
141
- [validationErrors, entityOptions]
142
- );
143
- function useUpdateMapping() {
144
- return useMutation({
145
- mutationFn: async (mapping) => {
146
- return await pagerDutyApi.storeServiceMapping(
147
- mapping.serviceId,
148
- mapping.integrationKey ?? "",
149
- mapping.entityRef,
150
- mapping.account ?? ""
151
- );
152
- }
153
- });
154
- }
155
- const { mutateAsync: updateMapping, isPending: isUpdatingMapping } = useUpdateMapping();
156
- const handleSaveMapping = async ({ values, table }) => {
157
- setValidationErrors({});
158
- values.entityName = catalogEntities.find(
159
- (entity) => `${entity.type}:${entity.namespace}/${entity.name}`.toLowerCase() === values.entityRef
160
- )?.name ?? "";
161
- values.status = "RefreshToUpdate";
162
- await updateMapping(values);
163
- const existingMapping = mappings.find(
164
- (item) => item.serviceId === values.serviceId
165
- );
166
- if (existingMapping) {
167
- existingMapping.entityRef = values.entityRef;
168
- existingMapping.entityName = values.entityName;
169
- }
170
- table.setEditingRow(null);
171
- };
172
- const openInBrowser = (url) => {
173
- window.open(url, "_blank", "noreferrer");
174
- };
175
- const dataTable = useMaterialReactTable({
176
- columns,
177
- data: mappings,
178
- editDisplayMode: "modal",
179
- enableEditing: true,
180
- positionActionsColumn: "last",
181
- enableStickyHeader: true,
182
- enableFilters: true,
183
- getRowId: (row) => row.serviceId,
184
- muiToolbarAlertBannerProps: mappings === void 0 ? {
185
- color: "error",
186
- children: "Error loading data"
187
- } : void 0,
188
- muiTableContainerProps: {
189
- sx: {
190
- minHeight: "500px"
191
- }
192
- },
193
- onEditingRowCancel: () => setValidationErrors({}),
194
- onEditingRowSave: handleSaveMapping,
195
- renderEditRowDialogContent: ({ table, row, internalEditComponents }) => /* @__PURE__ */ jsxs(Fragment, { children: [
196
- /* @__PURE__ */ jsx(DialogTitle, { children: "Update Entity Mapping" }),
197
- /* @__PURE__ */ jsx(
198
- DialogContent,
199
- {
200
- style: { display: "flex", flexDirection: "column", gap: "1rem" },
201
- children: internalEditComponents
202
- }
203
- ),
204
- /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(MRT_EditActionButtons, { variant: "text", table, row }) })
205
- ] }),
206
- renderRowActions: ({ row, table }) => /* @__PURE__ */ jsxs(Flex, { children: [
207
- /* @__PURE__ */ jsxs(TooltipTrigger, { children: [
208
- /* @__PURE__ */ jsx(
209
- ButtonIcon,
210
- {
211
- "aria-label": "Edit",
212
- variant: "tertiary",
213
- onClick: () => {
214
- getEntityOptions();
215
- table.setEditingRow(row);
216
- },
217
- icon: /* @__PURE__ */ jsx(Edit, {})
218
- }
219
- ),
220
- /* @__PURE__ */ jsx(Tooltip, { children: "Edit" })
221
- ] }),
222
- /* @__PURE__ */ jsxs(TooltipTrigger, { children: [
223
- /* @__PURE__ */ jsx(
224
- ButtonIcon,
225
- {
226
- "aria-label": "Open in PagerDuty",
227
- variant: "tertiary",
228
- onClick: () => openInBrowser(row.getValue("serviceUrl")),
229
- icon: /* @__PURE__ */ jsx(OpenInBrowser, {})
230
- }
231
- ),
232
- /* @__PURE__ */ jsx(Tooltip, { children: " Open in PagerDuty" })
233
- ] })
234
- ] }),
235
- state: {
236
- isLoading: mappings.length === 0 || catalogEntities.length === 0,
237
- isSaving: isUpdatingMapping,
238
- showAlertBanner: mappings === void 0 || catalogEntities === void 0,
239
- showProgressBars: mappings.length === 0 || catalogEntities.length === 0
240
- },
241
- initialState: {
242
- columnVisibility: {
243
- serviceId: false,
244
- entityRef: false,
245
- serviceUrl: false,
246
- integrationKey: false
247
- }
248
- }
249
- });
250
- function getEntityOptions() {
251
- const options = [];
252
- options.push({ value: "", label: "None" });
253
- catalogEntities.forEach((entity) => {
254
- const foundServiceAnnotation = entity.annotations["pagerduty.com/service-id"];
255
- const foundIntegrationKeyAnnotation = entity.annotations["pagerduty.com/integration-key"];
256
- let foundServiceMapping;
257
- if (foundServiceAnnotation || foundIntegrationKeyAnnotation) {
258
- foundServiceMapping = mappings.find(
259
- (item) => item.serviceId === foundServiceAnnotation || item.integrationKey === foundIntegrationKeyAnnotation
260
- );
261
- }
262
- const entityRef = `${entity.type}:${entity.namespace}/${entity.name}`.toLowerCase();
263
- const foundEntityMapping = mappings.find(
264
- (item) => item.entityRef === entityRef
265
- );
266
- if (!foundEntityMapping && (!foundServiceAnnotation || !foundIntegrationKeyAnnotation) || (foundServiceAnnotation || foundIntegrationKeyAnnotation) && foundServiceMapping && !foundEntityMapping) {
267
- options.push({
268
- value: entityRef,
269
- label: entity.name
270
- });
271
- }
272
- });
273
- setEntityOptions(options);
274
- }
275
- return /* @__PURE__ */ jsx(MaterialReactTable, { table: dataTable });
276
- };
277
- const queryClient = new QueryClient();
278
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(DenseTable, {}) });
279
- };
280
-
281
- export { MappingTable };
282
- //# sourceMappingURL=MappingTable.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MappingTable.esm.js","sources":["../../../src/components/PagerDutyPage/MappingTable.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { PagerDutyEntityMapping } from '@pagerduty/backstage-plugin-common';\nimport {\n MRT_ColumnDef,\n MRT_EditActionButtons,\n MRT_TableOptions,\n MaterialReactTable,\n useMaterialReactTable,\n} from 'material-react-table';\nimport {\n Box,\n DialogActions,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@material-ui/core';\nimport { Flex, Tooltip, TooltipTrigger, ButtonIcon } from '@backstage/ui';\nimport {\n QueryClient,\n QueryClientProvider,\n useMutation,\n} from '@tanstack/react-query';\nimport { Edit, OpenInBrowser } from '@mui/icons-material';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { pagerDutyApiRef } from '../../api';\n\ntype BackstageEntity = {\n id: string;\n name: string;\n namespace: string;\n type: string;\n system: string;\n owner: string;\n lifecycle: string;\n annotations: Annotations;\n};\n\nexport type Annotations = {\n 'pagerduty.com/integration-key': string;\n 'pagerduty.com/service-id': string;\n};\n\nfunction getColorFromStatus(status?: string) {\n switch (status) {\n case 'InSync':\n return 'green';\n case 'OutOfSync':\n return 'red';\n case 'NotMapped':\n return 'orange';\n default:\n return 'gray';\n }\n}\n\nfunction makeReadable(status?: string) {\n switch (status) {\n case 'InSync':\n return 'In Sync';\n case 'OutOfSync':\n return 'Out of Sync';\n case 'NotMapped':\n return 'Not Mapped';\n default:\n return 'Refresh to Update';\n }\n}\n\ntype CatalogEntityOptions = {\n value: string;\n label: string;\n};\n\ntype MappingTableProps = {\n mappings: PagerDutyEntityMapping[];\n catalogEntities: BackstageEntity[];\n};\n\nexport const MappingTable = ({\n mappings,\n catalogEntities,\n}: MappingTableProps) => {\n const DenseTable = () => {\n const [validationErrors, setValidationErrors] = useState<\n Record<string, string | undefined>\n >({});\n const [entityOptions, setEntityOptions] = useState<CatalogEntityOptions[]>(\n [],\n );\n const pagerDutyApi = useApi(pagerDutyApiRef);\n\n useEffect(() => {\n getEntityOptions();\n }, []);\n\n const columns = useMemo<MRT_ColumnDef<PagerDutyEntityMapping>[]>(\n () => [\n {\n id: 'serviceId',\n accessorKey: 'serviceId',\n header: 'Service ID',\n visibleInShowHideMenu: false,\n enableEditing: false,\n Edit: () => null,\n Cell: ({ cell }) => (\n <Typography variant=\"body1\" style={{ fontWeight: 600 }}>\n {cell.getValue<string>()}\n </Typography>\n ),\n },\n {\n id: 'integrationKey',\n accessorKey: 'integrationKey',\n header: 'Integration Key',\n visibleInShowHideMenu: false,\n enableEditing: false,\n Edit: () => null,\n },\n {\n id: 'serviceName',\n accessorKey: 'serviceName',\n header: 'PagerDuty Service',\n enableEditing: false,\n },\n {\n id: 'account',\n accessorKey: 'account',\n header: 'Account',\n enableEditing: false,\n Edit: () => null,\n },\n {\n id: 'team',\n accessorKey: 'team',\n header: 'Team',\n enableEditing: false,\n },\n {\n id: 'escalationPolicy',\n accessorKey: 'escalationPolicy',\n header: 'Escalation Policy',\n enableEditing: false,\n },\n {\n id: 'entityRef',\n accessorKey: 'entityRef',\n header: 'Mapping',\n visibleInShowHideMenu: false,\n editVariant: 'select',\n editSelectOptions: entityOptions,\n muiEditTextFieldProps: {\n select: true,\n error: !!validationErrors?.state,\n helperText: validationErrors?.state,\n multiline: true,\n type: 'range',\n },\n },\n {\n id: 'entityName',\n accessorKey: 'entityName',\n header: 'Mapped Entity Name',\n enableEditing: false,\n Edit: () => null,\n },\n {\n id: 'status',\n accessorKey: 'status',\n header: 'Status',\n enableEditing: false,\n Edit: () => null,\n Cell: ({ cell }) => (\n <Box\n component=\"span\"\n bgcolor={getColorFromStatus(cell.getValue<string>())}\n borderRadius=\"0.25rem\"\n color=\"white\"\n p=\"0.25rem\"\n >\n {makeReadable(cell.getValue<string>())}\n </Box>\n ),\n },\n {\n id: 'serviceUrl',\n accessorKey: 'serviceUrl',\n header: 'Service URL',\n visibleInShowHideMenu: false,\n enableEditing: false,\n Edit: () => null,\n },\n ],\n [validationErrors, entityOptions],\n );\n\n // UPDATE hook (put mapping in api)\n function useUpdateMapping() {\n return useMutation({\n mutationFn: async (mapping: PagerDutyEntityMapping) => {\n return await pagerDutyApi.storeServiceMapping(\n mapping.serviceId,\n mapping.integrationKey ?? '',\n mapping.entityRef,\n mapping.account ?? '',\n );\n },\n });\n }\n\n // call UPDATE hook\n const { mutateAsync: updateMapping, isPending: isUpdatingMapping } =\n useUpdateMapping();\n\n // UPDATE action\n const handleSaveMapping: MRT_TableOptions<PagerDutyEntityMapping>['onEditingRowSave'] =\n async ({ values, table }) => {\n setValidationErrors({});\n\n values.entityName =\n catalogEntities.find(\n entity =>\n `${entity.type}:${entity.namespace}/${entity.name}`.toLowerCase() ===\n values.entityRef,\n )?.name ?? '';\n values.status = 'RefreshToUpdate';\n\n await updateMapping(values);\n\n // find corresponding mapping in mappings array\n // and update it with new values\n const existingMapping = mappings.find(\n item => item.serviceId === values.serviceId,\n );\n if (existingMapping) {\n existingMapping.entityRef = values.entityRef;\n existingMapping.entityName = values.entityName;\n }\n\n table.setEditingRow(null); // exit editing mode\n };\n\n const openInBrowser = (url: string) => {\n window.open(url, '_blank', 'noreferrer');\n };\n\n const dataTable = useMaterialReactTable({\n columns,\n data: mappings,\n editDisplayMode: 'modal',\n enableEditing: true,\n positionActionsColumn: 'last',\n enableStickyHeader: true,\n enableFilters: true,\n getRowId: row => row.serviceId,\n muiToolbarAlertBannerProps:\n mappings === undefined\n ? {\n color: 'error',\n children: 'Error loading data',\n }\n : undefined,\n muiTableContainerProps: {\n sx: {\n minHeight: '500px',\n },\n },\n onEditingRowCancel: () => setValidationErrors({}),\n onEditingRowSave: handleSaveMapping,\n renderEditRowDialogContent: ({ table, row, internalEditComponents }) => (\n <>\n <DialogTitle>Update Entity Mapping</DialogTitle>\n <DialogContent\n style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}\n >\n {internalEditComponents}\n </DialogContent>\n <DialogActions>\n <MRT_EditActionButtons variant=\"text\" table={table} row={row} />\n </DialogActions>\n </>\n ),\n renderRowActions: ({ row, table }) => (\n <Flex>\n <TooltipTrigger>\n <ButtonIcon\n aria-label=\"Edit\"\n variant=\"tertiary\"\n onClick={() => {\n getEntityOptions();\n table.setEditingRow(row);\n }}\n icon={<Edit />}\n />\n <Tooltip>Edit</Tooltip>\n </TooltipTrigger>\n <TooltipTrigger>\n <ButtonIcon\n aria-label=\"Open in PagerDuty\"\n variant=\"tertiary\"\n onClick={() => openInBrowser(row.getValue('serviceUrl'))}\n icon={<OpenInBrowser />}\n />\n <Tooltip> Open in PagerDuty</Tooltip>\n </TooltipTrigger>\n </Flex>\n ),\n state: {\n isLoading: mappings.length === 0 || catalogEntities.length === 0,\n isSaving: isUpdatingMapping,\n showAlertBanner:\n mappings === undefined || catalogEntities === undefined,\n showProgressBars: mappings.length === 0 || catalogEntities.length === 0,\n },\n initialState: {\n columnVisibility: {\n serviceId: false,\n entityRef: false,\n serviceUrl: false,\n integrationKey: false,\n },\n },\n });\n\n function getEntityOptions() {\n const options: CatalogEntityOptions[] = [];\n // initialize with empty object\n options.push({ value: '', label: 'None' });\n\n catalogEntities.forEach(entity => {\n // find service-id annotation in entity\n const foundServiceAnnotation =\n entity.annotations['pagerduty.com/service-id'];\n\n // find integration-key annotation in entity\n const foundIntegrationKeyAnnotation =\n entity.annotations['pagerduty.com/integration-key'];\n\n // find entity with service-id in mappings array if service-id is found in entity\n let foundServiceMapping: PagerDutyEntityMapping | undefined;\n if (foundServiceAnnotation || foundIntegrationKeyAnnotation) {\n foundServiceMapping = mappings.find(\n item =>\n item.serviceId === foundServiceAnnotation ||\n item.integrationKey === foundIntegrationKeyAnnotation,\n );\n }\n\n const entityRef =\n `${entity.type}:${entity.namespace}/${entity.name}`.toLowerCase();\n // find entity with entity.id in entityMappings array\n const foundEntityMapping = mappings.find(\n item => item.entityRef === entityRef,\n );\n\n if (\n (!foundEntityMapping &&\n (!foundServiceAnnotation || !foundIntegrationKeyAnnotation)) ||\n ((foundServiceAnnotation || foundIntegrationKeyAnnotation) &&\n foundServiceMapping &&\n !foundEntityMapping)\n ) {\n options.push({\n value: entityRef,\n label: entity.name,\n });\n }\n });\n\n setEntityOptions(options);\n }\n\n return <MaterialReactTable table={dataTable} />;\n };\n\n const queryClient = new QueryClient();\n\n return (\n <QueryClientProvider client={queryClient}>\n <DenseTable />\n </QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA0CA,SAAS,mBAAmB,MAAA,EAAiB;AAC3C,EAAA,QAAQ,MAAA;AAAQ,IACd,KAAK,QAAA;AACH,MAAA,OAAO,OAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,KAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,QAAA;AAAA,IACT;AACE,MAAA,OAAO,MAAA;AAAA;AAEb;AAEA,SAAS,aAAa,MAAA,EAAiB;AACrC,EAAA,QAAQ,MAAA;AAAQ,IACd,KAAK,QAAA;AACH,MAAA,OAAO,SAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,aAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,YAAA;AAAA,IACT;AACE,MAAA,OAAO,mBAAA;AAAA;AAEb;AAYO,MAAM,eAAe,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA;AACF,CAAA,KAAyB;AACvB,EAAA,MAAM,aAAa,MAAM;AACvB,IAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,QAAA,CAE9C,EAAE,CAAA;AACJ,IAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,QAAA;AAAA,MACxC;AAAC,KACH;AACA,IAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAE3C,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,gBAAA,EAAiB;AAAA,IACnB,CAAA,EAAG,EAAE,CAAA;AAEL,IAAA,MAAM,OAAA,GAAU,OAAA;AAAA,MACd,MAAM;AAAA,QACJ;AAAA,UACE,EAAA,EAAI,WAAA;AAAA,UACJ,WAAA,EAAa,WAAA;AAAA,UACb,MAAA,EAAQ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AAmB,KAAA,EAAO,SAAA,EAAW,CAAA;AAAA,EAC/C,CAAA;AAEA,EAAA,MAAM,WAAA,GAAc,IAAI,WAAA,EAAY;AAEpC,EAAA,2BACG,mBAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,cAAW,CAAA,EACd,CAAA;AAEJ;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/hooks/index.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { useEntity } from '@backstage/plugin-catalog-react';\nimport { PagerDutyEntity } from '../types';\nimport { getPagerDutyEntity } from '../components/pagerDutyEntity';\n\nexport function usePagerdutyEntity(): PagerDutyEntity {\n const { entity } = useEntity();\n\n return getPagerDutyEntity(entity);\n}\n"],"names":[],"mappings":";;;AAoBO,SAAS,kBAAA,GAAsC;AACpD,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAE7B,EAAA,OAAO,mBAAmB,MAAM,CAAA;AAClC;;;;"}