@backstage-community/plugin-splunk-on-call 0.4.24 → 0.4.26

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/client.esm.js +114 -0
  3. package/dist/api/client.esm.js.map +1 -0
  4. package/dist/components/EntitySplunkOnCallCard.esm.js +189 -0
  5. package/dist/components/EntitySplunkOnCallCard.esm.js.map +1 -0
  6. package/dist/components/Errors/MissingApiKeyOrApiIdError.esm.js +24 -0
  7. package/dist/components/Errors/MissingApiKeyOrApiIdError.esm.js.map +1 -0
  8. package/dist/components/Escalation/EscalationPolicy.esm.js +65 -0
  9. package/dist/components/Escalation/EscalationPolicy.esm.js.map +1 -0
  10. package/dist/components/Escalation/EscalationUser.esm.js +30 -0
  11. package/dist/components/Escalation/EscalationUser.esm.js.map +1 -0
  12. package/dist/components/Escalation/EscalationUsersEmptyState.esm.js +23 -0
  13. package/dist/components/Escalation/EscalationUsersEmptyState.esm.js.map +1 -0
  14. package/dist/components/Incident/IncidentEmptyState.esm.js +28 -0
  15. package/dist/components/Incident/IncidentEmptyState.esm.js.map +1 -0
  16. package/dist/components/Incident/IncidentListItem.esm.js +189 -0
  17. package/dist/components/Incident/IncidentListItem.esm.js.map +1 -0
  18. package/dist/components/Incident/Incidents.esm.js +72 -0
  19. package/dist/components/Incident/Incidents.esm.js.map +1 -0
  20. package/dist/components/SplunkOnCallPage.esm.js +24 -0
  21. package/dist/components/SplunkOnCallPage.esm.js.map +1 -0
  22. package/dist/components/TriggerDialog/TriggerDialog.esm.js +205 -0
  23. package/dist/components/TriggerDialog/TriggerDialog.esm.js.map +1 -0
  24. package/dist/index.esm.js +3 -43
  25. package/dist/index.esm.js.map +1 -1
  26. package/dist/plugin.esm.js +37 -0
  27. package/dist/plugin.esm.js.map +1 -0
  28. package/package.json +14 -10
  29. package/dist/esm/SplunkOnCallPage-D9lfarwB.esm.js +0 -62
  30. package/dist/esm/SplunkOnCallPage-D9lfarwB.esm.js.map +0 -1
  31. package/dist/esm/index-D8KSFXg5.esm.js +0 -912
  32. package/dist/esm/index-D8KSFXg5.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage-community/plugin-splunk-on-call
2
2
 
3
+ ## 0.4.26
4
+
5
+ ### Patch Changes
6
+
7
+ - 2606a46: Backstage version bump to v1.30.2
8
+
9
+ ## 0.4.25
10
+
11
+ ### Patch Changes
12
+
13
+ - 31f5b59: Backstage version bump to v1.29.2
14
+
3
15
  ## 0.4.24
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,114 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+
3
+ class UnauthorizedError extends Error {
4
+ }
5
+ const splunkOnCallApiRef = createApiRef({
6
+ id: "plugin.splunk-on-call.api"
7
+ });
8
+ class SplunkOnCallClient {
9
+ constructor(config) {
10
+ this.config = config;
11
+ }
12
+ static fromConfig(configApi, discoveryApi) {
13
+ const eventsRestEndpoint = configApi.getOptionalString("splunkOnCall.eventsRestEndpoint") || null;
14
+ return new SplunkOnCallClient({
15
+ eventsRestEndpoint,
16
+ discoveryApi
17
+ });
18
+ }
19
+ async getIncidents() {
20
+ const url = `${await this.config.discoveryApi.getBaseUrl(
21
+ "proxy"
22
+ )}/splunk-on-call/v1/incidents`;
23
+ const { incidents } = await this.findByUrl(url);
24
+ return incidents;
25
+ }
26
+ async getOnCallUsers() {
27
+ const url = `${await this.config.discoveryApi.getBaseUrl(
28
+ "proxy"
29
+ )}/splunk-on-call/v1/oncall/current`;
30
+ const { teamsOnCall } = await this.findByUrl(url);
31
+ return teamsOnCall;
32
+ }
33
+ async getTeams() {
34
+ const url = `${await this.config.discoveryApi.getBaseUrl(
35
+ "proxy"
36
+ )}/splunk-on-call/v1/team`;
37
+ const teams = await this.findByUrl(url);
38
+ return teams;
39
+ }
40
+ async getRoutingKeys() {
41
+ const url = `${await this.config.discoveryApi.getBaseUrl(
42
+ "proxy"
43
+ )}/splunk-on-call/v1/org/routing-keys`;
44
+ const { routingKeys } = await this.findByUrl(url);
45
+ return routingKeys;
46
+ }
47
+ async getUsers() {
48
+ const url = `${await this.config.discoveryApi.getBaseUrl(
49
+ "proxy"
50
+ )}/splunk-on-call/v2/user`;
51
+ const { users } = await this.findByUrl(url);
52
+ return users;
53
+ }
54
+ async getEscalationPolicies() {
55
+ const url = `${await this.config.discoveryApi.getBaseUrl(
56
+ "proxy"
57
+ )}/splunk-on-call/v1/policies`;
58
+ const { policies } = await this.findByUrl(url);
59
+ return policies;
60
+ }
61
+ async incidentAction(options) {
62
+ const {
63
+ routingKey,
64
+ incidentType,
65
+ incidentId,
66
+ incidentDisplayName,
67
+ incidentMessage,
68
+ incidentStartTime
69
+ } = options;
70
+ const body = JSON.stringify({
71
+ message_type: incidentType,
72
+ ...incidentId ? { entity_id: incidentId } : {},
73
+ ...incidentDisplayName ? { entity_display_name: incidentDisplayName } : {},
74
+ ...incidentMessage ? { state_message: incidentMessage } : {},
75
+ ...incidentStartTime ? { state_start_time: incidentStartTime } : {}
76
+ });
77
+ const request = {
78
+ method: "POST",
79
+ headers: {
80
+ Accept: "application/json",
81
+ "Content-Type": "application/json"
82
+ },
83
+ body
84
+ };
85
+ const url = `${this.config.eventsRestEndpoint}/${routingKey}`;
86
+ return this.request(url, request);
87
+ }
88
+ async findByUrl(url) {
89
+ const options = {
90
+ method: "GET",
91
+ headers: {
92
+ "Content-Type": "application/json"
93
+ }
94
+ };
95
+ const response = await this.request(url, options);
96
+ return response.json();
97
+ }
98
+ async request(url, options) {
99
+ const response = await fetch(url, options);
100
+ if (response.status === 403) {
101
+ throw new UnauthorizedError();
102
+ }
103
+ if (!response.ok) {
104
+ const payload = await response.json();
105
+ const errors = payload.errors.map((error) => error).join(" ");
106
+ const message = `Request failed with ${response.status}, ${errors}`;
107
+ throw new Error(message);
108
+ }
109
+ return response;
110
+ }
111
+ }
112
+
113
+ export { SplunkOnCallClient, UnauthorizedError, splunkOnCallApiRef };
114
+ //# sourceMappingURL=client.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.esm.js","sources":["../../src/api/client.ts"],"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 {\n Incident,\n OnCall,\n User,\n EscalationPolicyInfo,\n RoutingKey,\n Team,\n} from '../components/types';\nimport {\n SplunkOnCallApi,\n TriggerAlarmRequest,\n IncidentsResponse,\n OnCallsResponse,\n ClientApiConfig,\n RequestOptions,\n ListUserResponse,\n EscalationPolicyResponse,\n ListRoutingKeyResponse,\n} from './types';\nimport {\n createApiRef,\n DiscoveryApi,\n ConfigApi,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport class UnauthorizedError extends Error {}\n\n/** @public */\nexport const splunkOnCallApiRef = createApiRef<SplunkOnCallApi>({\n id: 'plugin.splunk-on-call.api',\n});\n\n/** @public */\nexport class SplunkOnCallClient implements SplunkOnCallApi {\n static fromConfig(configApi: ConfigApi, discoveryApi: DiscoveryApi) {\n const eventsRestEndpoint: string | null =\n configApi.getOptionalString('splunkOnCall.eventsRestEndpoint') || null;\n return new SplunkOnCallClient({\n eventsRestEndpoint,\n discoveryApi,\n });\n }\n constructor(private readonly config: ClientApiConfig) {}\n\n async getIncidents(): Promise<Incident[]> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'proxy',\n )}/splunk-on-call/v1/incidents`;\n\n const { incidents } = await this.findByUrl<IncidentsResponse>(url);\n\n return incidents;\n }\n\n async getOnCallUsers(): Promise<OnCall[]> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'proxy',\n )}/splunk-on-call/v1/oncall/current`;\n const { teamsOnCall } = await this.findByUrl<OnCallsResponse>(url);\n\n return teamsOnCall;\n }\n\n async getTeams(): Promise<Team[]> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'proxy',\n )}/splunk-on-call/v1/team`;\n const teams = await this.findByUrl<Team[]>(url);\n\n return teams;\n }\n\n async getRoutingKeys(): Promise<RoutingKey[]> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'proxy',\n )}/splunk-on-call/v1/org/routing-keys`;\n const { routingKeys } = await this.findByUrl<ListRoutingKeyResponse>(url);\n\n return routingKeys;\n }\n\n async getUsers(): Promise<User[]> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'proxy',\n )}/splunk-on-call/v2/user`;\n const { users } = await this.findByUrl<ListUserResponse>(url);\n\n return users;\n }\n\n async getEscalationPolicies(): Promise<EscalationPolicyInfo[]> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'proxy',\n )}/splunk-on-call/v1/policies`;\n const { policies } = await this.findByUrl<EscalationPolicyResponse>(url);\n\n return policies;\n }\n\n async incidentAction(options: TriggerAlarmRequest): Promise<Response> {\n const {\n routingKey,\n incidentType,\n incidentId,\n incidentDisplayName,\n incidentMessage,\n incidentStartTime,\n } = options;\n\n const body = JSON.stringify({\n message_type: incidentType,\n ...(incidentId ? { entity_id: incidentId } : {}),\n ...(incidentDisplayName\n ? { entity_display_name: incidentDisplayName }\n : {}),\n ...(incidentMessage ? { state_message: incidentMessage } : {}),\n ...(incidentStartTime ? { state_start_time: incidentStartTime } : {}),\n });\n\n const request = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body,\n };\n\n const url = `${this.config.eventsRestEndpoint}/${routingKey}`;\n\n return this.request(url, request);\n }\n\n private async findByUrl<T>(url: string): Promise<T> {\n const options = {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n };\n const response = await this.request(url, options);\n\n return response.json();\n }\n\n private async request(\n url: string,\n options: RequestOptions,\n ): Promise<Response> {\n const response = await fetch(url, options);\n if (response.status === 403) {\n throw new UnauthorizedError();\n }\n if (!response.ok) {\n const payload = await response.json();\n const errors = payload.errors.map((error: string) => error).join(' ');\n const message = `Request failed with ${response.status}, ${errors}`;\n throw new Error(message);\n }\n return response;\n }\n}\n"],"names":[],"mappings":";;AA0CO,MAAM,0BAA0B,KAAM,CAAA;AAAC,CAAA;AAGvC,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA,2BAAA;AACN,CAAC,EAAA;AAGM,MAAM,kBAA8C,CAAA;AAAA,EASzD,YAA6B,MAAyB,EAAA;AAAzB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AAAA,GAA0B;AAAA,EARvD,OAAO,UAAW,CAAA,SAAA,EAAsB,YAA4B,EAAA;AAClE,IAAA,MAAM,kBACJ,GAAA,SAAA,CAAU,iBAAkB,CAAA,iCAAiC,CAAK,IAAA,IAAA,CAAA;AACpE,IAAA,OAAO,IAAI,kBAAmB,CAAA;AAAA,MAC5B,kBAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AAAA,EAGA,MAAM,YAAoC,GAAA;AACxC,IAAA,MAAM,GAAM,GAAA,CAAA,EAAG,MAAM,IAAA,CAAK,OAAO,YAAa,CAAA,UAAA;AAAA,MAC5C,OAAA;AAAA,KACD,CAAA,4BAAA,CAAA,CAAA;AAED,IAAA,MAAM,EAAE,SAAU,EAAA,GAAI,MAAM,IAAA,CAAK,UAA6B,GAAG,CAAA,CAAA;AAEjE,IAAO,OAAA,SAAA,CAAA;AAAA,GACT;AAAA,EAEA,MAAM,cAAoC,GAAA;AACxC,IAAA,MAAM,GAAM,GAAA,CAAA,EAAG,MAAM,IAAA,CAAK,OAAO,YAAa,CAAA,UAAA;AAAA,MAC5C,OAAA;AAAA,KACD,CAAA,iCAAA,CAAA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QAAW,GAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,KAAK,OAAO,CAAA,CAAA;AAEhD,IAAA,OAAO,SAAS,IAAK,EAAA,CAAA;AAAA,GACvB;AAAA,EAEA,MAAc,OACZ,CAAA,GAAA,EACA,OACmB,EAAA;AACnB,IAAA,MAAM,QAAW,GAAA,MAAM,KAAM,CAAA,GAAA,EAAK,OAAO,CAAA,CAAA;AACzC,IAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,MAAA,MAAM,IAAI,iBAAkB,EAAA,CAAA;AAAA,KAC9B;AACA,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,OAAA,GAAU,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACpC,MAAM,MAAA,MAAA,GAAS,QAAQ,MAAO,CAAA,GAAA,CAAI,CAAC,KAAkB,KAAA,KAAK,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACpE,MAAA,MAAM,OAAU,GAAA,CAAA,oBAAA,EAAuB,QAAS,CAAA,MAAM,KAAK,MAAM,CAAA,CAAA,CAAA;AACjE,MAAM,MAAA,IAAI,MAAM,OAAO,CAAA,CAAA;AAAA,KACzB;AACA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -0,0 +1,189 @@
1
+ import React, { useState, useCallback } from 'react';
2
+ import useAsync from 'react-use/esm/useAsync';
3
+ import { MissingAnnotationEmptyState, useEntity } from '@backstage/plugin-catalog-react';
4
+ import Card from '@material-ui/core/Card';
5
+ import CardContent from '@material-ui/core/CardContent';
6
+ import CardHeader from '@material-ui/core/CardHeader';
7
+ import Divider from '@material-ui/core/Divider';
8
+ import Typography from '@material-ui/core/Typography';
9
+ import { makeStyles } from '@material-ui/core/styles';
10
+ import AlarmAddIcon from '@material-ui/icons/AlarmAdd';
11
+ import WebIcon from '@material-ui/icons/Web';
12
+ import Alert from '@material-ui/lab/Alert';
13
+ import { splunkOnCallApiRef, UnauthorizedError } from '../api/client.esm.js';
14
+ import { MissingApiKeyOrApiIdError } from './Errors/MissingApiKeyOrApiIdError.esm.js';
15
+ import { EscalationPolicy } from './Escalation/EscalationPolicy.esm.js';
16
+ import { Incidents } from './Incident/Incidents.esm.js';
17
+ import { TriggerDialog } from './TriggerDialog/TriggerDialog.esm.js';
18
+ import { useApi, configApiRef } from '@backstage/core-plugin-api';
19
+ import { EmptyState, Progress, HeaderIconLinkRow } from '@backstage/core-components';
20
+
21
+ const SPLUNK_ON_CALL_TEAM = "splunk.com/on-call-team";
22
+ const SPLUNK_ON_CALL_ROUTING_KEY = "splunk.com/on-call-routing-key";
23
+ const MissingAnnotation = () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Typography, null, "The Splunk On Call plugin requires setting either the", " ", /* @__PURE__ */ React.createElement("code", null, SPLUNK_ON_CALL_TEAM), " or the", " ", /* @__PURE__ */ React.createElement("code", null, SPLUNK_ON_CALL_ROUTING_KEY), " annotation."), /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: SPLUNK_ON_CALL_TEAM }));
24
+ const InvalidAnnotation = ({
25
+ teamName,
26
+ routingKey
27
+ }) => {
28
+ let titleSuffix = "provided annotation";
29
+ if (routingKey) {
30
+ titleSuffix = `"${routingKey}" routing key`;
31
+ }
32
+ if (teamName) {
33
+ titleSuffix = `"${teamName}" team name`;
34
+ }
35
+ return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, { title: "Splunk On-Call" }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
36
+ EmptyState,
37
+ {
38
+ title: `Splunk On-Call API returned no record of teams associated with the ${titleSuffix}`,
39
+ missing: "info",
40
+ description: "Escalation Policy and incident information unavailable. Splunk On-Call requires a valid team name or routing key."
41
+ }
42
+ )));
43
+ };
44
+ const MissingEventsRestEndpoint = () => /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
45
+ EmptyState,
46
+ {
47
+ title: "No Splunk On-Call REST endpoint available.",
48
+ missing: "info",
49
+ description: "You need to add a valid REST endpoint to your 'app-config.yaml' if you want to enable Splunk On-Call."
50
+ }
51
+ ));
52
+ const isSplunkOnCallAvailable = (entity) => Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_TEAM]) || Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_ROUTING_KEY]);
53
+ const useStyles = makeStyles({
54
+ onCallCard: {
55
+ marginBottom: "1em"
56
+ }
57
+ });
58
+ const EntitySplunkOnCallCard = (props) => {
59
+ const { readOnly } = props;
60
+ const classes = useStyles();
61
+ const config = useApi(configApiRef);
62
+ const api = useApi(splunkOnCallApiRef);
63
+ const { entity } = useEntity();
64
+ const [showDialog, setShowDialog] = useState(false);
65
+ const [refreshIncidents, setRefreshIncidents] = useState(false);
66
+ const teamAnnotation = entity ? entity.metadata.annotations[SPLUNK_ON_CALL_TEAM] : void 0;
67
+ const routingKeyAnnotation = entity ? entity.metadata.annotations[SPLUNK_ON_CALL_ROUTING_KEY] : void 0;
68
+ const eventsRestEndpoint = config.getOptionalString("splunkOnCall.eventsRestEndpoint") || null;
69
+ const handleRefresh = useCallback(() => {
70
+ setRefreshIncidents((x) => !x);
71
+ }, []);
72
+ const handleDialog = useCallback(() => {
73
+ setShowDialog((x) => !x);
74
+ }, []);
75
+ const {
76
+ value: entityData,
77
+ loading,
78
+ error
79
+ } = useAsync(async () => {
80
+ const allUsers = await api.getUsers();
81
+ const usersHashMap = allUsers.reduce(
82
+ (map, obj) => {
83
+ if (obj.username) {
84
+ map[obj.username] = obj;
85
+ }
86
+ return map;
87
+ },
88
+ {}
89
+ );
90
+ const teams2 = await api.getTeams();
91
+ let foundTeams = [
92
+ teams2.find((teamValue) => teamValue.name === teamAnnotation)
93
+ ].filter((team) => team !== void 0);
94
+ let foundRoutingKey;
95
+ if (routingKeyAnnotation) {
96
+ const routingKeys = await api.getRoutingKeys();
97
+ foundRoutingKey = routingKeys.find(
98
+ (key) => key.routingKey === routingKeyAnnotation
99
+ );
100
+ }
101
+ if (!foundTeams.length) {
102
+ foundTeams = foundRoutingKey ? foundRoutingKey.targets.map((target) => {
103
+ const teamUrlParts = target._teamUrl.split("/");
104
+ const teamSlug = teamUrlParts[teamUrlParts.length - 1];
105
+ return teams2.find((teamValue) => teamValue.slug === teamSlug);
106
+ }).filter((team) => team !== void 0) : [];
107
+ }
108
+ return { usersHashMap, foundTeams, foundRoutingKey };
109
+ });
110
+ if (!teamAnnotation && !routingKeyAnnotation) {
111
+ return /* @__PURE__ */ React.createElement(MissingAnnotation, null);
112
+ }
113
+ if (!eventsRestEndpoint) {
114
+ return /* @__PURE__ */ React.createElement(MissingEventsRestEndpoint, null);
115
+ }
116
+ if (error instanceof UnauthorizedError) {
117
+ return /* @__PURE__ */ React.createElement(MissingApiKeyOrApiIdError, null);
118
+ }
119
+ if (error) {
120
+ return /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Error encountered while fetching information. ", error.message);
121
+ }
122
+ if (loading) {
123
+ return /* @__PURE__ */ React.createElement(Progress, null);
124
+ }
125
+ if (!entityData?.foundTeams || !entityData?.foundTeams.length) {
126
+ return /* @__PURE__ */ React.createElement(
127
+ InvalidAnnotation,
128
+ {
129
+ teamName: teamAnnotation,
130
+ routingKey: routingKeyAnnotation
131
+ }
132
+ );
133
+ }
134
+ const triggerLink = {
135
+ label: "Create Incident",
136
+ onClick: handleDialog,
137
+ color: "secondary",
138
+ icon: /* @__PURE__ */ React.createElement(AlarmAddIcon, null)
139
+ };
140
+ const serviceLink = {
141
+ label: "Portal",
142
+ href: "https://portal.victorops.com/",
143
+ icon: /* @__PURE__ */ React.createElement(WebIcon, null)
144
+ };
145
+ const teams = entityData?.foundTeams || [];
146
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, teams.map((team, i) => {
147
+ const teamName = team?.name ?? "";
148
+ return /* @__PURE__ */ React.createElement(Card, { key: i, className: classes.onCallCard }, /* @__PURE__ */ React.createElement(
149
+ CardHeader,
150
+ {
151
+ title: "Splunk On-Call",
152
+ subheader: [
153
+ /* @__PURE__ */ React.createElement(Typography, { key: "team_name" }, "Team: ", team && team.name ? team.name : ""),
154
+ /* @__PURE__ */ React.createElement(
155
+ HeaderIconLinkRow,
156
+ {
157
+ key: "incident_trigger",
158
+ links: !readOnly ? [serviceLink, triggerLink] : [serviceLink]
159
+ }
160
+ )
161
+ ]
162
+ }
163
+ ), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
164
+ Incidents,
165
+ {
166
+ readOnly: readOnly || false,
167
+ team: teamName,
168
+ refreshIncidents
169
+ }
170
+ ), entityData?.usersHashMap && team && /* @__PURE__ */ React.createElement(
171
+ EscalationPolicy,
172
+ {
173
+ team: teamName,
174
+ users: entityData?.usersHashMap
175
+ }
176
+ ), /* @__PURE__ */ React.createElement(
177
+ TriggerDialog,
178
+ {
179
+ routingKey: entityData?.foundRoutingKey?.routingKey ?? teamName,
180
+ showDialog,
181
+ handleDialog,
182
+ onIncidentCreated: handleRefresh
183
+ }
184
+ )));
185
+ }));
186
+ };
187
+
188
+ export { EntitySplunkOnCallCard, InvalidAnnotation, MissingAnnotation, MissingEventsRestEndpoint, SPLUNK_ON_CALL_ROUTING_KEY, SPLUNK_ON_CALL_TEAM, isSplunkOnCallAvailable };
189
+ //# sourceMappingURL=EntitySplunkOnCallCard.esm.js.map
@@ -0,0 +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,0BAAA;AAC5B,MAAM,0BAA6B,GAAA,iCAAA;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,EAAA;AAGK,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA,UAAA;AACF,CAGM,KAAA;AACJ,EAAA,IAAI,WAAc,GAAA,qBAAA,CAAA;AAElB,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,WAAA,GAAc,IAAI,UAAU,CAAA,aAAA,CAAA,CAAA;AAAA,GAC9B;AAEA,EAAA,IAAI,QAAU,EAAA;AACZ,IAAA,WAAA,GAAc,IAAI,QAAQ,CAAA,WAAA,CAAA,CAAA;AAAA,GAC5B;AAEA,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QACA,YAAA;AAAA,QACA,iBAAmB,EAAA,aAAA;AAAA,OAAA;AAAA,KAEvB,CACF,CAAA,CAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import Button from '@material-ui/core/Button';
3
+ import { EmptyState } from '@backstage/core-components';
4
+
5
+ const MissingApiKeyOrApiIdError = () => /* @__PURE__ */ React.createElement(
6
+ EmptyState,
7
+ {
8
+ missing: "info",
9
+ title: "Missing or invalid Splunk On-Call API key and/or API id",
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__ */ React.createElement(
12
+ Button,
13
+ {
14
+ color: "primary",
15
+ variant: "contained",
16
+ href: "https://github.com/backstage/backstage/blob/master/plugins/splunk-on-call/README.md"
17
+ },
18
+ "Read More"
19
+ )
20
+ }
21
+ );
22
+
23
+ export { MissingApiKeyOrApiIdError };
24
+ //# sourceMappingURL=MissingApiKeyOrApiIdError.esm.js.map
@@ -0,0 +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 React from 'react';\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":";;;;AAmBO,MAAM,4BAA4B,sBACvC,KAAA,CAAA,aAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAQ,EAAA,MAAA;AAAA,IACR,KAAM,EAAA,yDAAA;AAAA,IACN,WAAY,EAAA,kGAAA;AAAA,IACZ,MACE,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,WAAA;AAAA,QACR,IAAK,EAAA,qFAAA;AAAA,OAAA;AAAA,MACN,WAAA;AAAA,KAED;AAAA,GAAA;AAEJ;;;;"}
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import List from '@material-ui/core/List';
3
+ import ListSubheader from '@material-ui/core/ListSubheader';
4
+ import { makeStyles, createStyles } from '@material-ui/core/styles';
5
+ import { EscalationUsersEmptyState } from './EscalationUsersEmptyState.esm.js';
6
+ import { EscalationUser } from './EscalationUser.esm.js';
7
+ import useAsync from 'react-use/esm/useAsync';
8
+ import { splunkOnCallApiRef } from '../../api/client.esm.js';
9
+ import Alert from '@material-ui/lab/Alert';
10
+ import { useApi } from '@backstage/core-plugin-api';
11
+ import { Progress } from '@backstage/core-components';
12
+
13
+ const useStyles = makeStyles(
14
+ (theme) => createStyles({
15
+ root: {
16
+ maxHeight: "400px",
17
+ overflow: "auto"
18
+ },
19
+ subheader: {
20
+ backgroundColor: theme.palette.background.paper
21
+ },
22
+ progress: {
23
+ margin: theme.spacing(0, 2)
24
+ }
25
+ })
26
+ );
27
+ const EscalationPolicy = ({ users, team }) => {
28
+ const classes = useStyles();
29
+ const api = useApi(splunkOnCallApiRef);
30
+ const {
31
+ value: userNames,
32
+ loading,
33
+ error
34
+ } = useAsync(async () => {
35
+ const oncalls = await api.getOnCallUsers();
36
+ const teamUsernames = oncalls.filter((oncall) => oncall.team?.name === team).flatMap((oncall) => {
37
+ return oncall.oncallNow?.flatMap((oncallNow) => {
38
+ return oncallNow.users?.flatMap((user) => {
39
+ return user?.onCalluser?.username;
40
+ });
41
+ });
42
+ });
43
+ return teamUsernames;
44
+ });
45
+ if (error) {
46
+ return /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Error encountered while fetching information. ", error.message);
47
+ }
48
+ if (!loading && !userNames?.length) {
49
+ return /* @__PURE__ */ React.createElement(EscalationUsersEmptyState, null);
50
+ }
51
+ return /* @__PURE__ */ React.createElement(
52
+ List,
53
+ {
54
+ className: classes.root,
55
+ dense: true,
56
+ subheader: /* @__PURE__ */ React.createElement(ListSubheader, { className: classes.subheader }, "ON CALL")
57
+ },
58
+ loading ? /* @__PURE__ */ React.createElement(Progress, { className: classes.progress }) : userNames && userNames.map(
59
+ (userName, index) => userName && userName in users && /* @__PURE__ */ React.createElement(EscalationUser, { key: index, user: users[userName] })
60
+ )
61
+ );
62
+ };
63
+
64
+ export { EscalationPolicy };
65
+ //# sourceMappingURL=EscalationPolicy.esm.js.map
@@ -0,0 +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 React 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 { 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":";;;;;;;;;;;;AA8BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,SAAW,EAAA,OAAA;AAAA,MACX,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,IACA,SAAW,EAAA;AAAA,MACT,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Q,EAAA;AAClC,IAAA,2CAAQ,yBAA0B,EAAA,IAAA,CAAA,CAAA;AAAA,GACpC;AAEA,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,SAAO,CAAA;AAAA,KAAA;AAAA,IAGrD,OAAA,uCACE,QAAS,EAAA,EAAA,SAAA,EAAW,QAAQ,QAAU,EAAA,CAAA,GAEvC,aACA,SAAU,CAAA,GAAA;AAAA,MACR,CAAC,QAAA,EAAU,KACT,KAAA,QAAA,IACA,QAAY,IAAA,KAAA,oBACT,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,GAAK,EAAA,KAAA,EAAO,IAAM,EAAA,KAAA,CAAM,QAAQ,CAAG,EAAA,CAAA;AAAA,KAEzD;AAAA,GAEJ,CAAA;AAEJ;;;;"}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import ListItem from '@material-ui/core/ListItem';
3
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
4
+ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
5
+ import Tooltip from '@material-ui/core/Tooltip';
6
+ import ListItemText from '@material-ui/core/ListItemText';
7
+ import IconButton from '@material-ui/core/IconButton';
8
+ import Typography from '@material-ui/core/Typography';
9
+ import { makeStyles } from '@material-ui/core/styles';
10
+ import Avatar from '@material-ui/core/Avatar';
11
+ import EmailIcon from '@material-ui/icons/Email';
12
+
13
+ const useStyles = makeStyles({
14
+ listItemPrimary: {
15
+ fontWeight: "bold"
16
+ }
17
+ });
18
+ const EscalationUser = ({ user }) => {
19
+ const classes = useStyles();
20
+ return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Avatar, { alt: "User" })), /* @__PURE__ */ React.createElement(
21
+ ListItemText,
22
+ {
23
+ primary: /* @__PURE__ */ React.createElement(Typography, { className: classes.listItemPrimary }, user.firstName, " ", user.lastName),
24
+ secondary: user.email
25
+ }
26
+ ), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Send e-mail to user", placement: "top" }, /* @__PURE__ */ React.createElement(IconButton, { href: `mailto:${user.email}` }, /* @__PURE__ */ React.createElement(EmailIcon, { color: "primary" })))));
27
+ };
28
+
29
+ export { EscalationUser };
30
+ //# sourceMappingURL=EscalationUser.esm.js.map
@@ -0,0 +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 React 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 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":";;;;;;;;;;;;AA6BA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,eAAiB,EAAA;AAAA,IACf,UAAY,EAAA,MAAA;AAAA,GACd;AACF,CAAC,CAAA,CAAA;AAMM,MAAM,cAAiB,GAAA,CAAC,EAAE,IAAA,EAAkB,KAAA;AACjD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,gCACE,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,IAAA,sCACE,MAAO,EAAA,EAAA,GAAA,EAAI,MAAO,EAAA,CACrB,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,OAAA,CAAQ,mBAC5B,IAAK,CAAA,SAAA,EAAU,GAAE,EAAA,IAAA,CAAK,QACzB,CAAA;AAAA,MAEF,WAAW,IAAK,CAAA,KAAA;AAAA,KAAA;AAAA,GAClB,sCACC,uBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KAAM,EAAA,qBAAA,EAAsB,SAAU,EAAA,KAAA,EAAA,kBAC5C,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,MAAM,CAAU,OAAA,EAAA,IAAA,CAAK,KAAK,CAAA,CAAA,EAAA,kBACnC,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,OAAM,SAAU,EAAA,CAC7B,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import ListItem from '@material-ui/core/ListItem';
3
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
4
+ import ListItemText from '@material-ui/core/ListItemText';
5
+ import { makeStyles } from '@material-ui/core/styles';
6
+ import { StatusWarning } from '@backstage/core-components';
7
+
8
+ const useStyles = makeStyles({
9
+ denseListIcon: {
10
+ marginRight: 0,
11
+ display: "flex",
12
+ flexDirection: "column",
13
+ alignItems: "center",
14
+ justifyContent: "center"
15
+ }
16
+ });
17
+ const EscalationUsersEmptyState = () => {
18
+ const classes = useStyles();
19
+ return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement("div", { className: classes.denseListIcon }, /* @__PURE__ */ React.createElement(StatusWarning, null))), /* @__PURE__ */ React.createElement(ListItemText, { primary: "Empty escalation policy" }));
20
+ };
21
+
22
+ export { EscalationUsersEmptyState };
23
+ //# sourceMappingURL=EscalationUsersEmptyState.esm.js.map
@@ -0,0 +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 React from 'react';\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":";;;;;;;AAuBA,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,QAAA;AAAA,GAClB;AACF,CAAC,CAAA,CAAA;AAEM,MAAM,4BAA4B,MAAM;AAC7C,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,2CACG,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,WAAW,OAAQ,CAAA,aAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,IAAc,CACjB,CACF,CAAA,sCACC,YAAa,EAAA,EAAA,OAAA,EAAQ,2BAA0B,CAClD,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import Grid from '@material-ui/core/Grid';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import EmptyStateImage from '../../assets/emptystate.svg';
5
+
6
+ const IncidentsEmptyState = () => {
7
+ return /* @__PURE__ */ React.createElement(
8
+ Grid,
9
+ {
10
+ container: true,
11
+ justifyContent: "center",
12
+ direction: "column",
13
+ alignItems: "center"
14
+ },
15
+ /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Nice! No incidents found!")),
16
+ /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
17
+ "img",
18
+ {
19
+ src: EmptyStateImage,
20
+ alt: "EmptyState",
21
+ "data-testid": "emptyStateImg"
22
+ }
23
+ ))
24
+ );
25
+ };
26
+
27
+ export { IncidentsEmptyState };
28
+ //# sourceMappingURL=IncidentEmptyState.esm.js.map
@@ -0,0 +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 React from 'react';\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":";;;;;AAqBO,MAAM,sBAAsB,MAAM;AACvC,EACE,uBAAA,KAAA,CAAA,aAAA;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,KAAA;AAAA,oBAEX,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAK,EAAA,EAAA,2BAAyB,CACpD,CAAA;AAAA,oBACC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,eAAA;AAAA,QACL,GAAI,EAAA,YAAA;AAAA,QACJ,aAAY,EAAA,eAAA;AAAA,OAAA;AAAA,KAEhB,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}