@pagerduty/backstage-plugin 0.9.4-next.9 → 0.11.0-next.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.
@@ -22,6 +22,9 @@ import AddAlert from '@material-ui/icons/AddAlert';
22
22
  import { makeStyles as makeStyles$1, createStyles, useTheme } from '@material-ui/core/styles';
23
23
  import { useAsyncFn as useAsyncFn$1 } from 'react-use';
24
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';
25
28
  import validateColor from 'validate-color';
26
29
 
27
30
  const PAGERDUTY_INTEGRATION_KEY = "pagerduty.com/integration-key";
@@ -106,6 +109,12 @@ class PagerDutyClient {
106
109
  )}/services/${serviceId}/standards`;
107
110
  return await this.findByUrl(url);
108
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
+ }
109
118
  async getOnCallByPolicyId(policyId) {
110
119
  const params = `escalation_policy_ids[]=${policyId}`;
111
120
  const url = `${await this.config.discoveryApi.getBaseUrl(
@@ -206,7 +215,7 @@ const HomePagePagerDutyCard = pagerDutyPlugin.provide(
206
215
  createCardExtension({
207
216
  name: "HomePagePagerDutyCard",
208
217
  title: "PagerDuty Homepage Card",
209
- components: () => import('./index-29409a83.esm.js'),
218
+ components: () => import('./index-291e1428.esm.js'),
210
219
  settings: {
211
220
  schema: {
212
221
  title: "PagerDuty",
@@ -358,7 +367,7 @@ const IncidentsEmptyState = () => {
358
367
  };
359
368
 
360
369
  const IncidentForbiddenState = () => {
361
- return /* @__PURE__ */ React.createElement(Grid, { container: true, justify: "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(
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(
362
371
  "img",
363
372
  {
364
373
  src: ForbiddenStateImage,
@@ -498,7 +507,11 @@ const EscalationUser = ({ user, policyUrl, policyName }) => {
498
507
  ))));
499
508
  };
500
509
 
501
- const EscalationPolicy = ({ policyId, policyUrl, policyName }) => {
510
+ const EscalationPolicy = ({
511
+ policyId,
512
+ policyUrl,
513
+ policyName
514
+ }) => {
502
515
  const api = useApi(pagerDutyApiRef);
503
516
  const {
504
517
  value: users,
@@ -519,7 +532,23 @@ const EscalationPolicy = ({ policyId, policyUrl, policyName }) => {
519
532
  if (!(users == null ? void 0 : users.length)) {
520
533
  return /* @__PURE__ */ React.createElement(EscalationUsersEmptyState, null);
521
534
  }
522
- 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 })));
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
+ );
523
552
  };
524
553
 
525
554
  const MissingTokenError = () => /* @__PURE__ */ React.createElement(
@@ -616,7 +645,7 @@ const ChangeEventListItem = ({ changeEvent }) => {
616
645
  };
617
646
 
618
647
  const ChangeEventEmptyState = () => {
619
- return /* @__PURE__ */ React.createElement(Grid, { container: true, justify: "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(
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(
620
649
  "img",
621
650
  {
622
651
  src: EmptyStateImage,
@@ -627,7 +656,7 @@ const ChangeEventEmptyState = () => {
627
656
  };
628
657
 
629
658
  const ChangeEventForbiddenState = () => {
630
- return /* @__PURE__ */ React.createElement(Grid, { container: true, justify: "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(
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(
631
660
  "img",
632
661
  {
633
662
  src: ForbiddenStateImage,
@@ -687,16 +716,11 @@ const ForbiddenError = () => /* @__PURE__ */ React.createElement(
687
716
  }
688
717
  );
689
718
 
690
- function usePagerdutyEntity() {
691
- const { entity } = useEntity();
692
- return getPagerDutyEntity(entity);
693
- }
694
-
695
719
  const TriggerDialog = ({
696
720
  showDialog,
697
721
  handleDialog,
698
722
  onIncidentCreated,
699
- name,
723
+ serviceName,
700
724
  integrationKey
701
725
  }) => {
702
726
  const alertApi = useApi(alertApiRef);
@@ -739,7 +763,7 @@ const TriggerDialog = ({
739
763
  severity: "error"
740
764
  });
741
765
  }
742
- 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(
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(
743
767
  Typography,
744
768
  {
745
769
  variant: "body1",
@@ -755,7 +779,7 @@ const TriggerDialog = ({
755
779
  id: "description",
756
780
  multiline: true,
757
781
  fullWidth: true,
758
- rows: "4",
782
+ minRows: 4,
759
783
  margin: "normal",
760
784
  label: "Problem description",
761
785
  variant: "outlined",
@@ -785,19 +809,20 @@ const useStyles$3 = makeStyles((theme) => ({
785
809
  }
786
810
  },
787
811
  containerStyle: {
788
- flex: "flex !important",
789
- fontSize: "14px",
812
+ fontSize: "12px",
790
813
  width: "80px",
791
- lineHeight: "14px"
814
+ marginRight: "-10px"
792
815
  },
793
816
  iconStyle: {
794
- fontSize: "35px",
817
+ fontSize: "30px",
818
+ marginBottom: "-10px"
819
+ },
820
+ textStyle: {
795
821
  marginBottom: "-10px"
796
822
  }
797
823
  }));
798
- function TriggerIncidentButton({ handleRefresh }) {
799
- const { buttonStyle, containerStyle, iconStyle } = useStyles$3();
800
- const { integrationKey, name } = usePagerdutyEntity();
824
+ function TriggerIncidentButton({ integrationKey, entityName, handleRefresh }) {
825
+ const { buttonStyle, containerStyle, iconStyle, textStyle } = useStyles$3();
801
826
  const [dialogShown, setDialogShown] = useState(false);
802
827
  const showDialog = useCallback(() => {
803
828
  setDialogShown(true);
@@ -814,14 +839,14 @@ function TriggerIncidentButton({ handleRefresh }) {
814
839
  className: disabled ? "" : buttonStyle,
815
840
  disabled
816
841
  },
817
- /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(AddAlert, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", null, "Create new incident"))
842
+ /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(AddAlert, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", { className: textStyle }, "Create new incident"))
818
843
  ), integrationKey && /* @__PURE__ */ React.createElement(
819
844
  TriggerDialog,
820
845
  {
821
846
  showDialog: dialogShown,
822
847
  handleDialog: hideDialog,
823
848
  integrationKey,
824
- name,
849
+ serviceName: entityName,
825
850
  onIncidentCreated: handleRefresh
826
851
  }
827
852
  ));
@@ -836,18 +861,19 @@ const useStyles$2 = makeStyles((theme) => ({
836
861
  }
837
862
  },
838
863
  containerStyle: {
839
- flex: "flex",
840
- fontSize: "14px",
841
- width: "85px",
842
- lineHeight: "14px"
864
+ fontSize: "12px",
865
+ width: "85px"
843
866
  },
844
867
  iconStyle: {
845
- fontSize: "35px",
868
+ fontSize: "30px",
869
+ marginBottom: "-10px"
870
+ },
871
+ textStyle: {
846
872
  marginBottom: "-10px"
847
873
  }
848
874
  }));
849
875
  function OpenServiceButton(props) {
850
- const { buttonStyle, containerStyle, iconStyle } = useStyles$2();
876
+ const { buttonStyle, containerStyle, iconStyle, textStyle } = useStyles$2();
851
877
  function navigateToService() {
852
878
  window.open(props.serviceUrl, "_blank");
853
879
  }
@@ -858,7 +884,7 @@ function OpenServiceButton(props) {
858
884
  onClick: navigateToService,
859
885
  className: buttonStyle
860
886
  },
861
- /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(OpenInBrowserIcon, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", null, "Open service in PagerDuty"))
887
+ /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(OpenInBrowserIcon, { className: iconStyle }), /* @__PURE__ */ React.createElement("p", { className: textStyle }, "Open service in PagerDuty"))
862
888
  ));
863
889
  }
864
890
 
@@ -914,27 +940,10 @@ function StatusCard({ serviceId, refreshStatus }) {
914
940
  const api = useApi(pagerDutyApiRef);
915
941
  const [{ value: status, loading, error }, getStatus] = useAsyncFn$1(
916
942
  async () => {
917
- const { service: foundService } = await api.getServiceById(
918
- serviceId
919
- );
943
+ const { service: foundService } = await api.getServiceById(serviceId);
920
944
  return foundService.status;
921
945
  }
922
946
  );
923
- useEffect(() => {
924
- getStatus();
925
- }, [refreshStatus, getStatus]);
926
- if (error) {
927
- if (error.message.includes("Forbidden")) {
928
- return /* @__PURE__ */ React.createElement("p", null, "forbidden");
929
- }
930
- return /* @__PURE__ */ React.createElement(Alert$1, { severity: "error" }, "Error encountered while fetching information. ", error.message);
931
- }
932
- if (loading) {
933
- return /* @__PURE__ */ React.createElement(Progress, null);
934
- }
935
- if (!status) {
936
- return /* @__PURE__ */ React.createElement("p", null, "not found");
937
- }
938
947
  const useStyles = makeStyles$1((theme) => ({
939
948
  cardStyle: {
940
949
  height: "120px",
@@ -952,6 +961,21 @@ function StatusCard({ serviceId, refreshStatus }) {
952
961
  }
953
962
  }));
954
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
+ }
955
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"));
956
980
  }
957
981
 
@@ -963,7 +987,7 @@ function colorFromPercentage(theme, percentage) {
963
987
  }
964
988
  return theme.palette.success.main;
965
989
  }
966
- function ServiceStandardsCard({ total, completed }) {
990
+ function ServiceStandardsCard({ total, completed, standards }) {
967
991
  const useStyles = makeStyles((theme) => ({
968
992
  cardStyle: {
969
993
  height: "120px",
@@ -973,7 +997,8 @@ function ServiceStandardsCard({ total, completed }) {
973
997
  },
974
998
  containerStyle: {
975
999
  display: "flex",
976
- justifyContent: "center"
1000
+ justifyContent: "center",
1001
+ marginTop: "-100px"
977
1002
  },
978
1003
  largeTextStyle: {
979
1004
  fontSize: "50px",
@@ -989,6 +1014,14 @@ function ServiceStandardsCard({ total, completed }) {
989
1014
  justifyContent: "center",
990
1015
  marginLeft: "-2px",
991
1016
  marginTop: "25px"
1017
+ },
1018
+ tooltipContainer: {},
1019
+ tooltipIcon: {
1020
+ marginRight: "5px"
1021
+ },
1022
+ standardItem: {
1023
+ display: "flex",
1024
+ alignItems: "center"
992
1025
  }
993
1026
  }));
994
1027
  const BorderLinearProgress = withStyles((theme) => ({
@@ -1005,14 +1038,32 @@ function ServiceStandardsCard({ total, completed }) {
1005
1038
  backgroundColor: completed !== void 0 && total !== void 0 ? colorFromPercentage(theme, completed / total) : colorFromPercentage(theme, 0)
1006
1039
  }
1007
1040
  }))(LinearProgress);
1008
- const { cardStyle, containerStyle, largeTextStyle, smallTextStyle } = useStyles();
1009
- 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(
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(
1010
1061
  BorderLinearProgress,
1011
1062
  {
1012
1063
  variant: "determinate",
1013
1064
  value: completed / total * 100
1014
1065
  }
1015
- ))) : /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: largeTextStyle }, "Unable to retrieve Scores")));
1066
+ ))) : /* @__PURE__ */ React.createElement("div", { className: containerStyle }, /* @__PURE__ */ React.createElement(Typography, { className: smallTextStyle }, "Unable to retrieve Scores")));
1016
1067
  }
1017
1068
 
1018
1069
  function IncidentCounterCard({ count, label, color }) {
@@ -1041,7 +1092,7 @@ function IncidentCounterCard({ count, label, color }) {
1041
1092
  }
1042
1093
  }));
1043
1094
  const { cardStyle, largeTextStyle, smallTextStyle } = useStyles();
1044
- 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)));
1045
1096
  }
1046
1097
 
1047
1098
  const useStyles$1 = makeStyles$1(
@@ -1052,13 +1103,22 @@ const useStyles$1 = makeStyles$1(
1052
1103
  color: theme.palette.type === "light" ? "rgba(0, 0, 0, 0.54)" : "rgba(255, 255, 255, 0.7)"
1053
1104
  },
1054
1105
  headerStyle: {
1055
- marginRight: "1em"
1106
+ marginBottom: "0px",
1107
+ fontSize: "0px"
1056
1108
  },
1057
1109
  overviewHeaderContainerStyle: {
1058
1110
  display: "flex",
1059
1111
  margin: "15px",
1060
1112
  marginBottom: "20px"
1061
1113
  },
1114
+ headerWithSubheaderContainerStyle: {
1115
+ display: "flex",
1116
+ alignItems: "center"
1117
+ },
1118
+ subheaderTextStyle: {
1119
+ fontSize: "10px",
1120
+ marginLeft: "5px"
1121
+ },
1062
1122
  overviewCardsContainerStyle: {
1063
1123
  display: "flex",
1064
1124
  margin: "15px",
@@ -1074,7 +1134,7 @@ const useStyles$1 = makeStyles$1(
1074
1134
  );
1075
1135
  const BasicCard = ({ children }) => /* @__PURE__ */ React.createElement(InfoCard, { title: "PagerDuty" }, children);
1076
1136
  const PagerDutyCard$1 = (props) => {
1077
- var _a, _b;
1137
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1078
1138
  const classes = useStyles$1();
1079
1139
  const theme = useTheme();
1080
1140
  const { readOnly, disableChangeEvents } = props;
@@ -1095,7 +1155,12 @@ const PagerDutyCard$1 = (props) => {
1095
1155
  const { service: foundService } = await api.getServiceByPagerDutyEntity(
1096
1156
  props
1097
1157
  );
1098
- const { standards: serviceStandards } = await api.getServiceStandardsByServiceId(foundService.id);
1158
+ const serviceStandards = await api.getServiceStandardsByServiceId(
1159
+ foundService.id
1160
+ );
1161
+ const serviceMetrics = await api.getServiceMetricsByServiceId(
1162
+ foundService.id
1163
+ );
1099
1164
  const result = {
1100
1165
  id: foundService.id,
1101
1166
  name: foundService.name,
@@ -1104,7 +1169,8 @@ const PagerDutyCard$1 = (props) => {
1104
1169
  policyLink: foundService.escalation_policy.html_url,
1105
1170
  policyName: foundService.escalation_policy.name,
1106
1171
  status: foundService.status,
1107
- standardsScore: serviceStandards.score
1172
+ standards: serviceStandards !== void 0 ? serviceStandards.standards : void 0,
1173
+ metrics: serviceMetrics !== void 0 ? serviceMetrics.metrics : void 0
1108
1174
  };
1109
1175
  return result;
1110
1176
  }, [props]);
@@ -1125,39 +1191,47 @@ const PagerDutyCard$1 = (props) => {
1125
1191
  if (loading) {
1126
1192
  return /* @__PURE__ */ React.createElement(BasicCard, null, /* @__PURE__ */ React.createElement(Progress, null));
1127
1193
  }
1128
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Card, { "data-testid": "pagerduty-card" }, /* @__PURE__ */ React.createElement(
1194
+ return /* @__PURE__ */ React.createElement(Card, { "data-testid": "pagerduty-card" }, /* @__PURE__ */ React.createElement(
1129
1195
  CardHeader,
1130
1196
  {
1131
1197
  className: classes.headerStyle,
1132
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" }),
1133
- 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 })
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 })
1134
1207
  }
1135
- ), /* @__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, { serviceId: service.id, refreshStatus })), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 6, className: classes.incidentMetricsContainerStyle }, /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
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(
1136
1209
  IncidentCounterCard,
1137
1210
  {
1138
- count: 29,
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,
1139
1212
  label: "interruptions",
1140
1213
  color: theme.palette.textSubtle
1141
1214
  }
1142
- )), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
1215
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 4 }, /* @__PURE__ */ React.createElement(
1143
1216
  IncidentCounterCard,
1144
1217
  {
1145
- count: 29,
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,
1146
1219
  label: "high urgency",
1147
1220
  color: theme.palette.warning.main
1148
1221
  }
1149
- )), /* @__PURE__ */ React.createElement(Grid, { md: 4 }, /* @__PURE__ */ React.createElement(
1222
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 4 }, /* @__PURE__ */ React.createElement(
1150
1223
  IncidentCounterCard,
1151
1224
  {
1152
- count: 32,
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,
1153
1226
  label: "incidents",
1154
1227
  color: theme.palette.error.main
1155
1228
  }
1156
1229
  ))), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 3 }, /* @__PURE__ */ React.createElement(
1157
1230
  ServiceStandardsCard,
1158
1231
  {
1159
- total: (_a = service == null ? void 0 : service.standardsScore) == null ? void 0 : _a.total,
1160
- completed: (_b = service == null ? void 0 : service.standardsScore) == null ? void 0 : _b.passing
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
1161
1235
  }
1162
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(
1163
1237
  Incidents,
@@ -1178,7 +1252,7 @@ const PagerDutyCard$1 = (props) => {
1178
1252
  policyUrl: service.policyLink,
1179
1253
  policyName: service.policyName
1180
1254
  }
1181
- ))));
1255
+ )));
1182
1256
  };
1183
1257
 
1184
1258
  const isPluginApplicableToEntity = (entity) => {
@@ -1207,6 +1281,11 @@ var index = /*#__PURE__*/Object.freeze({
1207
1281
  EntityPagerDutyCard: EntityPagerDutyCard
1208
1282
  });
1209
1283
 
1284
+ function usePagerdutyEntity() {
1285
+ const { entity } = useEntity();
1286
+ return getPagerDutyEntity(entity);
1287
+ }
1288
+
1210
1289
  const useStyles = makeStyles((theme) => ({
1211
1290
  buttonStyle: {
1212
1291
  backgroundColor: theme.palette.error.main,
@@ -1243,7 +1322,7 @@ function TriggerButton(props) {
1243
1322
  showDialog: dialogShown,
1244
1323
  handleDialog: hideDialog,
1245
1324
  integrationKey,
1246
- name
1325
+ serviceName: name
1247
1326
  }
1248
1327
  ));
1249
1328
  }
@@ -1251,4 +1330,4 @@ function TriggerButton(props) {
1251
1330
  const PagerDutyCard = EntityPagerDutyCard;
1252
1331
 
1253
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 };
1254
- //# sourceMappingURL=index-c0e21d21.esm.js.map
1333
+ //# sourceMappingURL=index-0fec9996.esm.js.map