@backstage-community/plugin-splunk-on-call 0.8.0 → 0.9.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.
@@ -1,4 +1,5 @@
1
- import React, { useEffect } from 'react';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useEffect } from 'react';
2
3
  import ListItem from '@material-ui/core/ListItem';
3
4
  import ListItemIcon from '@material-ui/core/ListItemIcon';
4
5
  import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
@@ -39,11 +40,11 @@ const IncidentPhaseStatus = ({
39
40
  }) => {
40
41
  switch (currentPhase) {
41
42
  case "UNACKED":
42
- return /* @__PURE__ */ React.createElement(StatusError, null);
43
+ return /* @__PURE__ */ jsx(StatusError, {});
43
44
  case "ACKED":
44
- return /* @__PURE__ */ React.createElement(StatusWarning, null);
45
+ return /* @__PURE__ */ jsx(StatusWarning, {});
45
46
  default:
46
- return /* @__PURE__ */ React.createElement(StatusOK, null);
47
+ return /* @__PURE__ */ jsx(StatusOK, {});
47
48
  }
48
49
  };
49
50
  const incidentPhaseTooltip = (currentPhase) => {
@@ -64,23 +65,23 @@ const IncidentAction = ({
64
65
  }) => {
65
66
  switch (currentPhase) {
66
67
  case "UNACKED":
67
- return /* @__PURE__ */ React.createElement(Tooltip, { title: "Acknowledge", placement: "top" }, /* @__PURE__ */ React.createElement(
68
+ return /* @__PURE__ */ jsx(Tooltip, { title: "Acknowledge", placement: "top", children: /* @__PURE__ */ jsx(
68
69
  IconButton,
69
70
  {
70
- onClick: () => acknowledgeAction({ incidentId, incidentType: "ACKNOWLEDGEMENT" })
71
- },
72
- /* @__PURE__ */ React.createElement(DoneIcon, null)
73
- ));
71
+ onClick: () => acknowledgeAction({ incidentId, incidentType: "ACKNOWLEDGEMENT" }),
72
+ children: /* @__PURE__ */ jsx(DoneIcon, {})
73
+ }
74
+ ) });
74
75
  case "ACKED":
75
- return /* @__PURE__ */ React.createElement(Tooltip, { title: "Resolve", placement: "top" }, /* @__PURE__ */ React.createElement(
76
+ return /* @__PURE__ */ jsx(Tooltip, { title: "Resolve", placement: "top", children: /* @__PURE__ */ jsx(
76
77
  IconButton,
77
78
  {
78
- onClick: () => resolveAction({ incidentId, incidentType: "RECOVERY" })
79
- },
80
- /* @__PURE__ */ React.createElement(DoneAllIcon, null)
81
- ));
79
+ onClick: () => resolveAction({ incidentId, incidentType: "RECOVERY" }),
80
+ children: /* @__PURE__ */ jsx(DoneAllIcon, {})
81
+ }
82
+ ) });
82
83
  default:
83
- return /* @__PURE__ */ React.createElement(React.Fragment, null);
84
+ return /* @__PURE__ */ jsx(Fragment, {});
84
85
  }
85
86
  };
86
87
  const IncidentListItem = ({
@@ -148,41 +149,55 @@ const IncidentListItem = ({
148
149
  severity: "error"
149
150
  });
150
151
  }
151
- return /* @__PURE__ */ React.createElement(ListItem, { dense: true, key: incident.entityId }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: classes.listItemIcon }, /* @__PURE__ */ React.createElement(
152
- Tooltip,
153
- {
154
- title: incidentPhaseTooltip(incident.currentPhase),
155
- placement: "top"
156
- },
157
- /* @__PURE__ */ React.createElement("div", { className: classes.denseListIcon }, /* @__PURE__ */ React.createElement(IncidentPhaseStatus, { currentPhase: incident.currentPhase }))
158
- )), /* @__PURE__ */ React.createElement(
159
- ListItemText,
160
- {
161
- primary: incident.entityDisplayName,
162
- primaryTypographyProps: {
163
- variant: "body1",
164
- className: classes.listItemPrimary
165
- },
166
- secondary: /* @__PURE__ */ React.createElement(Typography, { noWrap: true, variant: "body2", color: "textSecondary" }, "#", incident.incidentNumber, " - Created ", createdAt, " ", source() && `by ${source()}`)
167
- }
168
- ), incident.incidentLink && incident.incidentNumber && /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, !readOnly && /* @__PURE__ */ React.createElement(
169
- IncidentAction,
170
- {
171
- currentPhase: incident.currentPhase || "",
172
- incidentId: incident.entityId,
173
- resolveAction: handleResolveIncident,
174
- acknowledgeAction: handleAcknowledgeIncident
175
- }
176
- ), /* @__PURE__ */ React.createElement(Tooltip, { title: "View in Splunk On-Call", placement: "top" }, /* @__PURE__ */ React.createElement(
177
- IconButton,
178
- {
179
- href: incident.incidentLink,
180
- target: "_blank",
181
- rel: "noopener noreferrer",
182
- color: "primary"
183
- },
184
- /* @__PURE__ */ React.createElement(OpenInBrowserIcon, null)
185
- ))));
152
+ return /* @__PURE__ */ jsxs(ListItem, { dense: true, children: [
153
+ /* @__PURE__ */ jsx(ListItemIcon, { className: classes.listItemIcon, children: /* @__PURE__ */ jsx(
154
+ Tooltip,
155
+ {
156
+ title: incidentPhaseTooltip(incident.currentPhase),
157
+ placement: "top",
158
+ children: /* @__PURE__ */ jsx("div", { className: classes.denseListIcon, children: /* @__PURE__ */ jsx(IncidentPhaseStatus, { currentPhase: incident.currentPhase }) })
159
+ }
160
+ ) }),
161
+ /* @__PURE__ */ jsx(
162
+ ListItemText,
163
+ {
164
+ primary: incident.entityDisplayName,
165
+ primaryTypographyProps: {
166
+ variant: "body1",
167
+ className: classes.listItemPrimary
168
+ },
169
+ secondary: /* @__PURE__ */ jsxs(Typography, { noWrap: true, variant: "body2", color: "textSecondary", children: [
170
+ "#",
171
+ incident.incidentNumber,
172
+ " - Created ",
173
+ createdAt,
174
+ " ",
175
+ source() && `by ${source()}`
176
+ ] })
177
+ }
178
+ ),
179
+ incident.incidentLink && incident.incidentNumber && /* @__PURE__ */ jsxs(ListItemSecondaryAction, { children: [
180
+ !readOnly && /* @__PURE__ */ jsx(
181
+ IncidentAction,
182
+ {
183
+ currentPhase: incident.currentPhase || "",
184
+ incidentId: incident.entityId,
185
+ resolveAction: handleResolveIncident,
186
+ acknowledgeAction: handleAcknowledgeIncident
187
+ }
188
+ ),
189
+ /* @__PURE__ */ jsx(Tooltip, { title: "View in Splunk On-Call", placement: "top", children: /* @__PURE__ */ jsx(
190
+ IconButton,
191
+ {
192
+ href: incident.incidentLink,
193
+ target: "_blank",
194
+ rel: "noopener noreferrer",
195
+ color: "primary",
196
+ children: /* @__PURE__ */ jsx(OpenInBrowserIcon, {})
197
+ }
198
+ ) })
199
+ ] })
200
+ ] }, incident.entityId);
186
201
  };
187
202
 
188
203
  export { IncidentListItem };
@@ -1 +1 @@
1
- {"version":3,"file":"IncidentListItem.esm.js","sources":["../../../src/components/Incident/IncidentListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport DoneIcon from '@material-ui/icons/Done';\nimport DoneAllIcon from '@material-ui/icons/DoneAll';\nimport { DateTime, Duration } from 'luxon';\nimport { Incident, IncidentPhase } from '../types';\nimport OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';\nimport { splunkOnCallApiRef } from '../../api/client';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\nimport { TriggerAlarmRequest } from '../../api/types';\n\nimport {\n StatusError,\n StatusWarning,\n StatusOK,\n} from '@backstage/core-components';\nimport { useApi, alertApiRef } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles({\n denseListIcon: {\n marginRight: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n listItemPrimary: {\n fontWeight: 'bold',\n },\n listItemIcon: {\n minWidth: '1em',\n },\n secondaryAction: {\n paddingRight: 48,\n },\n});\n\ntype Props = {\n team: string;\n incident: Incident;\n onIncidentAction: () => void;\n readOnly: boolean;\n};\n\nconst IncidentPhaseStatus = ({\n currentPhase,\n}: {\n currentPhase: IncidentPhase;\n}) => {\n switch (currentPhase) {\n case 'UNACKED':\n return <StatusError />;\n case 'ACKED':\n return <StatusWarning />;\n default:\n return <StatusOK />;\n }\n};\n\nconst incidentPhaseTooltip = (currentPhase: IncidentPhase) => {\n switch (currentPhase) {\n case 'UNACKED':\n return 'Triggered';\n case 'ACKED':\n return 'Acknowledged';\n default:\n return 'Resolved';\n }\n};\n\nconst IncidentAction = ({\n currentPhase,\n incidentId,\n resolveAction,\n acknowledgeAction,\n}: {\n currentPhase: string;\n incidentId: string;\n resolveAction: (args: TriggerAlarmRequest) => void;\n acknowledgeAction: (args: TriggerAlarmRequest) => void;\n}) => {\n switch (currentPhase) {\n case 'UNACKED':\n return (\n <Tooltip title=\"Acknowledge\" placement=\"top\">\n <IconButton\n onClick={() =>\n acknowledgeAction({ incidentId, incidentType: 'ACKNOWLEDGEMENT' })\n }\n >\n <DoneIcon />\n </IconButton>\n </Tooltip>\n );\n case 'ACKED':\n return (\n <Tooltip title=\"Resolve\" placement=\"top\">\n <IconButton\n onClick={() =>\n resolveAction({ incidentId, incidentType: 'RECOVERY' })\n }\n >\n <DoneAllIcon />\n </IconButton>\n </Tooltip>\n );\n default:\n return <></>;\n }\n};\n\nexport const IncidentListItem = ({\n incident,\n readOnly,\n onIncidentAction,\n team,\n}: Props) => {\n const classes = useStyles();\n const duration =\n new Date().getTime() - new Date(incident.startTime!).getTime();\n const createdAt = DateTime.local()\n .minus(Duration.fromMillis(duration))\n .toRelative({ locale: 'en' });\n const alertApi = useApi(alertApiRef);\n const api = useApi(splunkOnCallApiRef);\n\n const hasBeenManuallyTriggered = incident.monitorName?.includes('vouser-');\n\n const source = () => {\n if (hasBeenManuallyTriggered) {\n return incident.monitorName?.replace('vouser-', '');\n }\n if (incident.monitorType === 'API') {\n return '{ REST }';\n }\n\n return incident.monitorName;\n };\n\n const [{ value: resolveValue, error: resolveError }, handleResolveIncident] =\n useAsyncFn(\n async ({ incidentId, incidentType }: TriggerAlarmRequest) =>\n await api.incidentAction({\n routingKey: team,\n incidentType,\n incidentId,\n }),\n );\n\n const [\n { value: acknowledgeValue, error: acknowledgeError },\n handleAcknowledgeIncident,\n ] = useAsyncFn(\n async ({ incidentId, incidentType }: TriggerAlarmRequest) =>\n await api.incidentAction({\n routingKey: team,\n incidentType,\n incidentId,\n }),\n );\n\n useEffect(() => {\n if (acknowledgeValue) {\n alertApi.post({\n message: `Incident successfully acknowledged`,\n });\n }\n\n if (resolveValue) {\n alertApi.post({\n message: `Incident successfully resolved`,\n });\n }\n if (resolveValue || acknowledgeValue) {\n onIncidentAction();\n }\n }, [acknowledgeValue, resolveValue, alertApi, onIncidentAction]);\n\n if (acknowledgeError) {\n alertApi.post({\n message: `Failed to acknowledge incident. ${acknowledgeError.message}`,\n severity: 'error',\n });\n }\n\n if (resolveError) {\n alertApi.post({\n message: `Failed to resolve incident. ${resolveError.message}`,\n severity: 'error',\n });\n }\n\n return (\n <ListItem dense key={incident.entityId}>\n <ListItemIcon className={classes.listItemIcon}>\n <Tooltip\n title={incidentPhaseTooltip(incident.currentPhase)}\n placement=\"top\"\n >\n <div className={classes.denseListIcon}>\n <IncidentPhaseStatus currentPhase={incident.currentPhase} />\n </div>\n </Tooltip>\n </ListItemIcon>\n <ListItemText\n primary={incident.entityDisplayName}\n primaryTypographyProps={{\n variant: 'body1',\n className: classes.listItemPrimary,\n }}\n secondary={\n <Typography noWrap variant=\"body2\" color=\"textSecondary\">\n #{incident.incidentNumber} - Created {createdAt}{' '}\n {source() && `by ${source()}`}\n </Typography>\n }\n />\n\n {incident.incidentLink && incident.incidentNumber && (\n <ListItemSecondaryAction>\n {!readOnly && (\n <IncidentAction\n currentPhase={incident.currentPhase || ''}\n incidentId={incident.entityId}\n resolveAction={handleResolveIncident}\n acknowledgeAction={handleAcknowledgeIncident}\n />\n )}\n <Tooltip title=\"View in Splunk On-Call\" placement=\"top\">\n <IconButton\n href={incident.incidentLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"primary\"\n >\n <OpenInBrowserIcon />\n </IconButton>\n </Tooltip>\n </ListItemSecondaryAction>\n )}\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,aAAe,EAAA;AAAA,IACb,WAAa,EAAA,CAAA;AAAA,IACb,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA,QAAA;AAAA,IACf,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,UAAY,EAAA;AAAA,GACd;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA;AAAA;AAElB,CAAC,CAAA;AASD,MAAM,sBAAsB,CAAC;AAAA,EAC3B;AACF,CAEM,KAAA;AACJ,EAAA,QAAQ,YAAc;AAAA,IACpB,KAAK,SAAA;AACH,MAAA,2CAAQ,WAAY,EAAA,IAAA,CAAA;AAAA,IACtB,KAAK,OAAA;AACH,MAAA,2CAAQ,aAAc,EAAA,IAAA,CAAA;AAAA,IACxB;AACE,MAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA;AAEvB,CAAA;AAEA,MAAM,oBAAA,GAAuB,CAAC,YAAgC,KAAA;AAC5D,EAAA,QAAQ,YAAc;AAAA,IACpB,KAAK,SAAA;AACH,MAAO,OAAA,WAAA;AAAA,IACT,KAAK,OAAA;AACH,MAAO,OAAA,cAAA;AAAA,IACT;AACE,MAAO,OAAA,UAAA;AAAA;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A,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,SAAS,QAAS,CAAA,iBAAA;AAAA,MAClB,sBAAwB,EAAA;AAAA,QACtB,OAAS,EAAA,OAAA;AAAA,QACT,WAAW,OAAQ,CAAA;AAAA,OACrB;AAAA,MACA,SAAA,sCACG,UAAW,EAAA,EAAA,MAAA,EAAM,MAAC,OAAQ,EAAA,OAAA,EAAQ,OAAM,eAAgB,EAAA,EAAA,GAAA,EACrD,SAAS,cAAe,EAAA,aAAA,EAAY,WAAW,GAChD,EAAA,MAAA,MAAY,CAAM,GAAA,EAAA,MAAA,EAAQ,CAC7B,CAAA;AAAA;AAAA,GAEJ,EAEC,SAAS,YAAgB,IAAA,QAAA,CAAS,kCAChC,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,IAAA,EACE,CAAC,QACA,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAc,SAAS,YAAgB,IAAA,EAAA;AAAA,MACvC,YAAY,QAAS,CAAA,QAAA;AAAA,MACrB,aAAe,EAAA,qBAAA;AAAA,MACf,iBAAmB,EAAA;AAAA;AAAA,qBAGtB,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,KAAM,EAAA,wBAAA,EAAyB,WAAU,KAChD,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,MAAM,QAAS,CAAA,YAAA;AAAA,MACf,MAAO,EAAA,QAAA;AAAA,MACP,GAAI,EAAA,qBAAA;AAAA,MACJ,KAAM,EAAA;AAAA,KAAA;AAAA,wCAEL,iBAAkB,EAAA,IAAA;AAAA,GAEvB,CACF,CAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"IncidentListItem.esm.js","sources":["../../../src/components/Incident/IncidentListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect } from 'react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport DoneIcon from '@material-ui/icons/Done';\nimport DoneAllIcon from '@material-ui/icons/DoneAll';\nimport { DateTime, Duration } from 'luxon';\nimport { Incident, IncidentPhase } from '../types';\nimport OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';\nimport { splunkOnCallApiRef } from '../../api/client';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\nimport { TriggerAlarmRequest } from '../../api/types';\n\nimport {\n StatusError,\n StatusWarning,\n StatusOK,\n} from '@backstage/core-components';\nimport { useApi, alertApiRef } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles({\n denseListIcon: {\n marginRight: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n listItemPrimary: {\n fontWeight: 'bold',\n },\n listItemIcon: {\n minWidth: '1em',\n },\n secondaryAction: {\n paddingRight: 48,\n },\n});\n\ntype Props = {\n team: string;\n incident: Incident;\n onIncidentAction: () => void;\n readOnly: boolean;\n};\n\nconst IncidentPhaseStatus = ({\n currentPhase,\n}: {\n currentPhase: IncidentPhase;\n}) => {\n switch (currentPhase) {\n case 'UNACKED':\n return <StatusError />;\n case 'ACKED':\n return <StatusWarning />;\n default:\n return <StatusOK />;\n }\n};\n\nconst incidentPhaseTooltip = (currentPhase: IncidentPhase) => {\n switch (currentPhase) {\n case 'UNACKED':\n return 'Triggered';\n case 'ACKED':\n return 'Acknowledged';\n default:\n return 'Resolved';\n }\n};\n\nconst IncidentAction = ({\n currentPhase,\n incidentId,\n resolveAction,\n acknowledgeAction,\n}: {\n currentPhase: string;\n incidentId: string;\n resolveAction: (args: TriggerAlarmRequest) => void;\n acknowledgeAction: (args: TriggerAlarmRequest) => void;\n}) => {\n switch (currentPhase) {\n case 'UNACKED':\n return (\n <Tooltip title=\"Acknowledge\" placement=\"top\">\n <IconButton\n onClick={() =>\n acknowledgeAction({ incidentId, incidentType: 'ACKNOWLEDGEMENT' })\n }\n >\n <DoneIcon />\n </IconButton>\n </Tooltip>\n );\n case 'ACKED':\n return (\n <Tooltip title=\"Resolve\" placement=\"top\">\n <IconButton\n onClick={() =>\n resolveAction({ incidentId, incidentType: 'RECOVERY' })\n }\n >\n <DoneAllIcon />\n </IconButton>\n </Tooltip>\n );\n default:\n return <></>;\n }\n};\n\nexport const IncidentListItem = ({\n incident,\n readOnly,\n onIncidentAction,\n team,\n}: Props) => {\n const classes = useStyles();\n const duration =\n new Date().getTime() - new Date(incident.startTime!).getTime();\n const createdAt = DateTime.local()\n .minus(Duration.fromMillis(duration))\n .toRelative({ locale: 'en' });\n const alertApi = useApi(alertApiRef);\n const api = useApi(splunkOnCallApiRef);\n\n const hasBeenManuallyTriggered = incident.monitorName?.includes('vouser-');\n\n const source = () => {\n if (hasBeenManuallyTriggered) {\n return incident.monitorName?.replace('vouser-', '');\n }\n if (incident.monitorType === 'API') {\n return '{ REST }';\n }\n\n return incident.monitorName;\n };\n\n const [{ value: resolveValue, error: resolveError }, handleResolveIncident] =\n useAsyncFn(\n async ({ incidentId, incidentType }: TriggerAlarmRequest) =>\n await api.incidentAction({\n routingKey: team,\n incidentType,\n incidentId,\n }),\n );\n\n const [\n { value: acknowledgeValue, error: acknowledgeError },\n handleAcknowledgeIncident,\n ] = useAsyncFn(\n async ({ incidentId, incidentType }: TriggerAlarmRequest) =>\n await api.incidentAction({\n routingKey: team,\n incidentType,\n incidentId,\n }),\n );\n\n useEffect(() => {\n if (acknowledgeValue) {\n alertApi.post({\n message: `Incident successfully acknowledged`,\n });\n }\n\n if (resolveValue) {\n alertApi.post({\n message: `Incident successfully resolved`,\n });\n }\n if (resolveValue || acknowledgeValue) {\n onIncidentAction();\n }\n }, [acknowledgeValue, resolveValue, alertApi, onIncidentAction]);\n\n if (acknowledgeError) {\n alertApi.post({\n message: `Failed to acknowledge incident. ${acknowledgeError.message}`,\n severity: 'error',\n });\n }\n\n if (resolveError) {\n alertApi.post({\n message: `Failed to resolve incident. ${resolveError.message}`,\n severity: 'error',\n });\n }\n\n return (\n <ListItem dense key={incident.entityId}>\n <ListItemIcon className={classes.listItemIcon}>\n <Tooltip\n title={incidentPhaseTooltip(incident.currentPhase)}\n placement=\"top\"\n >\n <div className={classes.denseListIcon}>\n <IncidentPhaseStatus currentPhase={incident.currentPhase} />\n </div>\n </Tooltip>\n </ListItemIcon>\n <ListItemText\n primary={incident.entityDisplayName}\n primaryTypographyProps={{\n variant: 'body1',\n className: classes.listItemPrimary,\n }}\n secondary={\n <Typography noWrap variant=\"body2\" color=\"textSecondary\">\n #{incident.incidentNumber} - Created {createdAt}{' '}\n {source() && `by ${source()}`}\n </Typography>\n }\n />\n\n {incident.incidentLink && incident.incidentNumber && (\n <ListItemSecondaryAction>\n {!readOnly && (\n <IncidentAction\n currentPhase={incident.currentPhase || ''}\n incidentId={incident.entityId}\n resolveAction={handleResolveIncident}\n acknowledgeAction={handleAcknowledgeIncident}\n />\n )}\n <Tooltip title=\"View in Splunk On-Call\" placement=\"top\">\n <IconButton\n href={incident.incidentLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"primary\"\n >\n <OpenInBrowserIcon />\n </IconButton>\n </Tooltip>\n </ListItemSecondaryAction>\n )}\n </ListItem>\n );\n};\n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A,UAAW,GAAA;AAAA,UAChD,MAAO,EAAA,IAAK,CAAM,GAAA,EAAA,MAAA,EAAQ,CAAA;AAAA,SAC7B,EAAA;AAAA;AAAA,KAEJ;AAAA,IAEC,QAAS,CAAA,YAAA,IAAgB,QAAS,CAAA,cAAA,yBAChC,uBACE,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,CAAC,QACA,oBAAA,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAc,SAAS,YAAgB,IAAA,EAAA;AAAA,UACvC,YAAY,QAAS,CAAA,QAAA;AAAA,UACrB,aAAe,EAAA,qBAAA;AAAA,UACf,iBAAmB,EAAA;AAAA;AAAA,OACrB;AAAA,sBAED,GAAA,CAAA,OAAA,EAAA,EAAQ,KAAM,EAAA,wBAAA,EAAyB,WAAU,KAChD,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,MAAM,QAAS,CAAA,YAAA;AAAA,UACf,MAAO,EAAA,QAAA;AAAA,UACP,GAAI,EAAA,qBAAA;AAAA,UACJ,KAAM,EAAA,SAAA;AAAA,UAEN,8BAAC,iBAAkB,EAAA,EAAA;AAAA;AAAA,OAEvB,EAAA;AAAA,KACF,EAAA;AAAA,GAAA,EAAA,EA7CiB,SAAS,QA+C9B,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useEffect } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useEffect } from 'react';
2
3
  import List from '@material-ui/core/List';
3
4
  import ListSubheader from '@material-ui/core/ListSubheader';
4
5
  import { makeStyles, createStyles } from '@material-ui/core/styles';
@@ -43,28 +44,31 @@ const Incidents = ({ readOnly, refreshIncidents, team }) => {
43
44
  getIncidents();
44
45
  }, [refreshIncidents, getIncidents]);
45
46
  if (error) {
46
- return /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Error encountered while fetching information. ", error.message);
47
+ return /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
48
+ "Error encountered while fetching information. ",
49
+ error.message
50
+ ] });
47
51
  }
48
52
  if (!loading && !incidents?.length) {
49
- return /* @__PURE__ */ React.createElement(IncidentsEmptyState, null);
53
+ return /* @__PURE__ */ jsx(IncidentsEmptyState, {});
50
54
  }
51
- return /* @__PURE__ */ React.createElement(
55
+ return /* @__PURE__ */ jsx(
52
56
  List,
53
57
  {
54
58
  className: classes.root,
55
59
  dense: true,
56
- subheader: /* @__PURE__ */ React.createElement(ListSubheader, { className: classes.subheader }, "CRITICAL INCIDENTS")
57
- },
58
- loading ? /* @__PURE__ */ React.createElement(Progress, { className: classes.progress }) : incidents.map((incident, index) => /* @__PURE__ */ React.createElement(
59
- IncidentListItem,
60
- {
61
- onIncidentAction: () => getIncidents(),
62
- key: index,
63
- team,
64
- incident,
65
- readOnly
66
- }
67
- ))
60
+ subheader: /* @__PURE__ */ jsx(ListSubheader, { className: classes.subheader, children: "CRITICAL INCIDENTS" }),
61
+ children: loading ? /* @__PURE__ */ jsx(Progress, { className: classes.progress }) : incidents.map((incident, index) => /* @__PURE__ */ jsx(
62
+ IncidentListItem,
63
+ {
64
+ onIncidentAction: () => getIncidents(),
65
+ team,
66
+ incident,
67
+ readOnly
68
+ },
69
+ index
70
+ ))
71
+ }
68
72
  );
69
73
  };
70
74
 
@@ -1 +1 @@
1
- {"version":3,"file":"Incidents.esm.js","sources":["../../../src/components/Incident/Incidents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\nimport List from '@material-ui/core/List';\nimport ListSubheader from '@material-ui/core/ListSubheader';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport { IncidentListItem } from './IncidentListItem';\nimport { IncidentsEmptyState } from './IncidentEmptyState';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\nimport { splunkOnCallApiRef } from '../../api';\nimport Alert from '@material-ui/lab/Alert';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n maxHeight: '400px',\n overflow: 'auto',\n },\n subheader: {\n backgroundColor: theme.palette.background.paper,\n },\n progress: {\n margin: theme.spacing(0, 2),\n },\n }),\n);\n\ntype Props = {\n refreshIncidents: boolean;\n team: string;\n readOnly: boolean;\n};\n\nexport const Incidents = ({ readOnly, refreshIncidents, team }: Props) => {\n const classes = useStyles();\n const api = useApi(splunkOnCallApiRef);\n\n const [{ value: incidents, loading, error }, getIncidents] = useAsyncFn(\n async () => {\n // For some reason the changes applied to incidents (trigger-resolve-acknowledge)\n // may take some time to actually be applied after receiving the response from the server.\n // The timeout compensates for this latency.\n await new Promise(resolve => setTimeout(resolve, 2000));\n const allIncidents = await api.getIncidents();\n const teams = await api.getTeams();\n const teamSlug = teams.find(teamValue => teamValue.name === team)?.slug;\n const filteredIncidents = teamSlug\n ? allIncidents.filter(incident =>\n incident.pagedTeams?.includes(teamSlug),\n )\n : [];\n return filteredIncidents;\n },\n );\n\n useEffect(() => {\n getIncidents();\n }, [refreshIncidents, getIncidents]);\n\n if (error) {\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (!loading && !incidents?.length) {\n return <IncidentsEmptyState />;\n }\n\n return (\n <List\n className={classes.root}\n dense\n subheader={\n <ListSubheader className={classes.subheader}>\n CRITICAL INCIDENTS\n </ListSubheader>\n }\n >\n {loading ? (\n <Progress className={classes.progress} />\n ) : (\n incidents!.map((incident, index) => (\n <IncidentListIt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AExC,EAAC;AACL,MAAO,OAAA,iBAAA;AAAA;AACT,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAa,YAAA,EAAA;AAAA,GACZ,EAAA,CAAC,gBAAkB,EAAA,YAAY,CAAC,CAAA;AAEnC,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,2CACG,KAAM,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,EAAA,gDAAA,EACyB,MAAM,OACvD,CAAA;AAAA;AAIJ,EAAA,IAAI,CAAC,OAAA,IAAW,CAAC,SAAA,EAAW,MAAQ,EAAA;AAClC,IAAA,2CAAQ,mBAAoB,EAAA,IAAA,CAAA;AAAA;AAG9B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,IAAA;AAAA,MACnB,KAAK,EAAA,IAAA;AAAA,MACL,2BACG,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,SAAW,EAAA,OAAA,CAAQ,aAAW,oBAE7C;AAAA,KAAA;AAAA,IAGD,OAAA,mBACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,OAAA,CAAQ,QAAU,EAAA,CAAA,GAEvC,SAAW,CAAA,GAAA,CAAI,CAAC,QAAA,EAAU,KACxB,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,gBAAA,EAAkB,MAAM,YAAa,EAAA;AAAA,QACrC,GAAK,EAAA,KAAA;AAAA,QACL,IAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA;AAAA,KAEH;AAAA,GAEL;AAEJ;;;;"}
1
+ {"version":3,"file":"Incidents.esm.js","sources":["../../../src/components/Incident/Incidents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect } from 'react';\nimport List from '@material-ui/core/List';\nimport ListSubheader from '@material-ui/core/ListSubheader';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport { IncidentListItem } from './IncidentListItem';\nimport { IncidentsEmptyState } from './IncidentEmptyState';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\nimport { splunkOnCallApiRef } from '../../api';\nimport Alert from '@material-ui/lab/Alert';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n maxHeight: '400px',\n overflow: 'auto',\n },\n subheader: {\n backgroundColor: theme.palette.background.paper,\n },\n progress: {\n margin: theme.spacing(0, 2),\n },\n }),\n);\n\ntype Props = {\n refreshIncidents: boolean;\n team: string;\n readOnly: boolean;\n};\n\nexport const Incidents = ({ readOnly, refreshIncidents, team }: Props) => {\n const classes = useStyles();\n const api = useApi(splunkOnCallApiRef);\n\n const [{ value: incidents, loading, error }, getIncidents] = useAsyncFn(\n async () => {\n // For some reason the changes applied to incidents (trigger-resolve-acknowledge)\n // may take some time to actually be applied after receiving the response from the server.\n // The timeout compensates for this latency.\n await new Promise(resolve => setTimeout(resolve, 2000));\n const allIncidents = await api.getIncidents();\n const teams = await api.getTeams();\n const teamSlug = teams.find(teamValue => teamValue.name === team)?.slug;\n const filteredIncidents = teamSlug\n ? allIncidents.filter(incident =>\n incident.pagedTeams?.includes(teamSlug),\n )\n : [];\n return filteredIncidents;\n },\n );\n\n useEffect(() => {\n getIncidents();\n }, [refreshIncidents, getIncidents]);\n\n if (error) {\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (!loading && !incidents?.length) {\n return <IncidentsEmptyState />;\n }\n\n return (\n <List\n className={classes.root}\n dense\n subheader={\n <ListSubheader className={classes.subheader}>\n CRITICAL INCIDENTS\n </ListSubheader>\n }\n >\n {loading ? (\n <Progress className={classes.progress} />\n ) : (\n incidents!.map((incident, index) => (\n <IncidentListItem\n onIncidentAction={() => getIncidents()}\n key={index}\n team={team}\n incident={incident}\n readOnly={readOnly}\n />\n ))\n )}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA6BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,SAAW,EAAA,OAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,SAAW,EAAA;AAAA,MACT,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA;AAAA,KAC5C;AAAA,IACA,QAAU,EAAA;AAAA,MACR,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC;AAAA;AAC5B,GACD;AACH,CAAA;AAQO,MAAM,YAAY,CAAC,EAAE,QAAU,EAAA,gBAAA,EAAkB,MAAkB,KAAA;AACxE,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AAErC,EAAM,MAAA,CAAC,EAAE,KAAO,EAAA,SAAA,EAAW,SAAS,KAAM,EAAA,EAAG,YAAY,CAAI,GAAA,UAAA;AAAA,IAC3D,YAAY;AAIV,MAAA,MAAM,IAAI,OAAQ,CAAA,CAAA,OAAA,KAAW,UAAW,CAAA,OAAA,EAAS,GAAI,CAAC,CAAA;AACtD,MAAM,MAAA,YAAA,GAAe,MAAM,GAAA,CAAI,YAAa,EAAA;AAC5C,MAAM,MAAA,KAAA,GAAQ,MAAM,GAAA,CAAI,QAAS,EAAA;AACjC,MAAA,MAAM,WAAW,KAAM,CAAA,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A,OAKR;AAAA;AAAA,GAEL;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
4
  import { EntitySplunkOnCallCard } from './EntitySplunkOnCallCard.esm.js';
@@ -12,7 +12,13 @@ const useStyles = makeStyles(() => ({
12
12
  const SplunkOnCallPage = (props) => {
13
13
  const { title, subtitle, pageTitle } = props;
14
14
  const classes = useStyles();
15
- return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title, subtitle }), /* @__PURE__ */ React.createElement(Content, { className: classes.overflowXScroll }, /* @__PURE__ */ React.createElement(ContentHeader, { title: pageTitle }, /* @__PURE__ */ React.createElement(SupportButton, null, "This is used to help you automate incident management.")), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "row" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 4 }, /* @__PURE__ */ React.createElement(EntitySplunkOnCallCard, null)))));
15
+ return /* @__PURE__ */ jsxs(Page, { themeId: "tool", children: [
16
+ /* @__PURE__ */ jsx(Header, { title, subtitle }),
17
+ /* @__PURE__ */ jsxs(Content, { className: classes.overflowXScroll, children: [
18
+ /* @__PURE__ */ jsx(ContentHeader, { title: pageTitle, children: /* @__PURE__ */ jsx(SupportButton, { children: "This is used to help you automate incident management." }) }),
19
+ /* @__PURE__ */ jsx(Grid, { container: true, spacing: 3, direction: "row", children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, children: /* @__PURE__ */ jsx(EntitySplunkOnCallCard, {}) }) })
20
+ ] })
21
+ ] });
16
22
  };
17
23
  SplunkOnCallPage.defaultProps = {
18
24
  title: "Splunk On-Call",
@@ -1 +1 @@
1
- {"version":3,"file":"SplunkOnCallPage.esm.js","sources":["../../src/components/SplunkOnCallPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { EntitySplunkOnCallCard } from './EntitySplunkOnCallCard';\nimport {\n Content,\n ContentHeader,\n Page,\n Header,\n SupportButton,\n} from '@backstage/core-components';\n\nconst useStyles = makeStyles(() => ({\n overflowXScroll: {\n overflowX: 'scroll',\n },\n}));\n\n/** @public */\nexport type SplunkOnCallPageProps = {\n title?: string;\n subtitle?: string;\n pageTitle?: string;\n};\n\nexport const SplunkOnCallPage = (props: SplunkOnCallPageProps): JSX.Element => {\n const { title, subtitle, pageTitle } = props;\n const classes = useStyles();\n\n return (\n <Page themeId=\"tool\">\n <Header title={title} subtitle={subtitle} />\n <Content className={classes.overflowXScroll}>\n <ContentHeader title={pageTitle}>\n <SupportButton>\n This is used to help you automate incident management.\n </SupportButton>\n </ContentHeader>\n <Grid container spacing={3} direction=\"row\">\n <Grid item xs={12} sm={6} md={4}>\n <EntitySplunkOnCallCard />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n\nSplunkOnCallPage.defaultProps = {\n title: 'Splunk On-Call',\n subtitle: 'Automate incident management',\n pageTitle: 'Dashboard',\n};\n"],"names":[],"mappings":";;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,eAAiB,EAAA;AAAA,IACf,SAAW,EAAA;AAAA;AAEf,CAAE,CAAA,CAAA;AASW,MAAA,gBAAA,GAAmB,CAAC,KAA8C,KAAA;AAC7E,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA;AACvC,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,MAAO,EAAA,EAAA,KAAA,EAAc,UAAoB,CAC1C,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,mCACzB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAO,SACpB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,EAAA,wDAEf,CACF,CAAA,sCACC,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAG,WAAU,KACpC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EAAI,EAAA,EAAA,EAAI,GAAG,EAAI,EAAA,CAAA,EAAA,sCAC3B,sBAAuB,EAAA,IAAA,CAC1B,CACF,CACF,CACF,CAAA;AAEJ;AAEA,gBAAA,CAAiB,YAAe,GAAA;AAAA,EAC9B,KAAO,EAAA,gBAAA;AAAA,EACP,QAAU,EAAA,8BAAA;AAAA,EACV,SAAW,EAAA;AACb,CAAA;;;;"}
1
+ {"version":3,"file":"SplunkOnCallPage.esm.js","sources":["../../src/components/SplunkOnCallPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { EntitySplunkOnCallCard } from './EntitySplunkOnCallCard';\nimport {\n Content,\n ContentHeader,\n Page,\n Header,\n SupportButton,\n} from '@backstage/core-components';\n\nconst useStyles = makeStyles(() => ({\n overflowXScroll: {\n overflowX: 'scroll',\n },\n}));\n\n/** @public */\nexport type SplunkOnCallPageProps = {\n title?: string;\n subtitle?: string;\n pageTitle?: string;\n};\n\nexport const SplunkOnCallPage = (props: SplunkOnCallPageProps): JSX.Element => {\n const { title, subtitle, pageTitle } = props;\n const classes = useStyles();\n\n return (\n <Page themeId=\"tool\">\n <Header title={title} subtitle={subtitle} />\n <Content className={classes.overflowXScroll}>\n <ContentHeader title={pageTitle}>\n <SupportButton>\n This is used to help you automate incident management.\n </SupportButton>\n </ContentHeader>\n <Grid container spacing={3} direction=\"row\">\n <Grid item xs={12} sm={6} md={4}>\n <EntitySplunkOnCallCard />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n\nSplunkOnCallPage.defaultProps = {\n title: 'Splunk On-Call',\n subtitle: 'Automate incident management',\n pageTitle: 'Dashboard',\n};\n"],"names":[],"mappings":";;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,eAAiB,EAAA;AAAA,IACf,SAAW,EAAA;AAAA;AAEf,CAAE,CAAA,CAAA;AASW,MAAA,gBAAA,GAAmB,CAAC,KAA8C,KAAA;AAC7E,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA;AACvC,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,MAAA,EAAA,EAAO,OAAc,QAAoB,EAAA,CAAA;AAAA,oBACzC,IAAA,CAAA,OAAA,EAAA,EAAQ,SAAW,EAAA,OAAA,CAAQ,eAC1B,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,iBAAc,KAAO,EAAA,SAAA,EACpB,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,oEAEf,CACF,EAAA,CAAA;AAAA,sBACA,GAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,SAAS,CAAG,EAAA,SAAA,EAAU,OACpC,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,IAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CAC5B,EAAA,QAAA,kBAAA,GAAA,CAAC,sBAAuB,EAAA,EAAA,CAAA,EAC1B,CACF,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;AAEA,gBAAA,CAAiB,YAAe,GAAA;AAAA,EAC9B,KAAO,EAAA,gBAAA;AAAA,EACP,QAAU,EAAA,8BAAA;AAAA,EACV,SAAW,EAAA;AACb,CAAA;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
2
3
  import Dialog from '@material-ui/core/Dialog';
3
4
  import DialogTitle from '@material-ui/core/DialogTitle';
4
5
  import TextField from '@material-ui/core/TextField';
@@ -98,107 +99,135 @@ const TriggerDialog = ({
98
99
  severity: "error"
99
100
  });
100
101
  }
101
- return /* @__PURE__ */ React.createElement(Dialog, { maxWidth: "md", open: showDialog, onClose: handleDialog, fullWidth: true }, /* @__PURE__ */ React.createElement(DialogTitle, null, "This action will trigger an incident"), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1", gutterBottom: true, align: "justify" }, "Created by: ", /* @__PURE__ */ React.createElement("b", null, `{ REST } Endpoint`)), /* @__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(
102
- Typography,
103
- {
104
- variant: "body1",
105
- style: { marginTop: "1em" },
106
- gutterBottom: true,
107
- align: "justify"
108
- },
109
- "Please describe the problem you want to report. Be as descriptive as possible. ",
110
- /* @__PURE__ */ React.createElement("br", null),
111
- "Note that only the ",
112
- /* @__PURE__ */ React.createElement("b", null, "Incident type"),
113
- ", ",
114
- /* @__PURE__ */ React.createElement("b", null, "Incident display name"),
115
- " ",
116
- "and the ",
117
- /* @__PURE__ */ React.createElement("b", null, "Incident message"),
118
- " fields are ",
119
- /* @__PURE__ */ React.createElement("b", null, "required"),
120
- "."
121
- ), /* @__PURE__ */ React.createElement(FormControl, { className: classes.formControl }, /* @__PURE__ */ React.createElement("div", { className: classes.formHeader }, /* @__PURE__ */ React.createElement(InputLabel, { id: "demo-simple-select-label" }, "Incident type"), /* @__PURE__ */ React.createElement(
122
- Select,
123
- {
124
- id: "incident-type",
125
- className: classes.incidentType,
126
- value: incidentType,
127
- onChange: handleIncidentType,
128
- inputProps: { "data-testid": "trigger-incident-type" }
129
- },
130
- /* @__PURE__ */ React.createElement(MenuItem, { value: "CRITICAL" }, "Critical"),
131
- /* @__PURE__ */ React.createElement(MenuItem, { value: "WARNING" }, "Warning"),
132
- /* @__PURE__ */ React.createElement(MenuItem, { value: "INFO" }, "Info")
133
- )), /* @__PURE__ */ React.createElement(
134
- TextField,
135
- {
136
- className: classes.formHeader,
137
- id: "datetime-local",
138
- label: "Incident start time",
139
- type: "datetime-local",
140
- onChange: handleIncidentStartTime,
141
- InputLabelProps: {
142
- shrink: true
143
- }
144
- }
145
- )), /* @__PURE__ */ React.createElement(
146
- TextField,
147
- {
148
- inputProps: { "data-testid": "trigger-incident-id" },
149
- id: "summary",
150
- fullWidth: true,
151
- margin: "normal",
152
- label: "Incident id",
153
- variant: "outlined",
154
- onChange: handleIncidentId
155
- }
156
- ), /* @__PURE__ */ React.createElement(
157
- TextField,
158
- {
159
- required: true,
160
- inputProps: { "data-testid": "trigger-incident-displayName" },
161
- id: "summary",
162
- fullWidth: true,
163
- margin: "normal",
164
- label: "Incident display name",
165
- variant: "outlined",
166
- onChange: handleIncidentDisplayName
167
- }
168
- ), /* @__PURE__ */ React.createElement(
169
- TextField,
170
- {
171
- required: true,
172
- inputProps: { "data-testid": "trigger-incident-message" },
173
- id: "details",
174
- multiline: true,
175
- fullWidth: true,
176
- minRows: "2",
177
- margin: "normal",
178
- label: "Incident message",
179
- variant: "outlined",
180
- onChange: handleIncidentMessage
181
- }
182
- )), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(
183
- Button,
184
- {
185
- "data-testid": "trigger-button",
186
- id: "trigger",
187
- color: "secondary",
188
- disabled: !incidentType.length || !incidentDisplayName || !incidentMessage || triggerLoading,
189
- variant: "contained",
190
- onClick: () => handleTriggerAlarm({
191
- routingKey,
192
- incidentType,
193
- incidentDisplayName,
194
- incidentMessage,
195
- ...incidentId ? { incidentId } : {},
196
- ...incidentStartTime ? { incidentStartTime } : {}
197
- }),
198
- endIcon: triggerLoading && /* @__PURE__ */ React.createElement(CircularProgress, { size: 16 })
199
- },
200
- "Trigger Incident"
201
- ), /* @__PURE__ */ React.createElement(Button, { id: "close", color: "primary", onClick: handleDialog }, "Close")));
102
+ return /* @__PURE__ */ jsxs(Dialog, { maxWidth: "md", open: showDialog, onClose: handleDialog, fullWidth: true, children: [
103
+ /* @__PURE__ */ jsx(DialogTitle, { children: "This action will trigger an incident" }),
104
+ /* @__PURE__ */ jsxs(DialogContent, { children: [
105
+ /* @__PURE__ */ jsxs(Typography, { variant: "subtitle1", gutterBottom: true, align: "justify", children: [
106
+ "Created by: ",
107
+ /* @__PURE__ */ jsx("b", { children: `{ REST } Endpoint` })
108
+ ] }),
109
+ /* @__PURE__ */ jsx(Alert, { severity: "info", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", align: "justify", children: `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.` }) }),
110
+ /* @__PURE__ */ jsxs(
111
+ Typography,
112
+ {
113
+ variant: "body1",
114
+ style: { marginTop: "1em" },
115
+ gutterBottom: true,
116
+ align: "justify",
117
+ children: [
118
+ "Please describe the problem you want to report. Be as descriptive as possible. ",
119
+ /* @__PURE__ */ jsx("br", {}),
120
+ "Note that only the ",
121
+ /* @__PURE__ */ jsx("b", { children: "Incident type" }),
122
+ ", ",
123
+ /* @__PURE__ */ jsx("b", { children: "Incident display name" }),
124
+ " ",
125
+ "and the ",
126
+ /* @__PURE__ */ jsx("b", { children: "Incident message" }),
127
+ " fields are ",
128
+ /* @__PURE__ */ jsx("b", { children: "required" }),
129
+ "."
130
+ ]
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsxs(FormControl, { className: classes.formControl, children: [
134
+ /* @__PURE__ */ jsxs("div", { className: classes.formHeader, children: [
135
+ /* @__PURE__ */ jsx(InputLabel, { id: "demo-simple-select-label", children: "Incident type" }),
136
+ /* @__PURE__ */ jsxs(
137
+ Select,
138
+ {
139
+ id: "incident-type",
140
+ className: classes.incidentType,
141
+ value: incidentType,
142
+ onChange: handleIncidentType,
143
+ inputProps: { "data-testid": "trigger-incident-type" },
144
+ children: [
145
+ /* @__PURE__ */ jsx(MenuItem, { value: "CRITICAL", children: "Critical" }),
146
+ /* @__PURE__ */ jsx(MenuItem, { value: "WARNING", children: "Warning" }),
147
+ /* @__PURE__ */ jsx(MenuItem, { value: "INFO", children: "Info" })
148
+ ]
149
+ }
150
+ )
151
+ ] }),
152
+ /* @__PURE__ */ jsx(
153
+ TextField,
154
+ {
155
+ className: classes.formHeader,
156
+ id: "datetime-local",
157
+ label: "Incident start time",
158
+ type: "datetime-local",
159
+ onChange: handleIncidentStartTime,
160
+ InputLabelProps: {
161
+ shrink: true
162
+ }
163
+ }
164
+ )
165
+ ] }),
166
+ /* @__PURE__ */ jsx(
167
+ TextField,
168
+ {
169
+ inputProps: { "data-testid": "trigger-incident-id" },
170
+ id: "summary",
171
+ fullWidth: true,
172
+ margin: "normal",
173
+ label: "Incident id",
174
+ variant: "outlined",
175
+ onChange: handleIncidentId
176
+ }
177
+ ),
178
+ /* @__PURE__ */ jsx(
179
+ TextField,
180
+ {
181
+ required: true,
182
+ inputProps: { "data-testid": "trigger-incident-displayName" },
183
+ id: "summary",
184
+ fullWidth: true,
185
+ margin: "normal",
186
+ label: "Incident display name",
187
+ variant: "outlined",
188
+ onChange: handleIncidentDisplayName
189
+ }
190
+ ),
191
+ /* @__PURE__ */ jsx(
192
+ TextField,
193
+ {
194
+ required: true,
195
+ inputProps: { "data-testid": "trigger-incident-message" },
196
+ id: "details",
197
+ multiline: true,
198
+ fullWidth: true,
199
+ minRows: "2",
200
+ margin: "normal",
201
+ label: "Incident message",
202
+ variant: "outlined",
203
+ onChange: handleIncidentMessage
204
+ }
205
+ )
206
+ ] }),
207
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
208
+ /* @__PURE__ */ jsx(
209
+ Button,
210
+ {
211
+ "data-testid": "trigger-button",
212
+ id: "trigger",
213
+ color: "secondary",
214
+ disabled: !incidentType.length || !incidentDisplayName || !incidentMessage || triggerLoading,
215
+ variant: "contained",
216
+ onClick: () => handleTriggerAlarm({
217
+ routingKey,
218
+ incidentType,
219
+ incidentDisplayName,
220
+ incidentMessage,
221
+ ...incidentId ? { incidentId } : {},
222
+ ...incidentStartTime ? { incidentStartTime } : {}
223
+ }),
224
+ endIcon: triggerLoading && /* @__PURE__ */ jsx(CircularProgress, { size: 16 }),
225
+ children: "Trigger Incident"
226
+ }
227
+ ),
228
+ /* @__PURE__ */ jsx(Button, { id: "close", color: "primary", onClick: handleDialog, children: "Close" })
229
+ ] })
230
+ ] });
202
231
  };
203
232
 
204
233
  export { TriggerDialog };