@pagerduty/backstage-plugin 0.9.4-next.3 → 0.9.4-next.4
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-9209930a.esm.js → index-5db6e0a5.esm.js} +3 -4
- package/dist/esm/{index-9209930a.esm.js.map → index-5db6e0a5.esm.js.map} +1 -1
- package/dist/esm/{index-b664ea6c.esm.js → index-d288bb3d.esm.js} +272 -345
- package/dist/esm/index-d288bb3d.esm.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +2 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/index-b664ea6c.esm.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { NotFoundError } from '@backstage/errors';
|
|
|
3
3
|
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
|
-
import { makeStyles, ListItem, ListItemText, Chip, Typography, ListItemSecondaryAction, Tooltip, IconButton, Grid, List, ListItemIcon, ListSubheader, Button, Dialog, DialogTitle, DialogContent, TextField, DialogActions, CircularProgress, Card, CardHeader, Divider, CardContent } from '@material-ui/core';
|
|
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
7
|
import Done from '@material-ui/icons/Done';
|
|
8
8
|
import Warning from '@material-ui/icons/Warning';
|
|
9
9
|
import { DateTime, Duration } from 'luxon';
|
|
@@ -17,12 +17,11 @@ import Avatar from '@material-ui/core/Avatar';
|
|
|
17
17
|
import NotificationsIcon from '@material-ui/icons/Notifications';
|
|
18
18
|
import MailOutline from '@material-ui/icons/MailOutline';
|
|
19
19
|
import useAsync from 'react-use/lib/useAsync';
|
|
20
|
-
import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
21
20
|
import PDGreenImage from '../assets/PD-Green.svg';
|
|
22
21
|
import PDWhiteImage from '../assets/PD-White.svg';
|
|
22
|
+
import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
23
23
|
import AddAlert from '@material-ui/icons/AddAlert';
|
|
24
|
-
import { useTheme } from '@material-ui/core/styles';
|
|
25
|
-
import LinearProgress from '@material-ui/core/LinearProgress';
|
|
24
|
+
import { makeStyles as makeStyles$1, createStyles, useTheme } from '@material-ui/core/styles';
|
|
26
25
|
|
|
27
26
|
const PAGERDUTY_INTEGRATION_KEY = "pagerduty.com/integration-key";
|
|
28
27
|
const PAGERDUTY_SERVICE_ID = "pagerduty.com/service-id";
|
|
@@ -194,7 +193,7 @@ const HomePagePagerDutyCard = pagerDutyPlugin.provide(
|
|
|
194
193
|
createCardExtension({
|
|
195
194
|
name: "HomePagePagerDutyCard",
|
|
196
195
|
title: "PagerDuty Homepage Card",
|
|
197
|
-
components: () => import('./index-
|
|
196
|
+
components: () => import('./index-5db6e0a5.esm.js'),
|
|
198
197
|
settings: {
|
|
199
198
|
schema: {
|
|
200
199
|
title: "PagerDuty",
|
|
@@ -218,7 +217,7 @@ const HomePagePagerDutyCard = pagerDutyPlugin.provide(
|
|
|
218
217
|
})
|
|
219
218
|
);
|
|
220
219
|
|
|
221
|
-
const useStyles$
|
|
220
|
+
const useStyles$8 = makeStyles((theme) => ({
|
|
222
221
|
denseListIcon: {
|
|
223
222
|
marginRight: 0,
|
|
224
223
|
display: "flex",
|
|
@@ -246,7 +245,7 @@ const useStyles$7 = makeStyles((theme) => ({
|
|
|
246
245
|
}));
|
|
247
246
|
const IncidentListItem = ({ incident }) => {
|
|
248
247
|
var _a, _b, _c;
|
|
249
|
-
const classes = useStyles$
|
|
248
|
+
const classes = useStyles$8();
|
|
250
249
|
const duration = (/* @__PURE__ */ new Date()).getTime() - new Date(incident.created_at).getTime();
|
|
251
250
|
const createdAt = DateTime.local().minus(Duration.fromMillis(duration)).toRelative({ locale: "en" });
|
|
252
251
|
const user = (_a = incident.assignments[0]) == null ? void 0 : _a.assignee;
|
|
@@ -342,7 +341,7 @@ const Incidents = ({ serviceId, refreshIncidents }) => {
|
|
|
342
341
|
return /* @__PURE__ */ React.createElement(List, { dense: true }, incidents.map((incident, index) => /* @__PURE__ */ React.createElement(IncidentListItem, { key: incident.id + index, incident })));
|
|
343
342
|
};
|
|
344
343
|
|
|
345
|
-
const useStyles$
|
|
344
|
+
const useStyles$7 = makeStyles({
|
|
346
345
|
denseListIcon: {
|
|
347
346
|
marginRight: 0,
|
|
348
347
|
display: "flex",
|
|
@@ -352,11 +351,11 @@ const useStyles$6 = makeStyles({
|
|
|
352
351
|
}
|
|
353
352
|
});
|
|
354
353
|
const EscalationUsersEmptyState = () => {
|
|
355
|
-
const classes = useStyles$
|
|
354
|
+
const classes = useStyles$7();
|
|
356
355
|
return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement("div", { className: classes.denseListIcon }, /* @__PURE__ */ React.createElement(StatusWarning, null))), /* @__PURE__ */ React.createElement(ListItemText, { primary: "No one is on-call. Update the escalation policy." }));
|
|
357
356
|
};
|
|
358
357
|
|
|
359
|
-
const useStyles$
|
|
358
|
+
const useStyles$6 = makeStyles({
|
|
360
359
|
denseListIcon: {
|
|
361
360
|
marginRight: 0,
|
|
362
361
|
display: "flex",
|
|
@@ -366,11 +365,11 @@ const useStyles$5 = makeStyles({
|
|
|
366
365
|
}
|
|
367
366
|
});
|
|
368
367
|
const EscalationUsersForbiddenState = () => {
|
|
369
|
-
const classes = useStyles$
|
|
368
|
+
const classes = useStyles$6();
|
|
370
369
|
return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement("div", { className: classes.denseListIcon }, /* @__PURE__ */ React.createElement(StatusError, null))), /* @__PURE__ */ React.createElement(ListItemText, { primary: "You don't permissions to list on-calls. Check your OAuth token permissions." }));
|
|
371
370
|
};
|
|
372
371
|
|
|
373
|
-
const useStyles$
|
|
372
|
+
const useStyles$5 = makeStyles((theme) => ({
|
|
374
373
|
listItemPrimary: {
|
|
375
374
|
fontWeight: "bold"
|
|
376
375
|
},
|
|
@@ -404,7 +403,7 @@ const useStyles$4 = makeStyles((theme) => ({
|
|
|
404
403
|
}
|
|
405
404
|
}));
|
|
406
405
|
const EscalationUser = ({ user }) => {
|
|
407
|
-
const classes = useStyles$
|
|
406
|
+
const classes = useStyles$5();
|
|
408
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(
|
|
409
408
|
ListItemText,
|
|
410
409
|
{
|
|
@@ -497,91 +496,7 @@ const ServiceNotFoundError = () => /* @__PURE__ */ React.createElement(
|
|
|
497
496
|
}
|
|
498
497
|
);
|
|
499
498
|
|
|
500
|
-
const
|
|
501
|
-
showDialog,
|
|
502
|
-
handleDialog,
|
|
503
|
-
onIncidentCreated,
|
|
504
|
-
name,
|
|
505
|
-
integrationKey
|
|
506
|
-
}) => {
|
|
507
|
-
const alertApi = useApi(alertApiRef);
|
|
508
|
-
const identityApi = useApi(identityApiRef);
|
|
509
|
-
const api = useApi(pagerDutyApiRef);
|
|
510
|
-
const [description, setDescription] = useState("");
|
|
511
|
-
const [{ value, loading, error }, handleTriggerAlarm] = useAsyncFn(
|
|
512
|
-
async (descriptions) => {
|
|
513
|
-
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
|
514
|
-
const { name: userName } = parseEntityRef(userEntityRef, {
|
|
515
|
-
defaultKind: "User",
|
|
516
|
-
defaultNamespace: DEFAULT_NAMESPACE
|
|
517
|
-
});
|
|
518
|
-
return await api.triggerAlarm({
|
|
519
|
-
integrationKey,
|
|
520
|
-
source: window.location.toString(),
|
|
521
|
-
description: descriptions,
|
|
522
|
-
userName
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
);
|
|
526
|
-
const descriptionChanged = (event) => {
|
|
527
|
-
setDescription(event.target.value);
|
|
528
|
-
};
|
|
529
|
-
useEffect(() => {
|
|
530
|
-
if (value) {
|
|
531
|
-
(async () => {
|
|
532
|
-
alertApi.post({
|
|
533
|
-
message: `Alarm successfully triggered`
|
|
534
|
-
});
|
|
535
|
-
handleDialog();
|
|
536
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
537
|
-
onIncidentCreated == null ? void 0 : onIncidentCreated();
|
|
538
|
-
})();
|
|
539
|
-
}
|
|
540
|
-
}, [value, alertApi, handleDialog, onIncidentCreated]);
|
|
541
|
-
if (error) {
|
|
542
|
-
alertApi.post({
|
|
543
|
-
message: `Failed to trigger alarm. ${error.message}`,
|
|
544
|
-
severity: "error"
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
return /* @__PURE__ */ React.createElement(Dialog, { maxWidth: "md", open: showDialog, onClose: handleDialog, fullWidth: true }, /* @__PURE__ */ React.createElement(DialogTitle, null, "This action will trigger an incident for ", /* @__PURE__ */ React.createElement("strong", null, '"', name, '"'), "."), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Alert, { severity: "info" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", align: "justify" }, `If the issue you are seeing does not need urgent attention, please get in touch with the responsible team using their preferred communications channel. You can find information about the owner of this entity in the "About" card. If the issue is urgent, please don't hesitate to trigger the alert.`)), /* @__PURE__ */ React.createElement(
|
|
548
|
-
Typography,
|
|
549
|
-
{
|
|
550
|
-
variant: "body1",
|
|
551
|
-
style: { marginTop: "1em" },
|
|
552
|
-
gutterBottom: true,
|
|
553
|
-
align: "justify"
|
|
554
|
-
},
|
|
555
|
-
"Please describe the problem you want to report. Be as descriptive as possible. Your signed in user and a reference to the current page will automatically be amended to the alarm so that the receiver can reach out to you if necessary."
|
|
556
|
-
), /* @__PURE__ */ React.createElement(
|
|
557
|
-
TextField,
|
|
558
|
-
{
|
|
559
|
-
inputProps: { "data-testid": "trigger-input" },
|
|
560
|
-
id: "description",
|
|
561
|
-
multiline: true,
|
|
562
|
-
fullWidth: true,
|
|
563
|
-
rows: "4",
|
|
564
|
-
margin: "normal",
|
|
565
|
-
label: "Problem description",
|
|
566
|
-
variant: "outlined",
|
|
567
|
-
onChange: descriptionChanged
|
|
568
|
-
}
|
|
569
|
-
)), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(
|
|
570
|
-
Button,
|
|
571
|
-
{
|
|
572
|
-
"data-testid": "trigger-button",
|
|
573
|
-
id: "trigger",
|
|
574
|
-
color: "secondary",
|
|
575
|
-
disabled: !description || loading,
|
|
576
|
-
variant: "contained",
|
|
577
|
-
onClick: () => handleTriggerAlarm(description),
|
|
578
|
-
endIcon: loading && /* @__PURE__ */ React.createElement(CircularProgress, { size: 16 })
|
|
579
|
-
},
|
|
580
|
-
"Trigger Incident"
|
|
581
|
-
), /* @__PURE__ */ React.createElement(Button, { id: "close", color: "primary", onClick: handleDialog }, "Close")));
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
const useStyles$3 = makeStyles({
|
|
499
|
+
const useStyles$4 = makeStyles({
|
|
585
500
|
denseListIcon: {
|
|
586
501
|
marginRight: 0,
|
|
587
502
|
display: "flex",
|
|
@@ -594,7 +509,7 @@ const useStyles$3 = makeStyles({
|
|
|
594
509
|
}
|
|
595
510
|
});
|
|
596
511
|
const ChangeEventListItem = ({ changeEvent }) => {
|
|
597
|
-
const classes = useStyles$
|
|
512
|
+
const classes = useStyles$4();
|
|
598
513
|
const duration = (/* @__PURE__ */ new Date()).getTime() - new Date(changeEvent.timestamp).getTime();
|
|
599
514
|
const changedAt = DateTime.local().minus(Duration.fromMillis(duration)).toRelative({ locale: "en" });
|
|
600
515
|
let externalLinkElem;
|
|
@@ -708,7 +623,91 @@ function usePagerdutyEntity() {
|
|
|
708
623
|
return getPagerDutyEntity(entity);
|
|
709
624
|
}
|
|
710
625
|
|
|
711
|
-
const
|
|
626
|
+
const TriggerDialog = ({
|
|
627
|
+
showDialog,
|
|
628
|
+
handleDialog,
|
|
629
|
+
onIncidentCreated,
|
|
630
|
+
name,
|
|
631
|
+
integrationKey
|
|
632
|
+
}) => {
|
|
633
|
+
const alertApi = useApi(alertApiRef);
|
|
634
|
+
const identityApi = useApi(identityApiRef);
|
|
635
|
+
const api = useApi(pagerDutyApiRef);
|
|
636
|
+
const [description, setDescription] = useState("");
|
|
637
|
+
const [{ value, loading, error }, handleTriggerAlarm] = useAsyncFn(
|
|
638
|
+
async (descriptions) => {
|
|
639
|
+
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
|
640
|
+
const { name: userName } = parseEntityRef(userEntityRef, {
|
|
641
|
+
defaultKind: "User",
|
|
642
|
+
defaultNamespace: DEFAULT_NAMESPACE
|
|
643
|
+
});
|
|
644
|
+
return await api.triggerAlarm({
|
|
645
|
+
integrationKey,
|
|
646
|
+
source: window.location.toString(),
|
|
647
|
+
description: descriptions,
|
|
648
|
+
userName
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
const descriptionChanged = (event) => {
|
|
653
|
+
setDescription(event.target.value);
|
|
654
|
+
};
|
|
655
|
+
useEffect(() => {
|
|
656
|
+
if (value) {
|
|
657
|
+
(async () => {
|
|
658
|
+
alertApi.post({
|
|
659
|
+
message: `Alarm successfully triggered`
|
|
660
|
+
});
|
|
661
|
+
handleDialog();
|
|
662
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
663
|
+
onIncidentCreated == null ? void 0 : onIncidentCreated();
|
|
664
|
+
})();
|
|
665
|
+
}
|
|
666
|
+
}, [value, alertApi, handleDialog, onIncidentCreated]);
|
|
667
|
+
if (error) {
|
|
668
|
+
alertApi.post({
|
|
669
|
+
message: `Failed to trigger alarm. ${error.message}`,
|
|
670
|
+
severity: "error"
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
return /* @__PURE__ */ React.createElement(Dialog, { maxWidth: "md", open: showDialog, onClose: handleDialog, fullWidth: true }, /* @__PURE__ */ React.createElement(DialogTitle, null, "This action will trigger an incident for ", /* @__PURE__ */ React.createElement("strong", null, '"', name, '"'), "."), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Alert, { severity: "info" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", align: "justify" }, `If the issue you are seeing does not need urgent attention, please get in touch with the responsible team using their preferred communications channel. You can find information about the owner of this entity in the "About" card. If the issue is urgent, please don't hesitate to trigger the alert.`)), /* @__PURE__ */ React.createElement(
|
|
674
|
+
Typography,
|
|
675
|
+
{
|
|
676
|
+
variant: "body1",
|
|
677
|
+
style: { marginTop: "1em" },
|
|
678
|
+
gutterBottom: true,
|
|
679
|
+
align: "justify"
|
|
680
|
+
},
|
|
681
|
+
"Please describe the problem you want to report. Be as descriptive as possible. Your signed in user and a reference to the current page will automatically be amended to the alarm so that the receiver can reach out to you if necessary."
|
|
682
|
+
), /* @__PURE__ */ React.createElement(
|
|
683
|
+
TextField,
|
|
684
|
+
{
|
|
685
|
+
inputProps: { "data-testid": "trigger-input" },
|
|
686
|
+
id: "description",
|
|
687
|
+
multiline: true,
|
|
688
|
+
fullWidth: true,
|
|
689
|
+
rows: "4",
|
|
690
|
+
margin: "normal",
|
|
691
|
+
label: "Problem description",
|
|
692
|
+
variant: "outlined",
|
|
693
|
+
onChange: descriptionChanged
|
|
694
|
+
}
|
|
695
|
+
)), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(
|
|
696
|
+
Button,
|
|
697
|
+
{
|
|
698
|
+
"data-testid": "trigger-button",
|
|
699
|
+
id: "trigger",
|
|
700
|
+
color: "secondary",
|
|
701
|
+
disabled: !description || loading,
|
|
702
|
+
variant: "contained",
|
|
703
|
+
onClick: () => handleTriggerAlarm(description),
|
|
704
|
+
endIcon: loading && /* @__PURE__ */ React.createElement(CircularProgress, { size: 16 })
|
|
705
|
+
},
|
|
706
|
+
"Trigger Incident"
|
|
707
|
+
), /* @__PURE__ */ React.createElement(Button, { id: "close", color: "primary", onClick: handleDialog }, "Close")));
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
712
711
|
buttonStyle: {
|
|
713
712
|
color: theme.palette.text.primary,
|
|
714
713
|
"&:hover": {
|
|
@@ -728,7 +727,7 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
728
727
|
}
|
|
729
728
|
}));
|
|
730
729
|
function TriggerIncidentButton() {
|
|
731
|
-
const { buttonStyle, containerStyle, iconStyle } = useStyles$
|
|
730
|
+
const { buttonStyle, containerStyle, iconStyle } = useStyles$3();
|
|
732
731
|
const { integrationKey, name } = usePagerdutyEntity();
|
|
733
732
|
const [dialogShown, setDialogShown] = useState(false);
|
|
734
733
|
const showDialog = useCallback(() => {
|
|
@@ -746,7 +745,7 @@ function TriggerIncidentButton() {
|
|
|
746
745
|
className: disabled ? "" : buttonStyle,
|
|
747
746
|
disabled
|
|
748
747
|
},
|
|
749
|
-
/* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(AddAlert, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", null, "Create
|
|
748
|
+
/* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(AddAlert, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", null, "Create new incident"))
|
|
750
749
|
), integrationKey && /* @__PURE__ */ React.createElement(
|
|
751
750
|
TriggerDialog,
|
|
752
751
|
{
|
|
@@ -758,7 +757,7 @@ function TriggerIncidentButton() {
|
|
|
758
757
|
));
|
|
759
758
|
}
|
|
760
759
|
|
|
761
|
-
const useStyles$
|
|
760
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
762
761
|
buttonStyle: {
|
|
763
762
|
color: theme.palette.text.primary,
|
|
764
763
|
"&:hover": {
|
|
@@ -778,7 +777,7 @@ const useStyles$1 = makeStyles((theme) => ({
|
|
|
778
777
|
}
|
|
779
778
|
}));
|
|
780
779
|
function OpenServiceButton(props) {
|
|
781
|
-
const { buttonStyle, containerStyle, iconStyle } = useStyles$
|
|
780
|
+
const { buttonStyle, containerStyle, iconStyle } = useStyles$2();
|
|
782
781
|
function navigateToService() {
|
|
783
782
|
window.open(props.serviceUrl, "_blank");
|
|
784
783
|
}
|
|
@@ -793,8 +792,174 @@ function OpenServiceButton(props) {
|
|
|
793
792
|
));
|
|
794
793
|
}
|
|
795
794
|
|
|
795
|
+
const statusLabels = {
|
|
796
|
+
active: "OK",
|
|
797
|
+
warning: "ACTIVE",
|
|
798
|
+
critical: "ALARM",
|
|
799
|
+
maintenance: "MAINTENANCE",
|
|
800
|
+
disabled: "DISABLED"
|
|
801
|
+
};
|
|
802
|
+
function colorFromStatus(theme, status) {
|
|
803
|
+
const statusColors = {
|
|
804
|
+
active: theme.palette.success.main,
|
|
805
|
+
warning: theme.palette.warning.main,
|
|
806
|
+
critical: theme.palette.error.main,
|
|
807
|
+
maintenance: "#ebdc00",
|
|
808
|
+
disabled: "#A9A9A9"
|
|
809
|
+
};
|
|
810
|
+
return statusColors[status];
|
|
811
|
+
}
|
|
812
|
+
function StatusCard({ status }) {
|
|
813
|
+
const useStyles = makeStyles$1((theme) => ({
|
|
814
|
+
cardStyle: {
|
|
815
|
+
height: "120px",
|
|
816
|
+
display: "flex",
|
|
817
|
+
alignItems: "center",
|
|
818
|
+
justifyContent: "center",
|
|
819
|
+
backgroundColor: colorFromStatus(theme, status),
|
|
820
|
+
marginRight: "10px"
|
|
821
|
+
},
|
|
822
|
+
largeTextStyle: {
|
|
823
|
+
color: "white",
|
|
824
|
+
fontWeight: "bold",
|
|
825
|
+
fontSize: "20px"
|
|
826
|
+
}
|
|
827
|
+
}));
|
|
828
|
+
const { cardStyle, largeTextStyle } = useStyles();
|
|
829
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, statusLabels[status]));
|
|
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]));
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function colorFromPercentage(theme, percentage) {
|
|
872
|
+
if (percentage < 0.5) {
|
|
873
|
+
return theme.palette.error.main;
|
|
874
|
+
} else if (percentage < 0.8) {
|
|
875
|
+
return theme.palette.warning.main;
|
|
876
|
+
}
|
|
877
|
+
return theme.palette.success.main;
|
|
878
|
+
}
|
|
879
|
+
function ServiceStandardsCard({ total, completed }) {
|
|
880
|
+
const useStyles = makeStyles((theme) => ({
|
|
881
|
+
cardStyle: {
|
|
882
|
+
height: "120px",
|
|
883
|
+
display: "grid",
|
|
884
|
+
gridTemplateRows: "1fr auto auto",
|
|
885
|
+
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
886
|
+
},
|
|
887
|
+
containerStyle: {
|
|
888
|
+
display: "flex",
|
|
889
|
+
justifyContent: "center"
|
|
890
|
+
},
|
|
891
|
+
largeTextStyle: {
|
|
892
|
+
fontSize: "50px",
|
|
893
|
+
color: colorFromPercentage(theme, completed / total),
|
|
894
|
+
fontWeight: "bold",
|
|
895
|
+
alignSelf: "center",
|
|
896
|
+
justifyContent: "center"
|
|
897
|
+
},
|
|
898
|
+
smallTextStyle: {
|
|
899
|
+
color: theme.palette.text.primary,
|
|
900
|
+
fontSize: "16px",
|
|
901
|
+
fontWeight: "bold",
|
|
902
|
+
alignSelf: "center",
|
|
903
|
+
justifyContent: "center",
|
|
904
|
+
marginLeft: "1px",
|
|
905
|
+
marginTop: "25px"
|
|
906
|
+
}
|
|
907
|
+
}));
|
|
908
|
+
const BorderLinearProgress = withStyles((theme) => ({
|
|
909
|
+
root: {
|
|
910
|
+
height: 10,
|
|
911
|
+
borderRadius: 5,
|
|
912
|
+
margin: 5
|
|
913
|
+
},
|
|
914
|
+
colorPrimary: {
|
|
915
|
+
backgroundColor: theme.palette.grey[theme.palette.type === "light" ? 200 : 700]
|
|
916
|
+
},
|
|
917
|
+
bar: {
|
|
918
|
+
borderRadius: 5,
|
|
919
|
+
backgroundColor: colorFromPercentage(theme, completed / total)
|
|
920
|
+
}
|
|
921
|
+
}))(LinearProgress);
|
|
922
|
+
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(
|
|
924
|
+
BorderLinearProgress,
|
|
925
|
+
{
|
|
926
|
+
variant: "determinate",
|
|
927
|
+
value: completed / total * 100
|
|
928
|
+
}
|
|
929
|
+
)));
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
const useStyles$1 = makeStyles$1(
|
|
933
|
+
(theme) => createStyles({
|
|
934
|
+
overviewHeaderTextStyle: {
|
|
935
|
+
fontSize: "14px",
|
|
936
|
+
fontWeight: 500,
|
|
937
|
+
color: theme.palette.type === "light" ? "rgba(0, 0, 0, 0.54)" : "rgba(255, 255, 255, 0.7)"
|
|
938
|
+
},
|
|
939
|
+
headerStyle: {
|
|
940
|
+
marginRight: "1em"
|
|
941
|
+
},
|
|
942
|
+
overviewHeaderContainerStyle: {
|
|
943
|
+
display: "flex",
|
|
944
|
+
margin: "15px",
|
|
945
|
+
marginBottom: "20px"
|
|
946
|
+
},
|
|
947
|
+
overviewCardsContainerStyle: {
|
|
948
|
+
display: "flex",
|
|
949
|
+
margin: "15px",
|
|
950
|
+
marginTop: "-15px"
|
|
951
|
+
},
|
|
952
|
+
incidentMetricsContainerStyle: {
|
|
953
|
+
display: "flex",
|
|
954
|
+
height: "100%",
|
|
955
|
+
justifyContent: "center",
|
|
956
|
+
columnSpan: "all"
|
|
957
|
+
}
|
|
958
|
+
})
|
|
959
|
+
);
|
|
796
960
|
const BasicCard = ({ children }) => /* @__PURE__ */ React.createElement(InfoCard, { title: "PagerDuty" }, children);
|
|
797
961
|
const PagerDutyCard$1 = (props) => {
|
|
962
|
+
const classes = useStyles$1();
|
|
798
963
|
const theme = useTheme();
|
|
799
964
|
const { readOnly, disableChangeEvents, integrationKey, name } = props;
|
|
800
965
|
const api = useApi(pagerDutyApiRef);
|
|
@@ -845,249 +1010,11 @@ const PagerDutyCard$1 = (props) => {
|
|
|
845
1010
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Card, { "data-testid": "pagerduty-card" }, /* @__PURE__ */ React.createElement(
|
|
846
1011
|
CardHeader,
|
|
847
1012
|
{
|
|
848
|
-
|
|
1013
|
+
className: classes.headerStyle,
|
|
849
1014
|
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" }),
|
|
850
1015
|
action: !readOnly ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TriggerIncidentButton, null), /* @__PURE__ */ React.createElement(OpenServiceButton, { serviceUrl: service.url })) : /* @__PURE__ */ React.createElement(OpenServiceButton, { serviceUrl: service.url })
|
|
851
1016
|
}
|
|
852
|
-
), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12,
|
|
853
|
-
Typography,
|
|
854
|
-
{
|
|
855
|
-
style: {
|
|
856
|
-
fontSize: "14px",
|
|
857
|
-
fontWeight: "500",
|
|
858
|
-
color: "rgba(0, 0, 0, 0.54)"
|
|
859
|
-
// rgba(255, 255, 255, 0.7)
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
"STATUS"
|
|
863
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 6 }, /* @__PURE__ */ React.createElement(
|
|
864
|
-
Typography,
|
|
865
|
-
{
|
|
866
|
-
style: {
|
|
867
|
-
fontSize: "14px",
|
|
868
|
-
fontWeight: "500",
|
|
869
|
-
color: "rgba(0, 0, 0, 0.54)"
|
|
870
|
-
// rgba(255, 255, 255, 0.7)
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
"INCIDENT HISTORY"
|
|
874
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(
|
|
875
|
-
Typography,
|
|
876
|
-
{
|
|
877
|
-
style: {
|
|
878
|
-
fontSize: "14px",
|
|
879
|
-
fontWeight: "500",
|
|
880
|
-
color: "rgba(0, 0, 0, 0.54)"
|
|
881
|
-
// rgba(255, 255, 255, 0.7)
|
|
882
|
-
}
|
|
883
|
-
},
|
|
884
|
-
"SERVICE STANDARDS"
|
|
885
|
-
))), /* @__PURE__ */ React.createElement(
|
|
886
|
-
Grid,
|
|
887
|
-
{
|
|
888
|
-
item: true,
|
|
889
|
-
md: 12,
|
|
890
|
-
style: { display: "flex", margin: "15px", marginTop: "-15px" }
|
|
891
|
-
},
|
|
892
|
-
/* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(
|
|
893
|
-
Card,
|
|
894
|
-
{
|
|
895
|
-
style: {
|
|
896
|
-
background: theme.palette.error.main,
|
|
897
|
-
marginRight: "10px",
|
|
898
|
-
height: "120px",
|
|
899
|
-
display: "flex",
|
|
900
|
-
alignItems: "center",
|
|
901
|
-
justifyContent: "center"
|
|
902
|
-
}
|
|
903
|
-
},
|
|
904
|
-
/* @__PURE__ */ React.createElement(
|
|
905
|
-
Typography,
|
|
906
|
-
{
|
|
907
|
-
variant: "h3",
|
|
908
|
-
style: { color: "white", fontWeight: "bold" }
|
|
909
|
-
},
|
|
910
|
-
"ALARM"
|
|
911
|
-
)
|
|
912
|
-
)),
|
|
913
|
-
/* @__PURE__ */ React.createElement(
|
|
914
|
-
Grid,
|
|
915
|
-
{
|
|
916
|
-
item: true,
|
|
917
|
-
md: 6,
|
|
918
|
-
style: {
|
|
919
|
-
display: "flex",
|
|
920
|
-
height: "100%",
|
|
921
|
-
justifyContent: "center",
|
|
922
|
-
columnSpan: "all"
|
|
923
|
-
}
|
|
924
|
-
},
|
|
925
|
-
/* @__PURE__ */ React.createElement(Grid, { md: 4, style: { height: "100%" } }, /* @__PURE__ */ React.createElement(
|
|
926
|
-
Card,
|
|
927
|
-
{
|
|
928
|
-
style: {
|
|
929
|
-
marginRight: "10px",
|
|
930
|
-
height: "120px",
|
|
931
|
-
display: "flex",
|
|
932
|
-
alignItems: "center",
|
|
933
|
-
justifyContent: "center",
|
|
934
|
-
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
935
|
-
}
|
|
936
|
-
},
|
|
937
|
-
/* @__PURE__ */ React.createElement(
|
|
938
|
-
Typography,
|
|
939
|
-
{
|
|
940
|
-
style: {
|
|
941
|
-
color: theme.palette.error.main,
|
|
942
|
-
fontSize: "40px"
|
|
943
|
-
}
|
|
944
|
-
},
|
|
945
|
-
"1"
|
|
946
|
-
),
|
|
947
|
-
/* @__PURE__ */ React.createElement(
|
|
948
|
-
Typography,
|
|
949
|
-
{
|
|
950
|
-
style: {
|
|
951
|
-
color: theme.palette.error.main,
|
|
952
|
-
fontWeight: "bold",
|
|
953
|
-
fontSize: "10px"
|
|
954
|
-
}
|
|
955
|
-
},
|
|
956
|
-
"TRIGGERED"
|
|
957
|
-
)
|
|
958
|
-
)),
|
|
959
|
-
/* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
960
|
-
Card,
|
|
961
|
-
{
|
|
962
|
-
style: {
|
|
963
|
-
marginRight: "10px",
|
|
964
|
-
height: "120px",
|
|
965
|
-
display: "flex",
|
|
966
|
-
alignItems: "center",
|
|
967
|
-
justifyContent: "center",
|
|
968
|
-
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
969
|
-
}
|
|
970
|
-
},
|
|
971
|
-
/* @__PURE__ */ React.createElement(
|
|
972
|
-
Typography,
|
|
973
|
-
{
|
|
974
|
-
style: {
|
|
975
|
-
color: theme.palette.warning.main,
|
|
976
|
-
fontSize: "40px"
|
|
977
|
-
}
|
|
978
|
-
},
|
|
979
|
-
"1"
|
|
980
|
-
),
|
|
981
|
-
/* @__PURE__ */ React.createElement(
|
|
982
|
-
Typography,
|
|
983
|
-
{
|
|
984
|
-
style: {
|
|
985
|
-
color: theme.palette.warning.main,
|
|
986
|
-
fontWeight: "bold",
|
|
987
|
-
fontSize: "10px"
|
|
988
|
-
}
|
|
989
|
-
},
|
|
990
|
-
"ACKNOWLEDGED"
|
|
991
|
-
)
|
|
992
|
-
)),
|
|
993
|
-
/* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
994
|
-
Card,
|
|
995
|
-
{
|
|
996
|
-
style: {
|
|
997
|
-
marginRight: "10px",
|
|
998
|
-
height: "120px",
|
|
999
|
-
display: "flex",
|
|
1000
|
-
alignItems: "center",
|
|
1001
|
-
justifyContent: "center",
|
|
1002
|
-
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
1003
|
-
}
|
|
1004
|
-
},
|
|
1005
|
-
/* @__PURE__ */ React.createElement(
|
|
1006
|
-
Typography,
|
|
1007
|
-
{
|
|
1008
|
-
style: {
|
|
1009
|
-
color: theme.palette.success.main,
|
|
1010
|
-
fontSize: "40px"
|
|
1011
|
-
}
|
|
1012
|
-
},
|
|
1013
|
-
"43"
|
|
1014
|
-
),
|
|
1015
|
-
/* @__PURE__ */ React.createElement(
|
|
1016
|
-
Typography,
|
|
1017
|
-
{
|
|
1018
|
-
style: {
|
|
1019
|
-
color: theme.palette.success.main,
|
|
1020
|
-
fontWeight: "bold",
|
|
1021
|
-
fontSize: "10px"
|
|
1022
|
-
}
|
|
1023
|
-
},
|
|
1024
|
-
"RESOLVED"
|
|
1025
|
-
)
|
|
1026
|
-
))
|
|
1027
|
-
),
|
|
1028
|
-
/* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(
|
|
1029
|
-
Card,
|
|
1030
|
-
{
|
|
1031
|
-
style: {
|
|
1032
|
-
height: "120px",
|
|
1033
|
-
display: "grid",
|
|
1034
|
-
gridTemplateRows: "1fr auto auto",
|
|
1035
|
-
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
1036
|
-
}
|
|
1037
|
-
},
|
|
1038
|
-
/* @__PURE__ */ React.createElement(
|
|
1039
|
-
"div",
|
|
1040
|
-
{
|
|
1041
|
-
style: {
|
|
1042
|
-
display: "flex",
|
|
1043
|
-
justifyContent: "center"
|
|
1044
|
-
}
|
|
1045
|
-
},
|
|
1046
|
-
/* @__PURE__ */ React.createElement(
|
|
1047
|
-
Typography,
|
|
1048
|
-
{
|
|
1049
|
-
style: {
|
|
1050
|
-
fontSize: "50px",
|
|
1051
|
-
color: "rgba(0, 0, 0, 0.7)",
|
|
1052
|
-
// rgba(255, 255, 255, 0.7)
|
|
1053
|
-
fontWeight: "bold",
|
|
1054
|
-
alignSelf: "center",
|
|
1055
|
-
justifyContent: "center"
|
|
1056
|
-
}
|
|
1057
|
-
},
|
|
1058
|
-
"4"
|
|
1059
|
-
),
|
|
1060
|
-
/* @__PURE__ */ React.createElement(
|
|
1061
|
-
Typography,
|
|
1062
|
-
{
|
|
1063
|
-
variant: "body1",
|
|
1064
|
-
style: {
|
|
1065
|
-
fontWeight: "500",
|
|
1066
|
-
color: "rgba(0, 0, 0, 0.7)",
|
|
1067
|
-
// rgba(255, 255, 255, 0.7)
|
|
1068
|
-
alignSelf: "center",
|
|
1069
|
-
justifyContent: "center",
|
|
1070
|
-
marginLeft: "1px",
|
|
1071
|
-
marginTop: "20px"
|
|
1072
|
-
}
|
|
1073
|
-
},
|
|
1074
|
-
"/5"
|
|
1075
|
-
)
|
|
1076
|
-
),
|
|
1077
|
-
/* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
1078
|
-
LinearProgress,
|
|
1079
|
-
{
|
|
1080
|
-
variant: "determinate",
|
|
1081
|
-
value: 80,
|
|
1082
|
-
style: {
|
|
1083
|
-
margin: "5px",
|
|
1084
|
-
borderRadius: "10px",
|
|
1085
|
-
height: "10px"
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
))
|
|
1089
|
-
))
|
|
1090
|
-
), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(TabbedCard, null, /* @__PURE__ */ React.createElement(CardTab, { label: "Incidents" }, /* @__PURE__ */ React.createElement(
|
|
1017
|
+
), /* @__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 }, "INCIDENT HISTORY")), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.overviewHeaderTextStyle }, "SERVICE 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: "active" })), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 6, className: classes.incidentMetricsContainerStyle }, /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(IncidentCounterCard, { count: 1, label: "triggered" })), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(IncidentCounterCard, { count: 1, label: "acknowledged" })), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(IncidentCounterCard, { count: 43, label: "resolved" }))), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(ServiceStandardsCard, { total: 9, completed: 8 }))), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(TabbedCard, null, /* @__PURE__ */ React.createElement(CardTab, { label: "Incidents" }, /* @__PURE__ */ React.createElement(
|
|
1091
1018
|
Incidents,
|
|
1092
1019
|
{
|
|
1093
1020
|
serviceId: service.id,
|
|
@@ -1182,4 +1109,4 @@ function TriggerButton(props) {
|
|
|
1182
1109
|
const PagerDutyCard = EntityPagerDutyCard;
|
|
1183
1110
|
|
|
1184
1111
|
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 };
|
|
1185
|
-
//# sourceMappingURL=index-
|
|
1112
|
+
//# sourceMappingURL=index-d288bb3d.esm.js.map
|