@backstage-community/plugin-ilert 0.7.0 → 0.8.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/ILertIcon.esm.js +63 -56
- package/dist/ILertIcon.esm.js.map +1 -1
- package/dist/components/Alert/AlertActionsMenu.esm.js +49 -42
- package/dist/components/Alert/AlertActionsMenu.esm.js.map +1 -1
- package/dist/components/Alert/AlertAssignModal.esm.js +68 -60
- package/dist/components/Alert/AlertAssignModal.esm.js.map +1 -1
- package/dist/components/Alert/AlertLink.esm.js +5 -2
- package/dist/components/Alert/AlertLink.esm.js.map +1 -1
- package/dist/components/Alert/AlertNewModal.esm.js +109 -87
- package/dist/components/Alert/AlertNewModal.esm.js.map +1 -1
- package/dist/components/AlertSource/AlertSourceLink.esm.js +19 -16
- package/dist/components/AlertSource/AlertSourceLink.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsPage.esm.js +44 -36
- package/dist/components/AlertsPage/AlertsPage.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsTable.esm.js +15 -15
- package/dist/components/AlertsPage/AlertsTable.esm.js.map +1 -1
- package/dist/components/AlertsPage/StatusChip.esm.js +5 -5
- package/dist/components/AlertsPage/StatusChip.esm.js.map +1 -1
- package/dist/components/AlertsPage/TableTitle.esm.js +30 -24
- package/dist/components/AlertsPage/TableTitle.esm.js.map +1 -1
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js +6 -6
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCard.esm.js +63 -51
- package/dist/components/ILertCard/ILertCard.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardActionsHeader.esm.js +42 -33
- package/dist/components/ILertCard/ILertCardActionsHeader.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js +28 -20
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js +3 -3
- package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js +36 -27
- package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCall.esm.js +34 -28
- package/dist/components/ILertCard/ILertCardOnCall.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js +6 -6
- package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCallItem.esm.js +41 -31
- package/dist/components/ILertCard/ILertCardOnCallItem.esm.js.map +1 -1
- package/dist/components/ILertPage/ILertPage.esm.js +25 -17
- package/dist/components/ILertPage/ILertPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js +45 -35
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js +14 -11
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js +31 -23
- package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js.map +1 -1
- package/dist/components/Service/ServiceActionsMenu.esm.js +29 -25
- package/dist/components/Service/ServiceActionsMenu.esm.js.map +1 -1
- package/dist/components/Service/ServiceLink.esm.js +5 -2
- package/dist/components/Service/ServiceLink.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesPage.esm.js +17 -14
- package/dist/components/ServicesPage/ServicesPage.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesTable.esm.js +9 -9
- package/dist/components/ServicesPage/ServicesTable.esm.js.map +1 -1
- package/dist/components/ServicesPage/StatusChip.esm.js +7 -7
- package/dist/components/ServicesPage/StatusChip.esm.js.map +1 -1
- package/dist/components/Shift/ShiftOverrideModal.esm.js +83 -74
- package/dist/components/Shift/ShiftOverrideModal.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js +32 -26
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageLink.esm.js +5 -2
- package/dist/components/StatusPage/StatusPageLink.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageURL.esm.js +2 -2
- package/dist/components/StatusPage/StatusPageURL.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusChip.esm.js +7 -7
- package/dist/components/StatusPagePage/StatusChip.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js +17 -14
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesTable.esm.js +10 -10
- package/dist/components/StatusPagePage/StatusPagesTable.esm.js.map +1 -1
- package/dist/components/StatusPagePage/VisibilityChip.esm.js +4 -4
- package/dist/components/StatusPagePage/VisibilityChip.esm.js.map +1 -1
- package/dist/hooks/useAlertActions.esm.js +3 -5
- package/dist/hooks/useAlertActions.esm.js.map +1 -1
- package/dist/hooks/useAlertSource.esm.js +3 -5
- package/dist/hooks/useAlertSource.esm.js.map +1 -1
- package/dist/hooks/useAlertSourceOnCalls.esm.js +3 -3
- package/dist/hooks/useAlertSourceOnCalls.esm.js.map +1 -1
- package/dist/hooks/useAlerts.esm.js +6 -9
- package/dist/hooks/useAlerts.esm.js.map +1 -1
- package/dist/hooks/useAssignAlert.esm.js +6 -4
- package/dist/hooks/useAssignAlert.esm.js.map +1 -1
- package/dist/hooks/useNewAlert.esm.js +6 -10
- package/dist/hooks/useNewAlert.esm.js.map +1 -1
- package/dist/hooks/useOnCallSchedules.esm.js +5 -3
- package/dist/hooks/useOnCallSchedules.esm.js.map +1 -1
- package/dist/hooks/useServices.esm.js +4 -4
- package/dist/hooks/useServices.esm.js.map +1 -1
- package/dist/hooks/useShiftOverride.esm.js +4 -4
- package/dist/hooks/useShiftOverride.esm.js.map +1 -1
- package/dist/hooks/useStatusPages.esm.js +4 -6
- package/dist/hooks/useStatusPages.esm.js.map +1 -1
- package/dist/index.d.ts +6 -8
- package/package.json +13 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
2
3
|
import { useApi, alertApiRef, identityApiRef } from '@backstage/core-plugin-api';
|
|
3
4
|
import Typography from '@material-ui/core/Typography';
|
|
@@ -11,7 +12,6 @@ import TextField from '@material-ui/core/TextField';
|
|
|
11
12
|
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
12
13
|
import Alert from '@material-ui/lab/Alert';
|
|
13
14
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
14
|
-
import React from 'react';
|
|
15
15
|
import { ilertApiRef } from '../../api/client.esm.js';
|
|
16
16
|
import { useNewAlert } from '../../hooks/useNewAlert.esm.js';
|
|
17
17
|
|
|
@@ -94,97 +94,119 @@ const AlertNewModal = ({
|
|
|
94
94
|
}, 250);
|
|
95
95
|
};
|
|
96
96
|
const canCreate = !!integrationKey && !!summary;
|
|
97
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ jsxs(
|
|
98
98
|
Dialog,
|
|
99
99
|
{
|
|
100
100
|
open: isModalOpened,
|
|
101
101
|
onClose: handleClose,
|
|
102
|
-
"aria-labelledby": "create-alert-form-title"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
102
|
+
"aria-labelledby": "create-alert-form-title",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "create-alert-form-title", children: entityName ? /* @__PURE__ */ jsxs("div", { children: [
|
|
105
|
+
"This action will trigger an alert for",
|
|
106
|
+
" ",
|
|
107
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
108
|
+
'"',
|
|
109
|
+
entityName,
|
|
110
|
+
'"'
|
|
111
|
+
] }),
|
|
112
|
+
"."
|
|
113
|
+
] }) : "New alert" }),
|
|
114
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
115
|
+
/* @__PURE__ */ jsx(Alert, { severity: "info", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", gutterBottom: true, align: "justify", children: "Please describe the problem you want to report. Be as descriptive as possible. Your signed in user and a reference to the current page will automatically be amended to the alarm so that the receiver can reach out to you if necessary." }) }),
|
|
116
|
+
!initialAlertSource ? /* @__PURE__ */ jsx(
|
|
117
|
+
Autocomplete,
|
|
118
|
+
{
|
|
119
|
+
disabled: isLoading,
|
|
120
|
+
options: alertSources,
|
|
121
|
+
value: alertSource,
|
|
122
|
+
classes: {
|
|
123
|
+
root: classes.formControl,
|
|
124
|
+
option: classes.option
|
|
125
|
+
},
|
|
126
|
+
onChange: (_event, newValue) => {
|
|
127
|
+
setAlertSource(newValue);
|
|
128
|
+
},
|
|
129
|
+
autoHighlight: true,
|
|
130
|
+
getOptionLabel: (a) => a.name,
|
|
131
|
+
renderOption: (a) => /* @__PURE__ */ jsxs("div", { className: classes.optionWrapper, children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"img",
|
|
134
|
+
{
|
|
135
|
+
src: prefersDarkMode ? a.lightIconUrl : a.iconUrl,
|
|
136
|
+
alt: a.name,
|
|
137
|
+
className: classes.sourceImage
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ jsx(Typography, { noWrap: true, children: a.name })
|
|
141
|
+
] }),
|
|
142
|
+
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
143
|
+
TextField,
|
|
144
|
+
{
|
|
145
|
+
...params,
|
|
146
|
+
label: "Alert Source",
|
|
147
|
+
variant: "outlined",
|
|
148
|
+
margin: "normal",
|
|
149
|
+
inputProps: {
|
|
150
|
+
...params.inputProps,
|
|
151
|
+
autoComplete: "new-password"
|
|
152
|
+
// disable autocomplete and autofill
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
)
|
|
139
156
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
157
|
+
) : null,
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
TextField,
|
|
160
|
+
{
|
|
161
|
+
disabled: isLoading,
|
|
162
|
+
label: "Summary",
|
|
163
|
+
fullWidth: true,
|
|
164
|
+
margin: "normal",
|
|
165
|
+
variant: "outlined",
|
|
166
|
+
classes: {
|
|
167
|
+
root: classes.formControl
|
|
168
|
+
},
|
|
169
|
+
value: summary,
|
|
170
|
+
onChange: (event) => {
|
|
171
|
+
setSummary(event.target.value);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
TextField,
|
|
177
|
+
{
|
|
178
|
+
disabled: isLoading,
|
|
179
|
+
label: "Details",
|
|
180
|
+
fullWidth: true,
|
|
181
|
+
multiline: true,
|
|
182
|
+
rows: 4,
|
|
183
|
+
margin: "normal",
|
|
184
|
+
variant: "outlined",
|
|
185
|
+
classes: {
|
|
186
|
+
root: classes.formControl
|
|
187
|
+
},
|
|
188
|
+
value: details,
|
|
189
|
+
onChange: (event) => {
|
|
190
|
+
setDetails(event.target.value);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
Button,
|
|
198
|
+
{
|
|
199
|
+
disabled: !canCreate,
|
|
200
|
+
onClick: handleCreate,
|
|
201
|
+
color: "secondary",
|
|
202
|
+
variant: "contained",
|
|
203
|
+
children: "Create"
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleClose, color: "primary", children: "Cancel" })
|
|
207
|
+
] })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
188
210
|
);
|
|
189
211
|
};
|
|
190
212
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertNewModal.esm.js","sources":["../../../src/components/Alert/AlertNewModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';\nimport {\n alertApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TextField from '@material-ui/core/TextField';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport Alert from '@material-ui/lab/Alert';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport React from 'react';\nimport { ilertApiRef } from '../../api';\nimport { useNewAlert } from '../../hooks/useNewAlert';\nimport { AlertSource } from '../../types';\n\nconst useStyles = makeStyles(() => ({\n container: {\n display: 'flex',\n flexWrap: 'wrap',\n },\n formControl: {\n minWidth: 120,\n width: '100%',\n },\n option: {\n fontSize: 15,\n '& > span': {\n marginRight: 10,\n fontSize: 18,\n },\n },\n optionWrapper: {\n display: 'flex',\n width: '100%',\n },\n sourceImage: {\n height: 22,\n paddingRight: 4,\n },\n}));\n\nexport const AlertNewModal = ({\n isModalOpened,\n setIsModalOpened,\n refetchAlerts,\n initialAlertSource,\n entityName,\n}: {\n isModalOpened: boolean;\n setIsModalOpened: (open: boolean) => void;\n refetchAlerts: () => void;\n initialAlertSource?: AlertSource | null;\n entityName?: string;\n}) => {\n const [\n { alertSources, alertSource, summary, details, isLoading },\n { setAlertSource, setSummary, setDetails, setIsLoading },\n ] = useNewAlert(isModalOpened, initialAlertSource);\n const ilertApi = useApi(ilertApiRef);\n const alertApi = useApi(alertApiRef);\n const identityApi = useApi(identityApiRef);\n const source = window.location.toString();\n const classes = useStyles();\n const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');\n\n const handleClose = () => {\n setIsModalOpened(false);\n };\n\n let integrationKey = '';\n if (initialAlertSource && initialAlertSource.integrationKey) {\n integrationKey = initialAlertSource.integrationKey;\n } else if (alertSource && alertSource.integrationKey) {\n integrationKey = alertSource.integrationKey;\n }\n const handleCreate = () => {\n if (!integrationKey) {\n return;\n }\n setIsLoading(true);\n setTimeout(async () => {\n try {\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n const { name: userName } = parseEntityRef(userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n await ilertApi.createAlert({\n integrationKey,\n summary,\n details,\n userName,\n source,\n });\n alertApi.post({ message: 'Alert created.' });\n refetchAlerts();\n } catch (err) {\n alertApi.post({ message: err, severity: 'error' });\n }\n setIsModalOpened(false);\n }, 250);\n };\n\n const canCreate = !!integrationKey && !!summary;\n\n return (\n <Dialog\n open={isModalOpened}\n onClose={handleClose}\n aria-labelledby=\"create-alert-form-title\"\n >\n <DialogTitle id=\"create-alert-form-title\">\n {entityName ? (\n <div>\n This action will trigger an alert for{' '}\n <strong>\"{entityName}\"</strong>.\n </div>\n ) : (\n 'New alert'\n )}\n </DialogTitle>\n <DialogContent>\n <Alert severity=\"info\">\n <Typography variant=\"body1\" gutterBottom align=\"justify\">\n Please describe the problem you want to report. Be as descriptive as\n possible. Your signed in user and a reference to the current page\n will automatically be amended to the alarm so that the receiver can\n reach out to you if necessary.\n </Typography>\n </Alert>\n {!initialAlertSource ? (\n <Autocomplete\n disabled={isLoading}\n options={alertSources}\n value={alertSource}\n classes={{\n root: classes.formControl,\n option: classes.option,\n }}\n onChange={(_event: any, newValue: any) => {\n setAlertSource(newValue);\n }}\n autoHighlight\n getOptionLabel={a => a.name}\n renderOption={a => (\n <div className={classes.optionWrapper}>\n <img\n src={prefersDarkMode ? a.lightIconUrl : a.iconUrl}\n alt={a.name}\n className={classes.sourceImage}\n />\n <Typography noWrap>{a.name}</Typography>\n </div>\n )}\n renderInput={params => (\n <TextField\n {...params}\n label=\"Alert Source\"\n variant=\"outlined\"\n margin=\"normal\"\n inputProps={{\n ...params.inputProps,\n autoComplete: 'new-password', // disable autocomplete and autofill\n }}\n />\n )}\n />\n ) : null}\n <TextField\n disabled={isLoading}\n label=\"Summary\"\n fullWidth\n margin=\"normal\"\n variant=\"outlined\"\n classes={{\n root: classes.formControl,\n }}\n value={summary}\n onChange={event => {\n setSummary(event.target.value);\n }}\n />\n <TextField\n disabled={isLoading}\n label=\"Details\"\n fullWidth\n multiline\n rows={4}\n margin=\"normal\"\n variant=\"outlined\"\n classes={{\n root: classes.formControl,\n }}\n value={details}\n onChange={event => {\n setDetails(event.target.value);\n }}\n />\n </DialogContent>\n <DialogActions>\n <Button\n disabled={!canCreate}\n onClick={handleCreate}\n color=\"secondary\"\n variant=\"contained\"\n >\n Create\n </Button>\n <Button onClick={handleClose} color=\"primary\">\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAqCA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,SAAW,EAAA;AAAA,IACT,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,GAAA;AAAA,IACV,KAAO,EAAA;AAAA,GACT;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,EAAA;AAAA,MACb,QAAU,EAAA;AAAA;AACZ,GACF;AAAA,EACA,aAAe,EAAA;AAAA,IACb,OAAS,EAAA,MAAA;AAAA,IACT,KAAO,EAAA;AAAA,GACT;AAAA,EACA,WAAa,EAAA;AAAA,IACX,MAAQ,EAAA,EAAA;AAAA,IACR,YAAc,EAAA;AAAA;AAElB,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NewModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';\nimport {\n alertApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TextField from '@material-ui/core/TextField';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport Alert from '@material-ui/lab/Alert';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { ilertApiRef } from '../../api';\nimport { useNewAlert } from '../../hooks/useNewAlert';\nimport { AlertSource } from '../../types';\n\nconst useStyles = makeStyles(() => ({\n container: {\n display: 'flex',\n flexWrap: 'wrap',\n },\n formControl: {\n minWidth: 120,\n width: '100%',\n },\n option: {\n fontSize: 15,\n '& > span': {\n marginRight: 10,\n fontSize: 18,\n },\n },\n optionWrapper: {\n display: 'flex',\n width: '100%',\n },\n sourceImage: {\n height: 22,\n paddingRight: 4,\n },\n}));\n\nexport const AlertNewModal = ({\n isModalOpened,\n setIsModalOpened,\n refetchAlerts,\n initialAlertSource,\n entityName,\n}: {\n isModalOpened: boolean;\n setIsModalOpened: (open: boolean) => void;\n refetchAlerts: () => void;\n initialAlertSource?: AlertSource | null;\n entityName?: string;\n}) => {\n const [\n { alertSources, alertSource, summary, details, isLoading },\n { setAlertSource, setSummary, setDetails, setIsLoading },\n ] = useNewAlert(isModalOpened, initialAlertSource);\n const ilertApi = useApi(ilertApiRef);\n const alertApi = useApi(alertApiRef);\n const identityApi = useApi(identityApiRef);\n const source = window.location.toString();\n const classes = useStyles();\n const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');\n\n const handleClose = () => {\n setIsModalOpened(false);\n };\n\n let integrationKey = '';\n if (initialAlertSource && initialAlertSource.integrationKey) {\n integrationKey = initialAlertSource.integrationKey;\n } else if (alertSource && alertSource.integrationKey) {\n integrationKey = alertSource.integrationKey;\n }\n const handleCreate = () => {\n if (!integrationKey) {\n return;\n }\n setIsLoading(true);\n setTimeout(async () => {\n try {\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n const { name: userName } = parseEntityRef(userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n await ilertApi.createAlert({\n integrationKey,\n summary,\n details,\n userName,\n source,\n });\n alertApi.post({ message: 'Alert created.' });\n refetchAlerts();\n } catch (err) {\n alertApi.post({ message: err, severity: 'error' });\n }\n setIsModalOpened(false);\n }, 250);\n };\n\n const canCreate = !!integrationKey && !!summary;\n\n return (\n <Dialog\n open={isModalOpened}\n onClose={handleClose}\n aria-labelledby=\"create-alert-form-title\"\n >\n <DialogTitle id=\"create-alert-form-title\">\n {entityName ? (\n <div>\n This action will trigger an alert for{' '}\n <strong>\"{entityName}\"</strong>.\n </div>\n ) : (\n 'New alert'\n )}\n </DialogTitle>\n <DialogContent>\n <Alert severity=\"info\">\n <Typography variant=\"body1\" gutterBottom align=\"justify\">\n Please describe the problem you want to report. Be as descriptive as\n possible. Your signed in user and a reference to the current page\n will automatically be amended to the alarm so that the receiver can\n reach out to you if necessary.\n </Typography>\n </Alert>\n {!initialAlertSource ? (\n <Autocomplete\n disabled={isLoading}\n options={alertSources}\n value={alertSource}\n classes={{\n root: classes.formControl,\n option: classes.option,\n }}\n onChange={(_event: any, newValue: any) => {\n setAlertSource(newValue);\n }}\n autoHighlight\n getOptionLabel={a => a.name}\n renderOption={a => (\n <div className={classes.optionWrapper}>\n <img\n src={prefersDarkMode ? a.lightIconUrl : a.iconUrl}\n alt={a.name}\n className={classes.sourceImage}\n />\n <Typography noWrap>{a.name}</Typography>\n </div>\n )}\n renderInput={params => (\n <TextField\n {...params}\n label=\"Alert Source\"\n variant=\"outlined\"\n margin=\"normal\"\n inputProps={{\n ...params.inputProps,\n autoComplete: 'new-password', // disable autocomplete and autofill\n }}\n />\n )}\n />\n ) : null}\n <TextField\n disabled={isLoading}\n label=\"Summary\"\n fullWidth\n margin=\"normal\"\n variant=\"outlined\"\n classes={{\n root: classes.formControl,\n }}\n value={summary}\n onChange={event => {\n setSummary(event.target.value);\n }}\n />\n <TextField\n disabled={isLoading}\n label=\"Details\"\n fullWidth\n multiline\n rows={4}\n margin=\"normal\"\n variant=\"outlined\"\n classes={{\n root: classes.formControl,\n }}\n value={details}\n onChange={event => {\n setDetails(event.target.value);\n }}\n />\n </DialogContent>\n <DialogActions>\n <Button\n disabled={!canCreate}\n onClick={handleCreate}\n color=\"secondary\"\n variant=\"contained\"\n >\n Create\n </Button>\n <Button onClick={handleClose} color=\"primary\">\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,SAAW,EAAA;AAAA,IACT,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,GAAA;AAAA,IACV,KAAO,EAAA;AAAA,GACT;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,EAAA;AAAA,MACb,QAAU,EAAA;AAAA;AACZ,GACF;AAAA,EACA,aAAe,EAAA;AAAA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YAAC,MAAA;AAAA,YAAA;AAAA,cACC,UAAU,CAAC,SAAA;AAAA,cACX,OAAS,EAAA,YAAA;AAAA,cACT,KAAM,EAAA,WAAA;AAAA,cACN,OAAQ,EAAA,WAAA;AAAA,cACT,QAAA,EAAA;AAAA;AAAA,WAED;AAAA,8BACC,MAAO,EAAA,EAAA,OAAA,EAAS,WAAa,EAAA,KAAA,EAAM,WAAU,QAE9C,EAAA,QAAA,EAAA;AAAA,SACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Grid from '@material-ui/core/Grid';
|
|
3
3
|
import { ilertApiRef } from '../../api/client.esm.js';
|
|
4
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -28,21 +28,24 @@ const AlertSourceLink = ({
|
|
|
28
28
|
if (!alertSource) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 0, children: [
|
|
32
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 2, children: /* @__PURE__ */ jsx(
|
|
33
|
+
"img",
|
|
34
|
+
{
|
|
35
|
+
src: prefersDarkMode ? alertSource.lightIconUrl : alertSource.iconUrl,
|
|
36
|
+
alt: alertSource.name,
|
|
37
|
+
className: classes.image
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
40
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 10, children: /* @__PURE__ */ jsx(
|
|
41
|
+
Link,
|
|
42
|
+
{
|
|
43
|
+
className: classes.link,
|
|
44
|
+
to: ilertApi.getAlertSourceDetailsURL(alertSource),
|
|
45
|
+
children: alertSource.name
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
] });
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
export { AlertSourceLink };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertSourceLink.esm.js","sources":["../../../src/components/AlertSource/AlertSourceLink.tsx"],"sourcesContent":["/*\n * Copyright 2021 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":"AlertSourceLink.esm.js","sources":["../../../src/components/AlertSource/AlertSourceLink.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Grid from '@material-ui/core/Grid';\nimport { AlertSource } from '../../types';\nimport { ilertApiRef } from '../../api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n maxWidth: '100%',\n },\n image: {\n height: 22,\n paddingRight: 4,\n },\n link: {\n lineHeight: '22px',\n },\n});\n\nexport const AlertSourceLink = ({\n alertSource,\n}: {\n alertSource: AlertSource | null;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const classes = useStyles();\n const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');\n\n if (!alertSource) {\n return null;\n }\n\n return (\n <Grid container spacing={0}>\n <Grid item xs={2}>\n <img\n src={prefersDarkMode ? alertSource.lightIconUrl : alertSource.iconUrl}\n alt={alertSource.name}\n className={classes.image}\n />\n </Grid>\n <Grid item xs={10}>\n <Link\n className={classes.link}\n to={ilertApi.getAlertSourceDetailsURL(alertSource)}\n >\n {alertSource.name}\n </Link>\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,KAAO,EAAA;AAAA,IACL,MAAQ,EAAA,EAAA;AAAA,IACR,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA;AAAA;AAEhB,CAAC,CAAA;AAEM,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AACF,CAEM,KAAA;AACJ,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,eAAA,GAAkB,cAAc,8BAA8B,CAAA;AAEpE,EAAA,IAAI,CAAC,WAAa,EAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,uBACG,IAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,SAAS,CACvB,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,CACb,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,eAAA,GAAkB,WAAY,CAAA,YAAA,GAAe,WAAY,CAAA,OAAA;AAAA,QAC9D,KAAK,WAAY,CAAA,IAAA;AAAA,QACjB,WAAW,OAAQ,CAAA;AAAA;AAAA,KAEvB,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAQ,CAAA,IAAA;AAAA,QACnB,EAAA,EAAI,QAAS,CAAA,wBAAA,CAAyB,WAAW,CAAA;AAAA,QAEhD,QAAY,EAAA,WAAA,CAAA;AAAA;AAAA,KAEjB,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { Content, ResponseErrorPanel, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
2
3
|
import Button from '@material-ui/core/Button';
|
|
3
4
|
import AddIcon from '@material-ui/icons/Add';
|
|
4
|
-
import
|
|
5
|
+
import { useState } from 'react';
|
|
5
6
|
import { useAlerts } from '../../hooks/useAlerts.esm.js';
|
|
6
7
|
import { AlertNewModal } from '../Alert/AlertNewModal.esm.js';
|
|
7
8
|
import { MissingAuthorizationHeaderError } from '../Errors/MissingAuthorizationHeaderError.esm.js';
|
|
@@ -19,48 +20,55 @@ const AlertsPage = () => {
|
|
|
19
20
|
setIsLoading
|
|
20
21
|
}
|
|
21
22
|
] = useAlerts(true);
|
|
22
|
-
const [isModalOpened, setIsModalOpened] =
|
|
23
|
+
const [isModalOpened, setIsModalOpened] = useState(false);
|
|
23
24
|
const handleCreateNewAlertClick = () => {
|
|
24
25
|
setIsModalOpened(true);
|
|
25
26
|
};
|
|
26
27
|
if (error) {
|
|
27
28
|
if (error.name === "AuthenticationError") {
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(MissingAuthorizationHeaderError, {}) });
|
|
29
30
|
}
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ResponseErrorPanel, { error }) });
|
|
31
32
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
33
|
+
return /* @__PURE__ */ jsxs(Content, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(ContentHeader, { title: "Alerts", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
Button,
|
|
37
|
+
{
|
|
38
|
+
variant: "contained",
|
|
39
|
+
color: "primary",
|
|
40
|
+
size: "small",
|
|
41
|
+
startIcon: /* @__PURE__ */ jsx(AddIcon, {}),
|
|
42
|
+
onClick: handleCreateNewAlertClick,
|
|
43
|
+
children: "Create Alert"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
AlertNewModal,
|
|
48
|
+
{
|
|
49
|
+
isModalOpened,
|
|
50
|
+
setIsModalOpened,
|
|
51
|
+
refetchAlerts
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring iLert into your developer portal." })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
AlertsTable,
|
|
58
|
+
{
|
|
59
|
+
alerts,
|
|
60
|
+
alertsCount,
|
|
61
|
+
tableState,
|
|
62
|
+
states,
|
|
63
|
+
onAlertChanged,
|
|
64
|
+
onAlertStatesChange,
|
|
65
|
+
onChangePage,
|
|
66
|
+
onChangeRowsPerPage,
|
|
67
|
+
isLoading,
|
|
68
|
+
setIsLoading
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] });
|
|
64
72
|
};
|
|
65
73
|
|
|
66
74
|
export { AlertsPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertsPage.esm.js","sources":["../../../src/components/AlertsPage/AlertsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport AddIcon from '@material-ui/icons/Add';\nimport
|
|
1
|
+
{"version":3,"file":"AlertsPage.esm.js","sources":["../../../src/components/AlertsPage/AlertsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\nimport AddIcon from '@material-ui/icons/Add';\nimport { useState } from 'react';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { AlertsTable } from './AlertsTable';\n\nexport const AlertsPage = () => {\n const [\n { tableState, states, alerts, alertsCount, isLoading, error },\n {\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n onAlertChanged,\n refetchAlerts,\n setIsLoading,\n },\n ] = useAlerts(true);\n\n const [isModalOpened, setIsModalOpened] = useState(false);\n\n const handleCreateNewAlertClick = () => {\n setIsModalOpened(true);\n };\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Alerts\">\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n startIcon={<AddIcon />}\n onClick={handleCreateNewAlertClick}\n >\n Create Alert\n </Button>\n <AlertNewModal\n isModalOpened={isModalOpened}\n setIsModalOpened={setIsModalOpened}\n refetchAlerts={refetchAlerts}\n />\n <SupportButton>\n This helps you to bring iLert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <AlertsTable\n alerts={alerts}\n alertsCount={alertsCount}\n tableState={tableState}\n states={states}\n onAlertChanged={onAlertChanged}\n onAlertStatesChange={onAlertStatesChange}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA6BO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA;AAAA,IACJ,EAAE,UAAY,EAAA,MAAA,EA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,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,WAAA;AAAA,QACA,UAAA;AAAA,QACA,MAAA;AAAA,QACA,cAAA;AAAA,QACA,mBAAA;AAAA,QACA,YAAA;AAAA,QACA,mBAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
3
|
import Typography from '@material-ui/core/Typography';
|
|
3
4
|
import humanizeDuration from 'humanize-duration';
|
|
4
5
|
import { Interval, DateTime } from 'luxon';
|
|
5
|
-
import React from 'react';
|
|
6
6
|
import { ilertApiRef } from '../../api/client.esm.js';
|
|
7
7
|
import { AlertActionsMenu } from '../Alert/AlertActionsMenu.esm.js';
|
|
8
8
|
import { AlertLink } from '../Alert/AlertLink.esm.js';
|
|
@@ -60,21 +60,21 @@ const AlertsTable = ({
|
|
|
60
60
|
highlight: true,
|
|
61
61
|
cellStyle: smColumnStyle,
|
|
62
62
|
headerStyle: smColumnStyle,
|
|
63
|
-
render: (rowData) => /* @__PURE__ */
|
|
63
|
+
render: (rowData) => /* @__PURE__ */ jsx(AlertLink, { alert: rowData })
|
|
64
64
|
};
|
|
65
65
|
const summaryColumn = {
|
|
66
66
|
title: "Summary",
|
|
67
67
|
field: "summary",
|
|
68
68
|
cellStyle: !compact ? xlColumnStyle : void 0,
|
|
69
69
|
headerStyle: !compact ? xlColumnStyle : void 0,
|
|
70
|
-
render: (rowData) => /* @__PURE__ */
|
|
70
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { children: rowData.summary })
|
|
71
71
|
};
|
|
72
72
|
const sourceColumn = {
|
|
73
73
|
title: "Source",
|
|
74
74
|
field: "source",
|
|
75
75
|
cellStyle: mdColumnStyle,
|
|
76
76
|
headerStyle: mdColumnStyle,
|
|
77
|
-
render: (rowData) => /* @__PURE__ */
|
|
77
|
+
render: (rowData) => /* @__PURE__ */ jsx(AlertSourceLink, { alertSource: rowData.alertSource })
|
|
78
78
|
};
|
|
79
79
|
const durationColumn = {
|
|
80
80
|
title: "Duration",
|
|
@@ -82,7 +82,7 @@ const AlertsTable = ({
|
|
|
82
82
|
type: "datetime",
|
|
83
83
|
cellStyle: smColumnStyle,
|
|
84
84
|
headerStyle: smColumnStyle,
|
|
85
|
-
render: (rowData) => /* @__PURE__ */
|
|
85
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.status !== "RESOLVED" ? humanizeDuration(
|
|
86
86
|
Interval.fromDateTimes(DateTime.fromISO(rowData.reportTime), DateTime.now()).toDuration().valueOf(),
|
|
87
87
|
{ units: ["h", "m", "s"], largest: 2, round: true }
|
|
88
88
|
) : humanizeDuration(
|
|
@@ -91,37 +91,37 @@ const AlertsTable = ({
|
|
|
91
91
|
DateTime.fromISO(rowData.resolvedOn)
|
|
92
92
|
).toDuration().valueOf(),
|
|
93
93
|
{ units: ["h", "m", "s"], largest: 2, round: true }
|
|
94
|
-
))
|
|
94
|
+
) })
|
|
95
95
|
};
|
|
96
96
|
const respondersColumn = {
|
|
97
97
|
title: "Responders",
|
|
98
98
|
field: "responders",
|
|
99
99
|
cellStyle: !compact ? mdColumnStyle : lgColumnStyle,
|
|
100
100
|
headerStyle: !compact ? mdColumnStyle : lgColumnStyle,
|
|
101
|
-
render: (rowData) => /* @__PURE__ */
|
|
101
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { children: rowData.responders.map((value, i, arr) => {
|
|
102
102
|
return ilertApi.getUserInitials(value.user) + (arr.length - 1 !== i ? ", " : "");
|
|
103
|
-
}))
|
|
103
|
+
}) })
|
|
104
104
|
};
|
|
105
105
|
const priorityColumn = {
|
|
106
106
|
title: "Priority",
|
|
107
107
|
field: "priority",
|
|
108
108
|
cellStyle: smColumnStyle,
|
|
109
109
|
headerStyle: smColumnStyle,
|
|
110
|
-
render: (rowData) => /* @__PURE__ */
|
|
110
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.priority === "HIGH" ? "High" : "Low" })
|
|
111
111
|
};
|
|
112
112
|
const statusColumn = {
|
|
113
113
|
title: "Status",
|
|
114
114
|
field: "status",
|
|
115
115
|
cellStyle: xsColumnStyle,
|
|
116
116
|
headerStyle: xsColumnStyle,
|
|
117
|
-
render: (rowData) => /* @__PURE__ */
|
|
117
|
+
render: (rowData) => /* @__PURE__ */ jsx(StatusChip, { alert: rowData })
|
|
118
118
|
};
|
|
119
119
|
const actionsColumn = {
|
|
120
120
|
title: "",
|
|
121
121
|
field: "",
|
|
122
122
|
cellStyle: xsColumnStyle,
|
|
123
123
|
headerStyle: xsColumnStyle,
|
|
124
|
-
render: (rowData) => /* @__PURE__ */
|
|
124
|
+
render: (rowData) => /* @__PURE__ */ jsx(
|
|
125
125
|
AlertActionsMenu,
|
|
126
126
|
{
|
|
127
127
|
alert: rowData,
|
|
@@ -146,7 +146,7 @@ const AlertsTable = ({
|
|
|
146
146
|
statusColumn,
|
|
147
147
|
actionsColumn
|
|
148
148
|
];
|
|
149
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ jsx(
|
|
150
150
|
Table,
|
|
151
151
|
{
|
|
152
152
|
options: {
|
|
@@ -162,14 +162,14 @@ const AlertsTable = ({
|
|
|
162
162
|
showTitle: true,
|
|
163
163
|
toolbar: true
|
|
164
164
|
},
|
|
165
|
-
emptyContent: /* @__PURE__ */
|
|
166
|
-
title: !compact ? /* @__PURE__ */
|
|
165
|
+
emptyContent: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", className: classes.empty, children: "No alerts right now" }),
|
|
166
|
+
title: !compact ? /* @__PURE__ */ jsx(
|
|
167
167
|
TableTitle,
|
|
168
168
|
{
|
|
169
169
|
alertStates: states,
|
|
170
170
|
onAlertStatesChange
|
|
171
171
|
}
|
|
172
|
-
) : /* @__PURE__ */
|
|
172
|
+
) : /* @__PURE__ */ jsx(Typography, { variant: "button", color: "textSecondary", children: "ALERTS" }),
|
|
173
173
|
page: tableState.page,
|
|
174
174
|
totalCount: alertsCount,
|
|
175
175
|
onPageChange: onChangePage,
|