@backstage-community/plugin-ilert 0.7.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/ILertIcon.esm.js +63 -56
- package/dist/ILertIcon.esm.js.map +1 -1
- package/dist/components/Alert/AlertActionsMenu.esm.js +49 -42
- package/dist/components/Alert/AlertActionsMenu.esm.js.map +1 -1
- package/dist/components/Alert/AlertAssignModal.esm.js +68 -60
- package/dist/components/Alert/AlertAssignModal.esm.js.map +1 -1
- package/dist/components/Alert/AlertLink.esm.js +5 -2
- package/dist/components/Alert/AlertLink.esm.js.map +1 -1
- package/dist/components/Alert/AlertNewModal.esm.js +109 -87
- package/dist/components/Alert/AlertNewModal.esm.js.map +1 -1
- package/dist/components/AlertSource/AlertSourceLink.esm.js +19 -16
- package/dist/components/AlertSource/AlertSourceLink.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsPage.esm.js +44 -36
- package/dist/components/AlertsPage/AlertsPage.esm.js.map +1 -1
- package/dist/components/AlertsPage/AlertsTable.esm.js +15 -15
- package/dist/components/AlertsPage/AlertsTable.esm.js.map +1 -1
- package/dist/components/AlertsPage/StatusChip.esm.js +5 -5
- package/dist/components/AlertsPage/StatusChip.esm.js.map +1 -1
- package/dist/components/AlertsPage/TableTitle.esm.js +30 -24
- package/dist/components/AlertsPage/TableTitle.esm.js.map +1 -1
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js +6 -6
- package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCard.esm.js +63 -51
- package/dist/components/ILertCard/ILertCard.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardActionsHeader.esm.js +42 -33
- package/dist/components/ILertCard/ILertCardActionsHeader.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js +28 -20
- package/dist/components/ILertCard/ILertCardEmptyState.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js +3 -3
- package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js +36 -27
- package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCall.esm.js +34 -28
- package/dist/components/ILertCard/ILertCardOnCall.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js +6 -6
- package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js.map +1 -1
- package/dist/components/ILertCard/ILertCardOnCallItem.esm.js +41 -31
- package/dist/components/ILertCard/ILertCardOnCallItem.esm.js.map +1 -1
- package/dist/components/ILertPage/ILertPage.esm.js +25 -17
- package/dist/components/ILertPage/ILertPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js +45 -35
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js +14 -11
- package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js.map +1 -1
- package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js +31 -23
- package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js.map +1 -1
- package/dist/components/Service/ServiceActionsMenu.esm.js +29 -25
- package/dist/components/Service/ServiceActionsMenu.esm.js.map +1 -1
- package/dist/components/Service/ServiceLink.esm.js +5 -2
- package/dist/components/Service/ServiceLink.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesPage.esm.js +17 -14
- package/dist/components/ServicesPage/ServicesPage.esm.js.map +1 -1
- package/dist/components/ServicesPage/ServicesTable.esm.js +9 -9
- package/dist/components/ServicesPage/ServicesTable.esm.js.map +1 -1
- package/dist/components/ServicesPage/StatusChip.esm.js +7 -7
- package/dist/components/ServicesPage/StatusChip.esm.js.map +1 -1
- package/dist/components/Shift/ShiftOverrideModal.esm.js +83 -74
- package/dist/components/Shift/ShiftOverrideModal.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js +32 -26
- package/dist/components/StatusPage/StatusPageActionsMenu.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageLink.esm.js +5 -2
- package/dist/components/StatusPage/StatusPageLink.esm.js.map +1 -1
- package/dist/components/StatusPage/StatusPageURL.esm.js +2 -2
- package/dist/components/StatusPage/StatusPageURL.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusChip.esm.js +7 -7
- package/dist/components/StatusPagePage/StatusChip.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js +17 -14
- package/dist/components/StatusPagePage/StatusPagesPage.esm.js.map +1 -1
- package/dist/components/StatusPagePage/StatusPagesTable.esm.js +10 -10
- package/dist/components/StatusPagePage/StatusPagesTable.esm.js.map +1 -1
- package/dist/components/StatusPagePage/VisibilityChip.esm.js +4 -4
- package/dist/components/StatusPagePage/VisibilityChip.esm.js.map +1 -1
- package/dist/hooks/useAlertActions.esm.js +3 -5
- package/dist/hooks/useAlertActions.esm.js.map +1 -1
- package/dist/hooks/useAlertSource.esm.js +3 -5
- package/dist/hooks/useAlertSource.esm.js.map +1 -1
- package/dist/hooks/useAlertSourceOnCalls.esm.js +3 -3
- package/dist/hooks/useAlertSourceOnCalls.esm.js.map +1 -1
- package/dist/hooks/useAlerts.esm.js +6 -9
- package/dist/hooks/useAlerts.esm.js.map +1 -1
- package/dist/hooks/useAssignAlert.esm.js +6 -4
- package/dist/hooks/useAssignAlert.esm.js.map +1 -1
- package/dist/hooks/useNewAlert.esm.js +6 -10
- package/dist/hooks/useNewAlert.esm.js.map +1 -1
- package/dist/hooks/useOnCallSchedules.esm.js +5 -3
- package/dist/hooks/useOnCallSchedules.esm.js.map +1 -1
- package/dist/hooks/useServices.esm.js +4 -4
- package/dist/hooks/useServices.esm.js.map +1 -1
- package/dist/hooks/useShiftOverride.esm.js +4 -4
- package/dist/hooks/useShiftOverride.esm.js.map +1 -1
- package/dist/hooks/useStatusPages.esm.js +4 -6
- package/dist/hooks/useStatusPages.esm.js.map +1 -1
- package/dist/index.d.ts +6 -8
- package/package.json +14 -7
|
@@ -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 React from 'react';\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":";;;;;;;;;;;;;;AA+BA,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,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,KAAO,EAAA,KAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACZ;AAEA,EAAA,MAAM,QAA+B,G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,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,sCACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,SAAO,qBAE5D,CAAA;AAAA,MAEF,KAAA,EACE,CAAC,OACC,mBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,WAAa,EAAA,MAAA;AAAA,UACb;AAAA;AAAA,0BAGD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,QAAS,EAAA,KAAA,EAAM,mBAAgB,QAEnD,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,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,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O,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,6 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Chip from '@material-ui/core/Chip';
|
|
2
3
|
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
import { RESOLVED, ACCEPTED, PENDING } from '../../types.esm.js';
|
|
5
5
|
|
|
6
6
|
const ResolvedChip = withStyles((theme) => ({
|
|
@@ -33,13 +33,13 @@ const StatusChip = ({ alert }) => {
|
|
|
33
33
|
const label = `${alertStatusLabels[alert.status]}`;
|
|
34
34
|
switch (alert.status) {
|
|
35
35
|
case RESOLVED:
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsx(ResolvedChip, { label, size: "small" });
|
|
37
37
|
case ACCEPTED:
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx(AcceptedChip, { label, size: "small" });
|
|
39
39
|
case PENDING:
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ jsx(PendingChip, { label, size: "small" });
|
|
41
41
|
default:
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(Chip, { label, size: "small" });
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -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
|
|
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,CAAU,KAAA,MAAA;AAAA,EACxC,IAAM,EAAA;AAAA,IACJ,eAAiB,EAAA,SAAA;AAAA,IACjB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,MAAQ,EAAA;AAAA;AAEZ,CAAA,CAAE,EAAE,IAAI,CAAA;AAER,MAAM,YAAA,GAAe,WAAW,CAAU,KAAA,MAAA;AAAA,EACxC,IAAM,EAAA;AAAA,IACJ,eAAiB,EAAA,SAAA;AAAA,IACjB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,MAAQ,EAAA;AAAA;AAEZ,CAAA,CAAE,EAAE,IAAI,CAAA;AACR,MAAM,WAAA,GAAc,WAAW,CAAU,KAAA,MAAA;AAAA,EACvC,IAAM,EAAA;AAAA,IACJ,eAAiB,EAAA,SAAA;AAAA,IACjB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,MAAQ,EAAA;AAAA;AAEZ,CAAA,CAAE,EAAE,IAAI,CAAA;AAED,MAAM,iBAAoB,GAAA;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,EAA8B,KAAA;AACzD,EAAA,MAAM,KAAQ,GAAA,CAAA,EAAG,iBAAkB,CAAA,KAAA,CAAM,MAAM,CAAC,CAAA,CAAA;AAEhD,EAAA,QAAQ,MAAM,MAAQ;AAAA,IACpB,KAAK,QAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,YAAA,EAAA,EAAa,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAClD,KAAK,QAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,YAAA,EAAA,EAAa,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAClD,KAAK,OAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,WAAA,EAAA,EAAY,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACjD;AACE,MAAA,uBAAQ,GAAA,CAAA,IAAA,EAAA,EAAK,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA;AAE9C;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
2
3
|
import FormControl from '@material-ui/core/FormControl';
|
|
3
4
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
@@ -5,7 +6,6 @@ import MenuItem from '@material-ui/core/MenuItem';
|
|
|
5
6
|
import Select from '@material-ui/core/Select';
|
|
6
7
|
import { makeStyles } from '@material-ui/core/styles';
|
|
7
8
|
import Typography from '@material-ui/core/Typography';
|
|
8
|
-
import React from 'react';
|
|
9
9
|
import { PENDING, ACCEPTED, RESOLVED } from '../../types.esm.js';
|
|
10
10
|
import { alertStatusLabels } from './StatusChip.esm.js';
|
|
11
11
|
|
|
@@ -43,31 +43,37 @@ const TableTitle = ({
|
|
|
43
43
|
const handleAlertStatusSelectChange = (event) => {
|
|
44
44
|
onAlertStatesChange(event.target.value);
|
|
45
45
|
};
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
variant: "outlined",
|
|
51
|
-
size: "small"
|
|
52
|
-
},
|
|
53
|
-
/* @__PURE__ */ React.createElement(
|
|
54
|
-
Select,
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.root, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Typography, { noWrap: true, className: classes.label, children: "Status:" }),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
FormControl,
|
|
55
50
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
className: classes.formControl,
|
|
52
|
+
variant: "outlined",
|
|
53
|
+
size: "small",
|
|
54
|
+
children: /* @__PURE__ */ jsx(
|
|
55
|
+
Select,
|
|
56
|
+
{
|
|
57
|
+
id: "alerts-status-select",
|
|
58
|
+
multiple: true,
|
|
59
|
+
value: alertStates,
|
|
60
|
+
onChange: handleAlertStatusSelectChange,
|
|
61
|
+
renderValue: (selected) => selected.join(", "),
|
|
62
|
+
MenuProps,
|
|
63
|
+
children: [PENDING, ACCEPTED, RESOLVED].map((state) => /* @__PURE__ */ jsxs(MenuItem, { value: state, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
Checkbox,
|
|
66
|
+
{
|
|
67
|
+
checked: alertStates.indexOf(state) > -1
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: alertStatusLabels[state] })
|
|
71
|
+
] }, state))
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
69
75
|
)
|
|
70
|
-
)
|
|
76
|
+
] });
|
|
71
77
|
};
|
|
72
78
|
|
|
73
79
|
export { TableTitle };
|
|
@@ -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
|
|
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,WAAc,GAAA,EAAA;AACpB,MAAM,gBAAmB,GAAA,CAAA;AACzB,MAAM,SAAY,GAAA;AAAA,EAChB,UAAY,EAAA;AAAA,IACV,KAAO,EAAA;AAAA,MACL,SAAA,EAAW,cAAc,GAAM,GAAA,gBAAA;AAAA,MAC/B,KAAO,EAAA;AAAA;AACT;AAEJ,CAAA;AAEA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA;AAAA,GACX;AAAA,EACA,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AC3B,EAAA,QAAA,EAAA;AAAA,8BAAA,GAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBACC,OAAS,EAAA,WAAA,CAAY,OAAQ,CAAA,KAAoB,CAAI,GAAA,CAAA;AAAA;AAAA,eACvD;AAAA,8BACC,GAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,iBAAA,CAAkB,KAAK,CAAG,EAAA;AAAA,aAAA,EAAA,EAJpC,KAKf,CACD;AAAA;AAAA;AACH;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Button from '@material-ui/core/Button';
|
|
3
3
|
import { EmptyState } from '@backstage/core-components';
|
|
4
4
|
|
|
5
|
-
const MissingAuthorizationHeaderError = () => /* @__PURE__ */
|
|
5
|
+
const MissingAuthorizationHeaderError = () => /* @__PURE__ */ jsx(
|
|
6
6
|
EmptyState,
|
|
7
7
|
{
|
|
8
8
|
missing: "info",
|
|
9
9
|
title: "Missing or invalid iLert authorization header",
|
|
10
10
|
description: "The request to fetch data needs a valid authorization header. See README for more details.",
|
|
11
|
-
action: /* @__PURE__ */
|
|
11
|
+
action: /* @__PURE__ */ jsx(
|
|
12
12
|
Button,
|
|
13
13
|
{
|
|
14
14
|
color: "primary",
|
|
15
15
|
variant: "contained",
|
|
16
|
-
href: "https://github.com/backstage/backstage/blob/master/plugins/ilert/README.md"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
href: "https://github.com/backstage/backstage/blob/master/plugins/ilert/README.md",
|
|
17
|
+
children: "Read More"
|
|
18
|
+
}
|
|
19
19
|
)
|
|
20
20
|
}
|
|
21
21
|
);
|
|
@@ -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
|
|
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,OAAQ,EAAA,MAAA;AAAA,IACR,KAAM,EAAA,+CAAA;AAAA,IACN,WAAY,EAAA,4FAAA;AAAA,IACZ,MACE,kBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,WAAA;AAAA,QACR,IAAK,EAAA,4EAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { ResponseErrorPanel } from '@backstage/core-components';
|
|
2
3
|
import { AuthenticationError } from '@backstage/errors';
|
|
3
4
|
import Card from '@material-ui/core/Card';
|
|
@@ -5,7 +6,7 @@ import CardContent from '@material-ui/core/CardContent';
|
|
|
5
6
|
import CardHeader from '@material-ui/core/CardHeader';
|
|
6
7
|
import Divider from '@material-ui/core/Divider';
|
|
7
8
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
|
-
import
|
|
9
|
+
import { useState } from 'react';
|
|
9
10
|
import { ILERT_INTEGRATION_KEY_ANNOTATION } from '../../constants.esm.js';
|
|
10
11
|
import { useILertEntity } from '../../hooks/index.esm.js';
|
|
11
12
|
import { useAlerts } from '../../hooks/useAlerts.esm.js';
|
|
@@ -48,65 +49,76 @@ const ILertCard = () => {
|
|
|
48
49
|
setIsLoading
|
|
49
50
|
}
|
|
50
51
|
] = useAlerts(false, true, alertSource);
|
|
51
|
-
const [isNewAlertModalOpened, setIsNewAlertModalOpened] =
|
|
52
|
-
const [isMaintenanceModalOpened, setIsMaintenanceModalOpened] =
|
|
52
|
+
const [isNewAlertModalOpened, setIsNewAlertModalOpened] = useState(false);
|
|
53
|
+
const [isMaintenanceModalOpened, setIsMaintenanceModalOpened] = useState(false);
|
|
53
54
|
if (error) {
|
|
54
55
|
if (error instanceof AuthenticationError) {
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ jsx(MissingAuthorizationHeaderError, {});
|
|
56
57
|
}
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
58
59
|
}
|
|
59
60
|
if (!integrationKey) {
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ jsx(ILertCardEmptyState, {});
|
|
61
62
|
}
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
subheader: /* @__PURE__ */ React.createElement(
|
|
67
|
-
ILertCardActionsHeader,
|
|
63
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64
|
+
/* @__PURE__ */ jsxs(Card, { "data-testid": "ilert-card", children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
CardHeader,
|
|
68
67
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
title: "iLert",
|
|
69
|
+
subheader: /* @__PURE__ */ jsx(
|
|
70
|
+
ILertCardActionsHeader,
|
|
71
|
+
{
|
|
72
|
+
alertSource,
|
|
73
|
+
setAlertSource,
|
|
74
|
+
setIsNewAlertModalOpened,
|
|
75
|
+
setIsMaintenanceModalOpened
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
action: /* @__PURE__ */ jsx(ILertCardHeaderStatus, { alertSource })
|
|
73
79
|
}
|
|
74
80
|
),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
81
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
82
|
+
/* @__PURE__ */ jsxs(CardContent, { className: classes.content, children: [
|
|
83
|
+
/* @__PURE__ */ jsx(ILertCardOnCall, { alertSource }),
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
AlertsTable,
|
|
86
|
+
{
|
|
87
|
+
alerts,
|
|
88
|
+
alertsCount,
|
|
89
|
+
tableState,
|
|
90
|
+
states,
|
|
91
|
+
onAlertChanged,
|
|
92
|
+
onAlertStatesChange,
|
|
93
|
+
onChangePage,
|
|
94
|
+
onChangeRowsPerPage,
|
|
95
|
+
isLoading,
|
|
96
|
+
setIsLoading,
|
|
97
|
+
compact: true
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] })
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
AlertNewModal,
|
|
104
|
+
{
|
|
105
|
+
isModalOpened: isNewAlertModalOpened,
|
|
106
|
+
setIsModalOpened: setIsNewAlertModalOpened,
|
|
107
|
+
refetchAlerts,
|
|
108
|
+
initialAlertSource: alertSource,
|
|
109
|
+
entityName: name
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
ILertCardMaintenanceModal,
|
|
114
|
+
{
|
|
115
|
+
alertSource,
|
|
116
|
+
refetchAlertSource,
|
|
117
|
+
isModalOpened: isMaintenanceModalOpened,
|
|
118
|
+
setIsModalOpened: setIsMaintenanceModalOpened
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
110
122
|
};
|
|
111
123
|
|
|
112
124
|
export { ILertCard, isPluginApplicableToEntity };
|
|
@@ -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
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;AAsCa,MAAA,0BAAA,GAA6B,CAAC,MACzC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,gCAAgC,CAAC;AAEzE,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,OAAS,EAAA;AAAA,IACP,WAAa,EAAA,cAAA;AAAA,IACb,YAAc,EAAA,cAAA;AAAA,IACd,aAAe,EAAA,cAAA;AAAA,IACf,UAAY,EAAA,cAAA;AAAA,IACZ,WAAa,EAAA;AAAA,MACX,SAAW,EAAA;AAAA;AACb;AAEJ,CAAC,CAAA;AAGM,MAAM,YAAY,MAAM;AAC7B,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,cAAA,EAAgB,IAAK,EAAA,GAAI,cAAe,EAAA;AAChD,EAAM,MAAA,CAAC,EAAE,WAAA,EAAe,EAAA,EAAE,gBAAgB,kBAAmB,EAAC,CAC5D,GAAA,cAAA,CAAe,cAAc,CAAA;AAC/B,EAAM,MAAA;AAAA,IACJ,EAAE,UAAY,EAAA,MAAA,EAAQ,MAAQ,EAAA,WAAA,EAAa,WAAW,KAAM,EAAA;AAAA,IAC5D;AAAA,MACE,mBAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA,cAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA;AACF,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A,MAAA;AAAA,YACA,cAAA;AAAA,YACA,mBAAA;AAAA,YACA,YAAA;AAAA,YACA,mBAAA;AAAA,YACA,SAAA;AAAA,YACA,YAAA;AAAA,YACA,OAAO,EAAA;AAAA;AAAA;AACT,OACF,EAAA;AAAA,KACF,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,aAAe,EAAA,qBAAA;AAAA,QACf,gBAAkB,EAAA,wBAAA;AAAA,QAClB,aAAA;AAAA,QACA,kBAAoB,EAAA,WAAA;AAAA,QACpB,UAAY,EAAA;AAAA;AAAA,KACd;AAAA,oBACA,GAAA;AAAA,MAAC,yBAAA;AAAA,MAAA;AAAA,QACC,WAAA;AAAA,QACA,kBAAA;AAAA,QACA,aAAe,EAAA,wBAAA;AAAA,QACf,gBAAkB,EAAA;AAAA;AAAA;AACpB,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import Button from '@material-ui/core/Button';
|
|
2
3
|
import Dialog from '@material-ui/core/Dialog';
|
|
3
4
|
import DialogActions from '@material-ui/core/DialogActions';
|
|
@@ -10,7 +11,7 @@ import PauseIcon from '@material-ui/icons/Pause';
|
|
|
10
11
|
import PlayArrowIcon from '@material-ui/icons/PlayArrow';
|
|
11
12
|
import WebIcon from '@material-ui/icons/Web';
|
|
12
13
|
import Alert from '@material-ui/lab/Alert';
|
|
13
|
-
import
|
|
14
|
+
import { useState } from 'react';
|
|
14
15
|
import { ilertApiRef } from '../../api/client.esm.js';
|
|
15
16
|
import { HeaderIconLinkRow } from '@backstage/core-components';
|
|
16
17
|
import { useApi, alertApiRef } from '@backstage/core-plugin-api';
|
|
@@ -23,8 +24,8 @@ const ILertCardActionsHeader = ({
|
|
|
23
24
|
}) => {
|
|
24
25
|
const ilertApi = useApi(ilertApiRef);
|
|
25
26
|
const alertApi = useApi(alertApiRef);
|
|
26
|
-
const [isLoading, setIsLoading] =
|
|
27
|
-
const [isDisableModalOpened, setIsDisableModalOpened] =
|
|
27
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
28
|
+
const [isDisableModalOpened, setIsDisableModalOpened] = useState(false);
|
|
28
29
|
const handleCreateNewAlert = () => {
|
|
29
30
|
setIsNewAlertModalOpened(true);
|
|
30
31
|
};
|
|
@@ -71,31 +72,31 @@ const ILertCardActionsHeader = ({
|
|
|
71
72
|
const alertSourceLink = {
|
|
72
73
|
label: "Alert Source",
|
|
73
74
|
href: ilertApi.getAlertSourceDetailsURL(alertSource),
|
|
74
|
-
icon: /* @__PURE__ */
|
|
75
|
+
icon: /* @__PURE__ */ jsx(WebIcon, {})
|
|
75
76
|
};
|
|
76
77
|
const createAlertLink = {
|
|
77
78
|
label: "Create Alert",
|
|
78
79
|
onClick: handleCreateNewAlert,
|
|
79
|
-
icon: /* @__PURE__ */
|
|
80
|
+
icon: /* @__PURE__ */ jsx(AlarmAddIcon, {}),
|
|
80
81
|
color: "secondary",
|
|
81
82
|
disabled: !alertSource || alertSource.status === "DISABLED" || alertSource.status === "IN_MAINTENANCE"
|
|
82
83
|
};
|
|
83
84
|
const enableAlertSourceLink = {
|
|
84
85
|
label: "Enable",
|
|
85
86
|
onClick: handleEnableAlertSource,
|
|
86
|
-
icon: /* @__PURE__ */
|
|
87
|
+
icon: /* @__PURE__ */ jsx(PlayArrowIcon, {}),
|
|
87
88
|
disabled: !alertSource || isLoading
|
|
88
89
|
};
|
|
89
90
|
const disableAlertSourceLink = {
|
|
90
91
|
label: "Disable",
|
|
91
92
|
onClick: handleDisableAlertSourceWarningOpen,
|
|
92
|
-
icon: /* @__PURE__ */
|
|
93
|
+
icon: /* @__PURE__ */ jsx(PauseIcon, {}),
|
|
93
94
|
disabled: !alertSource || isLoading
|
|
94
95
|
};
|
|
95
96
|
const maintenanceAlertSourceLink = {
|
|
96
97
|
label: "Immediate maintenance",
|
|
97
98
|
onClick: handleMaintenanceAlertSource,
|
|
98
|
-
icon: /* @__PURE__ */
|
|
99
|
+
icon: /* @__PURE__ */ jsx(BuildIcon, {}),
|
|
99
100
|
disabled: !alertSource || isLoading
|
|
100
101
|
};
|
|
101
102
|
const links = [
|
|
@@ -106,32 +107,40 @@ const ILertCardActionsHeader = ({
|
|
|
106
107
|
if (alertSource && alertSource.status !== "IN_MAINTENANCE") {
|
|
107
108
|
links.push(maintenanceAlertSourceLink);
|
|
108
109
|
}
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
onClose: handleDisableAlertSourceWarningClose,
|
|
114
|
-
"aria-labelledby": "alert-source-disable-form-title"
|
|
115
|
-
},
|
|
116
|
-
/* @__PURE__ */ React.createElement(DialogTitle, { id: "alert-source-disable-form-title" }, "Disable alert source"),
|
|
117
|
-
/* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Alert, { severity: "info" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", align: "justify" }, "Do you really want to disable this alert source? A disabled alert source cannot create new alerts."))),
|
|
118
|
-
/* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(
|
|
119
|
-
Button,
|
|
110
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
111
|
+
/* @__PURE__ */ jsx(HeaderIconLinkRow, { links }),
|
|
112
|
+
/* @__PURE__ */ jsxs(
|
|
113
|
+
Dialog,
|
|
120
114
|
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
115
|
+
open: isDisableModalOpened,
|
|
116
|
+
onClose: handleDisableAlertSourceWarningClose,
|
|
117
|
+
"aria-labelledby": "alert-source-disable-form-title",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "alert-source-disable-form-title", children: "Disable alert source" }),
|
|
120
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Alert, { severity: "info", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", align: "justify", children: "Do you really want to disable this alert source? A disabled alert source cannot create new alerts." }) }) }),
|
|
121
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
Button,
|
|
124
|
+
{
|
|
125
|
+
onClick: handleDisableAlertSource,
|
|
126
|
+
color: "secondary",
|
|
127
|
+
variant: "contained",
|
|
128
|
+
children: "Disable"
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
Button,
|
|
133
|
+
{
|
|
134
|
+
onClick: handleDisableAlertSourceWarningClose,
|
|
135
|
+
color: "primary",
|
|
136
|
+
children: "Cancel"
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] })
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] });
|
|
135
144
|
};
|
|
136
145
|
|
|
137
146
|
export { ILertCardActionsHeader };
|
|
@@ -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
|
|
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 { alertApiRef, useApi } from '@backstage/core-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(alertApiRef);\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({ message: 'Alert source enabled.' });\n setIsLoading(false);\n setAlertSource(newAlertSource);\n } catch (err) {\n setIsLoading(false);\n alertApi.post({ message: err, severity: 'error' });\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({ message: 'Alert source disabled.' });\n setIsLoading(false);\n setAlertSource(newAlertSource);\n } catch (err) {\n setIsLoading(false);\n alertApi.post({ message: err, severity: 'error' });\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":";;;;;;;;;;;;;;;;;;AAqCO,MAAM,yBAAyB,CAAC;AAAA,EACrC,WAAA;AAAA,EACA,cAAA;AAAA,EACA,wBAAA;AAAA,EACA;AACF,CAKM,KAAA;AACJ,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EA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