@pagerduty/backstage-plugin 0.12.1-next.3 → 0.12.1-next.31
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/dist/esm/{index-4421d048.esm.js → index-77e3f0c9.esm.js} +23 -5
- package/dist/esm/index-77e3f0c9.esm.js.map +1 -0
- package/dist/esm/index-79db1ef4.esm.js +186 -0
- package/dist/esm/index-79db1ef4.esm.js.map +1 -0
- package/dist/esm/{index-7544432f.esm.js → index-f53003e9.esm.js} +2 -2
- package/dist/esm/{index-7544432f.esm.js.map → index-f53003e9.esm.js.map} +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.esm.js +1 -1
- package/package.json +2 -3
- package/dist/esm/index-4421d048.esm.js.map +0 -1
- package/dist/esm/index-9f8fbac3.esm.js +0 -169
- package/dist/esm/index-9f8fbac3.esm.js.map +0 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Typography, FormControl, Select, MenuItem, Button, Grid } from '@material-ui/core';
|
|
3
|
+
import { Table, Page, Header, Content } from '@backstage/core-components';
|
|
4
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import { p as pagerDutyApiRef } from './index-77e3f0c9.esm.js';
|
|
6
|
+
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
7
|
+
import '@backstage/errors';
|
|
8
|
+
import '@backstage/plugin-home-react';
|
|
9
|
+
import 'luxon';
|
|
10
|
+
import '@material-ui/icons/OpenInBrowser';
|
|
11
|
+
import '../assets/emptystate.svg';
|
|
12
|
+
import 'react-use/lib/useAsyncFn';
|
|
13
|
+
import '@material-ui/lab';
|
|
14
|
+
import '../assets/forbiddenstate.svg';
|
|
15
|
+
import '@material-ui/core/Avatar';
|
|
16
|
+
import '@material-ui/icons/Notifications';
|
|
17
|
+
import 'react-use/lib/useAsync';
|
|
18
|
+
import '@material-ui/icons/Link';
|
|
19
|
+
import '../assets/PD-Green.svg';
|
|
20
|
+
import '../assets/PD-White.svg';
|
|
21
|
+
import 'validate-color';
|
|
22
|
+
import '@material-ui/icons/Info';
|
|
23
|
+
import '@material-ui/icons/CheckCircle';
|
|
24
|
+
import '@material-ui/icons/RadioButtonUnchecked';
|
|
25
|
+
import '@material-ui/core/styles';
|
|
26
|
+
import 'react-use';
|
|
27
|
+
import '@material-ui/lab/Alert/Alert';
|
|
28
|
+
import '@backstage/catalog-model';
|
|
29
|
+
import '@material-ui/icons/AddAlert';
|
|
30
|
+
import '@material-ui/icons/ExpandMore';
|
|
31
|
+
|
|
32
|
+
function getColorFromStatus(status) {
|
|
33
|
+
switch (status) {
|
|
34
|
+
case "InSync":
|
|
35
|
+
return "green";
|
|
36
|
+
case "OutOfSync":
|
|
37
|
+
return "red";
|
|
38
|
+
case "NotMapped":
|
|
39
|
+
return "orange";
|
|
40
|
+
default:
|
|
41
|
+
return "gray";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const DenseTable = ({
|
|
45
|
+
data,
|
|
46
|
+
isLoading
|
|
47
|
+
}) => {
|
|
48
|
+
const columns = [
|
|
49
|
+
{ title: "PagerDuty Service", field: "name" },
|
|
50
|
+
{ title: "Team", field: "team" },
|
|
51
|
+
{ title: "Escalation Policy", field: "escalationPolicy" },
|
|
52
|
+
{ title: "Mapping", field: "mapping" },
|
|
53
|
+
{ title: "Status", field: "mappingStatus" },
|
|
54
|
+
{ title: "Actions", field: "actions" }
|
|
55
|
+
];
|
|
56
|
+
return /* @__PURE__ */ React.createElement(
|
|
57
|
+
Table,
|
|
58
|
+
{
|
|
59
|
+
isLoading,
|
|
60
|
+
title: "PagerDuty Service Import",
|
|
61
|
+
subtitle: "Use this page to import services from PagerDuty and map them to existing Backstage services. Only 1:1 mapping is allowed.",
|
|
62
|
+
options: {
|
|
63
|
+
search: true,
|
|
64
|
+
paging: true,
|
|
65
|
+
pageSize: 10,
|
|
66
|
+
pageSizeOptions: [10, 25, 50],
|
|
67
|
+
sorting: true,
|
|
68
|
+
emptyRowsWhenPaging: false,
|
|
69
|
+
showFirstLastPageButtons: true,
|
|
70
|
+
columnResizable: true,
|
|
71
|
+
columnsButton: true,
|
|
72
|
+
rowStyle: {
|
|
73
|
+
height: "10px"
|
|
74
|
+
},
|
|
75
|
+
padding: "dense"
|
|
76
|
+
},
|
|
77
|
+
columns,
|
|
78
|
+
data
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
const ServiceMappingComponent = () => {
|
|
83
|
+
const [tableData, setTableData] = useState([]);
|
|
84
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
85
|
+
const pagerDutyApi = useApi(pagerDutyApiRef);
|
|
86
|
+
const catalogApi = useApi(catalogApiRef);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
async function fetchEntities() {
|
|
89
|
+
const { items } = await catalogApi.getEntities({
|
|
90
|
+
filter: { kind: "Component" }
|
|
91
|
+
});
|
|
92
|
+
const backstageServices = [];
|
|
93
|
+
items.forEach((entity) => {
|
|
94
|
+
var _a, _b, _c, _d, _e, _f;
|
|
95
|
+
backstageServices.push({
|
|
96
|
+
name: (_a = entity.metadata) == null ? void 0 : _a.name,
|
|
97
|
+
id: (_c = (_b = entity.metadata) == null ? void 0 : _b.uid) != null ? _c : "",
|
|
98
|
+
system: JSON.stringify((_d = entity.spec) == null ? void 0 : _d.system) || "",
|
|
99
|
+
owner: JSON.stringify((_e = entity.spec) == null ? void 0 : _e.owner) || "",
|
|
100
|
+
lifecycle: JSON.stringify((_f = entity.spec) == null ? void 0 : _f.lifecycle) || ""
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return backstageServices;
|
|
104
|
+
}
|
|
105
|
+
async function fetchServices() {
|
|
106
|
+
const { mappings: foundServices } = await pagerDutyApi.getEntityMappings();
|
|
107
|
+
return foundServices;
|
|
108
|
+
}
|
|
109
|
+
Promise.all([fetchEntities(), fetchServices()]).then(
|
|
110
|
+
([entities, mappings]) => {
|
|
111
|
+
const data = mappings.map((service) => {
|
|
112
|
+
return {
|
|
113
|
+
name: service.serviceName,
|
|
114
|
+
team: service.team,
|
|
115
|
+
escalationPolicy: service.escalationPolicy,
|
|
116
|
+
// status of mapping
|
|
117
|
+
mappingStatus: /* @__PURE__ */ React.createElement(
|
|
118
|
+
Typography,
|
|
119
|
+
{
|
|
120
|
+
variant: "body2",
|
|
121
|
+
style: {
|
|
122
|
+
color: getColorFromStatus(service.status)
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
service.status
|
|
126
|
+
),
|
|
127
|
+
mapping: (
|
|
128
|
+
// dropdown menu with static options. If service.mapping is defined select that option
|
|
129
|
+
/* @__PURE__ */ React.createElement(FormControl, { variant: "standard" }, /* @__PURE__ */ React.createElement(
|
|
130
|
+
Select,
|
|
131
|
+
{
|
|
132
|
+
displayEmpty: true,
|
|
133
|
+
onChange: async (selection) => {
|
|
134
|
+
await pagerDutyApi.storeServiceMapping(
|
|
135
|
+
service.serviceId,
|
|
136
|
+
selection.target.value
|
|
137
|
+
);
|
|
138
|
+
service.status = "OutOfSync";
|
|
139
|
+
service.entityRef = selection.target.value;
|
|
140
|
+
},
|
|
141
|
+
value: service.entityRef
|
|
142
|
+
},
|
|
143
|
+
/* @__PURE__ */ React.createElement(MenuItem, { value: "" }, /* @__PURE__ */ React.createElement("em", null, "None")),
|
|
144
|
+
entities.map((backstageService) => {
|
|
145
|
+
return /* @__PURE__ */ React.createElement(
|
|
146
|
+
MenuItem,
|
|
147
|
+
{
|
|
148
|
+
key: backstageService.id,
|
|
149
|
+
value: backstageService.id
|
|
150
|
+
},
|
|
151
|
+
backstageService.name
|
|
152
|
+
);
|
|
153
|
+
})
|
|
154
|
+
))
|
|
155
|
+
),
|
|
156
|
+
actions: /* @__PURE__ */ React.createElement(
|
|
157
|
+
Button,
|
|
158
|
+
{
|
|
159
|
+
variant: "contained",
|
|
160
|
+
color: "primary",
|
|
161
|
+
href: service.serviceUrl
|
|
162
|
+
},
|
|
163
|
+
"Open in PagerDuty"
|
|
164
|
+
)
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
setTableData(data);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
setIsLoading(false);
|
|
171
|
+
}, [catalogApi, pagerDutyApi]);
|
|
172
|
+
return /* @__PURE__ */ React.createElement(
|
|
173
|
+
DenseTable,
|
|
174
|
+
{
|
|
175
|
+
data: tableData,
|
|
176
|
+
isLoading
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const PagerDutyPage = () => {
|
|
182
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Header, { title: "PagerDuty", subtitle: "Advanced configurations" }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(ServiceMappingComponent, null)))));
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export { PagerDutyPage };
|
|
186
|
+
//# sourceMappingURL=index-79db1ef4.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-79db1ef4.esm.js","sources":["../../src/components/PagerDutyPage/ServiceMappingComponent.tsx","../../src/components/PagerDutyPage/index.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport { Table, TableColumn } from \"@backstage/core-components\";\nimport {\n Button,\n FormControl,\n MenuItem,\n Select,\n Typography,\n} from \"@material-ui/core\";\nimport { PagerDutyEntityMapping } from \"@pagerduty/backstage-plugin-common\";\nimport { useApi } from \"@backstage/core-plugin-api\";\nimport { pagerDutyApiRef } from \"../../api\";\nimport { catalogApiRef } from \"@backstage/plugin-catalog-react\";\nimport { Entity } from \"@backstage/catalog-model\";\n\ntype Service = {\n name: string; // \"Ads\"\n id: string; // \"QWe1j283n12j132\"\n system: string; // \"Production\"\n owner: string; // \"Mapped\"\n lifecycle: string; // \"Ads\"\n};\n\n type TableItem = {\n name: string | undefined;\n team: string | undefined;\n escalationPolicy: string | undefined;\n mappingStatus: JSX.Element;\n mapping: JSX.Element;\n actions: JSX.Element;\n };\n\ntype DenseTableProps = {\n data: TableItem[];\n isLoading: boolean;\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\nexport const DenseTable = ({\n data,\n isLoading,\n}: DenseTableProps) => {\n // const classes = useStyles();\n\n const columns: TableColumn[] = [\n { title: \"PagerDuty Service\", field: \"name\" },\n { title: \"Team\", field: \"team\" },\n { title: \"Escalation Policy\", field: \"escalationPolicy\" },\n { title: \"Mapping\", field: \"mapping\" },\n { title: \"Status\", field: \"mappingStatus\" },\n { title: \"Actions\", field: \"actions\" },\n ];\n\n return (\n <Table\n isLoading={isLoading}\n title=\"PagerDuty Service Import\"\n subtitle=\"Use this page to import services from PagerDuty and map them to existing Backstage services. Only 1:1 mapping is allowed.\"\n options={{\n search: true,\n paging: true,\n pageSize: 10,\n pageSizeOptions: [10, 25, 50],\n sorting: true,\n emptyRowsWhenPaging: false,\n showFirstLastPageButtons: true,\n columnResizable: true,\n columnsButton: true,\n rowStyle: {\n height: \"10px\",\n },\n padding: \"dense\",\n }}\n columns={columns}\n data={data}\n />\n );\n};\n\nexport const ServiceMappingComponent = () => {\n // const [catalogEntities, setCatalogEntities] = useState<Service[]>([]);\n // const [serviceMappings, setServiceMappings] = useState<\n // PagerDutyEntityMapping[]\n // >([]);\n const [tableData, setTableData] = useState<TableItem[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n\n const pagerDutyApi = useApi(pagerDutyApiRef);\n const catalogApi = useApi(catalogApiRef);\n\n useEffect(() => {\n async function fetchEntities(): Promise<Service[]> {\n const { items } = await catalogApi.getEntities({\n filter: { kind: \"Component\" },\n });\n\n const backstageServices: Service[] = [];\n items.forEach((entity: Entity) => {\n backstageServices.push({\n name: entity.metadata?.name,\n id: entity.metadata?.uid ?? \"\",\n system: JSON.stringify(entity.spec?.system) || \"\",\n owner: JSON.stringify(entity.spec?.owner) || \"\",\n lifecycle: JSON.stringify(entity.spec?.lifecycle) || \"\",\n });\n });\n\n return backstageServices;\n }\n\n async function fetchServices(): Promise<PagerDutyEntityMapping[]> {\n const { mappings: foundServices } =\n await pagerDutyApi.getEntityMappings();\n\n return foundServices;\n }\n\n Promise.all([fetchEntities(), fetchServices()]).then(\n ([entities, mappings]) => {\n // setCatalogEntities(entities);\n // setServiceMappings(mappings);\n\n const data: TableItem[] = mappings.map((service) => {\n return {\n name: service.serviceName,\n team: service.team,\n escalationPolicy: service.escalationPolicy,\n // status of mapping\n mappingStatus: (\n <Typography\n variant=\"body2\"\n style={{\n color: getColorFromStatus(service.status),\n }}\n >\n {service.status}\n </Typography>\n ),\n mapping: (\n // dropdown menu with static options. If service.mapping is defined select that option\n <FormControl variant=\"standard\"> \n <Select\n displayEmpty\n onChange={async (selection) => {\n await pagerDutyApi.storeServiceMapping(\n service.serviceId,\n selection.target.value as string\n );\n\n // update the mapping status\n service.status = \"OutOfSync\";\n // update the mapping\n service.entityRef = selection.target.value as string;\n }}\n value={service.entityRef}\n >\n <MenuItem value=\"\">\n <em>None</em>\n </MenuItem>\n {entities.map((backstageService) => {\n return (\n <MenuItem\n key={backstageService.id}\n value={backstageService.id}\n >\n {backstageService.name}\n </MenuItem>\n );\n })}\n </Select>\n </FormControl>\n // <select title=\"Mapping\" value={service.mapping}>\n // <option aria-label=\"None\" value=\"\" />\n // <option value=\"Ads\">Ads</option>\n // <option value=\"Cache\">Cache</option>\n // <option value=\"Catalog\">Catalog</option>\n // <option value=\"Checkout\">Checkout</option>\n // </select>\n ),\n actions: (\n <Button\n variant=\"contained\"\n color=\"primary\"\n href={service.serviceUrl}\n >\n Open in PagerDuty\n </Button>\n ),\n };\n });\n\n setTableData(data);\n }\n );\n\n setIsLoading(false);\n }, [catalogApi, pagerDutyApi]);\n\n\n return (\n <DenseTable\n data={tableData}\n isLoading={isLoading}\n />\n );\n};\n","import React from \"react\";\nimport { Grid } from \"@material-ui/core\";\nimport { Header, Page, Content } from \"@backstage/core-components\";\nimport { ServiceMappingComponent } from \"./ServiceMappingComponent\";\n\n/** @public */\nexport const PagerDutyPage = () => {\n // const [toggleImport, setToggleImport] = useState(false);\n // const [toggleSave, setToggleSave] = useState(false);\n\n // const handleImport = () => {\n // setToggleImport(!toggleImport);\n // };\n\n // const handleSave = () => {\n // setToggleSave(!toggleSave);\n // }\n\n return (\n <Page themeId=\"home\">\n <Header title=\"PagerDuty\" subtitle=\"Advanced configurations\" />\n <Content>\n {/* <Grid container spacing={3} direction=\"column\">\n <Grid item alignContent=\"flex-end\">\n <Button variant=\"contained\" color=\"primary\" onClick={() => {handleImport()}}>\n Import\n </Button>\n <Button variant=\"outlined\" color=\"primary\" onClick={() => {handleSave()}}>\n Save\n </Button>\n </Grid>\n </Grid> */}\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ServiceMappingComponent />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,mBAAmB,MAAiB,EAAA;AAC3C,EAAA,QAAQ,MAAQ;AAAA,IACd,KAAK,QAAA;AACH,MAAO,OAAA,OAAA,CAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAO,OAAA,KAAA,CAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAO,OAAA,QAAA,CAAA;AAAA,IACT;AACE,MAAO,OAAA,MAAA,CAAA;AAAA,GACX;AACF,CAAA;AAEO,MAAM,aAAa,CAAC;AAAA,EACzB,IAAA;AAAA,EACA,SAAA;AACF,CAAuB,KAAA;AAGrB,EAAA,MAAM,OAAyB,GAAA;AAAA,IAC7B,EAAE,KAAA,EAAO,mBAAqB,EAAA,KAA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,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,kBACX,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,KAAM,EAAA,WAAA,EAAY,QAAS,EAAA,yBAAA,EAA0B,CAC7D,kBAAA,KAAA,CAAA,aAAA,CAAC,+BAWE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,OAAS,EAAA,CAAA,EAAG,SAAU,EAAA,QAAA,EAAA,kBACnC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAA,kBACP,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,IAAwB,CAC3B,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { P as PagerDutyCard } from './index-
|
|
2
|
+
import { P as PagerDutyCard } from './index-77e3f0c9.esm.js';
|
|
3
3
|
import '@backstage/core-plugin-api';
|
|
4
4
|
import '@backstage/errors';
|
|
5
5
|
import '@backstage/plugin-home-react';
|
|
@@ -34,4 +34,4 @@ const Content = (props) => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export { Content };
|
|
37
|
-
//# sourceMappingURL=index-
|
|
37
|
+
//# sourceMappingURL=index-f53003e9.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-f53003e9.esm.js","sources":["../../src/components/HomePagePagerDutyCard/Content.tsx"],"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// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\n\nimport { PagerDutyEntity } from '../../types';\nimport { PagerDutyCard } from '../PagerDutyCard';\n\n/** @public */\nexport type HomePagePagerDutyCardProps = PagerDutyEntity & {\n readOnly?: boolean;\n};\n\n/** @public */\nexport const Content = (props: HomePagePagerDutyCardProps) => {\n return <PagerDutyCard {...props} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Ba,MAAA,OAAA,GAAU,CAAC,KAAsC,KAAA;AAC5D,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,aAAe,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AACnC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as react from 'react';
|
|
|
5
5
|
import react__default, { ReactNode } from 'react';
|
|
6
6
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
7
7
|
import { DiscoveryApi, FetchApi, ConfigApi } from '@backstage/core-plugin-api';
|
|
8
|
-
import {
|
|
8
|
+
import { PagerDutyEntityMappingResponse, PagerDutyServiceResponse, PagerDutyIncidentsResponse, PagerDutyChangeEventsResponse, PagerDutyServiceStandardsResponse, PagerDutyServiceMetricsResponse, PagerDutyUser } from '@pagerduty/backstage-plugin-common';
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
11
|
declare const isPluginApplicableToEntity$1: (entity: Entity) => boolean;
|
|
@@ -63,10 +63,15 @@ type PagerDutyTriggerAlarmRequest = {
|
|
|
63
63
|
/** @public */
|
|
64
64
|
interface PagerDutyApi {
|
|
65
65
|
/**
|
|
66
|
-
* Fetches all
|
|
66
|
+
* Fetches all entity mappings.
|
|
67
67
|
*
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
getEntityMappings(): Promise<PagerDutyEntityMappingResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Stores the service mapping in the database.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
storeServiceMapping(serviceId: string, entityId: string): Promise<Response>;
|
|
70
75
|
/**
|
|
71
76
|
* Fetches the service for the provided pager duty Entity.
|
|
72
77
|
*
|
|
@@ -133,7 +138,8 @@ declare class PagerDutyClient implements PagerDutyApi {
|
|
|
133
138
|
static fromConfig(configApi: ConfigApi, dependencies: PagerDutyClientApiDependencies): PagerDutyClient;
|
|
134
139
|
constructor(config: PagerDutyClientApiConfig);
|
|
135
140
|
getServiceByPagerDutyEntity(pagerDutyEntity: PagerDutyEntity): Promise<PagerDutyServiceResponse>;
|
|
136
|
-
|
|
141
|
+
getEntityMappings(): Promise<PagerDutyEntityMappingResponse>;
|
|
142
|
+
storeServiceMapping(serviceId: string, backstageEntityId: string): Promise<Response>;
|
|
137
143
|
getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse>;
|
|
138
144
|
getServiceById(serviceId: string): Promise<PagerDutyServiceResponse>;
|
|
139
145
|
getIncidentsByServiceId(serviceId: string): Promise<PagerDutyIncidentsResponse>;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EntityPagerDutyCard, c as EntityPagerDutySmallCard, H as HomePagePagerDutyCard, f as PagerDutyCard, e as PagerDutyClient, b as PagerDutyPage, T as TriggerButton, U as UnauthorizedError, i as isPagerDutyAvailable, d as isPagerDutySmallCardAvailable, i as isPluginApplicableToEntity, p as pagerDutyApiRef, a as pagerDutyPlugin, a as plugin } from './esm/index-
|
|
1
|
+
export { E as EntityPagerDutyCard, c as EntityPagerDutySmallCard, H as HomePagePagerDutyCard, f as PagerDutyCard, e as PagerDutyClient, b as PagerDutyPage, T as TriggerButton, U as UnauthorizedError, i as isPagerDutyAvailable, d as isPagerDutySmallCardAvailable, i as isPluginApplicableToEntity, p as pagerDutyApiRef, a as pagerDutyPlugin, a as plugin } from './esm/index-77e3f0c9.esm.js';
|
|
2
2
|
import '@backstage/core-plugin-api';
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import '@backstage/plugin-home-react';
|
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.12.1-next.
|
|
4
|
+
"version": "0.12.1-next.31",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"@material-ui/core": "^4.12.2",
|
|
45
45
|
"@material-ui/icons": "^4.9.1",
|
|
46
46
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
47
|
+
"@pagerduty/backstage-plugin-common": "^0.1.5-next.7",
|
|
47
48
|
"classnames": "^2.2.6",
|
|
48
49
|
"luxon": "^3.4.1",
|
|
49
50
|
"react-use": "^17.2.4",
|
|
50
51
|
"validate-color": "^2.2.4"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"@pagerduty/backstage-plugin-common": "^0.1.2",
|
|
54
54
|
"react": "^18.0.0 || ^20.0.0",
|
|
55
55
|
"react-dom": "^18.0.0 || ^20.0.0",
|
|
56
56
|
"react-router-dom": "^6.3.0"
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
"@backstage/test-utils": "^1.5.1",
|
|
63
63
|
"@commitlint/cli": "^17.7.1",
|
|
64
64
|
"@commitlint/config-conventional": "^17.7.0",
|
|
65
|
-
"@pagerduty/backstage-plugin-common": "^0.1.2",
|
|
66
65
|
"@testing-library/dom": "^8.0.0",
|
|
67
66
|
"@testing-library/jest-dom": "^5.10.1",
|
|
68
67
|
"@testing-library/react": "^12.1.3",
|