@backstage-community/plugin-splunk-on-call 0.8.1 → 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/CHANGELOG.md +12 -0
- package/dist/components/EntitySplunkOnCallCard.esm.js +88 -59
- package/dist/components/EntitySplunkOnCallCard.esm.js.map +1 -1
- package/dist/components/Errors/MissingApiKeyOrApiIdError.esm.js +6 -6
- package/dist/components/Errors/MissingApiKeyOrApiIdError.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationPolicy.esm.js +12 -9
- package/dist/components/Escalation/EscalationPolicy.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationUser.esm.js +16 -8
- package/dist/components/Escalation/EscalationUser.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationUsersEmptyState.esm.js +5 -2
- package/dist/components/Escalation/EscalationUsersEmptyState.esm.js.map +1 -1
- package/dist/components/Incident/IncidentEmptyState.esm.js +15 -13
- package/dist/components/Incident/IncidentEmptyState.esm.js.map +1 -1
- package/dist/components/Incident/IncidentListItem.esm.js +65 -50
- package/dist/components/Incident/IncidentListItem.esm.js.map +1 -1
- package/dist/components/Incident/Incidents.esm.js +20 -16
- package/dist/components/Incident/Incidents.esm.js.map +1 -1
- package/dist/components/SplunkOnCallPage.esm.js +8 -2
- package/dist/components/SplunkOnCallPage.esm.js.map +1 -1
- package/dist/components/TriggerDialog/TriggerDialog.esm.js +131 -102
- package/dist/components/TriggerDialog/TriggerDialog.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-splunk-on-call
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2f5c952: Backstage version bump to v1.39.0
|
|
8
|
+
|
|
9
|
+
## 0.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8d69769: Backstage version bump to v1.38.1
|
|
14
|
+
|
|
3
15
|
## 0.8.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
2
3
|
import useAsync from 'react-use/esm/useAsync';
|
|
3
4
|
import { MissingAnnotationEmptyState, useEntity } from '@backstage/plugin-catalog-react';
|
|
4
5
|
import Card from '@material-ui/core/Card';
|
|
@@ -20,7 +21,18 @@ import { EmptyState, Progress, HeaderIconLinkRow } from '@backstage/core-compone
|
|
|
20
21
|
|
|
21
22
|
const SPLUNK_ON_CALL_TEAM = "splunk.com/on-call-team";
|
|
22
23
|
const SPLUNK_ON_CALL_ROUTING_KEY = "splunk.com/on-call-routing-key";
|
|
23
|
-
const MissingAnnotation = () => /* @__PURE__ */
|
|
24
|
+
const MissingAnnotation = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
25
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
26
|
+
"The Splunk On Call plugin requires setting either the",
|
|
27
|
+
" ",
|
|
28
|
+
/* @__PURE__ */ jsx("code", { children: SPLUNK_ON_CALL_TEAM }),
|
|
29
|
+
" or the",
|
|
30
|
+
" ",
|
|
31
|
+
/* @__PURE__ */ jsx("code", { children: SPLUNK_ON_CALL_ROUTING_KEY }),
|
|
32
|
+
" annotation."
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ jsx(MissingAnnotationEmptyState, { annotation: SPLUNK_ON_CALL_TEAM })
|
|
35
|
+
] });
|
|
24
36
|
const InvalidAnnotation = ({
|
|
25
37
|
teamName,
|
|
26
38
|
routingKey
|
|
@@ -32,23 +44,26 @@ const InvalidAnnotation = ({
|
|
|
32
44
|
if (teamName) {
|
|
33
45
|
titleSuffix = `"${teamName}" team name`;
|
|
34
46
|
}
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(CardHeader, { title: "Splunk On-Call" }),
|
|
49
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(
|
|
50
|
+
EmptyState,
|
|
51
|
+
{
|
|
52
|
+
title: `Splunk On-Call API returned no record of teams associated with the ${titleSuffix}`,
|
|
53
|
+
missing: "info",
|
|
54
|
+
description: "Escalation Policy and incident information unavailable. Splunk On-Call requires a valid team name or routing key."
|
|
55
|
+
}
|
|
56
|
+
) })
|
|
57
|
+
] });
|
|
43
58
|
};
|
|
44
|
-
const MissingEventsRestEndpoint = () => /* @__PURE__ */
|
|
59
|
+
const MissingEventsRestEndpoint = () => /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(
|
|
45
60
|
EmptyState,
|
|
46
61
|
{
|
|
47
62
|
title: "No Splunk On-Call REST endpoint available.",
|
|
48
63
|
missing: "info",
|
|
49
64
|
description: "You need to add a valid REST endpoint to your 'app-config.yaml' if you want to enable Splunk On-Call."
|
|
50
65
|
}
|
|
51
|
-
));
|
|
66
|
+
) });
|
|
52
67
|
const isSplunkOnCallAvailable = (entity) => Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_TEAM]) || Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_ROUTING_KEY]);
|
|
53
68
|
const useStyles = makeStyles({
|
|
54
69
|
onCallCard: {
|
|
@@ -108,22 +123,25 @@ const EntitySplunkOnCallCard = (props) => {
|
|
|
108
123
|
return { usersHashMap, foundTeams, foundRoutingKey };
|
|
109
124
|
});
|
|
110
125
|
if (!teamAnnotation && !routingKeyAnnotation) {
|
|
111
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ jsx(MissingAnnotation, {});
|
|
112
127
|
}
|
|
113
128
|
if (!eventsRestEndpoint) {
|
|
114
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ jsx(MissingEventsRestEndpoint, {});
|
|
115
130
|
}
|
|
116
131
|
if (error instanceof UnauthorizedError) {
|
|
117
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ jsx(MissingApiKeyOrApiIdError, {});
|
|
118
133
|
}
|
|
119
134
|
if (error) {
|
|
120
|
-
return /* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
|
|
136
|
+
"Error encountered while fetching information. ",
|
|
137
|
+
error.message
|
|
138
|
+
] });
|
|
121
139
|
}
|
|
122
140
|
if (loading) {
|
|
123
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
124
142
|
}
|
|
125
143
|
if (!entityData?.foundTeams || !entityData?.foundTeams.length) {
|
|
126
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ jsx(
|
|
127
145
|
InvalidAnnotation,
|
|
128
146
|
{
|
|
129
147
|
teamName: teamAnnotation,
|
|
@@ -135,54 +153,65 @@ const EntitySplunkOnCallCard = (props) => {
|
|
|
135
153
|
label: "Create Incident",
|
|
136
154
|
onClick: handleDialog,
|
|
137
155
|
color: "secondary",
|
|
138
|
-
icon: /* @__PURE__ */
|
|
156
|
+
icon: /* @__PURE__ */ jsx(AlarmAddIcon, {})
|
|
139
157
|
};
|
|
140
158
|
const serviceLink = {
|
|
141
159
|
label: "Portal",
|
|
142
160
|
href: "https://portal.victorops.com/",
|
|
143
|
-
icon: /* @__PURE__ */
|
|
161
|
+
icon: /* @__PURE__ */ jsx(WebIcon, {})
|
|
144
162
|
};
|
|
145
163
|
const teams = entityData?.foundTeams || [];
|
|
146
|
-
return /* @__PURE__ */
|
|
164
|
+
return /* @__PURE__ */ jsx(Fragment, { children: teams.map((team, i) => {
|
|
147
165
|
const teamName = team?.name ?? "";
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
166
|
+
return /* @__PURE__ */ jsxs(Card, { className: classes.onCallCard, children: [
|
|
167
|
+
/* @__PURE__ */ jsx(
|
|
168
|
+
CardHeader,
|
|
169
|
+
{
|
|
170
|
+
title: "Splunk On-Call",
|
|
171
|
+
subheader: [
|
|
172
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
173
|
+
"Team: ",
|
|
174
|
+
team && team.name ? team.name : ""
|
|
175
|
+
] }, "team_name"),
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
HeaderIconLinkRow,
|
|
178
|
+
{
|
|
179
|
+
links: !readOnly ? [serviceLink, triggerLink] : [serviceLink]
|
|
180
|
+
},
|
|
181
|
+
"incident_trigger"
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
187
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
188
|
+
/* @__PURE__ */ jsx(
|
|
189
|
+
Incidents,
|
|
190
|
+
{
|
|
191
|
+
readOnly: readOnly || false,
|
|
192
|
+
team: teamName,
|
|
193
|
+
refreshIncidents
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
entityData?.usersHashMap && team && /* @__PURE__ */ jsx(
|
|
197
|
+
EscalationPolicy,
|
|
198
|
+
{
|
|
199
|
+
team: teamName,
|
|
200
|
+
users: entityData?.usersHashMap
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
TriggerDialog,
|
|
205
|
+
{
|
|
206
|
+
routingKey: entityData?.foundRoutingKey?.routingKey ?? teamName,
|
|
207
|
+
showDialog,
|
|
208
|
+
handleDialog,
|
|
209
|
+
onIncidentCreated: handleRefresh
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] })
|
|
213
|
+
] }, i);
|
|
214
|
+
}) });
|
|
186
215
|
};
|
|
187
216
|
|
|
188
217
|
export { EntitySplunkOnCallCard, InvalidAnnotation, MissingAnnotation, MissingEventsRestEndpoint, SPLUNK_ON_CALL_ROUTING_KEY, SPLUNK_ON_CALL_TEAM, isSplunkOnCallAvailable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySplunkOnCallCard.esm.js","sources":["../../src/components/EntitySplunkOnCallCard.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 */\nimport React, { useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport AlarmAddIcon from '@material-ui/icons/AlarmAdd';\nimport WebIcon from '@material-ui/icons/Web';\nimport Alert from '@material-ui/lab/Alert';\nimport { splunkOnCallApiRef, UnauthorizedError } from '../api';\nimport { MissingApiKeyOrApiIdError } from './Errors';\nimport { EscalationPolicy } from './Escalation';\nimport { Incidents } from './Incident';\nimport { TriggerDialog } from './TriggerDialog';\nimport { RoutingKey, User } from './types';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport {\n EmptyState,\n HeaderIconLinkRow,\n IconLinkVerticalProps,\n Progress,\n} from '@backstage/core-components';\n\nexport const SPLUNK_ON_CALL_TEAM = 'splunk.com/on-call-team';\nexport const SPLUNK_ON_CALL_ROUTING_KEY = 'splunk.com/on-call-routing-key';\n\nexport const MissingAnnotation = () => (\n <div>\n <Typography>\n The Splunk On Call plugin requires setting either the{' '}\n <code>{SPLUNK_ON_CALL_TEAM}</code> or the{' '}\n <code>{SPLUNK_ON_CALL_ROUTING_KEY}</code> annotation.\n </Typography>\n <MissingAnnotationEmptyState annotation={SPLUNK_ON_CALL_TEAM} />\n </div>\n);\n\nexport const InvalidAnnotation = ({\n teamName,\n routingKey,\n}: {\n teamName: string | undefined;\n routingKey: string | undefined;\n}) => {\n let titleSuffix = 'provided annotation';\n\n if (routingKey) {\n titleSuffix = `\"${routingKey}\" routing key`;\n }\n\n if (teamName) {\n titleSuffix = `\"${teamName}\" team name`;\n }\n\n return (\n <Card>\n <CardHeader title=\"Splunk On-Call\" />\n <CardContent>\n <EmptyState\n title={`Splunk On-Call API returned no record of teams associated with the ${titleSuffix}`}\n missing=\"info\"\n description=\"Escalation Policy and incident information unavailable. Splunk On-Call requires a valid team name or routing key.\"\n />\n </CardContent>\n </Card>\n );\n};\n\nexport const MissingEventsRestEndpoint = () => (\n <CardContent>\n <EmptyState\n title=\"No Splunk On-Call REST endpoint available.\"\n missing=\"info\"\n description=\"You need to add a valid REST endpoint to your 'app-config.yaml' if you want to enable Splunk On-Call.\"\n />\n </CardContent>\n);\n\n/** @public */\nexport const isSplunkOnCallAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_TEAM]) ||\n Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_ROUTING_KEY]);\n\nconst useStyles = makeStyles({\n onCallCard: {\n marginBottom: '1em',\n },\n});\n\n/** @public */\nexport type EntitySplunkOnCallCardProps = {\n readOnly?: boolean;\n};\n\n/** @public */\nexport const EntitySplunkOnCallCard = (props: EntitySplunkOnCallCardProps) => {\n const { readOnly } = props;\n const classes = useStyles();\n const config = useApi(configApiRef);\n const api = useApi(splunkOnCallApiRef);\n const { entity } = useEntity();\n const [showDialog, setShowDialog] = useState<boolean>(false);\n const [refreshIncidents, setRefreshIncidents] = useState<boolean>(false);\n const teamAnnotation = entity\n ? entity.metadata.annotations![SPLUNK_ON_CALL_TEAM]\n : undefined;\n const routingKeyAnnotation = entity\n ? entity.metadata.annotations![SPLUNK_ON_CALL_ROUTING_KEY]\n : undefined;\n\n const eventsRestEndpoint =\n config.getOptionalString('splunkOnCall.eventsRestEndpoint') || null;\n\n const handleRefresh = useCallback(() => {\n setRefreshIncidents(x => !x);\n }, []);\n\n const handleDialog = useCallback(() => {\n setShowDialog(x => !x);\n }, []);\n\n const {\n value: entityData,\n loading,\n error,\n } = useAsync(async () => {\n const allUsers = await api.getUsers();\n const usersHashMap = allUsers.reduce(\n (map: Record<string, User>, obj: User) => {\n if (obj.username) {\n map[obj.username] = obj;\n }\n return map;\n },\n {},\n );\n const teams = await api.getTeams();\n let foundTeams = [\n teams.find(teamValue => teamValue.name === teamAnnotation),\n ].filter(team => team !== undefined);\n\n let foundRoutingKey: RoutingKey | undefined;\n if (routingKeyAnnotation) {\n const routingKeys = await api.getRoutingKeys();\n foundRoutingKey = routingKeys.find(\n key => key.routingKey === routingKeyAnnotation,\n );\n }\n\n if (!foundTeams.length) {\n foundTeams = foundRoutingKey\n ? foundRoutingKey.targets\n .map(target => {\n const teamUrlParts = target._teamUrl.split('/');\n const teamSlug = teamUrlParts[teamUrlParts.length - 1];\n\n return teams.find(teamValue => teamValue.slug === teamSlug);\n })\n .filter(team => team !== undefined)\n : [];\n }\n\n return { usersHashMap, foundTeams, foundRoutingKey };\n });\n\n if (!teamAnnotation && !routingKeyAnnotation) {\n return <MissingAnnotation />;\n }\n\n if (!eventsRestEndpoint) {\n return <MissingEventsRestEndpoint />;\n }\n\n if (error instanceof UnauthorizedError) {\n return <MissingApiKeyOrApiIdError />;\n }\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) {\n return <Progress />;\n }\n\n if (!entityData?.foundTeams || !entityData?.foundTeams.length) {\n return (\n <InvalidAnnotation\n teamName={teamAnnotation}\n routingKey={routingKeyAnnotation}\n />\n );\n }\n\n const triggerLink: IconLinkVerticalProps = {\n label: 'Create Incident',\n onClick: handleDialog,\n color: 'secondary',\n icon: <AlarmAddIcon />,\n };\n\n const serviceLink = {\n label: 'Portal',\n href: 'https://portal.victorops.com/',\n icon: <WebIcon />,\n };\n\n const teams = entityData?.foundTeams || [];\n\n return (\n <>\n {teams.map((team, i) => {\n const teamName = team?.name ?? '';\n return (\n <Card key={i} className={classes.onCallCard}>\n <CardHeader\n title=\"Splunk On-Call\"\n subheader={[\n <Typography key=\"team_name\">\n Team: {team && team.name ? team.name : ''}\n </Typography>,\n <HeaderIconLinkRow\n key=\"incident_trigger\"\n links={!readOnly ? [serviceLink, triggerLink] : [serviceLink]}\n />,\n ]}\n />\n <Divider />\n <CardContent>\n <Incidents\n readOnly={readOnly || false}\n team={teamName}\n refreshIncidents={refreshIncidents}\n />\n {entityData?.usersHashMap && team && (\n <EscalationPolicy\n team={teamName}\n users={entityData?.usersHashMap}\n />\n )}\n <TriggerDialog\n routingKey={entityData?.foundRoutingKey?.routingKey ?? teamName}\n showDialog={showDialog}\n handleDialog={handleDialog}\n onIncidentCreated={handleRefresh}\n />\n </CardContent>\n </Card>\n );\n })}\n </>\n );\n};\n"],"names":["teams"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8CO,MAAM,mBAAsB,GAAA;AAC5B,MAAM,0BAA6B,GAAA;AAE7B,MAAA,iBAAA,GAAoB,sBAC/B,KAAA,CAAA,aAAA,CAAC,KACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAW,uDAC4C,EAAA,GAAA,kBACrD,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAM,mBAAoB,CAAA,EAAO,WAAQ,GAC1C,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,IAAA,EAAA,0BAA2B,CAAO,EAAA,cAC3C,mBACC,KAAA,CAAA,aAAA,CAAA,2BAAA,EAAA,EAA4B,UAAY,EAAA,mBAAA,EAAqB,CAChE;AAGK,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAA,IAAI,WAAc,GAAA,qBAAA;AAElB,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,WAAA,GAAc,IAAI,UAAU,CAAA,aAAA,CAAA;AAAA;AAG9B,EAAA,IAAI,QAAU,EAAA;AACZ,IAAA,WAAA,GAAc,IAAI,QAAQ,CAAA,WAAA,CAAA;AAAA;AAG5B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,4BACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAM,gBAAiB,EAAA,CAAA,sCAClC,WACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,sEAAsE,WAAW,CAAA,CAAA;AAAA,MACxF,OAAQ,EAAA,MAAA;AAAA,MACR,WAAY,EAAA;AAAA;AAAA,GAEhB,CACF,CAAA;AAEJ;AAEa,MAAA,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A,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,UAAU,QAAY,IAAA,KAAA;AAAA,QACtB,IAAM,EAAA,QAAA;AAAA,QACN;AAAA;AAAA,KACF,EACC,UAAY,EAAA,YAAA,IAAgB,IAC3B,oBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,QAAA;AAAA,QACN,OAAO,UAAY,EAAA;AAAA;AAAA,KAGvB,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,UAAA,EAAY,UAAY,EAAA,eAAA,EAAiB,UAAc,IAAA,QAAA;AAAA,QACvD,UAAA;AAAA,QACA,YAAA;AAAA,QACA,iBAAmB,EAAA;AAAA;AAAA,KAEvB,CACF,CAAA;AAAA,GAEH,CACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"EntitySplunkOnCallCard.esm.js","sources":["../../src/components/EntitySplunkOnCallCard.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 */\nimport { useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport AlarmAddIcon from '@material-ui/icons/AlarmAdd';\nimport WebIcon from '@material-ui/icons/Web';\nimport Alert from '@material-ui/lab/Alert';\nimport { splunkOnCallApiRef, UnauthorizedError } from '../api';\nimport { MissingApiKeyOrApiIdError } from './Errors';\nimport { EscalationPolicy } from './Escalation';\nimport { Incidents } from './Incident';\nimport { TriggerDialog } from './TriggerDialog';\nimport { RoutingKey, User } from './types';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport {\n EmptyState,\n HeaderIconLinkRow,\n IconLinkVerticalProps,\n Progress,\n} from '@backstage/core-components';\n\nexport const SPLUNK_ON_CALL_TEAM = 'splunk.com/on-call-team';\nexport const SPLUNK_ON_CALL_ROUTING_KEY = 'splunk.com/on-call-routing-key';\n\nexport const MissingAnnotation = () => (\n <div>\n <Typography>\n The Splunk On Call plugin requires setting either the{' '}\n <code>{SPLUNK_ON_CALL_TEAM}</code> or the{' '}\n <code>{SPLUNK_ON_CALL_ROUTING_KEY}</code> annotation.\n </Typography>\n <MissingAnnotationEmptyState annotation={SPLUNK_ON_CALL_TEAM} />\n </div>\n);\n\nexport const InvalidAnnotation = ({\n teamName,\n routingKey,\n}: {\n teamName: string | undefined;\n routingKey: string | undefined;\n}) => {\n let titleSuffix = 'provided annotation';\n\n if (routingKey) {\n titleSuffix = `\"${routingKey}\" routing key`;\n }\n\n if (teamName) {\n titleSuffix = `\"${teamName}\" team name`;\n }\n\n return (\n <Card>\n <CardHeader title=\"Splunk On-Call\" />\n <CardContent>\n <EmptyState\n title={`Splunk On-Call API returned no record of teams associated with the ${titleSuffix}`}\n missing=\"info\"\n description=\"Escalation Policy and incident information unavailable. Splunk On-Call requires a valid team name or routing key.\"\n />\n </CardContent>\n </Card>\n );\n};\n\nexport const MissingEventsRestEndpoint = () => (\n <CardContent>\n <EmptyState\n title=\"No Splunk On-Call REST endpoint available.\"\n missing=\"info\"\n description=\"You need to add a valid REST endpoint to your 'app-config.yaml' if you want to enable Splunk On-Call.\"\n />\n </CardContent>\n);\n\n/** @public */\nexport const isSplunkOnCallAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_TEAM]) ||\n Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_ROUTING_KEY]);\n\nconst useStyles = makeStyles({\n onCallCard: {\n marginBottom: '1em',\n },\n});\n\n/** @public */\nexport type EntitySplunkOnCallCardProps = {\n readOnly?: boolean;\n};\n\n/** @public */\nexport const EntitySplunkOnCallCard = (props: EntitySplunkOnCallCardProps) => {\n const { readOnly } = props;\n const classes = useStyles();\n const config = useApi(configApiRef);\n const api = useApi(splunkOnCallApiRef);\n const { entity } = useEntity();\n const [showDialog, setShowDialog] = useState<boolean>(false);\n const [refreshIncidents, setRefreshIncidents] = useState<boolean>(false);\n const teamAnnotation = entity\n ? entity.metadata.annotations![SPLUNK_ON_CALL_TEAM]\n : undefined;\n const routingKeyAnnotation = entity\n ? entity.metadata.annotations![SPLUNK_ON_CALL_ROUTING_KEY]\n : undefined;\n\n const eventsRestEndpoint =\n config.getOptionalString('splunkOnCall.eventsRestEndpoint') || null;\n\n const handleRefresh = useCallback(() => {\n setRefreshIncidents(x => !x);\n }, []);\n\n const handleDialog = useCallback(() => {\n setShowDialog(x => !x);\n }, []);\n\n const {\n value: entityData,\n loading,\n error,\n } = useAsync(async () => {\n const allUsers = await api.getUsers();\n const usersHashMap = allUsers.reduce(\n (map: Record<string, User>, obj: User) => {\n if (obj.username) {\n map[obj.username] = obj;\n }\n return map;\n },\n {},\n );\n const teams = await api.getTeams();\n let foundTeams = [\n teams.find(teamValue => teamValue.name === teamAnnotation),\n ].filter(team => team !== undefined);\n\n let foundRoutingKey: RoutingKey | undefined;\n if (routingKeyAnnotation) {\n const routingKeys = await api.getRoutingKeys();\n foundRoutingKey = routingKeys.find(\n key => key.routingKey === routingKeyAnnotation,\n );\n }\n\n if (!foundTeams.length) {\n foundTeams = foundRoutingKey\n ? foundRoutingKey.targets\n .map(target => {\n const teamUrlParts = target._teamUrl.split('/');\n const teamSlug = teamUrlParts[teamUrlParts.length - 1];\n\n return teams.find(teamValue => teamValue.slug === teamSlug);\n })\n .filter(team => team !== undefined)\n : [];\n }\n\n return { usersHashMap, foundTeams, foundRoutingKey };\n });\n\n if (!teamAnnotation && !routingKeyAnnotation) {\n return <MissingAnnotation />;\n }\n\n if (!eventsRestEndpoint) {\n return <MissingEventsRestEndpoint />;\n }\n\n if (error instanceof UnauthorizedError) {\n return <MissingApiKeyOrApiIdError />;\n }\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) {\n return <Progress />;\n }\n\n if (!entityData?.foundTeams || !entityData?.foundTeams.length) {\n return (\n <InvalidAnnotation\n teamName={teamAnnotation}\n routingKey={routingKeyAnnotation}\n />\n );\n }\n\n const triggerLink: IconLinkVerticalProps = {\n label: 'Create Incident',\n onClick: handleDialog,\n color: 'secondary',\n icon: <AlarmAddIcon />,\n };\n\n const serviceLink = {\n label: 'Portal',\n href: 'https://portal.victorops.com/',\n icon: <WebIcon />,\n };\n\n const teams = entityData?.foundTeams || [];\n\n return (\n <>\n {teams.map((team, i) => {\n const teamName = team?.name ?? '';\n return (\n <Card key={i} className={classes.onCallCard}>\n <CardHeader\n title=\"Splunk On-Call\"\n subheader={[\n <Typography key=\"team_name\">\n Team: {team && team.name ? team.name : ''}\n </Typography>,\n <HeaderIconLinkRow\n key=\"incident_trigger\"\n links={!readOnly ? [serviceLink, triggerLink] : [serviceLink]}\n />,\n ]}\n />\n <Divider />\n <CardContent>\n <Incidents\n readOnly={readOnly || false}\n team={teamName}\n refreshIncidents={refreshIncidents}\n />\n {entityData?.usersHashMap && team && (\n <EscalationPolicy\n team={teamName}\n users={entityData?.usersHashMap}\n />\n )}\n <TriggerDialog\n routingKey={entityData?.foundRoutingKey?.routingKey ?? teamName}\n showDialog={showDialog}\n handleDialog={handleDialog}\n onIncidentCreated={handleRefresh}\n />\n </CardContent>\n </Card>\n );\n })}\n </>\n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AAA,UAAA;AAAA,YACC,UAAU,QAAY,IAAA,KAAA;AAAA,YACtB,IAAM,EAAA,QAAA;AAAA,YACN;AAAA;AAAA,SACF;AAAA,QACC,UAAA,EAAY,gBAAgB,IAC3B,oBAAA,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,IAAM,EAAA,QAAA;AAAA,YACN,OAAO,UAAY,EAAA;AAAA;AAAA,SACrB;AAAA,wBAEF,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,UAAA,EAAY,UAAY,EAAA,eAAA,EAAiB,UAAc,IAAA,QAAA;AAAA,YACvD,UAAA;AAAA,YACA,YAAA;AAAA,YACA,iBAAmB,EAAA;AAAA;AAAA;AACrB,OACF,EAAA;AAAA,KAAA,EAAA,EAhCS,CAiCX,CAAA;AAAA,GAEH,CACH,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Button from '@material-ui/core/Button';
|
|
3
3
|
import { EmptyState } from '@backstage/core-components';
|
|
4
4
|
|
|
5
|
-
const MissingApiKeyOrApiIdError = () => /* @__PURE__ */
|
|
5
|
+
const MissingApiKeyOrApiIdError = () => /* @__PURE__ */ jsx(
|
|
6
6
|
EmptyState,
|
|
7
7
|
{
|
|
8
8
|
missing: "info",
|
|
9
9
|
title: "Missing or invalid Splunk On-Call API key and/or API id",
|
|
10
10
|
description: "The request to fetch data needs a valid api id and a valid api key. See README for more details.",
|
|
11
|
-
action: /* @__PURE__ */
|
|
11
|
+
action: /* @__PURE__ */ jsx(
|
|
12
12
|
Button,
|
|
13
13
|
{
|
|
14
14
|
color: "primary",
|
|
15
15
|
variant: "contained",
|
|
16
|
-
href: "https://github.com/backstage/backstage/blob/master/plugins/splunk-on-call/README.md"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
href: "https://github.com/backstage/backstage/blob/master/plugins/splunk-on-call/README.md",
|
|
17
|
+
children: "Read More"
|
|
18
|
+
}
|
|
19
19
|
)
|
|
20
20
|
}
|
|
21
21
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingApiKeyOrApiIdError.esm.js","sources":["../../../src/components/Errors/MissingApiKeyOrApiIdError.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 */\nimport
|
|
1
|
+
{"version":3,"file":"MissingApiKeyOrApiIdError.esm.js","sources":["../../../src/components/Errors/MissingApiKeyOrApiIdError.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 */\nimport Button from '@material-ui/core/Button';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingApiKeyOrApiIdError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid Splunk On-Call API key and/or API id\"\n description=\"The request to fetch data needs a valid api id and a valid api key. See README for more details.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://github.com/backstage/backstage/blob/master/plugins/splunk-on-call/README.md\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAkBO,MAAM,4BAA4B,sBACvC,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAQ,EAAA,MAAA;AAAA,IACR,KAAM,EAAA,yDAAA;AAAA,IACN,WAAY,EAAA,kGAAA;AAAA,IACZ,MACE,kBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,WAAA;AAAA,QACR,IAAK,EAAA,qFAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import List from '@material-ui/core/List';
|
|
3
3
|
import ListSubheader from '@material-ui/core/ListSubheader';
|
|
4
4
|
import { makeStyles, createStyles } from '@material-ui/core/styles';
|
|
@@ -43,21 +43,24 @@ const EscalationPolicy = ({ users, team }) => {
|
|
|
43
43
|
return teamUsernames;
|
|
44
44
|
});
|
|
45
45
|
if (error) {
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
|
|
47
|
+
"Error encountered while fetching information. ",
|
|
48
|
+
error.message
|
|
49
|
+
] });
|
|
47
50
|
}
|
|
48
51
|
if (!loading && !userNames?.length) {
|
|
49
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsx(EscalationUsersEmptyState, {});
|
|
50
53
|
}
|
|
51
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
52
55
|
List,
|
|
53
56
|
{
|
|
54
57
|
className: classes.root,
|
|
55
58
|
dense: true,
|
|
56
|
-
subheader: /* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
subheader: /* @__PURE__ */ jsx(ListSubheader, { className: classes.subheader, children: "ON CALL" }),
|
|
60
|
+
children: loading ? /* @__PURE__ */ jsx(Progress, { className: classes.progress }) : userNames && userNames.map(
|
|
61
|
+
(userName, index) => userName && userName in users && /* @__PURE__ */ jsx(EscalationUser, { user: users[userName] }, index)
|
|
62
|
+
)
|
|
63
|
+
}
|
|
61
64
|
);
|
|
62
65
|
};
|
|
63
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EscalationPolicy.esm.js","sources":["../../../src/components/Escalation/EscalationPolicy.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
|
|
1
|
+
{"version":3,"file":"EscalationPolicy.esm.js","sources":["../../../src/components/Escalation/EscalationPolicy.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 List from '@material-ui/core/List';\nimport ListSubheader from '@material-ui/core/ListSubheader';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport { EscalationUsersEmptyState } from './EscalationUsersEmptyState';\nimport { EscalationUser } from './EscalationUser';\nimport useAsync from 'react-use/esm/useAsync';\nimport { splunkOnCallApiRef } from '../../api';\nimport Alert from '@material-ui/lab/Alert';\nimport { User } from '../types';\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 users: { [key: string]: User };\n team: string;\n};\n\nexport const EscalationPolicy = ({ users, team }: Props) => {\n const classes = useStyles();\n const api = useApi(splunkOnCallApiRef);\n\n const {\n value: userNames,\n loading,\n error,\n } = useAsync(async () => {\n const oncalls = await api.getOnCallUsers();\n const teamUsernames = oncalls\n .filter(oncall => oncall.team?.name === team)\n .flatMap(oncall => {\n return oncall.oncallNow?.flatMap(oncallNow => {\n return oncallNow.users?.flatMap(user => {\n return user?.onCalluser?.username;\n });\n });\n });\n return teamUsernames;\n });\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 && !userNames?.length) {\n return <EscalationUsersEmptyState />;\n }\n\n return (\n <List\n className={classes.root}\n dense\n subheader={\n <ListSubheader className={classes.subheader}>ON CALL</ListSubheader>\n }\n >\n {loading ? (\n <Progress className={classes.progress} />\n ) : (\n userNames &&\n userNames.map(\n (userName, index) =>\n userName &&\n userName in users && (\n <EscalationUser key={index} user={users[userName]} />\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;AAC5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aAAA,EAAA,EAAc,SAAW,EAAA,OAAA,CAAQ,WAAW,QAAO,EAAA,SAAA,EAAA,CAAA;AAAA,MAGrD,QAAA,EAAA,OAAA,uBACE,QAAS,EAAA,EAAA,SAAA,EAAW,QAAQ,QAAU,EAAA,CAAA,GAEvC,aACA,SAAU,CAAA,GAAA;AAAA,QACR,CAAC,QAAA,EAAU,KACT,KAAA,QAAA,IACA,QAAY,IAAA,KAAA,oBACT,GAAA,CAAA,cAAA,EAAA,EAA2B,IAAM,EAAA,KAAA,CAAM,QAAQ,CAAA,EAAA,EAA3B,KAA8B;AAAA;AAEzD;AAAA,GAEJ;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import ListItem from '@material-ui/core/ListItem';
|
|
3
3
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
4
4
|
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
|
|
@@ -17,13 +17,21 @@ const useStyles = makeStyles({
|
|
|
17
17
|
});
|
|
18
18
|
const EscalationUser = ({ user }) => {
|
|
19
19
|
const classes = useStyles();
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
return /* @__PURE__ */ jsxs(ListItem, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Avatar, { alt: "User" }) }),
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
ListItemText,
|
|
24
|
+
{
|
|
25
|
+
primary: /* @__PURE__ */ jsxs(Typography, { className: classes.listItemPrimary, children: [
|
|
26
|
+
user.firstName,
|
|
27
|
+
" ",
|
|
28
|
+
user.lastName
|
|
29
|
+
] }),
|
|
30
|
+
secondary: user.email
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(ListItemSecondaryAction, { children: /* @__PURE__ */ jsx(Tooltip, { title: "Send e-mail to user", placement: "top", children: /* @__PURE__ */ jsx(IconButton, { href: `mailto:${user.email}`, children: /* @__PURE__ */ jsx(EmailIcon, { color: "primary" }) }) }) })
|
|
34
|
+
] });
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
export { EscalationUser };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EscalationUser.esm.js","sources":["../../../src/components/Escalation/EscalationUser.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
|
|
1
|
+
{"version":3,"file":"EscalationUser.esm.js","sources":["../../../src/components/Escalation/EscalationUser.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 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 Avatar from '@material-ui/core/Avatar';\nimport EmailIcon from '@material-ui/icons/Email';\nimport { User } from '../types';\n\nconst useStyles = makeStyles({\n listItemPrimary: {\n fontWeight: 'bold',\n },\n});\n\ntype Props = {\n user: User;\n};\n\nexport const EscalationUser = ({ user }: Props) => {\n const classes = useStyles();\n\n return (\n <ListItem>\n <ListItemIcon>\n <Avatar alt=\"User\" />\n </ListItemIcon>\n <ListItemText\n primary={\n <Typography className={classes.listItemPrimary}>\n {user.firstName} {user.lastName}\n </Typography>\n }\n secondary={user.email}\n />\n <ListItemSecondaryAction>\n <Tooltip title=\"Send e-mail to user\" placement=\"top\">\n <IconButton href={`mailto:${user.email}`}>\n <EmailIcon color=\"primary\" />\n </IconButton>\n </Tooltip>\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA4BA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,eAAiB,EAAA;AAAA,IACf,UAAY,EAAA;AAAA;AAEhB,CAAC,CAAA;AAMM,MAAM,cAAiB,GAAA,CAAC,EAAE,IAAA,EAAkB,KAAA;AACjD,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,4BACG,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,YACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,GAAA,EAAI,QAAO,CACrB,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OACE,kBAAA,IAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAW,QAAQ,eAC5B,EAAA,QAAA,EAAA;AAAA,UAAK,IAAA,CAAA,SAAA;AAAA,UAAU,GAAA;AAAA,UAAE,IAAK,CAAA;AAAA,SACzB,EAAA,CAAA;AAAA,QAEF,WAAW,IAAK,CAAA;AAAA;AAAA,KAClB;AAAA,oBACA,GAAA,CAAC,2BACC,QAAC,kBAAA,GAAA,CAAA,OAAA,EAAA,EAAQ,OAAM,qBAAsB,EAAA,SAAA,EAAU,OAC7C,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,MAAM,CAAU,OAAA,EAAA,IAAA,CAAK,KAAK,CACpC,CAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,aAAU,KAAM,EAAA,SAAA,EAAU,CAC7B,EAAA,CAAA,EACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import ListItem from '@material-ui/core/ListItem';
|
|
3
3
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
4
4
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
@@ -16,7 +16,10 @@ const useStyles = makeStyles({
|
|
|
16
16
|
});
|
|
17
17
|
const EscalationUsersEmptyState = () => {
|
|
18
18
|
const classes = useStyles();
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsxs(ListItem, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx("div", { className: classes.denseListIcon, children: /* @__PURE__ */ jsx(StatusWarning, {}) }) }),
|
|
21
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: "Empty escalation policy" })
|
|
22
|
+
] });
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
export { EscalationUsersEmptyState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EscalationUsersEmptyState.esm.js","sources":["../../../src/components/Escalation/EscalationUsersEmptyState.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
|
|
1
|
+
{"version":3,"file":"EscalationUsersEmptyState.esm.js","sources":["../../../src/components/Escalation/EscalationUsersEmptyState.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 ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { StatusWarning } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n denseListIcon: {\n marginRight: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport const EscalationUsersEmptyState = () => {\n const classes = useStyles();\n return (\n <ListItem>\n <ListItemIcon>\n <div className={classes.denseListIcon}>\n <StatusWarning />\n </div>\n </ListItemIcon>\n <ListItemText primary=\"Empty escalation policy\" />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBA,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;AAEpB,CAAC,CAAA;AAEM,MAAM,4BAA4B,MAAM;AAC7C,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,4BACG,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,YAAA,EAAA,EACC,8BAAC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,aACtB,EAAA,QAAA,kBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA,EACjB,CACF,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,YAAa,EAAA,EAAA,OAAA,EAAQ,yBAA0B,EAAA;AAAA,GAClD,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Grid from '@material-ui/core/Grid';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import EmptyStateImage from '../../assets/emptystate.svg';
|
|
5
5
|
|
|
6
6
|
const IncidentsEmptyState = () => {
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ jsxs(
|
|
8
8
|
Grid,
|
|
9
9
|
{
|
|
10
10
|
container: true,
|
|
11
11
|
justifyContent: "center",
|
|
12
12
|
direction: "column",
|
|
13
|
-
alignItems: "center"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Nice! No incidents found!" }) }),
|
|
16
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
17
|
+
"img",
|
|
18
|
+
{
|
|
19
|
+
src: EmptyStateImage,
|
|
20
|
+
alt: "EmptyState",
|
|
21
|
+
"data-testid": "emptyStateImg"
|
|
22
|
+
}
|
|
23
|
+
) })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
24
26
|
);
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncidentEmptyState.esm.js","sources":["../../../src/components/Incident/IncidentEmptyState.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
|
|
1
|
+
{"version":3,"file":"IncidentEmptyState.esm.js","sources":["../../../src/components/Incident/IncidentEmptyState.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 Typography from '@material-ui/core/Typography';\nimport EmptyStateImage from '../../assets/emptystate.svg';\n\nexport const IncidentsEmptyState = () => {\n return (\n <Grid\n container\n justifyContent=\"center\"\n direction=\"column\"\n alignItems=\"center\"\n >\n <Grid item xs={12}>\n <Typography variant=\"h5\">Nice! No incidents found!</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={EmptyStateImage}\n alt=\"EmptyState\"\n data-testid=\"emptyStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;AAoBO,MAAM,sBAAsB,MAAM;AACvC,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,cAAe,EAAA,QAAA;AAAA,MACf,SAAU,EAAA,QAAA;AAAA,MACV,UAAW,EAAA,QAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EACb,8BAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAK,EAAA,QAAA,EAAA,2BAAA,EAAyB,CACpD,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,GAAK,EAAA,eAAA;AAAA,YACL,GAAI,EAAA,YAAA;AAAA,YACJ,aAAY,EAAA;AAAA;AAAA,SAEhB,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|