@pagerduty/backstage-plugin 0.9.4-next.8 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{index-1c9fcfab.esm.js → index-0fec9996.esm.js} +167 -54
- package/dist/esm/index-0fec9996.esm.js.map +1 -0
- package/dist/esm/{index-18f6f061.esm.js → index-291e1428.esm.js} +7 -2
- package/dist/esm/{index-18f6f061.esm.js.map → index-291e1428.esm.js.map} +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.esm.js +6 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/esm/index-1c9fcfab.esm.js.map +0 -1
|
@@ -20,6 +20,11 @@ import PDWhiteImage from '../assets/PD-White.svg';
|
|
|
20
20
|
import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
21
21
|
import AddAlert from '@material-ui/icons/AddAlert';
|
|
22
22
|
import { makeStyles as makeStyles$1, createStyles, useTheme } from '@material-ui/core/styles';
|
|
23
|
+
import { useAsyncFn as useAsyncFn$1 } from 'react-use';
|
|
24
|
+
import Alert$1 from '@material-ui/lab/Alert/Alert';
|
|
25
|
+
import InfoIcon from '@material-ui/icons/Info';
|
|
26
|
+
import CheckCircle from '@material-ui/icons/CheckCircle';
|
|
27
|
+
import RadioButtonUncheckedIcon from '@material-ui/icons/RadioButtonUnchecked';
|
|
23
28
|
import validateColor from 'validate-color';
|
|
24
29
|
|
|
25
30
|
const PAGERDUTY_INTEGRATION_KEY = "pagerduty.com/integration-key";
|
|
@@ -80,6 +85,12 @@ class PagerDutyClient {
|
|
|
80
85
|
async getServiceByEntity(entity) {
|
|
81
86
|
return await this.getServiceByPagerDutyEntity(getPagerDutyEntity(entity));
|
|
82
87
|
}
|
|
88
|
+
async getServiceById(serviceId) {
|
|
89
|
+
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
90
|
+
"pagerduty"
|
|
91
|
+
)}/services/${serviceId}`;
|
|
92
|
+
return await this.findByUrl(url);
|
|
93
|
+
}
|
|
83
94
|
async getIncidentsByServiceId(serviceId) {
|
|
84
95
|
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
85
96
|
"pagerduty"
|
|
@@ -98,6 +109,12 @@ class PagerDutyClient {
|
|
|
98
109
|
)}/services/${serviceId}/standards`;
|
|
99
110
|
return await this.findByUrl(url);
|
|
100
111
|
}
|
|
112
|
+
async getServiceMetricsByServiceId(serviceId) {
|
|
113
|
+
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
114
|
+
"pagerduty"
|
|
115
|
+
)}/services/${serviceId}/metrics`;
|
|
116
|
+
return await this.findByUrl(url);
|
|
117
|
+
}
|
|
101
118
|
async getOnCallByPolicyId(policyId) {
|
|
102
119
|
const params = `escalation_policy_ids[]=${policyId}`;
|
|
103
120
|
const url = `${await this.config.discoveryApi.getBaseUrl(
|
|
@@ -198,7 +215,7 @@ const HomePagePagerDutyCard = pagerDutyPlugin.provide(
|
|
|
198
215
|
createCardExtension({
|
|
199
216
|
name: "HomePagePagerDutyCard",
|
|
200
217
|
title: "PagerDuty Homepage Card",
|
|
201
|
-
components: () => import('./index-
|
|
218
|
+
components: () => import('./index-291e1428.esm.js'),
|
|
202
219
|
settings: {
|
|
203
220
|
schema: {
|
|
204
221
|
title: "PagerDuty",
|
|
@@ -350,7 +367,7 @@ const IncidentsEmptyState = () => {
|
|
|
350
367
|
};
|
|
351
368
|
|
|
352
369
|
const IncidentForbiddenState = () => {
|
|
353
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true,
|
|
370
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Feature not available with your account or token.")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
354
371
|
"img",
|
|
355
372
|
{
|
|
356
373
|
src: ForbiddenStateImage,
|
|
@@ -490,7 +507,11 @@ const EscalationUser = ({ user, policyUrl, policyName }) => {
|
|
|
490
507
|
))));
|
|
491
508
|
};
|
|
492
509
|
|
|
493
|
-
const EscalationPolicy = ({
|
|
510
|
+
const EscalationPolicy = ({
|
|
511
|
+
policyId,
|
|
512
|
+
policyUrl,
|
|
513
|
+
policyName
|
|
514
|
+
}) => {
|
|
494
515
|
const api = useApi(pagerDutyApiRef);
|
|
495
516
|
const {
|
|
496
517
|
value: users,
|
|
@@ -511,7 +532,23 @@ const EscalationPolicy = ({ policyId, policyUrl, policyName }) => {
|
|
|
511
532
|
if (!(users == null ? void 0 : users.length)) {
|
|
512
533
|
return /* @__PURE__ */ React.createElement(EscalationUsersEmptyState, null);
|
|
513
534
|
}
|
|
514
|
-
return /* @__PURE__ */ React.createElement(
|
|
535
|
+
return /* @__PURE__ */ React.createElement(
|
|
536
|
+
List,
|
|
537
|
+
{
|
|
538
|
+
dense: true,
|
|
539
|
+
subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "ON CALL"),
|
|
540
|
+
style: { marginLeft: "-15px" }
|
|
541
|
+
},
|
|
542
|
+
users.map((user, index) => /* @__PURE__ */ React.createElement(
|
|
543
|
+
EscalationUser,
|
|
544
|
+
{
|
|
545
|
+
key: index,
|
|
546
|
+
user,
|
|
547
|
+
policyUrl,
|
|
548
|
+
policyName
|
|
549
|
+
}
|
|
550
|
+
))
|
|
551
|
+
);
|
|
515
552
|
};
|
|
516
553
|
|
|
517
554
|
const MissingTokenError = () => /* @__PURE__ */ React.createElement(
|
|
@@ -608,7 +645,7 @@ const ChangeEventListItem = ({ changeEvent }) => {
|
|
|
608
645
|
};
|
|
609
646
|
|
|
610
647
|
const ChangeEventEmptyState = () => {
|
|
611
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true,
|
|
648
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "No change events to display yet.")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
612
649
|
"img",
|
|
613
650
|
{
|
|
614
651
|
src: EmptyStateImage,
|
|
@@ -619,7 +656,7 @@ const ChangeEventEmptyState = () => {
|
|
|
619
656
|
};
|
|
620
657
|
|
|
621
658
|
const ChangeEventForbiddenState = () => {
|
|
622
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true,
|
|
659
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Feature not available with your account or token.")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
623
660
|
"img",
|
|
624
661
|
{
|
|
625
662
|
src: ForbiddenStateImage,
|
|
@@ -679,16 +716,11 @@ const ForbiddenError = () => /* @__PURE__ */ React.createElement(
|
|
|
679
716
|
}
|
|
680
717
|
);
|
|
681
718
|
|
|
682
|
-
function usePagerdutyEntity() {
|
|
683
|
-
const { entity } = useEntity();
|
|
684
|
-
return getPagerDutyEntity(entity);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
719
|
const TriggerDialog = ({
|
|
688
720
|
showDialog,
|
|
689
721
|
handleDialog,
|
|
690
722
|
onIncidentCreated,
|
|
691
|
-
|
|
723
|
+
serviceName,
|
|
692
724
|
integrationKey
|
|
693
725
|
}) => {
|
|
694
726
|
const alertApi = useApi(alertApiRef);
|
|
@@ -731,7 +763,7 @@ const TriggerDialog = ({
|
|
|
731
763
|
severity: "error"
|
|
732
764
|
});
|
|
733
765
|
}
|
|
734
|
-
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, '"',
|
|
766
|
+
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, '"', serviceName, '"'), "."), /* @__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(
|
|
735
767
|
Typography,
|
|
736
768
|
{
|
|
737
769
|
variant: "body1",
|
|
@@ -747,7 +779,7 @@ const TriggerDialog = ({
|
|
|
747
779
|
id: "description",
|
|
748
780
|
multiline: true,
|
|
749
781
|
fullWidth: true,
|
|
750
|
-
|
|
782
|
+
minRows: 4,
|
|
751
783
|
margin: "normal",
|
|
752
784
|
label: "Problem description",
|
|
753
785
|
variant: "outlined",
|
|
@@ -777,19 +809,20 @@ const useStyles$3 = makeStyles((theme) => ({
|
|
|
777
809
|
}
|
|
778
810
|
},
|
|
779
811
|
containerStyle: {
|
|
780
|
-
|
|
781
|
-
fontSize: "14px",
|
|
812
|
+
fontSize: "12px",
|
|
782
813
|
width: "80px",
|
|
783
|
-
|
|
814
|
+
marginRight: "-10px"
|
|
784
815
|
},
|
|
785
816
|
iconStyle: {
|
|
786
|
-
fontSize: "
|
|
817
|
+
fontSize: "30px",
|
|
818
|
+
marginBottom: "-10px"
|
|
819
|
+
},
|
|
820
|
+
textStyle: {
|
|
787
821
|
marginBottom: "-10px"
|
|
788
822
|
}
|
|
789
823
|
}));
|
|
790
|
-
function TriggerIncidentButton({ handleRefresh }) {
|
|
791
|
-
const { buttonStyle, containerStyle, iconStyle } = useStyles$3();
|
|
792
|
-
const { integrationKey, name } = usePagerdutyEntity();
|
|
824
|
+
function TriggerIncidentButton({ integrationKey, entityName, handleRefresh }) {
|
|
825
|
+
const { buttonStyle, containerStyle, iconStyle, textStyle } = useStyles$3();
|
|
793
826
|
const [dialogShown, setDialogShown] = useState(false);
|
|
794
827
|
const showDialog = useCallback(() => {
|
|
795
828
|
setDialogShown(true);
|
|
@@ -806,14 +839,14 @@ function TriggerIncidentButton({ handleRefresh }) {
|
|
|
806
839
|
className: disabled ? "" : buttonStyle,
|
|
807
840
|
disabled
|
|
808
841
|
},
|
|
809
|
-
/* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(AddAlert, { className: iconStyle }), /* @__PURE__ */ React.createElement("p",
|
|
842
|
+
/* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(AddAlert, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", { className: textStyle }, "Create new incident"))
|
|
810
843
|
), integrationKey && /* @__PURE__ */ React.createElement(
|
|
811
844
|
TriggerDialog,
|
|
812
845
|
{
|
|
813
846
|
showDialog: dialogShown,
|
|
814
847
|
handleDialog: hideDialog,
|
|
815
848
|
integrationKey,
|
|
816
|
-
|
|
849
|
+
serviceName: entityName,
|
|
817
850
|
onIncidentCreated: handleRefresh
|
|
818
851
|
}
|
|
819
852
|
));
|
|
@@ -828,18 +861,19 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
828
861
|
}
|
|
829
862
|
},
|
|
830
863
|
containerStyle: {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
width: "85px",
|
|
834
|
-
lineHeight: "14px"
|
|
864
|
+
fontSize: "12px",
|
|
865
|
+
width: "85px"
|
|
835
866
|
},
|
|
836
867
|
iconStyle: {
|
|
837
|
-
fontSize: "
|
|
868
|
+
fontSize: "30px",
|
|
869
|
+
marginBottom: "-10px"
|
|
870
|
+
},
|
|
871
|
+
textStyle: {
|
|
838
872
|
marginBottom: "-10px"
|
|
839
873
|
}
|
|
840
874
|
}));
|
|
841
875
|
function OpenServiceButton(props) {
|
|
842
|
-
const { buttonStyle, containerStyle, iconStyle } = useStyles$2();
|
|
876
|
+
const { buttonStyle, containerStyle, iconStyle, textStyle } = useStyles$2();
|
|
843
877
|
function navigateToService() {
|
|
844
878
|
window.open(props.serviceUrl, "_blank");
|
|
845
879
|
}
|
|
@@ -850,7 +884,7 @@ function OpenServiceButton(props) {
|
|
|
850
884
|
onClick: navigateToService,
|
|
851
885
|
className: buttonStyle
|
|
852
886
|
},
|
|
853
|
-
/* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(OpenInBrowserIcon, { className: iconStyle }), /* @__PURE__ */ React.createElement("p",
|
|
887
|
+
/* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(OpenInBrowserIcon, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", { className: textStyle }, "Open service in PagerDuty"))
|
|
854
888
|
));
|
|
855
889
|
}
|
|
856
890
|
|
|
@@ -902,7 +936,14 @@ function colorFromStatus(theme, status) {
|
|
|
902
936
|
}
|
|
903
937
|
return color;
|
|
904
938
|
}
|
|
905
|
-
function StatusCard({
|
|
939
|
+
function StatusCard({ serviceId, refreshStatus }) {
|
|
940
|
+
const api = useApi(pagerDutyApiRef);
|
|
941
|
+
const [{ value: status, loading, error }, getStatus] = useAsyncFn$1(
|
|
942
|
+
async () => {
|
|
943
|
+
const { service: foundService } = await api.getServiceById(serviceId);
|
|
944
|
+
return foundService.status;
|
|
945
|
+
}
|
|
946
|
+
);
|
|
906
947
|
const useStyles = makeStyles$1((theme) => ({
|
|
907
948
|
cardStyle: {
|
|
908
949
|
height: "120px",
|
|
@@ -920,6 +961,21 @@ function StatusCard({ status }) {
|
|
|
920
961
|
}
|
|
921
962
|
}));
|
|
922
963
|
const { cardStyle, largeTextStyle } = useStyles();
|
|
964
|
+
useEffect(() => {
|
|
965
|
+
getStatus();
|
|
966
|
+
}, [refreshStatus, getStatus]);
|
|
967
|
+
if (error) {
|
|
968
|
+
if (error.message.includes("Forbidden")) {
|
|
969
|
+
return /* @__PURE__ */ React.createElement("p", null, "forbidden");
|
|
970
|
+
}
|
|
971
|
+
return /* @__PURE__ */ React.createElement(Alert$1, { severity: "error" }, "Error encountered while fetching information. ", error.message);
|
|
972
|
+
}
|
|
973
|
+
if (loading) {
|
|
974
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
975
|
+
}
|
|
976
|
+
if (!status) {
|
|
977
|
+
return /* @__PURE__ */ React.createElement("p", null, "not found");
|
|
978
|
+
}
|
|
923
979
|
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"));
|
|
924
980
|
}
|
|
925
981
|
|
|
@@ -931,7 +987,7 @@ function colorFromPercentage(theme, percentage) {
|
|
|
931
987
|
}
|
|
932
988
|
return theme.palette.success.main;
|
|
933
989
|
}
|
|
934
|
-
function ServiceStandardsCard({ total, completed }) {
|
|
990
|
+
function ServiceStandardsCard({ total, completed, standards }) {
|
|
935
991
|
const useStyles = makeStyles((theme) => ({
|
|
936
992
|
cardStyle: {
|
|
937
993
|
height: "120px",
|
|
@@ -941,7 +997,8 @@ function ServiceStandardsCard({ total, completed }) {
|
|
|
941
997
|
},
|
|
942
998
|
containerStyle: {
|
|
943
999
|
display: "flex",
|
|
944
|
-
justifyContent: "center"
|
|
1000
|
+
justifyContent: "center",
|
|
1001
|
+
marginTop: "-100px"
|
|
945
1002
|
},
|
|
946
1003
|
largeTextStyle: {
|
|
947
1004
|
fontSize: "50px",
|
|
@@ -957,6 +1014,14 @@ function ServiceStandardsCard({ total, completed }) {
|
|
|
957
1014
|
justifyContent: "center",
|
|
958
1015
|
marginLeft: "-2px",
|
|
959
1016
|
marginTop: "25px"
|
|
1017
|
+
},
|
|
1018
|
+
tooltipContainer: {},
|
|
1019
|
+
tooltipIcon: {
|
|
1020
|
+
marginRight: "5px"
|
|
1021
|
+
},
|
|
1022
|
+
standardItem: {
|
|
1023
|
+
display: "flex",
|
|
1024
|
+
alignItems: "center"
|
|
960
1025
|
}
|
|
961
1026
|
}));
|
|
962
1027
|
const BorderLinearProgress = withStyles((theme) => ({
|
|
@@ -973,14 +1038,32 @@ function ServiceStandardsCard({ total, completed }) {
|
|
|
973
1038
|
backgroundColor: completed !== void 0 && total !== void 0 ? colorFromPercentage(theme, completed / total) : colorFromPercentage(theme, 0)
|
|
974
1039
|
}
|
|
975
1040
|
}))(LinearProgress);
|
|
976
|
-
const {
|
|
977
|
-
|
|
1041
|
+
const {
|
|
1042
|
+
cardStyle,
|
|
1043
|
+
containerStyle,
|
|
1044
|
+
largeTextStyle,
|
|
1045
|
+
smallTextStyle,
|
|
1046
|
+
tooltipContainer,
|
|
1047
|
+
tooltipIcon,
|
|
1048
|
+
standardItem
|
|
1049
|
+
} = useStyles();
|
|
1050
|
+
if (standards === void 0 || completed === void 0 || total === void 0) {
|
|
1051
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, "Unable to retrieve Scores")));
|
|
1052
|
+
}
|
|
1053
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, completed !== void 0 && total !== void 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: tooltipContainer }, /* @__PURE__ */ React.createElement(IconButton, null, /* @__PURE__ */ React.createElement(
|
|
1054
|
+
Tooltip,
|
|
1055
|
+
{
|
|
1056
|
+
interactive: true,
|
|
1057
|
+
title: /* @__PURE__ */ React.createElement(React.Fragment, null, standards == null ? void 0 : standards.map((standard, key) => /* @__PURE__ */ React.createElement("p", { key }, standard.pass ? /* @__PURE__ */ React.createElement("span", { className: standardItem }, /* @__PURE__ */ React.createElement(CheckCircle, { className: tooltipIcon }), " ", standard.name) : /* @__PURE__ */ React.createElement("span", { className: standardItem }, /* @__PURE__ */ React.createElement(RadioButtonUncheckedIcon, { className: tooltipIcon }), " ", standard.name))))
|
|
1058
|
+
},
|
|
1059
|
+
/* @__PURE__ */ React.createElement(InfoIcon, null)
|
|
1060
|
+
))), /* @__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(
|
|
978
1061
|
BorderLinearProgress,
|
|
979
1062
|
{
|
|
980
1063
|
variant: "determinate",
|
|
981
1064
|
value: completed / total * 100
|
|
982
1065
|
}
|
|
983
|
-
))) : /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className:
|
|
1066
|
+
))) : /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, "Unable to retrieve Scores")));
|
|
984
1067
|
}
|
|
985
1068
|
|
|
986
1069
|
function IncidentCounterCard({ count, label, color }) {
|
|
@@ -1009,7 +1092,7 @@ function IncidentCounterCard({ count, label, color }) {
|
|
|
1009
1092
|
}
|
|
1010
1093
|
}));
|
|
1011
1094
|
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));
|
|
1095
|
+
return /* @__PURE__ */ React.createElement(Card, { className: cardStyle }, count !== void 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, count), /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, label)) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, "-"), /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, label)));
|
|
1013
1096
|
}
|
|
1014
1097
|
|
|
1015
1098
|
const useStyles$1 = makeStyles$1(
|
|
@@ -1020,13 +1103,22 @@ const useStyles$1 = makeStyles$1(
|
|
|
1020
1103
|
color: theme.palette.type === "light" ? "rgba(0, 0, 0, 0.54)" : "rgba(255, 255, 255, 0.7)"
|
|
1021
1104
|
},
|
|
1022
1105
|
headerStyle: {
|
|
1023
|
-
|
|
1106
|
+
marginBottom: "0px",
|
|
1107
|
+
fontSize: "0px"
|
|
1024
1108
|
},
|
|
1025
1109
|
overviewHeaderContainerStyle: {
|
|
1026
1110
|
display: "flex",
|
|
1027
1111
|
margin: "15px",
|
|
1028
1112
|
marginBottom: "20px"
|
|
1029
1113
|
},
|
|
1114
|
+
headerWithSubheaderContainerStyle: {
|
|
1115
|
+
display: "flex",
|
|
1116
|
+
alignItems: "center"
|
|
1117
|
+
},
|
|
1118
|
+
subheaderTextStyle: {
|
|
1119
|
+
fontSize: "10px",
|
|
1120
|
+
marginLeft: "5px"
|
|
1121
|
+
},
|
|
1030
1122
|
overviewCardsContainerStyle: {
|
|
1031
1123
|
display: "flex",
|
|
1032
1124
|
margin: "15px",
|
|
@@ -1042,16 +1134,18 @@ const useStyles$1 = makeStyles$1(
|
|
|
1042
1134
|
);
|
|
1043
1135
|
const BasicCard = ({ children }) => /* @__PURE__ */ React.createElement(InfoCard, { title: "PagerDuty" }, children);
|
|
1044
1136
|
const PagerDutyCard$1 = (props) => {
|
|
1045
|
-
var _a, _b;
|
|
1137
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1046
1138
|
const classes = useStyles$1();
|
|
1047
1139
|
const theme = useTheme();
|
|
1048
1140
|
const { readOnly, disableChangeEvents } = props;
|
|
1049
1141
|
const api = useApi(pagerDutyApiRef);
|
|
1050
1142
|
const [refreshIncidents, setRefreshIncidents] = useState(false);
|
|
1051
1143
|
const [refreshChangeEvents, setRefreshChangeEvents] = useState(false);
|
|
1144
|
+
const [refreshStatus, setRefreshStatus] = useState(false);
|
|
1052
1145
|
const handleRefresh = useCallback(() => {
|
|
1053
1146
|
setRefreshIncidents((x) => !x);
|
|
1054
1147
|
setRefreshChangeEvents((x) => !x);
|
|
1148
|
+
setRefreshStatus((x) => !x);
|
|
1055
1149
|
}, []);
|
|
1056
1150
|
const {
|
|
1057
1151
|
value: service,
|
|
@@ -1061,7 +1155,12 @@ const PagerDutyCard$1 = (props) => {
|
|
|
1061
1155
|
const { service: foundService } = await api.getServiceByPagerDutyEntity(
|
|
1062
1156
|
props
|
|
1063
1157
|
);
|
|
1064
|
-
const
|
|
1158
|
+
const serviceStandards = await api.getServiceStandardsByServiceId(
|
|
1159
|
+
foundService.id
|
|
1160
|
+
);
|
|
1161
|
+
const serviceMetrics = await api.getServiceMetricsByServiceId(
|
|
1162
|
+
foundService.id
|
|
1163
|
+
);
|
|
1065
1164
|
const result = {
|
|
1066
1165
|
id: foundService.id,
|
|
1067
1166
|
name: foundService.name,
|
|
@@ -1070,7 +1169,8 @@ const PagerDutyCard$1 = (props) => {
|
|
|
1070
1169
|
policyLink: foundService.escalation_policy.html_url,
|
|
1071
1170
|
policyName: foundService.escalation_policy.name,
|
|
1072
1171
|
status: foundService.status,
|
|
1073
|
-
|
|
1172
|
+
standards: serviceStandards !== void 0 ? serviceStandards.standards : void 0,
|
|
1173
|
+
metrics: serviceMetrics !== void 0 ? serviceMetrics.metrics : void 0
|
|
1074
1174
|
};
|
|
1075
1175
|
return result;
|
|
1076
1176
|
}, [props]);
|
|
@@ -1091,39 +1191,47 @@ const PagerDutyCard$1 = (props) => {
|
|
|
1091
1191
|
if (loading) {
|
|
1092
1192
|
return /* @__PURE__ */ React.createElement(BasicCard, null, /* @__PURE__ */ React.createElement(Progress, null));
|
|
1093
1193
|
}
|
|
1094
|
-
return /* @__PURE__ */ React.createElement(
|
|
1194
|
+
return /* @__PURE__ */ React.createElement(Card, { "data-testid": "pagerduty-card" }, /* @__PURE__ */ React.createElement(
|
|
1095
1195
|
CardHeader,
|
|
1096
1196
|
{
|
|
1097
1197
|
className: classes.headerStyle,
|
|
1098
1198
|
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" }),
|
|
1099
|
-
action: !readOnly ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
1199
|
+
action: !readOnly ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
1200
|
+
TriggerIncidentButton,
|
|
1201
|
+
{
|
|
1202
|
+
integrationKey: props.integrationKey,
|
|
1203
|
+
entityName: props.name,
|
|
1204
|
+
handleRefresh
|
|
1205
|
+
}
|
|
1206
|
+
), /* @__PURE__ */ React.createElement(OpenServiceButton, { serviceUrl: service.url })) : /* @__PURE__ */ React.createElement(OpenServiceButton, { serviceUrl: service.url })
|
|
1100
1207
|
}
|
|
1101
|
-
), /* @__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, {
|
|
1208
|
+
), /* @__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("span", { className: classes.headerWithSubheaderContainerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: classes.overviewHeaderTextStyle }, "INSIGHTS"), /* @__PURE__ */ React.createElement(Typography, { className: classes.subheaderTextStyle }, "(last 30 days)"))), /* @__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, { serviceId: service.id, refreshStatus })), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 6, className: classes.incidentMetricsContainerStyle }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1102
1209
|
IncidentCounterCard,
|
|
1103
1210
|
{
|
|
1104
|
-
count:
|
|
1211
|
+
count: (service == null ? void 0 : service.metrics) !== void 0 && service.metrics.length > 0 ? service == null ? void 0 : service.metrics[0].total_interruptions : void 0,
|
|
1105
1212
|
label: "interruptions",
|
|
1106
1213
|
color: theme.palette.textSubtle
|
|
1107
1214
|
}
|
|
1108
|
-
)), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1215
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1109
1216
|
IncidentCounterCard,
|
|
1110
1217
|
{
|
|
1111
|
-
count:
|
|
1218
|
+
count: (service == null ? void 0 : service.metrics) !== void 0 && service.metrics.length > 0 ? service == null ? void 0 : service.metrics[0].total_high_urgency_incidents : void 0,
|
|
1112
1219
|
label: "high urgency",
|
|
1113
1220
|
color: theme.palette.warning.main
|
|
1114
1221
|
}
|
|
1115
|
-
)), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1222
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 4 }, /* @__PURE__ */ React.createElement(
|
|
1116
1223
|
IncidentCounterCard,
|
|
1117
1224
|
{
|
|
1118
|
-
count:
|
|
1225
|
+
count: (service == null ? void 0 : service.metrics) !== void 0 && ((_a = service == null ? void 0 : service.metrics) == null ? void 0 : _a.length) > 0 ? service == null ? void 0 : service.metrics[0].total_incident_count : void 0,
|
|
1119
1226
|
label: "incidents",
|
|
1120
1227
|
color: theme.palette.error.main
|
|
1121
1228
|
}
|
|
1122
1229
|
))), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(
|
|
1123
1230
|
ServiceStandardsCard,
|
|
1124
1231
|
{
|
|
1125
|
-
total: (
|
|
1126
|
-
completed: (
|
|
1232
|
+
total: (service == null ? void 0 : service.standards) !== void 0 && ((_b = service == null ? void 0 : service.standards) == null ? void 0 : _b.score) !== void 0 ? (_d = (_c = service == null ? void 0 : service.standards) == null ? void 0 : _c.score) == null ? void 0 : _d.total : void 0,
|
|
1233
|
+
completed: (service == null ? void 0 : service.standards) !== void 0 && ((_e = service == null ? void 0 : service.standards) == null ? void 0 : _e.score) !== void 0 ? (_g = (_f = service == null ? void 0 : service.standards) == null ? void 0 : _f.score) == null ? void 0 : _g.passing : void 0,
|
|
1234
|
+
standards: (service == null ? void 0 : service.standards) !== void 0 ? (_h = service == null ? void 0 : service.standards) == null ? void 0 : _h.standards : void 0
|
|
1127
1235
|
}
|
|
1128
1236
|
))), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(TabbedCard, null, /* @__PURE__ */ React.createElement(CardTab, { label: "Incidents" }, /* @__PURE__ */ React.createElement(
|
|
1129
1237
|
Incidents,
|
|
@@ -1144,7 +1252,7 @@ const PagerDutyCard$1 = (props) => {
|
|
|
1144
1252
|
policyUrl: service.policyLink,
|
|
1145
1253
|
policyName: service.policyName
|
|
1146
1254
|
}
|
|
1147
|
-
)))
|
|
1255
|
+
)));
|
|
1148
1256
|
};
|
|
1149
1257
|
|
|
1150
1258
|
const isPluginApplicableToEntity = (entity) => {
|
|
@@ -1173,6 +1281,11 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
1173
1281
|
EntityPagerDutyCard: EntityPagerDutyCard
|
|
1174
1282
|
});
|
|
1175
1283
|
|
|
1284
|
+
function usePagerdutyEntity() {
|
|
1285
|
+
const { entity } = useEntity();
|
|
1286
|
+
return getPagerDutyEntity(entity);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1176
1289
|
const useStyles = makeStyles((theme) => ({
|
|
1177
1290
|
buttonStyle: {
|
|
1178
1291
|
backgroundColor: theme.palette.error.main,
|
|
@@ -1209,7 +1322,7 @@ function TriggerButton(props) {
|
|
|
1209
1322
|
showDialog: dialogShown,
|
|
1210
1323
|
handleDialog: hideDialog,
|
|
1211
1324
|
integrationKey,
|
|
1212
|
-
name
|
|
1325
|
+
serviceName: name
|
|
1213
1326
|
}
|
|
1214
1327
|
));
|
|
1215
1328
|
}
|
|
@@ -1217,4 +1330,4 @@ function TriggerButton(props) {
|
|
|
1217
1330
|
const PagerDutyCard = EntityPagerDutyCard;
|
|
1218
1331
|
|
|
1219
1332
|
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 };
|
|
1220
|
-
//# sourceMappingURL=index-
|
|
1333
|
+
//# sourceMappingURL=index-0fec9996.esm.js.map
|