@backstage-community/plugin-ilert 0.18.0 → 0.20.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.map +1 -1
- package/dist/api/client.esm.js +2 -2
- package/dist/api/client.esm.js.map +1 -1
- package/dist/components/Alert/AlertActionsMenu.esm.js +9 -8
- package/dist/components/Alert/AlertActionsMenu.esm.js.map +1 -1
- package/dist/components/Alert/AlertAssignModal.esm.js +5 -4
- package/dist/components/Alert/AlertAssignModal.esm.js.map +1 -1
- package/dist/components/Alert/AlertLink.esm.js.map +1 -1
- package/dist/components/Alert/AlertNewModal.esm.js +5 -4
- package/dist/components/Alert/AlertNewModal.esm.js.map +1 -1
- package/dist/components/AlertSource/AlertSourceLink.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsPage.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsTable.esm.js.map +1 -1
- package/dist/components/AlertsPage/StatusChip.esm.js +1 -1
- package/dist/components/AlertsPage/StatusChip.esm.js.map +1 -1
- package/dist/components/AlertsPage/TableTitle.esm.js.map +1 -1
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCard.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardActionsHeader.esm.js +8 -7
- package/dist/components/ILertCard/ILertCardActionsHeader.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js +5 -4
- package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCall.esm.js +1 -1
- package/dist/components/ILertCard/ILertCardOnCall.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCallItem.esm.js.map +1 -1
- package/dist/components/ILertCard/index.esm.js +6 -1
- package/dist/components/ILertCard/index.esm.js.map +1 -1
- package/dist/components/ILertPage/ILertPage.esm.js +1 -1
- package/dist/components/ILertPage/ILertPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js.map +1 -1
- package/dist/components/Service/ServiceActionsMenu.esm.js.map +1 -1
- package/dist/components/Service/ServiceLink.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesPage.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesTable.esm.js.map +1 -1
- package/dist/components/ServicesPage/StatusChip.esm.js.map +1 -1
- package/dist/components/Shift/ShiftOverrideModal.esm.js +5 -4
- package/dist/components/Shift/ShiftOverrideModal.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageLink.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageURL.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusChip.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesTable.esm.js.map +1 -1
- package/dist/components/StatusPagePage/VisibilityChip.esm.js.map +1 -1
- package/dist/components/index.esm.js +5 -1
- package/dist/components/index.esm.js.map +1 -1
- package/dist/constants.esm.js.map +1 -1
- package/dist/hooks/index.esm.js.map +1 -1
- package/dist/hooks/useAlertActions.esm.js.map +1 -1
- package/dist/hooks/useAlertSource.esm.js.map +1 -1
- package/dist/hooks/useAlertSourceOnCalls.esm.js.map +1 -1
- package/dist/hooks/useAlerts.esm.js.map +1 -1
- package/dist/hooks/useAssignAlert.esm.js.map +1 -1
- package/dist/hooks/useNewAlert.esm.js.map +1 -1
- package/dist/hooks/useOnCallSchedules.esm.js.map +1 -1
- package/dist/hooks/useServices.esm.js.map +1 -1
- package/dist/hooks/useShiftOverride.esm.js.map +1 -1
- package/dist/hooks/useStatusPages.esm.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/route-refs.esm.js.map +1 -1
- package/dist/types.esm.js.map +1 -1
- package/package.json +9 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertsTable.esm.js","sources":["../../../src/components/AlertsPage/AlertsTable.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 { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport humanizeDuration from 'humanize-duration';\nimport { DateTime as dt, Interval } from 'luxon';\nimport { ilertApiRef, TableState } from '../../api';\nimport { Alert, AlertStatus } from '../../types';\nimport { AlertActionsMenu } from '../Alert/AlertActionsMenu';\nimport { AlertLink } from '../Alert/AlertLink';\nimport { AlertSourceLink } from '../AlertSource/AlertSourceLink';\nimport { StatusChip } from './StatusChip';\nimport { TableTitle } from './TableTitle';\n\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nexport const AlertsTable = ({\n alerts,\n alertsCount,\n tableState,\n states,\n isLoading,\n onAlertChanged,\n setIsLoading,\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n compact,\n}: {\n alerts: Alert[];\n alertsCount: number;\n tableState: TableState;\n states: AlertStatus[];\n isLoading: boolean;\n onAlertChanged: (alert: Alert) => void;\n setIsLoading: (isLoading: boolean) => void;\n onAlertStatesChange: (states: AlertStatus[]) => void;\n onChangePage: (page: number) => void;\n onChangeRowsPerPage: (pageSize: number) => void;\n compact?: boolean;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const classes = useStyles();\n\n const xsColumnStyle = {\n width: '5%',\n maxWidth: '5%',\n };\n const smColumnStyle = {\n width: '10%',\n maxWidth: '10%',\n };\n const mdColumnStyle = {\n width: '15%',\n maxWidth: '15%',\n };\n const lgColumnStyle = {\n width: '20%',\n maxWidth: '20%',\n };\n const xlColumnStyle = {\n width: '30%',\n maxWidth: '30%',\n };\n\n const idColumn: TableColumn<Alert> = {\n title: 'ID',\n field: 'id',\n highlight: true,\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <AlertLink alert={rowData} />,\n };\n const summaryColumn: TableColumn<Alert> = {\n title: 'Summary',\n field: 'summary',\n cellStyle: !compact ? xlColumnStyle : undefined,\n headerStyle: !compact ? xlColumnStyle : undefined,\n render: rowData => <Typography>{rowData.summary}</Typography>,\n };\n const sourceColumn: TableColumn<Alert> = {\n title: 'Source',\n field: 'source',\n cellStyle: mdColumnStyle,\n headerStyle: mdColumnStyle,\n render: rowData => <AlertSourceLink alertSource={rowData.alertSource} />,\n };\n const durationColumn: TableColumn<Alert> = {\n title: 'Duration',\n field: 'reportTime',\n type: 'datetime',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => (\n <Typography noWrap>\n {rowData.status !== 'RESOLVED'\n ? humanizeDuration(\n Interval.fromDateTimes(dt.fromISO(rowData.reportTime), dt.now())\n .toDuration()\n .valueOf(),\n { units: ['h', 'm', 's'], largest: 2, round: true },\n )\n : humanizeDuration(\n Interval.fromDateTimes(\n dt.fromISO(rowData.reportTime),\n dt.fromISO(rowData.resolvedOn),\n )\n .toDuration()\n .valueOf(),\n { units: ['h', 'm', 's'], largest: 2, round: true },\n )}\n </Typography>\n ),\n };\n const respondersColumn: TableColumn<Alert> = {\n title: 'Responders',\n field: 'responders',\n cellStyle: !compact ? mdColumnStyle : lgColumnStyle,\n headerStyle: !compact ? mdColumnStyle : lgColumnStyle,\n render: rowData => (\n <Typography>\n {rowData.responders.map((value, i, arr) => {\n return (\n ilertApi.getUserInitials(value.user) +\n (arr.length - 1 !== i ? ', ' : '')\n );\n })}\n </Typography>\n ),\n };\n const priorityColumn: TableColumn<Alert> = {\n title: 'Priority',\n field: 'priority',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => (\n <Typography noWrap>\n {rowData.priority === 'HIGH' ? 'High' : 'Low'}\n </Typography>\n ),\n };\n const statusColumn: TableColumn<Alert> = {\n title: 'Status',\n field: 'status',\n cellStyle: xsColumnStyle,\n headerStyle: xsColumnStyle,\n render: rowData => <StatusChip alert={rowData} />,\n };\n const actionsColumn: TableColumn<Alert> = {\n title: '',\n field: '',\n cellStyle: xsColumnStyle,\n headerStyle: xsColumnStyle,\n render: rowData => (\n <AlertActionsMenu\n alert={rowData}\n onAlertChanged={onAlertChanged}\n setIsLoading={setIsLoading}\n />\n ),\n };\n\n const columns: TableColumn<Alert>[] = compact\n ? [\n summaryColumn,\n durationColumn,\n respondersColumn,\n statusColumn,\n actionsColumn,\n ]\n : [\n idColumn,\n summaryColumn,\n sourceColumn,\n durationColumn,\n respondersColumn,\n priorityColumn,\n statusColumn,\n actionsColumn,\n ];\n\n return (\n <Table\n options={{\n sorting: false,\n search: !compact,\n paging: !compact,\n actionsColumnIndex: -1,\n pageSize: tableState.pageSize,\n pageSizeOptions: !compact ? [10, 20, 50, 100] : [3, 10, 20, 50, 100],\n padding: 'dense',\n loadingType: 'overlay',\n showEmptyDataSourceMessage: !isLoading,\n showTitle: true,\n toolbar: true,\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No alerts right now\n </Typography>\n }\n title={\n !compact ? (\n <TableTitle\n alertStates={states}\n onAlertStatesChange={onAlertStatesChange}\n />\n ) : (\n <Typography variant=\"button\" color=\"textSecondary\">\n ALERTS\n </Typography>\n )\n }\n page={tableState.page}\n totalCount={alertsCount}\n onPageChange={onChangePage}\n onRowsPerPageChange={onChangeRowsPerPage}\n columns={columns}\n data={alerts}\n isLoading={isLoading}\n />\n );\n};\n"],"names":["dt"],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA,CAAA;AAEK,MAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAYM,KAAA;AACJ,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,KAAO,EAAA,IAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACZ;AACA,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,KAAO,EAAA,KAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACZ;AACA,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,KAAO,EAAA,KAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACZ;AACA,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,KAAO,EAAA,KAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACZ;AACA,E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AS,EAAA,KAAA;AAAA,QACT,QAAQ,CAAC,OAAA;AAAA,QACT,QAAQ,CAAC,OAAA;AAAA,QACT,kBAAoB,EAAA,CAAA,CAAA;AAAA,QACpB,UAAU,UAAW,CAAA,QAAA;AAAA,QACrB,eAAiB,EAAA,CAAC,OAAU,GAAA,CAAC,IAAI,EAAI,EAAA,EAAA,EAAI,GAAG,CAAA,GAAI,CAAC,CAAA,EAAG,EAAI,EAAA,EAAA,EAAI,IAAI,GAAG,CAAA;AAAA,QACnE,OAAS,EAAA,OAAA;AAAA,QACT,WAAa,EAAA,SAAA;AAAA,QACb,4BAA4B,CAAC,SAAA;AAAA,QAC7B,SAAW,EAAA,IAAA;AAAA,QACX,OAAS,EAAA;AAAA,OACX;AAAA,MACA,YAAA,sBACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,OAAO,QAE5D,EAAA,qBAAA,EAAA,CAAA;AAAA,MAEF,KAAA,EACE,CAAC,OACC,mBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,WAAa,EAAA,MAAA;AAAA,UACb;AAAA;AAAA,0BAGD,GAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,QAAS,EAAA,KAAA,EAAM,iBAAgB,QAEnD,EAAA,QAAA,EAAA,CAAA;AAAA,MAGJ,MAAM,UAAW,CAAA,IAAA;AAAA,MACjB,UAAY,EAAA,WAAA;AAAA,MACZ,YAAc,EAAA,YAAA;AAAA,MACd,mBAAqB,EAAA,mBAAA;AAAA,MACrB,OAAA;AAAA,MACA,IAAM,EAAA,MAAA;AAAA,MACN;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AlertsTable.esm.js","sources":["../../../src/components/AlertsPage/AlertsTable.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 { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport humanizeDuration from 'humanize-duration';\nimport { DateTime as dt, Interval } from 'luxon';\nimport { ilertApiRef, TableState } from '../../api';\nimport { Alert, AlertStatus } from '../../types';\nimport { AlertActionsMenu } from '../Alert/AlertActionsMenu';\nimport { AlertLink } from '../Alert/AlertLink';\nimport { AlertSourceLink } from '../AlertSource/AlertSourceLink';\nimport { StatusChip } from './StatusChip';\nimport { TableTitle } from './TableTitle';\n\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nexport const AlertsTable = ({\n alerts,\n alertsCount,\n tableState,\n states,\n isLoading,\n onAlertChanged,\n setIsLoading,\n onAlertStatesChange,\n onChangePage,\n onChangeRowsPerPage,\n compact,\n}: {\n alerts: Alert[];\n alertsCount: number;\n tableState: TableState;\n states: AlertStatus[];\n isLoading: boolean;\n onAlertChanged: (alert: Alert) => void;\n setIsLoading: (isLoading: boolean) => void;\n onAlertStatesChange: (states: AlertStatus[]) => void;\n onChangePage: (page: number) => void;\n onChangeRowsPerPage: (pageSize: number) => void;\n compact?: boolean;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const classes = useStyles();\n\n const xsColumnStyle = {\n width: '5%',\n maxWidth: '5%',\n };\n const smColumnStyle = {\n width: '10%',\n maxWidth: '10%',\n };\n const mdColumnStyle = {\n width: '15%',\n maxWidth: '15%',\n };\n const lgColumnStyle = {\n width: '20%',\n maxWidth: '20%',\n };\n const xlColumnStyle = {\n width: '30%',\n maxWidth: '30%',\n };\n\n const idColumn: TableColumn<Alert> = {\n title: 'ID',\n field: 'id',\n highlight: true,\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <AlertLink alert={rowData} />,\n };\n const summaryColumn: TableColumn<Alert> = {\n title: 'Summary',\n field: 'summary',\n cellStyle: !compact ? xlColumnStyle : undefined,\n headerStyle: !compact ? xlColumnStyle : undefined,\n render: rowData => <Typography>{rowData.summary}</Typography>,\n };\n const sourceColumn: TableColumn<Alert> = {\n title: 'Source',\n field: 'source',\n cellStyle: mdColumnStyle,\n headerStyle: mdColumnStyle,\n render: rowData => <AlertSourceLink alertSource={rowData.alertSource} />,\n };\n const durationColumn: TableColumn<Alert> = {\n title: 'Duration',\n field: 'reportTime',\n type: 'datetime',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => (\n <Typography noWrap>\n {rowData.status !== 'RESOLVED'\n ? humanizeDuration(\n Interval.fromDateTimes(dt.fromISO(rowData.reportTime), dt.now())\n .toDuration()\n .valueOf(),\n { units: ['h', 'm', 's'], largest: 2, round: true },\n )\n : humanizeDuration(\n Interval.fromDateTimes(\n dt.fromISO(rowData.reportTime),\n dt.fromISO(rowData.resolvedOn),\n )\n .toDuration()\n .valueOf(),\n { units: ['h', 'm', 's'], largest: 2, round: true },\n )}\n </Typography>\n ),\n };\n const respondersColumn: TableColumn<Alert> = {\n title: 'Responders',\n field: 'responders',\n cellStyle: !compact ? mdColumnStyle : lgColumnStyle,\n headerStyle: !compact ? mdColumnStyle : lgColumnStyle,\n render: rowData => (\n <Typography>\n {rowData.responders.map((value, i, arr) => {\n return (\n ilertApi.getUserInitials(value.user) +\n (arr.length - 1 !== i ? ', ' : '')\n );\n })}\n </Typography>\n ),\n };\n const priorityColumn: TableColumn<Alert> = {\n title: 'Priority',\n field: 'priority',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => (\n <Typography noWrap>\n {rowData.priority === 'HIGH' ? 'High' : 'Low'}\n </Typography>\n ),\n };\n const statusColumn: TableColumn<Alert> = {\n title: 'Status',\n field: 'status',\n cellStyle: xsColumnStyle,\n headerStyle: xsColumnStyle,\n render: rowData => <StatusChip alert={rowData} />,\n };\n const actionsColumn: TableColumn<Alert> = {\n title: '',\n field: '',\n cellStyle: xsColumnStyle,\n headerStyle: xsColumnStyle,\n render: rowData => (\n <AlertActionsMenu\n alert={rowData}\n onAlertChanged={onAlertChanged}\n setIsLoading={setIsLoading}\n />\n ),\n };\n\n const columns: TableColumn<Alert>[] = compact\n ? [\n summaryColumn,\n durationColumn,\n respondersColumn,\n statusColumn,\n actionsColumn,\n ]\n : [\n idColumn,\n summaryColumn,\n sourceColumn,\n durationColumn,\n respondersColumn,\n priorityColumn,\n statusColumn,\n actionsColumn,\n ];\n\n return (\n <Table\n options={{\n sorting: false,\n search: !compact,\n paging: !compact,\n actionsColumnIndex: -1,\n pageSize: tableState.pageSize,\n pageSizeOptions: !compact ? [10, 20, 50, 100] : [3, 10, 20, 50, 100],\n padding: 'dense',\n loadingType: 'overlay',\n showEmptyDataSourceMessage: !isLoading,\n showTitle: true,\n toolbar: true,\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No alerts right now\n </Typography>\n }\n title={\n !compact ? (\n <TableTitle\n alertStates={states}\n onAlertStatesChange={onAlertStatesChange}\n />\n ) : (\n <Typography variant=\"button\" color=\"textSecondary\">\n ALERTS\n </Typography>\n )\n }\n page={tableState.page}\n totalCount={alertsCount}\n onPageChange={onChangePage}\n onRowsPerPageChange={onChangeRowsPerPage}\n columns={columns}\n data={alerts}\n isLoading={isLoading}\n />\n );\n};\n"],"names":["dt"],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAA,EAAS,MAAA;AAAA,IACT,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,EAAM,iBAAgB,SAAA,EAAW,OAAA,CAAQ,OAAO,QAAA,EAAA,qBAAA,EAE5D,CAAA;AAAA,MAEF,KAAA,EACE,CAAC,OAAA,mBACC,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,WAAA,EAAa,MAAA;AAAA,UACb;AAAA;AAAA,0BAGF,GAAA,CAAC,UAAA,EAAA,EAAW,SAAQ,QAAA,EAAS,KAAA,EAAM,iBAAgB,QAAA,EAAA,QAAA,EAEnD,CAAA;AAAA,MAGJ,MAAM,UAAA,CAAW,IAAA;AAAA,MACjB,UAAA,EAAY,WAAA;AAAA,MACZ,YAAA,EAAc,YAAA;AAAA,MACd,mBAAA,EAAqB,mBAAA;AAAA,MACrB,OAAA;AAAA,MACA,IAAA,EAAM,MAAA;AAAA,MACN;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Chip from '@material-ui/core/Chip';
|
|
3
3
|
import { withStyles } from '@material-ui/core/styles';
|
|
4
|
-
import {
|
|
4
|
+
import { PENDING, ACCEPTED, RESOLVED } from '../../types.esm.js';
|
|
5
5
|
|
|
6
6
|
const ResolvedChip = withStyles((theme) => ({
|
|
7
7
|
root: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusChip.esm.js","sources":["../../../src/components/AlertsPage/StatusChip.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 Chip from '@material-ui/core/Chip';\nimport { withStyles } from '@material-ui/core/styles';\nimport { ACCEPTED, Alert, PENDING, RESOLVED } from '../../types';\n\nconst ResolvedChip = withStyles(theme => ({\n root: {\n backgroundColor: '#4caf50',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst AcceptedChip = withStyles(theme => ({\n root: {\n backgroundColor: '#ffb74d',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst PendingChip = withStyles(theme => ({\n root: {\n backgroundColor: '#d32f2f',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nexport const alertStatusLabels = {\n [RESOLVED]: 'Resolved',\n [ACCEPTED]: 'Accepted',\n [PENDING]: 'Pending',\n} as Record<string, string>;\n\nexport const StatusChip = ({ alert }: { alert: Alert }) => {\n const label = `${alertStatusLabels[alert.status]}`;\n\n switch (alert.status) {\n case RESOLVED:\n return <ResolvedChip label={label} size=\"small\" />;\n case ACCEPTED:\n return <AcceptedChip label={label} size=\"small\" />;\n case PENDING:\n return <PendingChip label={label} size=\"small\" />;\n default:\n return <Chip label={label} size=\"small\" />;\n }\n};\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,YAAA,GAAe,WAAW,
|
|
1
|
+
{"version":3,"file":"StatusChip.esm.js","sources":["../../../src/components/AlertsPage/StatusChip.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 Chip from '@material-ui/core/Chip';\nimport { withStyles } from '@material-ui/core/styles';\nimport { ACCEPTED, Alert, PENDING, RESOLVED } from '../../types';\n\nconst ResolvedChip = withStyles(theme => ({\n root: {\n backgroundColor: '#4caf50',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst AcceptedChip = withStyles(theme => ({\n root: {\n backgroundColor: '#ffb74d',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst PendingChip = withStyles(theme => ({\n root: {\n backgroundColor: '#d32f2f',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nexport const alertStatusLabels = {\n [RESOLVED]: 'Resolved',\n [ACCEPTED]: 'Accepted',\n [PENDING]: 'Pending',\n} as Record<string, string>;\n\nexport const StatusChip = ({ alert }: { alert: Alert }) => {\n const label = `${alertStatusLabels[alert.status]}`;\n\n switch (alert.status) {\n case RESOLVED:\n return <ResolvedChip label={label} size=\"small\" />;\n case ACCEPTED:\n return <AcceptedChip label={label} size=\"small\" />;\n case PENDING:\n return <PendingChip label={label} size=\"small\" />;\n default:\n return <Chip label={label} size=\"small\" />;\n }\n};\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,YAAA,GAAe,WAAW,CAAA,KAAA,MAAU;AAAA,EACxC,IAAA,EAAM;AAAA,IACJ,eAAA,EAAiB,SAAA;AAAA,IACjB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IAC5B,MAAA,EAAQ;AAAA;AAEZ,CAAA,CAAE,EAAE,IAAI,CAAA;AAER,MAAM,YAAA,GAAe,WAAW,CAAA,KAAA,MAAU;AAAA,EACxC,IAAA,EAAM;AAAA,IACJ,eAAA,EAAiB,SAAA;AAAA,IACjB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IAC5B,MAAA,EAAQ;AAAA;AAEZ,CAAA,CAAE,EAAE,IAAI,CAAA;AACR,MAAM,WAAA,GAAc,WAAW,CAAA,KAAA,MAAU;AAAA,EACvC,IAAA,EAAM;AAAA,IACJ,eAAA,EAAiB,SAAA;AAAA,IACjB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IAC5B,MAAA,EAAQ;AAAA;AAEZ,CAAA,CAAE,EAAE,IAAI,CAAA;AAED,MAAM,iBAAA,GAAoB;AAAA,EAC/B,CAAC,QAAQ,GAAG,UAAA;AAAA,EACZ,CAAC,QAAQ,GAAG,UAAA;AAAA,EACZ,CAAC,OAAO,GAAG;AACb;AAEO,MAAM,UAAA,GAAa,CAAC,EAAE,KAAA,EAAM,KAAwB;AACzD,EAAA,MAAM,KAAA,GAAQ,CAAA,EAAG,iBAAA,CAAkB,KAAA,CAAM,MAAM,CAAC,CAAA,CAAA;AAEhD,EAAA,QAAQ,MAAM,MAAA;AAAQ,IACpB,KAAK,QAAA;AACH,MAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,KAAA,EAAc,IAAA,EAAK,OAAA,EAAQ,CAAA;AAAA,IAClD,KAAK,QAAA;AACH,MAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,KAAA,EAAc,IAAA,EAAK,OAAA,EAAQ,CAAA;AAAA,IAClD,KAAK,OAAA;AACH,MAAA,uBAAO,GAAA,CAAC,WAAA,EAAA,EAAY,KAAA,EAAc,IAAA,EAAK,OAAA,EAAQ,CAAA;AAAA,IACjD;AACE,MAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAc,IAAA,EAAK,OAAA,EAAQ,CAAA;AAAA;AAE9C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableTitle.esm.js","sources":["../../../src/components/AlertsPage/TableTitle.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 Checkbox from '@material-ui/core/Checkbox';\nimport FormControl from '@material-ui/core/FormControl';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { ACCEPTED, AlertStatus, PENDING, RESOLVED } from '../../types';\nimport { alertStatusLabels } from './StatusChip';\n\nconst ITEM_HEIGHT = 48;\nconst ITEM_PADDING_TOP = 8;\nconst MenuProps = {\n PaperProps: {\n style: {\n maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,\n width: 250,\n },\n },\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n },\n label: {\n marginTop: 8,\n marginRight: 4,\n },\n formControl: {\n minWidth: 120,\n maxWidth: 300,\n },\n grow: {\n flexGrow: 1,\n },\n});\n\nexport const TableTitle = ({\n alertStates,\n onAlertStatesChange,\n}: {\n alertStates: AlertStatus[];\n onAlertStatesChange: (states: AlertStatus[]) => void;\n}) => {\n const classes = useStyles();\n const handleAlertStatusSelectChange = (event: any) => {\n onAlertStatesChange(event.target.value);\n };\n\n return (\n <div className={classes.root}>\n <Typography noWrap className={classes.label}>\n Status:\n </Typography>\n <FormControl\n className={classes.formControl}\n variant=\"outlined\"\n size=\"small\"\n >\n <Select\n id=\"alerts-status-select\"\n multiple\n value={alertStates}\n onChange={handleAlertStatusSelectChange}\n renderValue={(selected: any) => selected.join(', ')}\n MenuProps={MenuProps}\n >\n {[PENDING, ACCEPTED, RESOLVED].map(state => (\n <MenuItem key={state} value={state}>\n <Checkbox\n checked={alertStates.indexOf(state as AlertStatus) > -1}\n />\n <ListItemText primary={alertStatusLabels[state]} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAyBA,MAAM,
|
|
1
|
+
{"version":3,"file":"TableTitle.esm.js","sources":["../../../src/components/AlertsPage/TableTitle.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 Checkbox from '@material-ui/core/Checkbox';\nimport FormControl from '@material-ui/core/FormControl';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { ACCEPTED, AlertStatus, PENDING, RESOLVED } from '../../types';\nimport { alertStatusLabels } from './StatusChip';\n\nconst ITEM_HEIGHT = 48;\nconst ITEM_PADDING_TOP = 8;\nconst MenuProps = {\n PaperProps: {\n style: {\n maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,\n width: 250,\n },\n },\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n },\n label: {\n marginTop: 8,\n marginRight: 4,\n },\n formControl: {\n minWidth: 120,\n maxWidth: 300,\n },\n grow: {\n flexGrow: 1,\n },\n});\n\nexport const TableTitle = ({\n alertStates,\n onAlertStatesChange,\n}: {\n alertStates: AlertStatus[];\n onAlertStatesChange: (states: AlertStatus[]) => void;\n}) => {\n const classes = useStyles();\n const handleAlertStatusSelectChange = (event: any) => {\n onAlertStatesChange(event.target.value);\n };\n\n return (\n <div className={classes.root}>\n <Typography noWrap className={classes.label}>\n Status:\n </Typography>\n <FormControl\n className={classes.formControl}\n variant=\"outlined\"\n size=\"small\"\n >\n <Select\n id=\"alerts-status-select\"\n multiple\n value={alertStates}\n onChange={handleAlertStatusSelectChange}\n renderValue={(selected: any) => selected.join(', ')}\n MenuProps={MenuProps}\n >\n {[PENDING, ACCEPTED, RESOLVED].map(state => (\n <MenuItem key={state} value={state}>\n <Checkbox\n checked={alertStates.indexOf(state as AlertStatus) > -1}\n />\n <ListItemText primary={alertStatusLabels[state]} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAyBA,MAAM,WAAA,GAAc,EAAA;AACpB,MAAM,gBAAA,GAAmB,CAAA;AACzB,MAAM,SAAA,GAAY;AAAA,EAChB,UAAA,EAAY;AAAA,IACV,KAAA,EAAO;AAAA,MACL,SAAA,EAAW,cAAc,GAAA,GAAM,gBAAA;AAAA,MAC/B,KAAA,EAAO;AAAA;AACT;AAEJ,CAAA;AAEA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS;AAAA,GACX;AAAA,EACA,KAAA,EAAO;AAAA,IACL,SAAA,EAAW,CAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,WAAA,EAAa;AAAA,IACX,QAAA,EAAU,GAAA;AAAA,IACV,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU;AAAA;AAEd,CAAC,CAAA;AAEM,MAAM,aAAa,CAAC;AAAA,EACzB,WAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,6BAAA,GAAgC,CAAC,KAAA,KAAe;AACpD,IAAA,mBAAA,CAAoB,KAAA,CAAM,OAAO,KAAK,CAAA;AAAA,EACxC,CAAA;AAEA,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,IAAA,EACtB,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAW,MAAA,EAAM,IAAA,EAAC,SAAA,EAAW,OAAA,CAAQ,OAAO,QAAA,EAAA,SAAA,EAE7C,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,WAAA;AAAA,QACnB,OAAA,EAAQ,UAAA;AAAA,QACR,IAAA,EAAK,OAAA;AAAA,QAEL,QAAA,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAG,sBAAA;AAAA,YACH,QAAA,EAAQ,IAAA;AAAA,YACR,KAAA,EAAO,WAAA;AAAA,YACP,QAAA,EAAU,6BAAA;AAAA,YACV,WAAA,EAAa,CAAC,QAAA,KAAkB,QAAA,CAAS,KAAK,IAAI,CAAA;AAAA,YAClD,SAAA;AAAA,YAEC,QAAA,EAAA,CAAC,OAAA,EAAS,QAAA,EAAU,QAAQ,CAAA,CAAE,IAAI,CAAA,KAAA,qBACjC,IAAA,CAAC,QAAA,EAAA,EAAqB,KAAA,EAAO,KAAA,EAC3B,QAAA,EAAA;AAAA,8BAAA,GAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBACC,OAAA,EAAS,WAAA,CAAY,OAAA,CAAQ,KAAoB,CAAA,GAAI;AAAA;AAAA,eACvD;AAAA,8BACA,GAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAAA,aAAA,EAAA,EAJpC,KAKf,CACD;AAAA;AAAA;AACH;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingAuthorizationHeaderError.esm.js","sources":["../../../src/components/Errors/MissingAuthorizationHeaderError.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 Button from '@material-ui/core/Button';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingAuthorizationHeaderError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid iLert authorization header\"\n description=\"The request to fetch data needs a valid authorization header. 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/ilert/README.md\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAkBO,MAAM,kCAAkC,sBAC7C,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,
|
|
1
|
+
{"version":3,"file":"MissingAuthorizationHeaderError.esm.js","sources":["../../../src/components/Errors/MissingAuthorizationHeaderError.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 Button from '@material-ui/core/Button';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingAuthorizationHeaderError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid iLert authorization header\"\n description=\"The request to fetch data needs a valid authorization header. 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/ilert/README.md\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAkBO,MAAM,kCAAkC,sBAC7C,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAM,+CAAA;AAAA,IACN,WAAA,EAAY,4FAAA;AAAA,IACZ,MAAA,kBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAQ,WAAA;AAAA,QACR,IAAA,EAAK,4EAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCard.esm.js","sources":["../../../src/components/ILertCard/ILertCard.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 { Entity } from '@backstage/catalog-model';\nimport { ResponseErrorPanel } from '@backstage/core-components';\nimport { AuthenticationError } from '@backstage/errors';\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 { makeStyles } from '@material-ui/core/styles';\nimport { useState } from 'react';\nimport { ILERT_INTEGRATION_KEY_ANNOTATION } from '../../constants';\nimport { useILertEntity } from '../../hooks';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { useAlertSource } from '../../hooks/useAlertSource';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { AlertsTable } from '../AlertsPage';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { ILertCardActionsHeader } from './ILertCardActionsHeader';\nimport { ILertCardEmptyState } from './ILertCardEmptyState';\nimport { ILertCardHeaderStatus } from './ILertCardHeaderStatus';\nimport { ILertCardMaintenanceModal } from './ILertCardMaintenanceModal';\nimport { ILertCardOnCall } from './ILertCardOnCall';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ILERT_INTEGRATION_KEY_ANNOTATION]);\n\nconst useStyles = makeStyles({\n content: {\n paddingLeft: '0 !important',\n paddingRight: '0 !important',\n paddingBottom: '0 !important',\n paddingTop: '0 !important',\n '& div div': {\n boxShadow: 'none !important',\n },\n },\n});\n\n/** @public */\nexport const ILertCard = () => {\n const classes = useStyles();\n const { integrationKey, name } = useILertEntity();\n const [{ alertSource }, { setAlertSource, refetchAlertSource }] =\n useAlertSource(integrationKey);\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(false, true, alertSource);\n\n const [isNewAlertModalOpened, setIsNewAlertModalOpened] = useState(false);\n const [isMaintenanceModalOpened, setIsMaintenanceModalOpened] =\n useState(false);\n\n if (error) {\n if (error instanceof AuthenticationError) {\n return <MissingAuthorizationHeaderError />;\n }\n\n return <ResponseErrorPanel error={error} />;\n }\n\n if (!integrationKey) {\n return <ILertCardEmptyState />;\n }\n\n return (\n <>\n <Card data-testid=\"ilert-card\">\n <CardHeader\n title=\"iLert\"\n subheader={\n <ILertCardActionsHeader\n alertSource={alertSource}\n setAlertSource={setAlertSource}\n setIsNewAlertModalOpened={setIsNewAlertModalOpened}\n setIsMaintenanceModalOpened={setIsMaintenanceModalOpened}\n />\n }\n action={<ILertCardHeaderStatus alertSource={alertSource} />}\n />\n <Divider />\n <CardContent className={classes.content}>\n <ILertCardOnCall alertSource={alertSource} />\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 compact\n />\n </CardContent>\n </Card>\n <AlertNewModal\n isModalOpened={isNewAlertModalOpened}\n setIsModalOpened={setIsNewAlertModalOpened}\n refetchAlerts={refetchAlerts}\n initialAlertSource={alertSource}\n entityName={name}\n />\n <ILertCardMaintenanceModal\n alertSource={alertSource}\n refetchAlertSource={refetchAlertSource}\n isModalOpened={isMaintenanceModalOpened}\n setIsModalOpened={setIsMaintenanceModalOpened}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ILertCard.esm.js","sources":["../../../src/components/ILertCard/ILertCard.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 { Entity } from '@backstage/catalog-model';\nimport { ResponseErrorPanel } from '@backstage/core-components';\nimport { AuthenticationError } from '@backstage/errors';\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 { makeStyles } from '@material-ui/core/styles';\nimport { useState } from 'react';\nimport { ILERT_INTEGRATION_KEY_ANNOTATION } from '../../constants';\nimport { useILertEntity } from '../../hooks';\nimport { useAlerts } from '../../hooks/useAlerts';\nimport { useAlertSource } from '../../hooks/useAlertSource';\nimport { AlertNewModal } from '../Alert/AlertNewModal';\nimport { AlertsTable } from '../AlertsPage';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { ILertCardActionsHeader } from './ILertCardActionsHeader';\nimport { ILertCardEmptyState } from './ILertCardEmptyState';\nimport { ILertCardHeaderStatus } from './ILertCardHeaderStatus';\nimport { ILertCardMaintenanceModal } from './ILertCardMaintenanceModal';\nimport { ILertCardOnCall } from './ILertCardOnCall';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ILERT_INTEGRATION_KEY_ANNOTATION]);\n\nconst useStyles = makeStyles({\n content: {\n paddingLeft: '0 !important',\n paddingRight: '0 !important',\n paddingBottom: '0 !important',\n paddingTop: '0 !important',\n '& div div': {\n boxShadow: 'none !important',\n },\n },\n});\n\n/** @public */\nexport const ILertCard = () => {\n const classes = useStyles();\n const { integrationKey, name } = useILertEntity();\n const [{ alertSource }, { setAlertSource, refetchAlertSource }] =\n useAlertSource(integrationKey);\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(false, true, alertSource);\n\n const [isNewAlertModalOpened, setIsNewAlertModalOpened] = useState(false);\n const [isMaintenanceModalOpened, setIsMaintenanceModalOpened] =\n useState(false);\n\n if (error) {\n if (error instanceof AuthenticationError) {\n return <MissingAuthorizationHeaderError />;\n }\n\n return <ResponseErrorPanel error={error} />;\n }\n\n if (!integrationKey) {\n return <ILertCardEmptyState />;\n }\n\n return (\n <>\n <Card data-testid=\"ilert-card\">\n <CardHeader\n title=\"iLert\"\n subheader={\n <ILertCardActionsHeader\n alertSource={alertSource}\n setAlertSource={setAlertSource}\n setIsNewAlertModalOpened={setIsNewAlertModalOpened}\n setIsMaintenanceModalOpened={setIsMaintenanceModalOpened}\n />\n }\n action={<ILertCardHeaderStatus alertSource={alertSource} />}\n />\n <Divider />\n <CardContent className={classes.content}>\n <ILertCardOnCall alertSource={alertSource} />\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 compact\n />\n </CardContent>\n </Card>\n <AlertNewModal\n isModalOpened={isNewAlertModalOpened}\n setIsModalOpened={setIsNewAlertModalOpened}\n refetchAlerts={refetchAlerts}\n initialAlertSource={alertSource}\n entityName={name}\n />\n <ILertCardMaintenanceModal\n alertSource={alertSource}\n refetchAlertSource={refetchAlertSource}\n isModalOpened={isMaintenanceModalOpened}\n setIsModalOpened={setIsMaintenanceModalOpened}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,0BAAA,GAA6B,CAAC,MAAA,KACzC,OAAA,CAAQ,OAAO,QAAA,CAAS,WAAA,GAAc,gCAAgC,CAAC;AAEzE,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,OAAA,EAAS;AAAA,IACP,WAAA,EAAa,cAAA;AAAA,IACb,YAAA,EAAc,cAAA;AAAA,IACd,aAAA,EAAe,cAAA;AAAA,IACf,UAAA,EAAY,cAAA;AAAA,IACZ,WAAA,EAAa;AAAA,MACX,SAAA,EAAW;AAAA;AACb;AAEJ,CAAC,CAAA;AAGM,MAAM,YAAY,MAAM;AAC7B,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,cAAA,EAAgB,IAAA,EAAK,GAAI,cAAA,EAAe;AAChD,EAAA,MAAM,CAAC,EAAE,WAAA,EAAY,EAAG,EAAE,gBAAgB,kBAAA,EAAoB,CAAA,GAC5D,cAAA,CAAe,cAAc,CAAA;AAC/B,EAAA,MAAM;AAAA,IACJ,EAAE,UAAA,EAAY,MAAA,EAAQ,MAAA,EAAQ,WAAA,EAAa,WAAW,KAAA,EAAM;AAAA,IAC5D;AAAA,MACE,mBAAA;AAAA,MACA,YAAA;AAAA,MACA,m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,WAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,WAAA;AAAA,YACA,UAAA;AAAA,YACA,MAAA;AAAA,YACA,cAAA;AAAA,YACA,mBAAA;AAAA,YACA,YAAA;AAAA,YACA,mBAAA;AAAA,YACA,SAAA;AAAA,YACA,YAAA;AAAA,YACA,OAAA,EAAO;AAAA;AAAA;AACT,OAAA,EACF;AAAA,KAAA,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,aAAA,EAAe,qBAAA;AAAA,QACf,gBAAA,EAAkB,wBAAA;AAAA,QAClB,aAAA;AAAA,QACA,kBAAA,EAAoB,WAAA;AAAA,QACpB,UAAA,EAAY;AAAA;AAAA,KACd;AAAA,oBACA,GAAA;AAAA,MAAC,yBAAA;AAAA,MAAA;AAAA,QACC,WAAA;AAAA,QACA,kBAAA;AAAA,QACA,aAAA,EAAe,wBAAA;AAAA,QACf,gBAAA,EAAkB;AAAA;AAAA;AACpB,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Button from '@material-ui/core/Button';
|
|
3
3
|
import Dialog from '@material-ui/core/Dialog';
|
|
4
4
|
import DialogActions from '@material-ui/core/DialogActions';
|
|
@@ -14,7 +14,8 @@ import Alert from '@material-ui/lab/Alert';
|
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
import { ilertApiRef } from '../../api/client.esm.js';
|
|
16
16
|
import { HeaderIconLinkRow } from '@backstage/core-components';
|
|
17
|
-
import { useApi
|
|
17
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
18
|
+
import { toastApiRef } from '@backstage/frontend-plugin-api';
|
|
18
19
|
|
|
19
20
|
const ILertCardActionsHeader = ({
|
|
20
21
|
alertSource,
|
|
@@ -23,7 +24,7 @@ const ILertCardActionsHeader = ({
|
|
|
23
24
|
setIsMaintenanceModalOpened
|
|
24
25
|
}) => {
|
|
25
26
|
const ilertApi = useApi(ilertApiRef);
|
|
26
|
-
const alertApi = useApi(
|
|
27
|
+
const alertApi = useApi(toastApiRef);
|
|
27
28
|
const [isLoading, setIsLoading] = useState(false);
|
|
28
29
|
const [isDisableModalOpened, setIsDisableModalOpened] = useState(false);
|
|
29
30
|
const handleCreateNewAlert = () => {
|
|
@@ -36,12 +37,12 @@ const ILertCardActionsHeader = ({
|
|
|
36
37
|
}
|
|
37
38
|
setIsLoading(true);
|
|
38
39
|
const newAlertSource = await ilertApi.enableAlertSource(alertSource);
|
|
39
|
-
alertApi.post({
|
|
40
|
+
alertApi.post({ title: "Alert source enabled." });
|
|
40
41
|
setIsLoading(false);
|
|
41
42
|
setAlertSource(newAlertSource);
|
|
42
43
|
} catch (err) {
|
|
43
44
|
setIsLoading(false);
|
|
44
|
-
alertApi.post({
|
|
45
|
+
alertApi.post({ title: err, status: "danger" });
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
const handleDisableAlertSource = async () => {
|
|
@@ -52,12 +53,12 @@ const ILertCardActionsHeader = ({
|
|
|
52
53
|
setIsDisableModalOpened(false);
|
|
53
54
|
setIsLoading(true);
|
|
54
55
|
const newAlertSource = await ilertApi.disableAlertSource(alertSource);
|
|
55
|
-
alertApi.post({
|
|
56
|
+
alertApi.post({ title: "Alert source disabled." });
|
|
56
57
|
setIsLoading(false);
|
|
57
58
|
setAlertSource(newAlertSource);
|
|
58
59
|
} catch (err) {
|
|
59
60
|
setIsLoading(false);
|
|
60
|
-
alertApi.post({
|
|
61
|
+
alertApi.post({ title: err, status: "danger" });
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
const handleDisableAlertSourceWarningOpen = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardActionsHeader.esm.js","sources":["../../../src/components/ILertCard/ILertCardActionsHeader.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 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 Typography from '@material-ui/core/Typography';\nimport AlarmAddIcon from '@material-ui/icons/AlarmAdd';\nimport BuildIcon from '@material-ui/icons/Build';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport PlayArrowIcon from '@material-ui/icons/PlayArrow';\nimport WebIcon from '@material-ui/icons/Web';\nimport Alert from '@material-ui/lab/Alert';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { AlertSource } from '../../types';\n\nimport {\n HeaderIconLinkRow,\n IconLinkVerticalProps,\n} from '@backstage/core-components';\nimport {
|
|
1
|
+
{"version":3,"file":"ILertCardActionsHeader.esm.js","sources":["../../../src/components/ILertCard/ILertCardActionsHeader.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 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 Typography from '@material-ui/core/Typography';\nimport AlarmAddIcon from '@material-ui/icons/AlarmAdd';\nimport BuildIcon from '@material-ui/icons/Build';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport PlayArrowIcon from '@material-ui/icons/PlayArrow';\nimport WebIcon from '@material-ui/icons/Web';\nimport Alert from '@material-ui/lab/Alert';\nimport { useState } from 'react';\nimport { ilertApiRef } from '../../api';\nimport { AlertSource } from '../../types';\n\nimport {\n HeaderIconLinkRow,\n IconLinkVerticalProps,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\n\nexport const ILertCardActionsHeader = ({\n alertSource,\n setAlertSource,\n setIsNewAlertModalOpened,\n setIsMaintenanceModalOpened,\n}: {\n alertSource: AlertSource | null;\n setAlertSource: (alertSource: AlertSource) => void;\n setIsNewAlertModalOpened: (isOpen: boolean) => void;\n setIsMaintenanceModalOpened: (isOpen: boolean) => void;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const alertApi = useApi(toastApiRef);\n const [isLoading, setIsLoading] = useState(false);\n const [isDisableModalOpened, setIsDisableModalOpened] = useState(false);\n\n const handleCreateNewAlert = () => {\n setIsNewAlertModalOpened(true);\n };\n\n const handleEnableAlertSource = async () => {\n try {\n if (!alertSource) {\n return;\n }\n setIsLoading(true);\n const newAlertSource = await ilertApi.enableAlertSource(alertSource);\n alertApi.post({ title: 'Alert source enabled.' });\n setIsLoading(false);\n setAlertSource(newAlertSource);\n } catch (err) {\n setIsLoading(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n const handleDisableAlertSource = async () => {\n try {\n if (!alertSource) {\n return;\n }\n setIsDisableModalOpened(false);\n setIsLoading(true);\n const newAlertSource = await ilertApi.disableAlertSource(alertSource);\n alertApi.post({ title: 'Alert source disabled.' });\n setIsLoading(false);\n setAlertSource(newAlertSource);\n } catch (err) {\n setIsLoading(false);\n alertApi.post({ title: err, status: 'danger' });\n }\n };\n\n const handleDisableAlertSourceWarningOpen = () => {\n setIsDisableModalOpened(true);\n };\n\n const handleDisableAlertSourceWarningClose = () => {\n setIsDisableModalOpened(false);\n };\n\n const handleMaintenanceAlertSource = () => {\n setIsMaintenanceModalOpened(true);\n };\n\n const alertSourceLink: IconLinkVerticalProps = {\n label: 'Alert Source',\n href: ilertApi.getAlertSourceDetailsURL(alertSource),\n icon: <WebIcon />,\n };\n\n const createAlertLink: IconLinkVerticalProps = {\n label: 'Create Alert',\n onClick: handleCreateNewAlert,\n icon: <AlarmAddIcon />,\n color: 'secondary',\n disabled:\n !alertSource ||\n alertSource.status === 'DISABLED' ||\n alertSource.status === 'IN_MAINTENANCE',\n };\n\n const enableAlertSourceLink: IconLinkVerticalProps = {\n label: 'Enable',\n onClick: handleEnableAlertSource,\n icon: <PlayArrowIcon />,\n disabled: !alertSource || isLoading,\n };\n\n const disableAlertSourceLink: IconLinkVerticalProps = {\n label: 'Disable',\n onClick: handleDisableAlertSourceWarningOpen,\n icon: <PauseIcon />,\n disabled: !alertSource || isLoading,\n };\n\n const maintenanceAlertSourceLink: IconLinkVerticalProps = {\n label: 'Immediate maintenance',\n onClick: handleMaintenanceAlertSource,\n icon: <BuildIcon />,\n disabled: !alertSource || isLoading,\n };\n\n const links: IconLinkVerticalProps[] = [\n alertSourceLink,\n createAlertLink,\n alertSource && alertSource.active\n ? disableAlertSourceLink\n : enableAlertSourceLink,\n ];\n\n if (alertSource && alertSource.status !== 'IN_MAINTENANCE') {\n links.push(maintenanceAlertSourceLink);\n }\n\n return (\n <>\n <HeaderIconLinkRow links={links} />\n <Dialog\n open={isDisableModalOpened}\n onClose={handleDisableAlertSourceWarningClose}\n aria-labelledby=\"alert-source-disable-form-title\"\n >\n <DialogTitle id=\"alert-source-disable-form-title\">\n Disable alert source\n </DialogTitle>\n <DialogContent>\n <Alert severity=\"info\">\n <Typography variant=\"body1\" align=\"justify\">\n Do you really want to disable this alert source? A disabled alert\n source cannot create new alerts.\n </Typography>\n </Alert>\n </DialogContent>\n <DialogActions>\n <Button\n onClick={handleDisableAlertSource}\n color=\"secondary\"\n variant=\"contained\"\n >\n Disable\n </Button>\n <Button\n onClick={handleDisableAlertSourceWarningClose}\n color=\"primary\"\n >\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCO,MAAM,yBAAyB,CAAC;AAAA,EACrC,WAAA;AAAA,EACA,cAAA;AAAA,EACA,wBAAA;AAAA,EACA;AACF,CAAA,KAKM;AACJ,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAChD,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAAI,SAAS,KAAK,CAAA;AAEtE,EAAA,MAAM,uBAAuB,MAAM;AACjC,IAAA,wBAAA,CAAyB,IAAI,CAAA;AAAA,EAC/B,CAAA;AAEA,EAAA,MAAM,0BAA0B,YAAY;AAC1C,IAAA,IAAI;AACF,MAAA,IAAI,CAAC,WAAA,EAAa;AAChB,QAAA;AAAA,MACF;AACA,MAAA,YAAA,CAAa,IAAI,CAAA;AACjB,MAAA,MAAM,cAAA,GAAiB,MAAM,QAAA,CAAS,iBAAA,CAAkB,WAAW,CAAA;AACnE,MAAA,QAAA,CAAS,IAAA,CAAK,EAAE,KAAA,EAAO,uBAAA,EAAyB,CAAA;AAChD,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,cAAA,CAAe,cAAc,CAAA;AAAA,IAC/B,SAAS,GAAA,EAAK;AACZ,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,QAAA,CAAS,KAAK,EAAE,KAAA,EAAO,GAAA,EAAK,MAAA,EAAQ,UAAU,CAAA;A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,0BAAA,GAAA,CAAC,WAAA,EAAA,EAAY,EAAA,EAAG,iCAAA,EAAkC,QAAA,EAAA,sBAAA,EAElD,CAAA;AAAA,0BACA,GAAA,CAAC,aAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,UAAS,MAAA,EACd,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,KAAA,EAAM,SAAA,EAAU,QAAA,EAAA,oGAAA,EAG5C,GACF,CAAA,EACF,CAAA;AAAA,+BACC,aAAA,EAAA,EACC,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,wBAAA;AAAA,gBACT,KAAA,EAAM,WAAA;AAAA,gBACN,OAAA,EAAQ,WAAA;AAAA,gBACT,QAAA,EAAA;AAAA;AAAA,aAED;AAAA,4BACA,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,oCAAA;AAAA,gBACT,KAAA,EAAM,SAAA;AAAA,gBACP,QAAA,EAAA;AAAA;AAAA;AAED,WAAA,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardEmptyState.esm.js","sources":["../../../src/components/ILertCard/ILertCardEmptyState.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 */\n\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Button from '@material-ui/core/Button';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst ENTITY_YAML = `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: example\n description: example.com\n annotations:\n ilert.com/integration-key: [INTEGRATION_KEY]\nspec:\n type: website\n lifecycle: production\n owner: guest`;\n\nconst useStyles = makeStyles(theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n header: {\n display: 'inline-block',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n}));\n\nexport const ILertCardEmptyState = () => {\n const classes = useStyles();\n\n return (\n <Card data-testid=\"ilert-empty-card\">\n <CardHeader title=\"iLert\" className={classes.header} />\n <Divider />\n <CardContent>\n <Typography variant=\"body1\">\n No integration key defined for this entity. You can add integration\n key to your entity YAML as shown in the highlighted example below:\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[6, 7]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://github.com/backstage/backstage/blob/master/plugins/ilert/README.md\"\n >\n Read more\n </Button>\n </CardContent>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBA,MAAM,
|
|
1
|
+
{"version":3,"file":"ILertCardEmptyState.esm.js","sources":["../../../src/components/ILertCard/ILertCardEmptyState.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 */\n\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Button from '@material-ui/core/Button';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst ENTITY_YAML = `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: example\n description: example.com\n annotations:\n ilert.com/integration-key: [INTEGRATION_KEY]\nspec:\n type: website\n lifecycle: production\n owner: guest`;\n\nconst useStyles = makeStyles(theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n header: {\n display: 'inline-block',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n}));\n\nexport const ILertCardEmptyState = () => {\n const classes = useStyles();\n\n return (\n <Card data-testid=\"ilert-empty-card\">\n <CardHeader title=\"iLert\" className={classes.header} />\n <Divider />\n <CardContent>\n <Typography variant=\"body1\">\n No integration key defined for this entity. You can add integration\n key to your entity YAML as shown in the highlighted example below:\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[6, 7]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://github.com/backstage/backstage/blob/master/plugins/ilert/README.md\"\n >\n Read more\n </Button>\n </CardContent>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBA,MAAM,WAAA,GAAc,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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UAAU,MAAA;AAAO;AAAA,OACzD,EACF,CAAA;AAAA,sBACA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,WAAA;AAAA,UACR,KAAA,EAAM,SAAA;AAAA,UACN,MAAA,EAAO,QAAA;AAAA,UACP,IAAA,EAAK,4EAAA;AAAA,UACN,QAAA,EAAA;AAAA;AAAA;AAED,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardHeaderStatus.esm.js","sources":["../../../src/components/ILertCard/ILertCardHeaderStatus.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 Chip from '@material-ui/core/Chip';\nimport { withStyles } from '@material-ui/core/styles';\nimport { AlertSource } from '../../types';\n\nconst MaintenanceChip = withStyles(theme => ({\n root: {\n backgroundColor: '#92949c',\n color: theme.palette.common.white,\n marginTop: 8,\n },\n}))(Chip);\n\nexport const ILertCardHeaderStatus = ({\n alertSource,\n}: {\n alertSource: AlertSource | null;\n}) => {\n if (!alertSource) {\n return null;\n }\n\n switch (alertSource.status) {\n case 'IN_MAINTENANCE':\n return <MaintenanceChip label=\"MAINTENANCE\" size=\"small\" />;\n case 'DISABLED':\n return <MaintenanceChip label=\"INACTIVE\" size=\"small\" />;\n default:\n return null;\n }\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,eAAA,GAAkB,WAAW,
|
|
1
|
+
{"version":3,"file":"ILertCardHeaderStatus.esm.js","sources":["../../../src/components/ILertCard/ILertCardHeaderStatus.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 Chip from '@material-ui/core/Chip';\nimport { withStyles } from '@material-ui/core/styles';\nimport { AlertSource } from '../../types';\n\nconst MaintenanceChip = withStyles(theme => ({\n root: {\n backgroundColor: '#92949c',\n color: theme.palette.common.white,\n marginTop: 8,\n },\n}))(Chip);\n\nexport const ILertCardHeaderStatus = ({\n alertSource,\n}: {\n alertSource: AlertSource | null;\n}) => {\n if (!alertSource) {\n return null;\n }\n\n switch (alertSource.status) {\n case 'IN_MAINTENANCE':\n return <MaintenanceChip label=\"MAINTENANCE\" size=\"small\" />;\n case 'DISABLED':\n return <MaintenanceChip label=\"INACTIVE\" size=\"small\" />;\n default:\n return null;\n }\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,eAAA,GAAkB,WAAW,CAAA,KAAA,MAAU;AAAA,EAC3C,IAAA,EAAM;AAAA,IACJ,eAAA,EAAiB,SAAA;AAAA,IACjB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IAC5B,SAAA,EAAW;AAAA;AAEf,CAAA,CAAE,EAAE,IAAI,CAAA;AAED,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,CAAA,KAEM;AACJ,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,QAAQ,YAAY,MAAA;AAAQ,IAC1B,KAAK,gBAAA;AACH,MAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,KAAA,EAAM,aAAA,EAAc,MAAK,OAAA,EAAQ,CAAA;AAAA,IAC3D,KAAK,UAAA;AACH,MAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,KAAA,EAAM,UAAA,EAAW,MAAK,OAAA,EAAQ,CAAA;AAAA,IACxD;AACE,MAAA,OAAO,IAAA;AAAA;AAEb;;;;"}
|
|
@@ -9,7 +9,8 @@ import DialogTitle from '@material-ui/core/DialogTitle';
|
|
|
9
9
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
10
10
|
import TextField from '@material-ui/core/TextField';
|
|
11
11
|
import { ilertApiRef } from '../../api/client.esm.js';
|
|
12
|
-
import { useApi
|
|
12
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
13
|
+
import { toastApiRef } from '@backstage/frontend-plugin-api';
|
|
13
14
|
|
|
14
15
|
const ILertCardMaintenanceModal = ({
|
|
15
16
|
alertSource,
|
|
@@ -18,7 +19,7 @@ const ILertCardMaintenanceModal = ({
|
|
|
18
19
|
setIsModalOpened
|
|
19
20
|
}) => {
|
|
20
21
|
const ilertApi = useApi(ilertApiRef);
|
|
21
|
-
const alertApi = useApi(
|
|
22
|
+
const alertApi = useApi(toastApiRef);
|
|
22
23
|
const [minutes, setMinutes] = useState(5);
|
|
23
24
|
const handleClose = () => {
|
|
24
25
|
setIsModalOpened(false);
|
|
@@ -31,10 +32,10 @@ const ILertCardMaintenanceModal = ({
|
|
|
31
32
|
setTimeout(async () => {
|
|
32
33
|
try {
|
|
33
34
|
await ilertApi.addImmediateMaintenance(alertSource.id, minutes);
|
|
34
|
-
alertApi.post({
|
|
35
|
+
alertApi.post({ title: "Maintenance started." });
|
|
35
36
|
refetchAlertSource();
|
|
36
37
|
} catch (err) {
|
|
37
|
-
alertApi.post({
|
|
38
|
+
alertApi.post({ title: err, status: "danger" });
|
|
38
39
|
}
|
|
39
40
|
}, 250);
|
|
40
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardMaintenanceModal.esm.js","sources":["../../../src/components/ILertCard/ILertCardMaintenanceModal.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 { useState } from 'react';\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 DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport { ilertApiRef } from '../../api';\nimport { AlertSource } from '../../types';\nimport {
|
|
1
|
+
{"version":3,"file":"ILertCardMaintenanceModal.esm.js","sources":["../../../src/components/ILertCard/ILertCardMaintenanceModal.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 { useState } from 'react';\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 DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport { ilertApiRef } from '../../api';\nimport { AlertSource } from '../../types';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\n\nexport const ILertCardMaintenanceModal = ({\n alertSource,\n refetchAlertSource,\n isModalOpened,\n setIsModalOpened,\n}: {\n alertSource: AlertSource | null;\n refetchAlertSource: () => void;\n isModalOpened: boolean;\n setIsModalOpened: (isModalOpened: boolean) => void;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const alertApi = useApi(toastApiRef);\n const [minutes, setMinutes] = useState(5);\n\n const handleClose = () => {\n setIsModalOpened(false);\n };\n\n const handleImmediateMaintenance = () => {\n if (!alertSource) {\n return;\n }\n setIsModalOpened(false);\n setTimeout(async () => {\n try {\n await ilertApi.addImmediateMaintenance(alertSource.id, minutes);\n alertApi.post({ title: 'Maintenance started.' });\n refetchAlertSource();\n } catch (err) {\n alertApi.post({ title: err, status: 'danger' });\n }\n }, 250);\n };\n\n const handleMinutesChange = (event: any) => {\n setMinutes(event.target.value);\n };\n\n const minuteOptions = [\n {\n value: 5,\n label: '5 minutes',\n },\n {\n value: 10,\n label: '10 minutes',\n },\n {\n value: 15,\n label: '15 minutes',\n },\n {\n value: 30,\n label: '30 minutes',\n },\n {\n value: 60,\n label: '60 minutes',\n },\n ];\n\n if (!alertSource) {\n return null;\n }\n\n return (\n <Dialog\n open={isModalOpened}\n onClose={handleClose}\n aria-labelledby=\"maintenance-form-title\"\n >\n <DialogTitle id=\"maintenance-form-title\">\n New maintenance window\n </DialogTitle>\n <DialogContent>\n <DialogContentText>\n Keep your alert sources quiet, when your systems are under\n maintenance.\n </DialogContentText>\n <TextField\n select\n label=\"Duration\"\n value={minutes}\n onChange={handleMinutesChange}\n variant=\"outlined\"\n fullWidth\n >\n {minuteOptions.map(option => (\n <MenuItem key={option.value} value={option.value}>\n {option.label}\n </MenuItem>\n ))}\n </TextField>\n </DialogContent>\n <DialogActions>\n <Button\n onClick={handleImmediateMaintenance}\n color=\"primary\"\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":";;;;;;;;;;;;;;AA6BO,MAAM,4BAA4B,CAAC;AAAA,EACxC,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAKM;AACJ,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,CAAC,CAAA;AAExC,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA,EACxB,CAAA;AAEA,EAAA,MAAM,6BAA6B,MAAM;AACvC,IAAA,IAAI,CAAC,WAAA,EAAa;AAChB,MAAA;AAAA,IACF;AACA,IAAA,gBAAA,CAAiB,KAAK,CAAA;AACtB,IAAA,UAAA,CAAW,YAAY;AACrB,MAAA,IAAI;AACF,QAAA,MAAM,QAAA,CAAS,uBAAA,CAAwB,WAAA,CAAY,EAAA,EAAI,OAAO,CAAA;AAC9D,QAAA,QAAA,CAAS,IAAA,CAAK,EAAE,KAAA,EAAO,sBAAA,EAAwB,CAAA;AAC/C,QAAA,kBAAA,EAAmB;AAAA,MACrB,SAAS,GAAA,EAAK;AACZ,QAAA,QAAA,CAAS,KAAK,EAAE,KAAA,EAAO,GAAA,EAAK,MAAA,EAAQ,UAAU,CAAA;AAAA,MAChD;AAAA,IACF,GAAG,GAAG,CAAA;AAAA,EACR,CAAA;AAEA,EAAA,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAe;AAC1C,IAAA,UAAA,CAAW,KAAA,CAAM,OAAO,KAAK,CAAA;AAAA,EAC/B,CAAA;AAEA,EAAA,MAAM,aAAA,GAA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AAO,KAEtB,CACD;AAAA;AAAA;AACH,SAAA,EACF,CAAA;AAAA,6BACC,aAAA,EAAA,EACC,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAS,0BAAA;AAAA,cACT,KAAA,EAAM,SAAA;AAAA,cACN,OAAA,EAAQ,WAAA;AAAA,cACT,QAAA,EAAA;AAAA;AAAA,WAED;AAAA,8BACC,MAAA,EAAA,EAAO,OAAA,EAAS,WAAA,EAAa,KAAA,EAAM,WAAU,QAAA,EAAA,QAAA,EAE9C;AAAA,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -24,7 +24,7 @@ const ILertCardOnCall = ({
|
|
|
24
24
|
alertSource
|
|
25
25
|
}) => {
|
|
26
26
|
const classes = useStyles();
|
|
27
|
-
const [{ onCalls, isLoading }
|
|
27
|
+
const [{ onCalls, isLoading }] = useAlertSourceOnCalls(alertSource);
|
|
28
28
|
if (isLoading) {
|
|
29
29
|
return /* @__PURE__ */ jsx(Progress, {});
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardOnCall.esm.js","sources":["../../../src/components/ILertCard/ILertCardOnCall.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 List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport ListSubheader from '@material-ui/core/ListSubheader';\nimport Typography from '@material-ui/core/Typography';\nimport ReplayIcon from '@material-ui/icons/Replay';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { AlertSource } from '../../types';\nimport { useAlertSourceOnCalls } from '../../hooks/useAlertSourceOnCalls';\nimport { ILertCardOnCallEmptyState } from './ILertCardOnCallEmptyState';\nimport { ILertCardOnCallItem } from './ILertCardOnCallItem';\nimport { Progress } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n repeatText: {\n fontStyle: 'italic',\n },\n repeatIcon: {\n marginLeft: theme.spacing(1),\n },\n}));\n\nexport const ILertCardOnCall = ({\n alertSource,\n}: {\n alertSource: AlertSource | null;\n}) => {\n const classes = useStyles();\n const [{ onCalls, isLoading }, {}] = useAlertSourceOnCalls(alertSource);\n\n if (isLoading) {\n return <Progress />;\n }\n\n if (!alertSource || !onCalls) {\n return null;\n }\n\n const repeatInfo = () => {\n if (\n !alertSource ||\n !alertSource.escalationPolicy ||\n !alertSource.escalationPolicy.repeating ||\n !alertSource.escalationPolicy.frequency\n ) {\n return null;\n }\n\n return (\n <ListItem key=\"repeat\">\n <ListItemIcon>\n <ReplayIcon className={classes.repeatIcon} fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={classes.repeatText}\n >\n {`Repeat ${alertSource.escalationPolicy.frequency} times`}\n </Typography>\n }\n />\n </ListItem>\n );\n };\n\n if (!onCalls.length) {\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <ILertCardOnCallEmptyState />\n </List>\n );\n }\n\n if (onCalls.length === 1) {\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <ILertCardOnCallItem\n onCall={onCalls[0]}\n fistItem={false}\n lastItem={false}\n />\n </List>;\n }\n\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n {onCalls.map((onCall, index) => (\n <ILertCardOnCallItem\n key={index}\n onCall={onCall}\n fistItem={index === 0}\n lastItem={index === onCalls.length - 1}\n />\n ))}\n {repeatInfo()}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"ILertCardOnCall.esm.js","sources":["../../../src/components/ILertCard/ILertCardOnCall.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 List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport ListSubheader from '@material-ui/core/ListSubheader';\nimport Typography from '@material-ui/core/Typography';\nimport ReplayIcon from '@material-ui/icons/Replay';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { AlertSource } from '../../types';\nimport { useAlertSourceOnCalls } from '../../hooks/useAlertSourceOnCalls';\nimport { ILertCardOnCallEmptyState } from './ILertCardOnCallEmptyState';\nimport { ILertCardOnCallItem } from './ILertCardOnCallItem';\nimport { Progress } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n repeatText: {\n fontStyle: 'italic',\n },\n repeatIcon: {\n marginLeft: theme.spacing(1),\n },\n}));\n\nexport const ILertCardOnCall = ({\n alertSource,\n}: {\n alertSource: AlertSource | null;\n}) => {\n const classes = useStyles();\n const [{ onCalls, isLoading }, {}] = useAlertSourceOnCalls(alertSource);\n\n if (isLoading) {\n return <Progress />;\n }\n\n if (!alertSource || !onCalls) {\n return null;\n }\n\n const repeatInfo = () => {\n if (\n !alertSource ||\n !alertSource.escalationPolicy ||\n !alertSource.escalationPolicy.repeating ||\n !alertSource.escalationPolicy.frequency\n ) {\n return null;\n }\n\n return (\n <ListItem key=\"repeat\">\n <ListItemIcon>\n <ReplayIcon className={classes.repeatIcon} fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={classes.repeatText}\n >\n {`Repeat ${alertSource.escalationPolicy.frequency} times`}\n </Typography>\n }\n />\n </ListItem>\n );\n };\n\n if (!onCalls.length) {\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <ILertCardOnCallEmptyState />\n </List>\n );\n }\n\n if (onCalls.length === 1) {\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <ILertCardOnCallItem\n onCall={onCalls[0]}\n fistItem={false}\n lastItem={false}\n />\n </List>;\n }\n\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n {onCalls.map((onCall, index) => (\n <ILertCardOnCallItem\n key={index}\n onCall={onCall}\n fistItem={index === 0}\n lastItem={index === onCalls.length - 1}\n />\n ))}\n {repeatInfo()}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,UAAA,EAAY;AAAA,IACV,SAAA,EAAW;AAAA,GACb;AAAA,EACA,UAAA,EAAY;AAAA,IACV,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA;AAE/B,CAAA,CAAE,CAAA;AAEK,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AACF,CAAA,KAEM;AACJ,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,CAAC,EAAE,OAAA,EAAS,SAAA,EAAe,CAAA,GAAI,qBAAA,CAAsB,WAAW,CAAA;AAEtE,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AAE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EAAC,2BAAW,GAAA,CAAC,aAAA,EAAA,EAAc,qBAAO,CAAA,EAC3C,QAAA,kBAAA,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,MAAA,EAAQ,QAAQ,CAAC,CAAA;AAAA,QACjB,QAAA,EAAU,KAAA;AAAA,QACV,QAAA,EAAU;AAAA;AAAA,KACZ,EACF,CAAA;AAAA,EACF;AAEA,EAAA,uBACE,IAAA,CAAC,QAAK,KAAA,EAAK,IAAA,EAAC,2BAAW,GAAA,CAAC,aAAA,EAAA,EAAc,qBAAO,CAAA,EAC1C,QAAA,EAAA;AAAA,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAA,qBACpB,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QAEC,MAAA;AAAA,QACA,UAAU,KAAA,KAAU,CAAA;AAAA,QACpB,QAAA,EAAU,KAAA,KAAU,OAAA,CAAQ,MAAA,GAAS;AAAA,OAAA;AAAA,MAHhC;AAAA,KAKR,CAAA;AAAA,IACA,UAAA;AAAW,GAAA,EACd,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardOnCallEmptyState.esm.js","sources":["../../../src/components/ILertCard/ILertCardOnCallEmptyState.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 { makeStyles } from '@material-ui/core/styles';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Typography from '@material-ui/core/Typography';\n\nconst useStyles = makeStyles({\n text: {\n fontStyle: 'italic',\n },\n});\n\nexport const ILertCardOnCallEmptyState = () => {\n const classes = useStyles();\n\n return (\n <ListItem>\n <ListItemText>\n <Typography\n variant=\"subtitle1\"\n color=\"textSecondary\"\n className={classes.text}\n >\n Nobody\n </Typography>\n </ListItemText>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"ILertCardOnCallEmptyState.esm.js","sources":["../../../src/components/ILertCard/ILertCardOnCallEmptyState.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 { makeStyles } from '@material-ui/core/styles';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Typography from '@material-ui/core/Typography';\n\nconst useStyles = makeStyles({\n text: {\n fontStyle: 'italic',\n },\n});\n\nexport const ILertCardOnCallEmptyState = () => {\n const classes = useStyles();\n\n return (\n <ListItem>\n <ListItemText>\n <Typography\n variant=\"subtitle1\"\n color=\"textSecondary\"\n className={classes.text}\n >\n Nobody\n </Typography>\n </ListItemText>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,IAAA,EAAM;AAAA,IACJ,SAAA,EAAW;AAAA;AAEf,CAAC,CAAA;AAEM,MAAM,4BAA4B,MAAM;AAC7C,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,WAAA;AAAA,MACR,KAAA,EAAM,eAAA;AAAA,MACN,WAAW,OAAA,CAAQ,IAAA;AAAA,MACpB,QAAA,EAAA;AAAA;AAAA,KAGH,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILertCardOnCallItem.esm.js","sources":["../../../src/components/ILertCard/ILertCardOnCallItem.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 Divider from '@material-ui/core/Divider';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport Avatar from '@material-ui/core/Avatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport EmailIcon from '@material-ui/icons/Email';\nimport PhoneIcon from '@material-ui/icons/Phone';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { OnCall } from '../../types';\nimport { ilertApiRef } from '../../api';\nimport { DateTime as dt } from 'luxon';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles({\n listItemPrimary: {\n fontWeight: 'bold',\n },\n fistItemLine: {\n position: 'absolute',\n bottom: 0,\n height: '50%',\n left: 36,\n },\n lastItemLine: {\n position: 'absolute',\n top: 0,\n height: '50%',\n left: 36,\n },\n itemLine: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n height: '100%',\n left: 36,\n },\n});\n\nexport const ILertCardOnCallItem = ({\n onCall,\n fistItem = false,\n lastItem = false,\n}: {\n onCall: OnCall;\n fistItem?: boolean;\n lastItem?: boolean;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const classes = useStyles();\n\n if (!onCall || !onCall.user) {\n return null;\n }\n\n const phoneNumber = ilertApi.getUserPhoneNumber(onCall.user);\n const escalationRepeating = onCall.escalationPolicy.repeating;\n const escalationSeconds =\n onCall.escalationPolicy.escalationRules[onCall.escalationLevel - 1]\n .escalationTimeout;\n const escalationHoursOnly = Math.floor(escalationSeconds / 60);\n const escalationMinutesOnly = escalationSeconds % 60;\n\n let escalationText = '';\n if (!lastItem || (lastItem && escalationRepeating)) {\n escalationText = 'escalate';\n if (escalationSeconds === 0) {\n escalationText += ' immediately';\n } else {\n escalationText += ' after';\n if (escalationHoursOnly > 0) {\n escalationText += ` ${escalationHoursOnly} ${\n escalationHoursOnly === 1 ? 'hour' : 'hours'\n }`;\n }\n if (escalationMinutesOnly > 0 || escalationSeconds === 0) {\n escalationText += ` ${escalationMinutesOnly} ${\n escalationMinutesOnly === 1 ? 'minute' : 'minutes'\n }`;\n }\n }\n }\n\n return (\n <ListItem>\n {fistItem ? (\n <Divider orientation=\"vertical\" className={classes.fistItemLine} />\n ) : null}\n {lastItem ? (\n <Divider orientation=\"vertical\" className={classes.lastItemLine} />\n ) : null}\n {!fistItem && !lastItem ? (\n <Divider orientation=\"vertical\" className={classes.itemLine} />\n ) : null}\n <ListItemIcon>\n <Tooltip\n title={`Escalation level #${onCall.escalationLevel}`}\n placement=\"top\"\n >\n <Avatar>{onCall.escalationLevel}</Avatar>\n </Tooltip>\n </ListItemIcon>\n {onCall.schedule ? (\n <Tooltip\n title={\n 'On call shift ' +\n `${dt.fromISO(onCall.start).toFormat('D MMM, HH:mm')} - ` +\n `${dt.fromISO(onCall.end).toFormat('D MMM, HH:mm')}`\n }\n placement=\"top-start\"\n >\n <ListItemText\n primary={\n <Typography className={classes.listItemPrimary}>\n {ilertApi.getUserInitials(onCall.user)}\n </Typography>\n }\n secondary={escalationText}\n />\n </Tooltip>\n ) : (\n <ListItemText\n primary={\n <Typography className={classes.listItemPrimary}>\n {ilertApi.getUserInitials(onCall.user)}\n </Typography>\n }\n secondary={escalationText}\n />\n )}\n <ListItemSecondaryAction>\n {phoneNumber ? (\n <Tooltip title=\"Call to user\" placement=\"top\">\n <IconButton href={`tel:${phoneNumber}`}>\n <PhoneIcon color=\"secondary\" />\n </IconButton>\n </Tooltip>\n ) : null}\n <Tooltip\n title={`Send e-mail to user ${onCall.user.email}`}\n placement=\"top\"\n >\n <IconButton href={`mailto:${onCall.user.email}`}>\n <EmailIcon color=\"primary\" />\n </IconButton>\n </Tooltip>\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":["dt"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"ILertCardOnCallItem.esm.js","sources":["../../../src/components/ILertCard/ILertCardOnCallItem.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 Divider from '@material-ui/core/Divider';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport Avatar from '@material-ui/core/Avatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Typography from '@material-ui/core/Typography';\nimport EmailIcon from '@material-ui/icons/Email';\nimport PhoneIcon from '@material-ui/icons/Phone';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { OnCall } from '../../types';\nimport { ilertApiRef } from '../../api';\nimport { DateTime as dt } from 'luxon';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles({\n listItemPrimary: {\n fontWeight: 'bold',\n },\n fistItemLine: {\n position: 'absolute',\n bottom: 0,\n height: '50%',\n left: 36,\n },\n lastItemLine: {\n position: 'absolute',\n top: 0,\n height: '50%',\n left: 36,\n },\n itemLine: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n height: '100%',\n left: 36,\n },\n});\n\nexport const ILertCardOnCallItem = ({\n onCall,\n fistItem = false,\n lastItem = false,\n}: {\n onCall: OnCall;\n fistItem?: boolean;\n lastItem?: boolean;\n}) => {\n const ilertApi = useApi(ilertApiRef);\n const classes = useStyles();\n\n if (!onCall || !onCall.user) {\n return null;\n }\n\n const phoneNumber = ilertApi.getUserPhoneNumber(onCall.user);\n const escalationRepeating = onCall.escalationPolicy.repeating;\n const escalationSeconds =\n onCall.escalationPolicy.escalationRules[onCall.escalationLevel - 1]\n .escalationTimeout;\n const escalationHoursOnly = Math.floor(escalationSeconds / 60);\n const escalationMinutesOnly = escalationSeconds % 60;\n\n let escalationText = '';\n if (!lastItem || (lastItem && escalationRepeating)) {\n escalationText = 'escalate';\n if (escalationSeconds === 0) {\n escalationText += ' immediately';\n } else {\n escalationText += ' after';\n if (escalationHoursOnly > 0) {\n escalationText += ` ${escalationHoursOnly} ${\n escalationHoursOnly === 1 ? 'hour' : 'hours'\n }`;\n }\n if (escalationMinutesOnly > 0 || escalationSeconds === 0) {\n escalationText += ` ${escalationMinutesOnly} ${\n escalationMinutesOnly === 1 ? 'minute' : 'minutes'\n }`;\n }\n }\n }\n\n return (\n <ListItem>\n {fistItem ? (\n <Divider orientation=\"vertical\" className={classes.fistItemLine} />\n ) : null}\n {lastItem ? (\n <Divider orientation=\"vertical\" className={classes.lastItemLine} />\n ) : null}\n {!fistItem && !lastItem ? (\n <Divider orientation=\"vertical\" className={classes.itemLine} />\n ) : null}\n <ListItemIcon>\n <Tooltip\n title={`Escalation level #${onCall.escalationLevel}`}\n placement=\"top\"\n >\n <Avatar>{onCall.escalationLevel}</Avatar>\n </Tooltip>\n </ListItemIcon>\n {onCall.schedule ? (\n <Tooltip\n title={\n 'On call shift ' +\n `${dt.fromISO(onCall.start).toFormat('D MMM, HH:mm')} - ` +\n `${dt.fromISO(onCall.end).toFormat('D MMM, HH:mm')}`\n }\n placement=\"top-start\"\n >\n <ListItemText\n primary={\n <Typography className={classes.listItemPrimary}>\n {ilertApi.getUserInitials(onCall.user)}\n </Typography>\n }\n secondary={escalationText}\n />\n </Tooltip>\n ) : (\n <ListItemText\n primary={\n <Typography className={classes.listItemPrimary}>\n {ilertApi.getUserInitials(onCall.user)}\n </Typography>\n }\n secondary={escalationText}\n />\n )}\n <ListItemSecondaryAction>\n {phoneNumber ? (\n <Tooltip title=\"Call to user\" placement=\"top\">\n <IconButton href={`tel:${phoneNumber}`}>\n <PhoneIcon color=\"secondary\" />\n </IconButton>\n </Tooltip>\n ) : null}\n <Tooltip\n title={`Send e-mail to user ${onCall.user.email}`}\n placement=\"top\"\n >\n <IconButton href={`mailto:${onCall.user.email}`}>\n <EmailIcon color=\"primary\" />\n </IconButton>\n </Tooltip>\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":["dt"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,eAAA,EAAiB;AAAA,IACf,UAAA,EAAY;AAAA,GACd;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,QAAA,EAAU,UAAA;AAAA,IACV,MAAA,EAAQ,CAAA;AAAA,IACR,MAAA,EAAQ,KAAA;AAAA,IACR,IAAA,EAAM;AAAA,GACR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A,EAAA,EAAW,IAAA,EAAM,CAAA,OAAA,EAAU,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAAA,EAC3C,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,KAAA,EAAM,SAAA,EAAU,CAAA,EAC7B;AAAA;AAAA;AACF,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|