@pagerduty/backstage-plugin 0.9.4-next.4 → 0.9.4-next.7
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-d288bb3d.esm.js → index-c61adcff.esm.js} +221 -98
- package/dist/esm/index-c61adcff.esm.js.map +1 -0
- package/dist/esm/{index-5db6e0a5.esm.js → index-fa52682c.esm.js} +4 -5
- package/dist/esm/{index-5db6e0a5.esm.js.map → index-fa52682c.esm.js.map} +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.esm.js +3 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -4
- package/dist/esm/index-d288bb3d.esm.js.map +0 -1
|
@@ -4,8 +4,6 @@ import { createCardExtension } from '@backstage/plugin-home-react';
|
|
|
4
4
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
5
5
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
6
6
|
import { makeStyles, ListItem, ListItemText, Chip, Typography, ListItemSecondaryAction, Tooltip, IconButton, Grid, List, ListItemIcon, ListSubheader, Button, Dialog, DialogTitle, DialogContent, TextField, DialogActions, CircularProgress, Card, withStyles, LinearProgress, CardHeader, Divider, CardContent } from '@material-ui/core';
|
|
7
|
-
import Done from '@material-ui/icons/Done';
|
|
8
|
-
import Warning from '@material-ui/icons/Warning';
|
|
9
7
|
import { DateTime, Duration } from 'luxon';
|
|
10
8
|
import OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';
|
|
11
9
|
import { Link, Progress, StatusWarning, StatusError, EmptyState, TabbedCard, CardTab, InfoCard } from '@backstage/core-components';
|
|
@@ -15,13 +13,14 @@ import { Alert } from '@material-ui/lab';
|
|
|
15
13
|
import ForbiddenStateImage from '../assets/forbiddenstate.svg';
|
|
16
14
|
import Avatar from '@material-ui/core/Avatar';
|
|
17
15
|
import NotificationsIcon from '@material-ui/icons/Notifications';
|
|
18
|
-
import MailOutline from '@material-ui/icons/MailOutline';
|
|
19
16
|
import useAsync from 'react-use/lib/useAsync';
|
|
17
|
+
import LinkIcon from '@material-ui/icons/Link';
|
|
20
18
|
import PDGreenImage from '../assets/PD-Green.svg';
|
|
21
19
|
import PDWhiteImage from '../assets/PD-White.svg';
|
|
22
20
|
import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
23
21
|
import AddAlert from '@material-ui/icons/AddAlert';
|
|
24
22
|
import { makeStyles as makeStyles$1, createStyles, useTheme } from '@material-ui/core/styles';
|
|
23
|
+
import validateColor from 'validate-color';
|
|
25
24
|
|
|
26
25
|
const PAGERDUTY_INTEGRATION_KEY = "pagerduty.com/integration-key";
|
|
27
26
|
const PAGERDUTY_SERVICE_ID = "pagerduty.com/service-id";
|
|
@@ -93,6 +92,12 @@ class PagerDutyClient {
|
|
|
93
92
|
)}/services/${serviceId}/change-events`;
|
|
94
93
|
return await this.findByUrl(url);
|
|
95
94
|
}
|
|
95
|
+
async getServiceStandardsByServiceId(serviceId) {
|
|
96
|
+
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
97
|
+
"pagerduty"
|
|
98
|
+
)}/services/${serviceId}/standards`;
|
|
99
|
+
return await this.findByUrl(url);
|
|
100
|
+
}
|
|
96
101
|
async getOnCallByPolicyId(policyId) {
|
|
97
102
|
const params = `escalation_policy_ids[]=${policyId}`;
|
|
98
103
|
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
@@ -193,7 +198,7 @@ const HomePagePagerDutyCard = pagerDutyPlugin.provide(
|
|
|
193
198
|
createCardExtension({
|
|
194
199
|
name: "HomePagePagerDutyCard",
|
|
195
200
|
title: "PagerDuty Homepage Card",
|
|
196
|
-
components: () => import('./index-
|
|
201
|
+
components: () => import('./index-fa52682c.esm.js'),
|
|
197
202
|
settings: {
|
|
198
203
|
schema: {
|
|
199
204
|
title: "PagerDuty",
|
|
@@ -229,18 +234,52 @@ const useStyles$8 = makeStyles((theme) => ({
|
|
|
229
234
|
fontWeight: "bold"
|
|
230
235
|
},
|
|
231
236
|
warning: {
|
|
232
|
-
borderColor: theme.palette.
|
|
233
|
-
color:
|
|
237
|
+
borderColor: theme.palette.warning.main,
|
|
238
|
+
color: "#fff",
|
|
239
|
+
backgroundColor: theme.palette.warning.main,
|
|
240
|
+
boxShadow: "0 4px 4px 0 rgba(0,0,0,0.2)",
|
|
241
|
+
textTransform: "uppercase",
|
|
234
242
|
"& *": {
|
|
235
|
-
color:
|
|
243
|
+
color: "#fff"
|
|
236
244
|
}
|
|
237
245
|
},
|
|
238
246
|
error: {
|
|
239
|
-
borderColor: theme.palette.
|
|
240
|
-
color:
|
|
247
|
+
borderColor: theme.palette.error.main,
|
|
248
|
+
color: "#fff",
|
|
249
|
+
backgroundColor: theme.palette.error.main,
|
|
250
|
+
boxShadow: "0 4px 4px 0 rgba(0,0,0,0.2)",
|
|
251
|
+
textTransform: "uppercase",
|
|
252
|
+
"& *": {
|
|
253
|
+
color: "#fff"
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
lowUrgency: {
|
|
257
|
+
borderColor: theme.palette.warning.main,
|
|
258
|
+
color: theme.palette.warning.main,
|
|
259
|
+
backgroundColor: "#fff",
|
|
260
|
+
boxShadow: "0 4px 4px 0 rgba(0,0,0,0.2)",
|
|
261
|
+
textTransform: "uppercase",
|
|
262
|
+
"& *": {
|
|
263
|
+
color: theme.palette.warning.main
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
highUrgency: {
|
|
267
|
+
borderColor: theme.palette.error.main,
|
|
268
|
+
color: theme.palette.error.main,
|
|
269
|
+
backgroundColor: "#fff",
|
|
270
|
+
boxShadow: "0 4px 4px 0 rgba(0,0,0,0.2)",
|
|
271
|
+
textTransform: "uppercase",
|
|
241
272
|
"& *": {
|
|
242
|
-
color: theme.palette.
|
|
273
|
+
color: theme.palette.error.main
|
|
243
274
|
}
|
|
275
|
+
},
|
|
276
|
+
textContainer: {
|
|
277
|
+
display: "flex",
|
|
278
|
+
alignItems: "baseline"
|
|
279
|
+
},
|
|
280
|
+
smallIconStyle: {
|
|
281
|
+
color: theme.palette.text.primary,
|
|
282
|
+
marginRight: "-20px"
|
|
244
283
|
}
|
|
245
284
|
}));
|
|
246
285
|
const IncidentListItem = ({ incident }) => {
|
|
@@ -252,16 +291,24 @@ const IncidentListItem = ({ incident }) => {
|
|
|
252
291
|
return /* @__PURE__ */ React.createElement(ListItem, { dense: true, key: incident.id }, /* @__PURE__ */ React.createElement(
|
|
253
292
|
ListItemText,
|
|
254
293
|
{
|
|
255
|
-
primary: /* @__PURE__ */ React.createElement(
|
|
294
|
+
primary: /* @__PURE__ */ React.createElement("div", { className: classes.textContainer }, /* @__PURE__ */ React.createElement(
|
|
256
295
|
Chip,
|
|
257
296
|
{
|
|
258
297
|
"data-testid": `chip-${incident.status}`,
|
|
259
298
|
label: incident.status,
|
|
260
299
|
size: "small",
|
|
261
300
|
variant: "outlined",
|
|
262
|
-
icon: incident.status === "acknowledged" ? /* @__PURE__ */ React.createElement(Done, null) : /* @__PURE__ */ React.createElement(Warning, null),
|
|
263
301
|
className: incident.status === "triggered" ? classes.error : classes.warning
|
|
264
302
|
}
|
|
303
|
+
), /* @__PURE__ */ React.createElement(
|
|
304
|
+
Chip,
|
|
305
|
+
{
|
|
306
|
+
"data-testid": `chip-${incident.urgency}`,
|
|
307
|
+
label: `${incident.urgency} urgency`,
|
|
308
|
+
size: "small",
|
|
309
|
+
variant: "outlined",
|
|
310
|
+
className: incident.urgency === "high" ? classes.highUrgency : classes.lowUrgency
|
|
311
|
+
}
|
|
265
312
|
), incident.title),
|
|
266
313
|
primaryTypographyProps: {
|
|
267
314
|
variant: "body1",
|
|
@@ -275,7 +322,7 @@ const IncidentListItem = ({ incident }) => {
|
|
|
275
322
|
href: incident.html_url,
|
|
276
323
|
target: "_blank",
|
|
277
324
|
rel: "noopener noreferrer",
|
|
278
|
-
|
|
325
|
+
className: classes.smallIconStyle
|
|
279
326
|
},
|
|
280
327
|
/* @__PURE__ */ React.createElement(OpenInBrowserIcon, null)
|
|
281
328
|
))));
|
|
@@ -400,11 +447,17 @@ const useStyles$5 = makeStyles((theme) => ({
|
|
|
400
447
|
},
|
|
401
448
|
smallIconStyle: {
|
|
402
449
|
color: theme.palette.text.primary
|
|
450
|
+
},
|
|
451
|
+
avatarStyle: {
|
|
452
|
+
marginTop: "-20px"
|
|
403
453
|
}
|
|
404
454
|
}));
|
|
405
|
-
|
|
455
|
+
function navigateToEscalationPolicy(url) {
|
|
456
|
+
window.open(url, "_blank");
|
|
457
|
+
}
|
|
458
|
+
const EscalationUser = ({ user, policyUrl, policyName }) => {
|
|
406
459
|
const classes = useStyles$5();
|
|
407
|
-
return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Avatar, { alt: user.name, src: user.avatar_url })), /* @__PURE__ */ React.createElement(
|
|
460
|
+
return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Avatar, { alt: user.name, src: user.avatar_url, className: classes.avatarStyle })), /* @__PURE__ */ React.createElement(
|
|
408
461
|
ListItemText,
|
|
409
462
|
{
|
|
410
463
|
primary: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { className: classes.listItemPrimary }, user.name), /* @__PURE__ */ React.createElement(
|
|
@@ -419,12 +472,13 @@ const EscalationUser = ({ user }) => {
|
|
|
419
472
|
IconButton,
|
|
420
473
|
{
|
|
421
474
|
"aria-label": "open-service-in-browser",
|
|
475
|
+
onClick: () => navigateToEscalationPolicy(policyUrl),
|
|
422
476
|
className: classes.buttonStyle
|
|
423
477
|
},
|
|
424
|
-
/* @__PURE__ */ React.createElement("span", { className: classes.containerStyle }, /* @__PURE__ */ React.createElement(NotificationsIcon, { className: classes.iconStyle }),
|
|
478
|
+
/* @__PURE__ */ React.createElement("span", { className: classes.containerStyle }, /* @__PURE__ */ React.createElement(NotificationsIcon, { className: classes.iconStyle }), policyName)
|
|
425
479
|
)
|
|
426
480
|
}
|
|
427
|
-
), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "
|
|
481
|
+
), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Open user in PagerDuty", placement: "top" }, /* @__PURE__ */ React.createElement(
|
|
428
482
|
IconButton,
|
|
429
483
|
{
|
|
430
484
|
href: user.html_url,
|
|
@@ -436,7 +490,7 @@ const EscalationUser = ({ user }) => {
|
|
|
436
490
|
))));
|
|
437
491
|
};
|
|
438
492
|
|
|
439
|
-
const EscalationPolicy = ({ policyId }) => {
|
|
493
|
+
const EscalationPolicy = ({ policyId, policyUrl, policyName }) => {
|
|
440
494
|
const api = useApi(pagerDutyApiRef);
|
|
441
495
|
const {
|
|
442
496
|
value: users,
|
|
@@ -457,7 +511,7 @@ const EscalationPolicy = ({ policyId }) => {
|
|
|
457
511
|
if (!(users == null ? void 0 : users.length)) {
|
|
458
512
|
return /* @__PURE__ */ React.createElement(EscalationUsersEmptyState, null);
|
|
459
513
|
}
|
|
460
|
-
return /* @__PURE__ */ React.createElement(List, { dense: true, subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "ON CALL"), style: { marginLeft: "-15px" } }, users.map((user, index) => /* @__PURE__ */ React.createElement(EscalationUser, { key: index, user })));
|
|
514
|
+
return /* @__PURE__ */ React.createElement(List, { dense: true, subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "ON CALL"), style: { marginLeft: "-15px" } }, users.map((user, index) => /* @__PURE__ */ React.createElement(EscalationUser, { key: index, user, policyUrl, policyName })));
|
|
461
515
|
};
|
|
462
516
|
|
|
463
517
|
const MissingTokenError = () => /* @__PURE__ */ React.createElement(
|
|
@@ -496,7 +550,7 @@ const ServiceNotFoundError = () => /* @__PURE__ */ React.createElement(
|
|
|
496
550
|
}
|
|
497
551
|
);
|
|
498
552
|
|
|
499
|
-
const useStyles$4 = makeStyles({
|
|
553
|
+
const useStyles$4 = makeStyles((theme) => ({
|
|
500
554
|
denseListIcon: {
|
|
501
555
|
marginRight: 0,
|
|
502
556
|
display: "flex",
|
|
@@ -506,8 +560,15 @@ const useStyles$4 = makeStyles({
|
|
|
506
560
|
},
|
|
507
561
|
listItemPrimary: {
|
|
508
562
|
fontWeight: "bold"
|
|
563
|
+
},
|
|
564
|
+
smallExternalLinkIconStyle: {
|
|
565
|
+
color: theme.palette.text.primary
|
|
566
|
+
},
|
|
567
|
+
smallIconStyle: {
|
|
568
|
+
color: theme.palette.text.primary,
|
|
569
|
+
marginRight: "-20px"
|
|
509
570
|
}
|
|
510
|
-
});
|
|
571
|
+
}));
|
|
511
572
|
const ChangeEventListItem = ({ changeEvent }) => {
|
|
512
573
|
const classes = useStyles$4();
|
|
513
574
|
const duration = (/* @__PURE__ */ new Date()).getTime() - new Date(changeEvent.timestamp).getTime();
|
|
@@ -520,9 +581,9 @@ const ChangeEventListItem = ({ changeEvent }) => {
|
|
|
520
581
|
{
|
|
521
582
|
component: Link,
|
|
522
583
|
to: changeEvent.links[0].href,
|
|
523
|
-
|
|
584
|
+
className: classes.smallExternalLinkIconStyle
|
|
524
585
|
},
|
|
525
|
-
/* @__PURE__ */ React.createElement(
|
|
586
|
+
/* @__PURE__ */ React.createElement(LinkIcon, null)
|
|
526
587
|
));
|
|
527
588
|
}
|
|
528
589
|
return /* @__PURE__ */ React.createElement(ListItem, { dense: true, key: changeEvent.id }, /* @__PURE__ */ React.createElement(
|
|
@@ -540,7 +601,7 @@ const ChangeEventListItem = ({ changeEvent }) => {
|
|
|
540
601
|
{
|
|
541
602
|
component: Link,
|
|
542
603
|
to: changeEvent.html_url,
|
|
543
|
-
|
|
604
|
+
className: classes.smallIconStyle
|
|
544
605
|
},
|
|
545
606
|
/* @__PURE__ */ React.createElement(OpenInBrowserIcon, null)
|
|
546
607
|
))));
|
|
@@ -726,7 +787,7 @@ const useStyles$3 = makeStyles((theme) => ({
|
|
|
726
787
|
marginBottom: "-10px"
|
|
727
788
|
}
|
|
728
789
|
}));
|
|
729
|
-
function TriggerIncidentButton() {
|
|
790
|
+
function TriggerIncidentButton({ handleRefresh }) {
|
|
730
791
|
const { buttonStyle, containerStyle, iconStyle } = useStyles$3();
|
|
731
792
|
const { integrationKey, name } = usePagerdutyEntity();
|
|
732
793
|
const [dialogShown, setDialogShown] = useState(false);
|
|
@@ -752,7 +813,8 @@ function TriggerIncidentButton() {
|
|
|
752
813
|
showDialog: dialogShown,
|
|
753
814
|
handleDialog: hideDialog,
|
|
754
815
|
integrationKey,
|
|
755
|
-
name
|
|
816
|
+
name,
|
|
817
|
+
onIncidentCreated: handleRefresh
|
|
756
818
|
}
|
|
757
819
|
));
|
|
758
820
|
}
|
|
@@ -792,22 +854,53 @@ function OpenServiceButton(props) {
|
|
|
792
854
|
));
|
|
793
855
|
}
|
|
794
856
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
857
|
+
function labelFromStatus(status) {
|
|
858
|
+
let label;
|
|
859
|
+
switch (status) {
|
|
860
|
+
case "active":
|
|
861
|
+
label = "OK";
|
|
862
|
+
break;
|
|
863
|
+
case "warning":
|
|
864
|
+
label = "ACTIVE";
|
|
865
|
+
break;
|
|
866
|
+
case "critical":
|
|
867
|
+
label = "ALARM";
|
|
868
|
+
break;
|
|
869
|
+
case "maintenance":
|
|
870
|
+
label = "MAINTENANCE";
|
|
871
|
+
break;
|
|
872
|
+
case "disabled":
|
|
873
|
+
label = "DISABLED";
|
|
874
|
+
break;
|
|
875
|
+
default:
|
|
876
|
+
label = "OK";
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
return label;
|
|
880
|
+
}
|
|
802
881
|
function colorFromStatus(theme, status) {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
882
|
+
let color;
|
|
883
|
+
switch (status) {
|
|
884
|
+
case "active":
|
|
885
|
+
color = theme.palette.success.main;
|
|
886
|
+
break;
|
|
887
|
+
case "warning":
|
|
888
|
+
color = theme.palette.warningBackground;
|
|
889
|
+
break;
|
|
890
|
+
case "critical":
|
|
891
|
+
color = theme.palette.error.main;
|
|
892
|
+
break;
|
|
893
|
+
case "maintenance":
|
|
894
|
+
color = "#ebdc00";
|
|
895
|
+
break;
|
|
896
|
+
case "disabled":
|
|
897
|
+
color = "#A9A9A9";
|
|
898
|
+
break;
|
|
899
|
+
default:
|
|
900
|
+
color = theme.palette.success.main;
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
return color;
|
|
811
904
|
}
|
|
812
905
|
function StatusCard({ status }) {
|
|
813
906
|
const useStyles = makeStyles$1((theme) => ({
|
|
@@ -816,56 +909,18 @@ function StatusCard({ status }) {
|
|
|
816
909
|
display: "flex",
|
|
817
910
|
alignItems: "center",
|
|
818
911
|
justifyContent: "center",
|
|
819
|
-
backgroundColor: colorFromStatus(theme, status),
|
|
912
|
+
backgroundColor: status !== void 0 ? colorFromStatus(theme, status) : colorFromStatus(theme, "active"),
|
|
820
913
|
marginRight: "10px"
|
|
821
914
|
},
|
|
822
915
|
largeTextStyle: {
|
|
823
916
|
color: "white",
|
|
824
917
|
fontWeight: "bold",
|
|
825
|
-
fontSize: "20px"
|
|
918
|
+
fontSize: "20px",
|
|
919
|
+
wordWrap: "break-word"
|
|
826
920
|
}
|
|
827
921
|
}));
|
|
828
922
|
const { cardStyle, largeTextStyle } = useStyles();
|
|
829
|
-
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle },
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
const cardLabels = {
|
|
833
|
-
triggered: "TRIGGERED",
|
|
834
|
-
acknowledged: "ACKNOWLEDGED",
|
|
835
|
-
resolved: "RESOLVED"
|
|
836
|
-
};
|
|
837
|
-
function colorFromLabel(theme, label) {
|
|
838
|
-
const cardColors = {
|
|
839
|
-
triggered: theme.palette.error.main,
|
|
840
|
-
acknowledged: theme.palette.warning.main,
|
|
841
|
-
resolved: theme.palette.success.main
|
|
842
|
-
};
|
|
843
|
-
return cardColors[label];
|
|
844
|
-
}
|
|
845
|
-
function IncidentCounterCard({ count, label }) {
|
|
846
|
-
const useStyles = makeStyles((theme) => ({
|
|
847
|
-
cardStyle: {
|
|
848
|
-
marginRight: "10px",
|
|
849
|
-
height: "120px",
|
|
850
|
-
display: "flex",
|
|
851
|
-
alignItems: "center",
|
|
852
|
-
justifyContent: "center",
|
|
853
|
-
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
854
|
-
},
|
|
855
|
-
largeTextStyle: {
|
|
856
|
-
color: colorFromLabel(theme, label),
|
|
857
|
-
fontSize: "40px",
|
|
858
|
-
marginTop: "-20px"
|
|
859
|
-
},
|
|
860
|
-
smallTextStyle: {
|
|
861
|
-
color: colorFromLabel(theme, label),
|
|
862
|
-
fontWeight: "bold",
|
|
863
|
-
fontSize: "10px",
|
|
864
|
-
marginTop: "-10px"
|
|
865
|
-
}
|
|
866
|
-
}));
|
|
867
|
-
const { cardStyle, largeTextStyle, smallTextStyle } = useStyles();
|
|
868
|
-
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, count), /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, cardLabels[label]));
|
|
923
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, status !== void 0 ? /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, labelFromStatus(status)) : /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, "Unable to get status"));
|
|
869
924
|
}
|
|
870
925
|
|
|
871
926
|
function colorFromPercentage(theme, percentage) {
|
|
@@ -890,18 +945,17 @@ function ServiceStandardsCard({ total, completed }) {
|
|
|
890
945
|
},
|
|
891
946
|
largeTextStyle: {
|
|
892
947
|
fontSize: "50px",
|
|
893
|
-
color: colorFromPercentage(theme, completed / total),
|
|
894
|
-
fontWeight: "bold",
|
|
948
|
+
color: completed !== void 0 && total !== void 0 ? colorFromPercentage(theme, completed / total) : colorFromPercentage(theme, 0),
|
|
895
949
|
alignSelf: "center",
|
|
896
950
|
justifyContent: "center"
|
|
897
951
|
},
|
|
898
952
|
smallTextStyle: {
|
|
899
|
-
color: theme.palette.
|
|
900
|
-
fontSize: "
|
|
953
|
+
color: theme.palette.textSubtle,
|
|
954
|
+
fontSize: "14px",
|
|
901
955
|
fontWeight: "bold",
|
|
902
956
|
alignSelf: "center",
|
|
903
957
|
justifyContent: "center",
|
|
904
|
-
marginLeft: "
|
|
958
|
+
marginLeft: "-2px",
|
|
905
959
|
marginTop: "25px"
|
|
906
960
|
}
|
|
907
961
|
}));
|
|
@@ -916,17 +970,46 @@ function ServiceStandardsCard({ total, completed }) {
|
|
|
916
970
|
},
|
|
917
971
|
bar: {
|
|
918
972
|
borderRadius: 5,
|
|
919
|
-
backgroundColor: colorFromPercentage(theme, completed / total)
|
|
973
|
+
backgroundColor: completed !== void 0 && total !== void 0 ? colorFromPercentage(theme, completed / total) : colorFromPercentage(theme, 0)
|
|
920
974
|
}
|
|
921
975
|
}))(LinearProgress);
|
|
922
976
|
const { cardStyle, containerStyle, largeTextStyle, smallTextStyle } = useStyles();
|
|
923
|
-
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, completed), /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, "/", total)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
977
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, completed !== void 0 && total !== void 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, completed), /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, "/", total)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
924
978
|
BorderLinearProgress,
|
|
925
979
|
{
|
|
926
980
|
variant: "determinate",
|
|
927
981
|
value: completed / total * 100
|
|
928
982
|
}
|
|
929
|
-
)));
|
|
983
|
+
))) : /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, "Unable to retrieve Scores")));
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function IncidentCounterCard({ count, label, color }) {
|
|
987
|
+
const textColor = color && validateColor(color) ? color : "black";
|
|
988
|
+
const useStyles = makeStyles(() => ({
|
|
989
|
+
cardStyle: {
|
|
990
|
+
marginRight: "10px",
|
|
991
|
+
height: "120px",
|
|
992
|
+
display: "flex",
|
|
993
|
+
alignItems: "center",
|
|
994
|
+
justifyContent: "center",
|
|
995
|
+
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
996
|
+
},
|
|
997
|
+
largeTextStyle: {
|
|
998
|
+
color: textColor,
|
|
999
|
+
fontSize: "30px",
|
|
1000
|
+
marginTop: "-10px"
|
|
1001
|
+
},
|
|
1002
|
+
smallTextStyle: {
|
|
1003
|
+
color: textColor,
|
|
1004
|
+
fontWeight: "bold",
|
|
1005
|
+
fontSize: "10px",
|
|
1006
|
+
marginTop: "-5px",
|
|
1007
|
+
textTransform: "uppercase",
|
|
1008
|
+
flexWrap: "wrap"
|
|
1009
|
+
}
|
|
1010
|
+
}));
|
|
1011
|
+
const { cardStyle, largeTextStyle, smallTextStyle } = useStyles();
|
|
1012
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, count), /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, label));
|
|
930
1013
|
}
|
|
931
1014
|
|
|
932
1015
|
const useStyles$1 = makeStyles$1(
|
|
@@ -959,6 +1042,7 @@ const useStyles$1 = makeStyles$1(
|
|
|
959
1042
|
);
|
|
960
1043
|
const BasicCard = ({ children }) => /* @__PURE__ */ React.createElement(InfoCard, { title: "PagerDuty" }, children);
|
|
961
1044
|
const PagerDutyCard$1 = (props) => {
|
|
1045
|
+
var _a, _b;
|
|
962
1046
|
const classes = useStyles$1();
|
|
963
1047
|
const theme = useTheme();
|
|
964
1048
|
const { readOnly, disableChangeEvents, integrationKey, name } = props;
|
|
@@ -981,13 +1065,18 @@ const PagerDutyCard$1 = (props) => {
|
|
|
981
1065
|
const { service: foundService } = await api.getServiceByPagerDutyEntity(
|
|
982
1066
|
props
|
|
983
1067
|
);
|
|
984
|
-
|
|
1068
|
+
const { standards: serviceStandards } = await api.getServiceStandardsByServiceId(foundService.id);
|
|
1069
|
+
const result = {
|
|
985
1070
|
id: foundService.id,
|
|
986
1071
|
name: foundService.name,
|
|
987
1072
|
url: foundService.html_url,
|
|
988
1073
|
policyId: foundService.escalation_policy.id,
|
|
989
|
-
policyLink: foundService.escalation_policy.html_url
|
|
1074
|
+
policyLink: foundService.escalation_policy.html_url,
|
|
1075
|
+
policyName: foundService.escalation_policy.name,
|
|
1076
|
+
status: foundService.status,
|
|
1077
|
+
standardsScore: serviceStandards.score
|
|
990
1078
|
};
|
|
1079
|
+
return result;
|
|
991
1080
|
}, [props]);
|
|
992
1081
|
if (error) {
|
|
993
1082
|
let errorNode;
|
|
@@ -1012,9 +1101,36 @@ const PagerDutyCard$1 = (props) => {
|
|
|
1012
1101
|
{
|
|
1013
1102
|
className: classes.headerStyle,
|
|
1014
1103
|
title: theme.palette.type === "dark" ? /* @__PURE__ */ React.createElement("img", { src: PDWhiteImage, alt: "PagerDuty", height: "35" }) : /* @__PURE__ */ React.createElement("img", { src: PDGreenImage, alt: "PagerDuty", height: "35" }),
|
|
1015
|
-
action: !readOnly ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TriggerIncidentButton,
|
|
1104
|
+
action: !readOnly ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TriggerIncidentButton, { handleRefresh }), /* @__PURE__ */ React.createElement(OpenServiceButton, { serviceUrl: service.url })) : /* @__PURE__ */ React.createElement(OpenServiceButton, { serviceUrl: service.url })
|
|
1105
|
+
}
|
|
1106
|
+
), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, className: classes.overviewHeaderContainerStyle }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.overviewHeaderTextStyle }, "STATUS")), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 6 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.overviewHeaderTextStyle }, "INSIGHTS")), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.overviewHeaderTextStyle }, "STANDARDS"))), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, className: classes.overviewCardsContainerStyle }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(StatusCard, { status: service == null ? void 0 : service.status })), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 6, className: classes.incidentMetricsContainerStyle }, /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1107
|
+
IncidentCounterCard,
|
|
1108
|
+
{
|
|
1109
|
+
count: 29,
|
|
1110
|
+
label: "interruptions",
|
|
1111
|
+
color: theme.palette.textSubtle
|
|
1016
1112
|
}
|
|
1017
|
-
)
|
|
1113
|
+
)), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1114
|
+
IncidentCounterCard,
|
|
1115
|
+
{
|
|
1116
|
+
count: 29,
|
|
1117
|
+
label: "high urgency",
|
|
1118
|
+
color: theme.palette.warning.main
|
|
1119
|
+
}
|
|
1120
|
+
)), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1121
|
+
IncidentCounterCard,
|
|
1122
|
+
{
|
|
1123
|
+
count: 32,
|
|
1124
|
+
label: "incidents",
|
|
1125
|
+
color: theme.palette.error.main
|
|
1126
|
+
}
|
|
1127
|
+
))), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(
|
|
1128
|
+
ServiceStandardsCard,
|
|
1129
|
+
{
|
|
1130
|
+
total: (_a = service == null ? void 0 : service.standardsScore) == null ? void 0 : _a.total,
|
|
1131
|
+
completed: (_b = service == null ? void 0 : service.standardsScore) == null ? void 0 : _b.passing
|
|
1132
|
+
}
|
|
1133
|
+
))), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(TabbedCard, null, /* @__PURE__ */ React.createElement(CardTab, { label: "Incidents" }, /* @__PURE__ */ React.createElement(
|
|
1018
1134
|
Incidents,
|
|
1019
1135
|
{
|
|
1020
1136
|
serviceId: service.id,
|
|
@@ -1026,7 +1142,14 @@ const PagerDutyCard$1 = (props) => {
|
|
|
1026
1142
|
serviceId: service.id,
|
|
1027
1143
|
refreshEvents: refreshChangeEvents
|
|
1028
1144
|
}
|
|
1029
|
-
)) : /* @__PURE__ */ React.createElement(React.Fragment, null)), /* @__PURE__ */ React.createElement(
|
|
1145
|
+
)) : /* @__PURE__ */ React.createElement(React.Fragment, null)), /* @__PURE__ */ React.createElement(
|
|
1146
|
+
EscalationPolicy,
|
|
1147
|
+
{
|
|
1148
|
+
policyId: service.policyId,
|
|
1149
|
+
policyUrl: service.policyLink,
|
|
1150
|
+
policyName: service.policyName
|
|
1151
|
+
}
|
|
1152
|
+
))), !createIncidentDisabled && /* @__PURE__ */ React.createElement(
|
|
1030
1153
|
TriggerDialog,
|
|
1031
1154
|
{
|
|
1032
1155
|
"data-testid": "trigger-dialog",
|
|
@@ -1094,7 +1217,7 @@ function TriggerButton(props) {
|
|
|
1094
1217
|
className: disabled ? "" : buttonStyle,
|
|
1095
1218
|
disabled
|
|
1096
1219
|
},
|
|
1097
|
-
integrationKey ? (_a = props.children) != null ? _a : "Create
|
|
1220
|
+
integrationKey ? (_a = props.children) != null ? _a : "Create new incident" : "Missing integration key"
|
|
1098
1221
|
), integrationKey && /* @__PURE__ */ React.createElement(
|
|
1099
1222
|
TriggerDialog,
|
|
1100
1223
|
{
|
|
@@ -1109,4 +1232,4 @@ function TriggerButton(props) {
|
|
|
1109
1232
|
const PagerDutyCard = EntityPagerDutyCard;
|
|
1110
1233
|
|
|
1111
1234
|
export { EntityPagerDutyCard$1 as E, HomePagePagerDutyCard as H, PagerDutyCard$1 as P, TriggerButton as T, UnauthorizedError as U, PagerDutyClient as a, pagerDutyApiRef as b, PagerDutyCard as c, isPluginApplicableToEntity as i, pagerDutyPlugin as p };
|
|
1112
|
-
//# sourceMappingURL=index-
|
|
1235
|
+
//# sourceMappingURL=index-c61adcff.esm.js.map
|