@backstage-community/plugin-ilert 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/ILertIcon.esm.js +63 -56
  3. package/dist/ILertIcon.esm.js.map +1 -1
  4. package/dist/components/Alert/AlertActionsMenu.esm.js +49 -42
  5. package/dist/components/Alert/AlertActionsMenu.esm.js.map +1 -1
  6. package/dist/components/Alert/AlertAssignModal.esm.js +68 -60
  7. package/dist/components/Alert/AlertAssignModal.esm.js.map +1 -1
  8. package/dist/components/Alert/AlertLink.esm.js +5 -2
  9. package/dist/components/Alert/AlertLink.esm.js.map +1 -1
  10. package/dist/components/Alert/AlertNewModal.esm.js +109 -87
  11. package/dist/components/Alert/AlertNewModal.esm.js.map +1 -1
  12. package/dist/components/AlertSource/AlertSourceLink.esm.js +19 -16
  13. package/dist/components/AlertSource/AlertSourceLink.esm.js.map +1 -1
  14. package/dist/components/AlertsPage/AlertsPage.esm.js +44 -36
  15. package/dist/components/AlertsPage/AlertsPage.esm.js.map +1 -1
  16. package/dist/components/AlertsPage/AlertsTable.esm.js +15 -15
  17. package/dist/components/AlertsPage/AlertsTable.esm.js.map +1 -1
  18. package/dist/components/AlertsPage/StatusChip.esm.js +5 -5
  19. package/dist/components/AlertsPage/StatusChip.esm.js.map +1 -1
  20. package/dist/components/AlertsPage/TableTitle.esm.js +30 -24
  21. package/dist/components/AlertsPage/TableTitle.esm.js.map +1 -1
  22. package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js +6 -6
  23. package/dist/components/Errors/MissingAuthorizationHeaderError.esm.js.map +1 -1
  24. package/dist/components/ILertCard/ILertCard.esm.js +63 -51
  25. package/dist/components/ILertCard/ILertCard.esm.js.map +1 -1
  26. package/dist/components/ILertCard/ILertCardActionsHeader.esm.js +42 -33
  27. package/dist/components/ILertCard/ILertCardActionsHeader.esm.js.map +1 -1
  28. package/dist/components/ILertCard/ILertCardEmptyState.esm.js +28 -20
  29. package/dist/components/ILertCard/ILertCardEmptyState.esm.js.map +1 -1
  30. package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js +3 -3
  31. package/dist/components/ILertCard/ILertCardHeaderStatus.esm.js.map +1 -1
  32. package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js +36 -27
  33. package/dist/components/ILertCard/ILertCardMaintenanceModal.esm.js.map +1 -1
  34. package/dist/components/ILertCard/ILertCardOnCall.esm.js +34 -28
  35. package/dist/components/ILertCard/ILertCardOnCall.esm.js.map +1 -1
  36. package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js +6 -6
  37. package/dist/components/ILertCard/ILertCardOnCallEmptyState.esm.js.map +1 -1
  38. package/dist/components/ILertCard/ILertCardOnCallItem.esm.js +41 -31
  39. package/dist/components/ILertCard/ILertCardOnCallItem.esm.js.map +1 -1
  40. package/dist/components/ILertPage/ILertPage.esm.js +25 -17
  41. package/dist/components/ILertPage/ILertPage.esm.js.map +1 -1
  42. package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js +45 -35
  43. package/dist/components/OnCallSchedulesPage/OnCallSchedulesGrid.esm.js.map +1 -1
  44. package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js +14 -11
  45. package/dist/components/OnCallSchedulesPage/OnCallSchedulesPage.esm.js.map +1 -1
  46. package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js +31 -23
  47. package/dist/components/OnCallSchedulesPage/OnCallShiftItem.esm.js.map +1 -1
  48. package/dist/components/Service/ServiceActionsMenu.esm.js +29 -25
  49. package/dist/components/Service/ServiceActionsMenu.esm.js.map +1 -1
  50. package/dist/components/Service/ServiceLink.esm.js +5 -2
  51. package/dist/components/Service/ServiceLink.esm.js.map +1 -1
  52. package/dist/components/ServicesPage/ServicesPage.esm.js +17 -14
  53. package/dist/components/ServicesPage/ServicesPage.esm.js.map +1 -1
  54. package/dist/components/ServicesPage/ServicesTable.esm.js +9 -9
  55. package/dist/components/ServicesPage/ServicesTable.esm.js.map +1 -1
  56. package/dist/components/ServicesPage/StatusChip.esm.js +7 -7
  57. package/dist/components/ServicesPage/StatusChip.esm.js.map +1 -1
  58. package/dist/components/Shift/ShiftOverrideModal.esm.js +83 -74
  59. package/dist/components/Shift/ShiftOverrideModal.esm.js.map +1 -1
  60. package/dist/components/StatusPage/StatusPageActionsMenu.esm.js +32 -26
  61. package/dist/components/StatusPage/StatusPageActionsMenu.esm.js.map +1 -1
  62. package/dist/components/StatusPage/StatusPageLink.esm.js +5 -2
  63. package/dist/components/StatusPage/StatusPageLink.esm.js.map +1 -1
  64. package/dist/components/StatusPage/StatusPageURL.esm.js +2 -2
  65. package/dist/components/StatusPage/StatusPageURL.esm.js.map +1 -1
  66. package/dist/components/StatusPagePage/StatusChip.esm.js +7 -7
  67. package/dist/components/StatusPagePage/StatusChip.esm.js.map +1 -1
  68. package/dist/components/StatusPagePage/StatusPagesPage.esm.js +17 -14
  69. package/dist/components/StatusPagePage/StatusPagesPage.esm.js.map +1 -1
  70. package/dist/components/StatusPagePage/StatusPagesTable.esm.js +10 -10
  71. package/dist/components/StatusPagePage/StatusPagesTable.esm.js.map +1 -1
  72. package/dist/components/StatusPagePage/VisibilityChip.esm.js +4 -4
  73. package/dist/components/StatusPagePage/VisibilityChip.esm.js.map +1 -1
  74. package/dist/hooks/useAlertActions.esm.js +3 -5
  75. package/dist/hooks/useAlertActions.esm.js.map +1 -1
  76. package/dist/hooks/useAlertSource.esm.js +3 -5
  77. package/dist/hooks/useAlertSource.esm.js.map +1 -1
  78. package/dist/hooks/useAlertSourceOnCalls.esm.js +3 -3
  79. package/dist/hooks/useAlertSourceOnCalls.esm.js.map +1 -1
  80. package/dist/hooks/useAlerts.esm.js +6 -9
  81. package/dist/hooks/useAlerts.esm.js.map +1 -1
  82. package/dist/hooks/useAssignAlert.esm.js +6 -4
  83. package/dist/hooks/useAssignAlert.esm.js.map +1 -1
  84. package/dist/hooks/useNewAlert.esm.js +6 -10
  85. package/dist/hooks/useNewAlert.esm.js.map +1 -1
  86. package/dist/hooks/useOnCallSchedules.esm.js +5 -3
  87. package/dist/hooks/useOnCallSchedules.esm.js.map +1 -1
  88. package/dist/hooks/useServices.esm.js +4 -4
  89. package/dist/hooks/useServices.esm.js.map +1 -1
  90. package/dist/hooks/useShiftOverride.esm.js +4 -4
  91. package/dist/hooks/useShiftOverride.esm.js.map +1 -1
  92. package/dist/hooks/useStatusPages.esm.js +4 -6
  93. package/dist/hooks/useStatusPages.esm.js.map +1 -1
  94. package/dist/index.d.ts +6 -8
  95. package/package.json +13 -6
@@ -1 +1 @@
1
- {"version":3,"file":"StatusChip.esm.js","sources":["../../../src/components/StatusPagePage/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 React from 'react';\nimport {\n DEGRADED,\n MAJOR_OUTAGE,\n OPERATIONAL,\n PARTIAL_OUTAGE,\n StatusPage,\n UNDER_MAINTENANCE,\n} from '../../types';\n\nconst OperationalChip = withStyles(theme => ({\n root: {\n backgroundColor: '#388E3D',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst UnderMaintenanceChip = withStyles(theme => ({\n root: {\n backgroundColor: '#616161',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst DegradedChip = withStyles(theme => ({\n root: {\n backgroundColor: '#FBC02D',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst PartialOutageChip = withStyles(theme => ({\n root: {\n backgroundColor: '#F57C02',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst MajorOutageChip = withStyles(theme => ({\n root: {\n backgroundColor: '#D22F2E',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst statusPageStatusLabels = {\n [OPERATIONAL]: 'Operational',\n [UNDER_MAINTENANCE]: 'Under maintenance',\n [DEGRADED]: 'Degraded',\n [PARTIAL_OUTAGE]: 'Partial outage',\n [MAJOR_OUTAGE]: 'Major outage',\n} as Record<string, string>;\n\nexport const StatusChip = ({ statusPage }: { statusPage: StatusPage }) => {\n const label = `${statusPageStatusLabels[statusPage.status]}`;\n\n switch (statusPage.status) {\n case OPERATIONAL:\n return <OperationalChip label={label} size=\"small\" />;\n case UNDER_MAINTENANCE:\n return <UnderMaintenanceChip label={label} size=\"small\" />;\n case DEGRADED:\n return <DegradedChip label={label} size=\"small\" />;\n case PARTIAL_OUTAGE:\n return <PartialOutageChip label={label} size=\"small\" />;\n case MAJOR_OUTAGE:\n return <MajorOutageChip label={label} size=\"small\" />;\n default:\n return <Chip label={label} size=\"small\" />;\n }\n};\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,eAAA,GAAkB,WAAW,CAAU,KAAA,MAAA;AAAA,EAC3C,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,oBAAA,GAAuB,WAAW,CAAU,KAAA,MAAA;AAAA,EAChD,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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AAK,OAAQ,EAAA,CAAA;AAAA,IACrD,KAAK,iBAAA;AACH,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,oBAAA,EAAA,EAAqB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAC1D,KAAK,QAAA;AACH,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAClD,KAAK,cAAA;AACH,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACvD,KAAK,YAAA;AACH,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,EAAgB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACrD;AACE,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA;AAE9C;;;;"}
1
+ {"version":3,"file":"StatusChip.esm.js","sources":["../../../src/components/StatusPagePage/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 {\n DEGRADED,\n MAJOR_OUTAGE,\n OPERATIONAL,\n PARTIAL_OUTAGE,\n StatusPage,\n UNDER_MAINTENANCE,\n} from '../../types';\n\nconst OperationalChip = withStyles(theme => ({\n root: {\n backgroundColor: '#388E3D',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst UnderMaintenanceChip = withStyles(theme => ({\n root: {\n backgroundColor: '#616161',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst DegradedChip = withStyles(theme => ({\n root: {\n backgroundColor: '#FBC02D',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst PartialOutageChip = withStyles(theme => ({\n root: {\n backgroundColor: '#F57C02',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\nconst MajorOutageChip = withStyles(theme => ({\n root: {\n backgroundColor: '#D22F2E',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst statusPageStatusLabels = {\n [OPERATIONAL]: 'Operational',\n [UNDER_MAINTENANCE]: 'Under maintenance',\n [DEGRADED]: 'Degraded',\n [PARTIAL_OUTAGE]: 'Partial outage',\n [MAJOR_OUTAGE]: 'Major outage',\n} as Record<string, string>;\n\nexport const StatusChip = ({ statusPage }: { statusPage: StatusPage }) => {\n const label = `${statusPageStatusLabels[statusPage.status]}`;\n\n switch (statusPage.status) {\n case OPERATIONAL:\n return <OperationalChip label={label} size=\"small\" />;\n case UNDER_MAINTENANCE:\n return <UnderMaintenanceChip label={label} size=\"small\" />;\n case DEGRADED:\n return <DegradedChip label={label} size=\"small\" />;\n case PARTIAL_OUTAGE:\n return <PartialOutageChip label={label} size=\"small\" />;\n case MAJOR_OUTAGE:\n return <MajorOutageChip label={label} size=\"small\" />;\n default:\n return <Chip label={label} size=\"small\" />;\n }\n};\n"],"names":[],"mappings":";;;;;AA0BA,MAAM,eAAA,GAAkB,WAAW,CAAU,KAAA,MAAA;AAAA,EAC3C,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,C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AAC,EAAE,UAAA,EAA6C,KAAA;AACxE,EAAA,MAAM,KAAQ,GAAA,CAAA,EAAG,sBAAuB,CAAA,UAAA,CAAW,MAAM,CAAC,CAAA,CAAA;AAE1D,EAAA,QAAQ,WAAW,MAAQ;AAAA,IACzB,KAAK,WAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,eAAA,EAAA,EAAgB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACrD,KAAK,iBAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAC1D,KAAK,QAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,YAAA,EAAA,EAAa,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAClD,KAAK,cAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,iBAAA,EAAA,EAAkB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACvD,KAAK,YAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,eAAA,EAAA,EAAgB,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACrD;AACE,MAAA,uBAAQ,GAAA,CAAA,IAAA,EAAA,EAAK,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA;AAE9C;;;;"}
@@ -1,5 +1,5 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
1
2
  import { Content, ResponseErrorPanel, ContentHeader, SupportButton } from '@backstage/core-components';
2
- import React from 'react';
3
3
  import { useStatusPages } from '../../hooks/useStatusPages.esm.js';
4
4
  import { MissingAuthorizationHeaderError } from '../Errors/MissingAuthorizationHeaderError.esm.js';
5
5
  import { StatusPagesTable } from './StatusPagesTable.esm.js';
@@ -11,21 +11,24 @@ const StatusPagesPage = () => {
11
11
  ] = useStatusPages(true);
12
12
  if (error) {
13
13
  if (error.name === "AuthenticationError") {
14
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(MissingAuthorizationHeaderError, null));
14
+ return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(MissingAuthorizationHeaderError, {}) });
15
15
  }
16
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error }));
16
+ return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ResponseErrorPanel, { error }) });
17
17
  }
18
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "Status pages" }, /* @__PURE__ */ React.createElement(SupportButton, null, "This helps you to bring iLert into your developer portal.")), /* @__PURE__ */ React.createElement(
19
- StatusPagesTable,
20
- {
21
- statusPages,
22
- tableState,
23
- onChangePage,
24
- onChangeRowsPerPage,
25
- isLoading,
26
- setIsLoading
27
- }
28
- ));
18
+ return /* @__PURE__ */ jsxs(Content, { children: [
19
+ /* @__PURE__ */ jsx(ContentHeader, { title: "Status pages", children: /* @__PURE__ */ jsx(SupportButton, { children: "This helps you to bring iLert into your developer portal." }) }),
20
+ /* @__PURE__ */ jsx(
21
+ StatusPagesTable,
22
+ {
23
+ statusPages,
24
+ tableState,
25
+ onChangePage,
26
+ onChangeRowsPerPage,
27
+ isLoading,
28
+ setIsLoading
29
+ }
30
+ )
31
+ ] });
29
32
  };
30
33
 
31
34
  export { StatusPagesPage };
@@ -1 +1 @@
1
- {"version":3,"file":"StatusPagesPage.esm.js","sources":["../../../src/components/StatusPagePage/StatusPagesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport React from 'react';\nimport { useStatusPages } from '../../hooks/useStatusPages';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { StatusPagesTable } from './StatusPagesTable';\n\nexport const StatusPagesPage = () => {\n const [\n { tableState, statusPages, isLoading, error },\n { onChangePage, onChangeRowsPerPage, setIsLoading },\n ] = useStatusPages(true);\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Status pages\">\n <SupportButton>\n This helps you to bring iLert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <StatusPagesTable\n statusPages={statusPages}\n tableState={tableState}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA;AAAA,IACJ,EAAE,UAAA,EAAY,WAAa,EAAA,SAAA,EAAW,KAAM,EAAA;AAAA,IAC5C,EAAE,YAAc,EAAA,mBAAA,EAAqB,YAAa;AAAA,GACpD,GAAI,eAAe,IAAI,CAAA;AAEvB,EAAA,IAAI,KAAO,EAAA;AACT,IAAI,IAAA,KAAA,CAAM,SAAS,qBAAuB,EAAA;AACxC,MAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,+BAAA,EAAA,IAAgC,CACnC,CAAA;AAAA;AAIJ,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,EAAmB,OAAc,CACpC,CAAA;AAAA;AAIJ,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAM,kCAClB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,IAAA,EAAc,2DAEf,CACF,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,UAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StatusPagesPage.esm.js","sources":["../../../src/components/StatusPagePage/StatusPagesPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Content,\n ContentHeader,\n ResponseErrorPanel,\n SupportButton,\n} from '@backstage/core-components';\nimport { useStatusPages } from '../../hooks/useStatusPages';\nimport { MissingAuthorizationHeaderError } from '../Errors';\nimport { StatusPagesTable } from './StatusPagesTable';\n\nexport const StatusPagesPage = () => {\n const [\n { tableState, statusPages, isLoading, error },\n { onChangePage, onChangeRowsPerPage, setIsLoading },\n ] = useStatusPages(true);\n\n if (error) {\n if (error.name === 'AuthenticationError') {\n return (\n <Content>\n <MissingAuthorizationHeaderError />\n </Content>\n );\n }\n\n return (\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n );\n }\n\n return (\n <Content>\n <ContentHeader title=\"Status pages\">\n <SupportButton>\n This helps you to bring iLert into your developer portal.\n </SupportButton>\n </ContentHeader>\n <StatusPagesTable\n statusPages={statusPages}\n tableState={tableState}\n onChangePage={onChangePage}\n onChangeRowsPerPage={onChangeRowsPerPage}\n isLoading={isLoading}\n setIsLoading={setIsLoading}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA;AAAA,IACJ,EAAE,UAAA,EAAY,WAAa,EAAA,SAAA,EAAW,KAAM,EAAA;AAAA,IAC5C,EAAE,YAAc,EAAA,mBAAA,EAAqB,YAAa;AAAA,GACpD,GAAI,eAAe,IAAI,CAAA;AAEvB,EAAA,IAAI,KAAO,EAAA;AACT,IAAI,IAAA,KAAA,CAAM,SAAS,qBAAuB,EAAA;AACxC,MAAA,uBACG,GAAA,CAAA,OAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,+BAAA,EAAA,EAAgC,CACnC,EAAA,CAAA;AAAA;AAIJ,IAAA,uBACG,GAAA,CAAA,OAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,kBAAA,EAAA,EAAmB,OAAc,CACpC,EAAA,CAAA;AAAA;AAIJ,EAAA,4BACG,OACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAc,KAAM,EAAA,cAAA,EACnB,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,uEAEf,CACF,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,WAAA;AAAA,QACA,UAAA;AAAA,QACA,YAAA;AAAA,QACA,mBAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,6 +1,6 @@
1
+ import { jsx } from 'react/jsx-runtime';
1
2
  import { makeStyles } from '@material-ui/core/styles';
2
3
  import Typography from '@material-ui/core/Typography';
3
- import React from 'react';
4
4
  import { VisibilityChip } from './VisibilityChip.esm.js';
5
5
  import { Table } from '@backstage/core-components';
6
6
  import { StatusPageActionsMenu } from '../StatusPage/StatusPageActionsMenu.esm.js';
@@ -38,42 +38,42 @@ const StatusPagesTable = ({
38
38
  highlight: true,
39
39
  cellStyle: smColumnStyle,
40
40
  headerStyle: smColumnStyle,
41
- render: (rowData) => /* @__PURE__ */ React.createElement(StatusPageLink, { statusPage: rowData })
41
+ render: (rowData) => /* @__PURE__ */ jsx(StatusPageLink, { statusPage: rowData })
42
42
  };
43
43
  const nameColumn = {
44
44
  title: "Name",
45
45
  field: "name",
46
46
  cellStyle: !compact ? xlColumnStyle : void 0,
47
47
  headerStyle: !compact ? xlColumnStyle : void 0,
48
- render: (rowData) => /* @__PURE__ */ React.createElement(Typography, null, rowData.name)
48
+ render: (rowData) => /* @__PURE__ */ jsx(Typography, { children: rowData.name })
49
49
  };
50
50
  const urlColumn = {
51
51
  title: "URL",
52
52
  field: "url",
53
53
  cellStyle: smColumnStyle,
54
54
  headerStyle: smColumnStyle,
55
- render: (rowData) => /* @__PURE__ */ React.createElement(StatusPageURL, { statusPage: rowData })
55
+ render: (rowData) => /* @__PURE__ */ jsx(StatusPageURL, { statusPage: rowData })
56
56
  };
57
57
  const visibilityColumn = {
58
58
  title: "Visibility",
59
59
  field: "visibility",
60
60
  cellStyle: smColumnStyle,
61
61
  headerStyle: smColumnStyle,
62
- render: (rowData) => /* @__PURE__ */ React.createElement(VisibilityChip, { statusPage: rowData })
62
+ render: (rowData) => /* @__PURE__ */ jsx(VisibilityChip, { statusPage: rowData })
63
63
  };
64
64
  const statusColumn = {
65
65
  title: "Status",
66
66
  field: "status",
67
67
  cellStyle: smColumnStyle,
68
68
  headerStyle: smColumnStyle,
69
- render: (rowData) => /* @__PURE__ */ React.createElement(StatusChip, { statusPage: rowData })
69
+ render: (rowData) => /* @__PURE__ */ jsx(StatusChip, { statusPage: rowData })
70
70
  };
71
71
  const actionsColumn = {
72
72
  title: "",
73
73
  field: "",
74
74
  cellStyle: smColumnStyle,
75
75
  headerStyle: smColumnStyle,
76
- render: (rowData) => /* @__PURE__ */ React.createElement(StatusPageActionsMenu, { statusPage: rowData })
76
+ render: (rowData) => /* @__PURE__ */ jsx(StatusPageActionsMenu, { statusPage: rowData })
77
77
  };
78
78
  const columns = compact ? [nameColumn, statusColumn, urlColumn, actionsColumn] : [
79
79
  idColumn,
@@ -83,7 +83,7 @@ const StatusPagesTable = ({
83
83
  visibilityColumn,
84
84
  actionsColumn
85
85
  ];
86
- return /* @__PURE__ */ React.createElement(
86
+ return /* @__PURE__ */ jsx(
87
87
  Table,
88
88
  {
89
89
  options: {
@@ -99,8 +99,8 @@ const StatusPagesTable = ({
99
99
  showTitle: true,
100
100
  toolbar: true
101
101
  },
102
- emptyContent: /* @__PURE__ */ React.createElement(Typography, { color: "textSecondary", className: classes.empty }, "No status pages"),
103
- title: /* @__PURE__ */ React.createElement(Typography, { variant: "button", color: "textSecondary" }, "STATUS PAGES"),
102
+ emptyContent: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", className: classes.empty, children: "No status pages" }),
103
+ title: /* @__PURE__ */ jsx(Typography, { variant: "button", color: "textSecondary", children: "STATUS PAGES" }),
104
104
  page: tableState.page,
105
105
  onPageChange: onChangePage,
106
106
  onRowsPerPageChange: onChangeRowsPerPage,
@@ -1 +1 @@
1
- {"version":3,"file":"StatusPagesTable.esm.js","sources":["../../../src/components/StatusPagePage/StatusPagesTable.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 React from 'react';\nimport { TableState } from '../../api';\nimport { StatusPage } from '../../types';\nimport { VisibilityChip } from './VisibilityChip';\n\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { StatusPageActionsMenu } from '../StatusPage/StatusPageActionsMenu';\nimport { StatusPageLink } from '../StatusPage/StatusPageLink';\nimport { StatusPageURL } from '../StatusPage/StatusPageURL';\nimport { StatusChip } from './StatusChip';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nexport const StatusPagesTable = ({\n statusPages,\n tableState,\n isLoading,\n onChangePage,\n onChangeRowsPerPage,\n compact,\n}: {\n statusPages: StatusPage[];\n tableState: TableState;\n isLoading: boolean;\n setIsLoading: (isLoading: boolean) => void;\n onChangePage: (page: number) => void;\n onChangeRowsPerPage: (pageSize: number) => void;\n compact?: boolean;\n}) => {\n const classes = useStyles();\n\n const smColumnStyle = {\n width: '10%',\n maxWidth: '10%',\n };\n const xlColumnStyle = {\n width: '30%',\n maxWidth: '30%',\n };\n\n const idColumn: TableColumn<StatusPage> = {\n title: 'ID',\n field: 'id',\n highlight: true,\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusPageLink statusPage={rowData} />,\n };\n const nameColumn: TableColumn<StatusPage> = {\n title: 'Name',\n field: 'name',\n cellStyle: !compact ? xlColumnStyle : undefined,\n headerStyle: !compact ? xlColumnStyle : undefined,\n render: rowData => <Typography>{rowData.name}</Typography>,\n };\n const urlColumn: TableColumn<StatusPage> = {\n title: 'URL',\n field: 'url',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusPageURL statusPage={rowData} />,\n };\n const visibilityColumn: TableColumn<StatusPage> = {\n title: 'Visibility',\n field: 'visibility',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <VisibilityChip statusPage={rowData} />,\n };\n const statusColumn: TableColumn<StatusPage> = {\n title: 'Status',\n field: 'status',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusChip statusPage={rowData} />,\n };\n const actionsColumn: TableColumn<StatusPage> = {\n title: '',\n field: '',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusPageActionsMenu statusPage={rowData} />,\n };\n\n const columns: TableColumn<StatusPage>[] = compact\n ? [nameColumn, statusColumn, urlColumn, actionsColumn]\n : [\n idColumn,\n nameColumn,\n statusColumn,\n urlColumn,\n visibilityColumn,\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 status pages\n </Typography>\n }\n title={\n <Typography variant=\"button\" color=\"textSecondary\">\n STATUS PAGES\n </Typography>\n }\n page={tableState.page}\n onPageChange={onChangePage}\n onRowsPerPageChange={onChangeRowsPerPage}\n columns={columns}\n data={statusPages}\n isLoading={isLoading}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA4BA,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,mBAAmB,CAAC;AAAA,EAC/B,WAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAQM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,MAAM,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AAG,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,iBAE5D,CAAA;AAAA,MAEF,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,QAAS,EAAA,KAAA,EAAM,mBAAgB,cAEnD,CAAA;AAAA,MAEF,MAAM,UAAW,CAAA,IAAA;AAAA,MACjB,YAAc,EAAA,YAAA;AAAA,MACd,mBAAqB,EAAA,mBAAA;AAAA,MACrB,OAAA;AAAA,MACA,IAAM,EAAA,WAAA;AAAA,MACN;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"StatusPagesTable.esm.js","sources":["../../../src/components/StatusPagePage/StatusPagesTable.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 { TableState } from '../../api';\nimport { StatusPage } from '../../types';\nimport { VisibilityChip } from './VisibilityChip';\n\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { StatusPageActionsMenu } from '../StatusPage/StatusPageActionsMenu';\nimport { StatusPageLink } from '../StatusPage/StatusPageLink';\nimport { StatusPageURL } from '../StatusPage/StatusPageURL';\nimport { StatusChip } from './StatusChip';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nexport const StatusPagesTable = ({\n statusPages,\n tableState,\n isLoading,\n onChangePage,\n onChangeRowsPerPage,\n compact,\n}: {\n statusPages: StatusPage[];\n tableState: TableState;\n isLoading: boolean;\n setIsLoading: (isLoading: boolean) => void;\n onChangePage: (page: number) => void;\n onChangeRowsPerPage: (pageSize: number) => void;\n compact?: boolean;\n}) => {\n const classes = useStyles();\n\n const smColumnStyle = {\n width: '10%',\n maxWidth: '10%',\n };\n const xlColumnStyle = {\n width: '30%',\n maxWidth: '30%',\n };\n\n const idColumn: TableColumn<StatusPage> = {\n title: 'ID',\n field: 'id',\n highlight: true,\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusPageLink statusPage={rowData} />,\n };\n const nameColumn: TableColumn<StatusPage> = {\n title: 'Name',\n field: 'name',\n cellStyle: !compact ? xlColumnStyle : undefined,\n headerStyle: !compact ? xlColumnStyle : undefined,\n render: rowData => <Typography>{rowData.name}</Typography>,\n };\n const urlColumn: TableColumn<StatusPage> = {\n title: 'URL',\n field: 'url',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusPageURL statusPage={rowData} />,\n };\n const visibilityColumn: TableColumn<StatusPage> = {\n title: 'Visibility',\n field: 'visibility',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <VisibilityChip statusPage={rowData} />,\n };\n const statusColumn: TableColumn<StatusPage> = {\n title: 'Status',\n field: 'status',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusChip statusPage={rowData} />,\n };\n const actionsColumn: TableColumn<StatusPage> = {\n title: '',\n field: '',\n cellStyle: smColumnStyle,\n headerStyle: smColumnStyle,\n render: rowData => <StatusPageActionsMenu statusPage={rowData} />,\n };\n\n const columns: TableColumn<StatusPage>[] = compact\n ? [nameColumn, statusColumn, urlColumn, actionsColumn]\n : [\n idColumn,\n nameColumn,\n statusColumn,\n urlColumn,\n visibilityColumn,\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 status pages\n </Typography>\n }\n title={\n <Typography variant=\"button\" color=\"textSecondary\">\n STATUS PAGES\n </Typography>\n }\n page={tableState.page}\n onPageChange={onChangePage}\n onRowsPerPageChange={onChangeRowsPerPage}\n columns={columns}\n data={statusPages}\n isLoading={isLoading}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA2BA,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,mBAAmB,CAAC;AAAA,EAC/B,WAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAQM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,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,QAAoC,GAAA;AAAA,IACxC,KAAO,EAAA,IAAA;AAAA,IACP,KAAO,EA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W,SAAQ,QAAS,EAAA,KAAA,EAAM,iBAAgB,QAEnD,EAAA,cAAA,EAAA,CAAA;AAAA,MAEF,MAAM,UAAW,CAAA,IAAA;AAAA,MACjB,YAAc,EAAA,YAAA;AAAA,MACd,mBAAqB,EAAA,mBAAA;AAAA,MACrB,OAAA;AAAA,MACA,IAAM,EAAA,WAAA;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 { PUBLIC, PRIVATE } from '../../types.esm.js';
5
5
 
6
6
  const PrivateChip = withStyles((theme) => ({
@@ -25,11 +25,11 @@ const VisibilityChip = ({ statusPage }) => {
25
25
  const label = `${statusPageVisibilityLabels[statusPage.visibility]}`;
26
26
  switch (statusPage.visibility) {
27
27
  case PRIVATE:
28
- return /* @__PURE__ */ React.createElement(PrivateChip, { label, size: "small" });
28
+ return /* @__PURE__ */ jsx(PrivateChip, { label, size: "small" });
29
29
  case PUBLIC:
30
- return /* @__PURE__ */ React.createElement(PublicChip, { label, size: "small" });
30
+ return /* @__PURE__ */ jsx(PublicChip, { label, size: "small" });
31
31
  default:
32
- return /* @__PURE__ */ React.createElement(Chip, { label, size: "small" });
32
+ return /* @__PURE__ */ jsx(Chip, { label, size: "small" });
33
33
  }
34
34
  };
35
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"VisibilityChip.esm.js","sources":["../../../src/components/StatusPagePage/VisibilityChip.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 React from 'react';\nimport { PRIVATE, PUBLIC, StatusPage } from '../../types';\n\nconst PrivateChip = withStyles(theme => ({\n root: {\n backgroundColor: '#4caf50',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst PublicChip = withStyles(theme => ({\n root: {\n backgroundColor: '#ffb74d',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst statusPageVisibilityLabels = {\n [PUBLIC]: 'Public',\n [PRIVATE]: 'Private',\n} as Record<string, string>;\n\nexport const VisibilityChip = ({ statusPage }: { statusPage: StatusPage }) => {\n const label = `${statusPageVisibilityLabels[statusPage.visibility]}`;\n\n switch (statusPage.visibility) {\n case PRIVATE:\n return <PrivateChip label={label} size=\"small\" />;\n case PUBLIC:\n return <PublicChip label={label} size=\"small\" />;\n default:\n return <Chip label={label} size=\"small\" />;\n }\n};\n"],"names":[],"mappings":";;;;;AAoBA,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;AAER,MAAM,UAAA,GAAa,WAAW,CAAU,KAAA,MAAA;AAAA,EACtC,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,0BAA6B,GAAA;AAAA,EACjC,CAAC,MAAM,GAAG,QAAA;AAAA,EACV,CAAC,OAAO,GAAG;AACb,CAAA;AAEO,MAAM,cAAiB,GAAA,CAAC,EAAE,UAAA,EAA6C,KAAA;AAC5E,EAAA,MAAM,KAAQ,GAAA,CAAA,EAAG,0BAA2B,CAAA,UAAA,CAAW,UAAU,CAAC,CAAA,CAAA;AAElE,EAAA,QAAQ,WAAW,UAAY;AAAA,IAC7B,KAAK,OAAA;AACH,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACjD,KAAK,MAAA;AACH,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAChD;AACE,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA;AAE9C;;;;"}
1
+ {"version":3,"file":"VisibilityChip.esm.js","sources":["../../../src/components/StatusPagePage/VisibilityChip.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 { PRIVATE, PUBLIC, StatusPage } from '../../types';\n\nconst PrivateChip = withStyles(theme => ({\n root: {\n backgroundColor: '#4caf50',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst PublicChip = withStyles(theme => ({\n root: {\n backgroundColor: '#ffb74d',\n color: theme.palette.common.white,\n margin: 0,\n },\n}))(Chip);\n\nconst statusPageVisibilityLabels = {\n [PUBLIC]: 'Public',\n [PRIVATE]: 'Private',\n} as Record<string, string>;\n\nexport const VisibilityChip = ({ statusPage }: { statusPage: StatusPage }) => {\n const label = `${statusPageVisibilityLabels[statusPage.visibility]}`;\n\n switch (statusPage.visibility) {\n case PRIVATE:\n return <PrivateChip label={label} size=\"small\" />;\n case PUBLIC:\n return <PublicChip label={label} size=\"small\" />;\n default:\n return <Chip label={label} size=\"small\" />;\n }\n};\n"],"names":[],"mappings":";;;;;AAmBA,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;AAER,MAAM,UAAA,GAAa,WAAW,CAAU,KAAA,MAAA;AAAA,EACtC,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,0BAA6B,GAAA;AAAA,EACjC,CAAC,MAAM,GAAG,QAAA;AAAA,EACV,CAAC,OAAO,GAAG;AACb,CAAA;AAEO,MAAM,cAAiB,GAAA,CAAC,EAAE,UAAA,EAA6C,KAAA;AAC5E,EAAA,MAAM,KAAQ,GAAA,CAAA,EAAG,0BAA2B,CAAA,UAAA,CAAW,UAAU,CAAC,CAAA,CAAA;AAElE,EAAA,QAAQ,WAAW,UAAY;AAAA,IAC7B,KAAK,OAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,WAAA,EAAA,EAAY,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IACjD,KAAK,MAAA;AACH,MAAA,uBAAQ,GAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA,IAChD;AACE,MAAA,uBAAQ,GAAA,CAAA,IAAA,EAAA,EAAK,KAAc,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA;AAAA;AAE9C;;;;"}
@@ -1,16 +1,14 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
 
7
7
  const useAlertActions = (alert, open) => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [alertActionsList, setAlertActionsList] = React.useState(
11
- []
12
- );
13
- const [isLoading, setIsLoading] = React.useState(false);
10
+ const [alertActionsList, setAlertActionsList] = useState([]);
11
+ const [isLoading, setIsLoading] = useState(false);
14
12
  const { error, retry } = useAsyncRetry(async () => {
15
13
  try {
16
14
  if (!alert || !open) {
@@ -1 +1 @@
1
- {"version":3,"file":"useAlertActions.esm.js","sources":["../../src/hooks/useAlertActions.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport React from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { Alert, AlertAction } from '../types';\n\nexport const useAlertActions = (alert: Alert | null, open: boolean) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertActionsList, setAlertActionsList] = React.useState<AlertAction[]>(\n [],\n );\n const [isLoading, setIsLoading] = React.useState(false);\n\n const { error, retry } = useAsyncRetry(async () => {\n try {\n if (!alert || !open) {\n return;\n }\n const data = await ilertApi.fetchAlertActions(alert);\n setAlertActionsList(data);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n }, [alert, open]);\n\n return [\n {\n alertActions: alertActionsList,\n error,\n isLoading,\n },\n {\n setAlertActionsList,\n setIsLoading,\n retry,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,eAAA,GAAkB,CAAC,KAAA,EAAqB,IAAkB,KAAA;AACrE,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IACpD;AAAC,GACH;AACA,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAEtD,EAAA,MAAM,EAAE,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,YAAY;AACjD,IAAI,IAAA;AACF,MAAI,IAAA,CAAC,KAAS,IAAA,CAAC,IAAM,EAAA;AACnB,QAAA;AAAA;AAEF,MAAA,MAAM,IAAO,GAAA,MAAM,QAAS,CAAA,iBAAA,CAAkB,KAAK,CAAA;AACnD,MAAA,mBAAA,CAAoB,IAAI,CAAA;AAAA,aACjB,CAAG,EAAA;AACV,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACC,EAAA,CAAC,KAAO,EAAA,IAAI,CAAC,CAAA;AAEhB,EAAO,OAAA;AAAA,IACL;AAAA,MACE,YAAc,EAAA,gBAAA;AAAA,MACd,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,mBAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useAlertActions.esm.js","sources":["../../src/hooks/useAlertActions.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { Alert, AlertAction } from '../types';\n\nexport const useAlertActions = (alert: Alert | null, open: boolean) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertActionsList, setAlertActionsList] = useState<AlertAction[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n\n const { error, retry } = useAsyncRetry(async () => {\n try {\n if (!alert || !open) {\n return;\n }\n const data = await ilertApi.fetchAlertActions(alert);\n setAlertActionsList(data);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n }, [alert, open]);\n\n return [\n {\n alertActions: alertActionsList,\n error,\n isLoading,\n },\n {\n setAlertActionsList,\n setIsLoading,\n retry,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,eAAA,GAAkB,CAAC,KAAA,EAAqB,IAAkB,KAAA;AACrE,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,gBAAkB,EAAA,mBAAmB,CAAI,GAAA,QAAA,CAAwB,EAAE,CAAA;AAC1E,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,MAAM,EAAE,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,YAAY;AACjD,IAAI,IAAA;AACF,MAAI,IAAA,CAAC,KAAS,IAAA,CAAC,IAAM,EAAA;AACnB,QAAA;AAAA;AAEF,MAAA,MAAM,IAAO,GAAA,MAAM,QAAS,CAAA,iBAAA,CAAkB,KAAK,CAAA;AACnD,MAAA,mBAAA,CAAoB,IAAI,CAAA;AAAA,aACjB,CAAG,EAAA;AACV,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACC,EAAA,CAAC,KAAO,EAAA,IAAI,CAAC,CAAA;AAEhB,EAAO,OAAA;AAAA,IACL;AAAA,MACE,YAAc,EAAA,gBAAA;AAAA,MACd,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,mBAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
@@ -1,16 +1,14 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
 
7
7
  const useAlertSource = (integrationKey) => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [alertSource, setAlertSource] = React.useState(
11
- null
12
- );
13
- const [isAlertSourceLoading, setIsAlertSourceLoading] = React.useState(false);
10
+ const [alertSource, setAlertSource] = useState(null);
11
+ const [isAlertSourceLoading, setIsAlertSourceLoading] = useState(false);
14
12
  const fetchAlertSourceCall = async () => {
15
13
  try {
16
14
  if (!integrationKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"useAlertSource.esm.js","sources":["../../src/hooks/useAlertSource.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport React from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { AlertSource } from '../types';\n\nexport const useAlertSource = (integrationKey: string) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertSource, setAlertSource] = React.useState<AlertSource | null>(\n null,\n );\n const [isAlertSourceLoading, setIsAlertSourceLoading] = React.useState(false);\n\n const fetchAlertSourceCall = async () => {\n try {\n if (!integrationKey) {\n return;\n }\n setIsAlertSourceLoading(true);\n const data = await ilertApi.fetchAlertSource(integrationKey);\n setAlertSource(data || null);\n setIsAlertSourceLoading(false);\n } catch (e) {\n setIsAlertSourceLoading(false);\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n\n const { error: alertSourceError, retry: alertSourceRetry } = useAsyncRetry(\n fetchAlertSourceCall,\n [integrationKey],\n );\n\n const retry = () => alertSourceRetry();\n\n return [\n {\n alertSource,\n error: alertSourceError,\n isLoading: isAlertSourceLoading,\n },\n {\n retry,\n setIsLoading: setIsAlertSourceLoading,\n refetchAlertSource: fetchAlertSourceCall,\n setAlertSource,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,cAAA,GAAiB,CAAC,cAA2B,KAAA;AACxD,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IAC1C;AAAA,GACF;AACA,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAE5E,EAAA,MAAM,uBAAuB,YAAY;AACvC,IAAI,IAAA;AACF,MAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,QAAA;AAAA;AAEF,MAAA,uBAAA,CAAwB,IAAI,CAAA;AAC5B,MAAA,MAAM,IAAO,GAAA,MAAM,QAAS,CAAA,gBAAA,CAAiB,cAAc,CAAA;AAC3D,MAAA,cAAA,CAAe,QAAQ,IAAI,CAAA;AAC3B,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAAA,aACtB,CAAG,EAAA;AACV,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAC7B,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,gBAAkB,EAAA,KAAA,EAAO,kBAAqB,GAAA,aAAA;AAAA,IAC3D,oBAAA;AAAA,IACA,CAAC,cAAc;AAAA,GACjB;AAEA,EAAM,MAAA,KAAA,GAAQ,MAAM,gBAAiB,EAAA;AAErC,EAAO,OAAA;AAAA,IACL;AAAA,MACE,WAAA;AAAA,MACA,KAAO,EAAA,gBAAA;AAAA,MACP,SAAW,EAAA;AAAA,KACb;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,YAAc,EAAA,uBAAA;AAAA,MACd,kBAAoB,EAAA,oBAAA;AAAA,MACpB;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useAlertSource.esm.js","sources":["../../src/hooks/useAlertSource.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { AlertSource } from '../types';\n\nexport const useAlertSource = (integrationKey: string) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertSource, setAlertSource] = useState<AlertSource | null>(null);\n const [isAlertSourceLoading, setIsAlertSourceLoading] = useState(false);\n\n const fetchAlertSourceCall = async () => {\n try {\n if (!integrationKey) {\n return;\n }\n setIsAlertSourceLoading(true);\n const data = await ilertApi.fetchAlertSource(integrationKey);\n setAlertSource(data || null);\n setIsAlertSourceLoading(false);\n } catch (e) {\n setIsAlertSourceLoading(false);\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n\n const { error: alertSourceError, retry: alertSourceRetry } = useAsyncRetry(\n fetchAlertSourceCall,\n [integrationKey],\n );\n\n const retry = () => alertSourceRetry();\n\n return [\n {\n alertSource,\n error: alertSourceError,\n isLoading: isAlertSourceLoading,\n },\n {\n retry,\n setIsLoading: setIsAlertSourceLoading,\n refetchAlertSource: fetchAlertSourceCall,\n setAlertSource,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,cAAA,GAAiB,CAAC,cAA2B,KAAA;AACxD,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAA6B,IAAI,CAAA;AACvE,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAAI,SAAS,KAAK,CAAA;AAEtE,EAAA,MAAM,uBAAuB,YAAY;AACvC,IAAI,IAAA;AACF,MAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,QAAA;AAAA;AAEF,MAAA,uBAAA,CAAwB,IAAI,CAAA;AAC5B,MAAA,MAAM,IAAO,GAAA,MAAM,QAAS,CAAA,gBAAA,CAAiB,cAAc,CAAA;AAC3D,MAAA,cAAA,CAAe,QAAQ,IAAI,CAAA;AAC3B,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAAA,aACtB,CAAG,EAAA;AACV,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAC7B,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,gBAAkB,EAAA,KAAA,EAAO,kBAAqB,GAAA,aAAA;AAAA,IAC3D,oBAAA;AAAA,IACA,CAAC,cAAc;AAAA,GACjB;AAEA,EAAM,MAAA,KAAA,GAAQ,MAAM,gBAAiB,EAAA;AAErC,EAAO,OAAA;AAAA,IACL;AAAA,MACE,WAAA;AAAA,MACA,KAAO,EAAA,gBAAA;AAAA,MACP,SAAW,EAAA;AAAA,KACb;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,YAAc,EAAA,uBAAA;AAAA,MACd,kBAAoB,EAAA,oBAAA;AAAA,MACpB;AAAA;AACF,GACF;AACF;;;;"}
@@ -1,14 +1,14 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
 
7
7
  const useAlertSourceOnCalls = (alertSource) => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [onCallsList, setOnCallsList] = React.useState([]);
11
- const [isLoading, setIsLoading] = React.useState(false);
10
+ const [onCallsList, setOnCallsList] = useState([]);
11
+ const [isLoading, setIsLoading] = useState(false);
12
12
  const fetchAlertSourceOnCallsCall = async () => {
13
13
  try {
14
14
  if (!alertSource) {
@@ -1 +1 @@
1
- {"version":3,"file":"useAlertSourceOnCalls.esm.js","sources":["../../src/hooks/useAlertSourceOnCalls.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport React from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { AlertSource, OnCall } from '../types';\n\nexport const useAlertSourceOnCalls = (alertSource?: AlertSource | null) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [onCallsList, setOnCallsList] = React.useState<OnCall[]>([]);\n const [isLoading, setIsLoading] = React.useState(false);\n\n const fetchAlertSourceOnCallsCall = async () => {\n try {\n if (!alertSource) {\n return;\n }\n setIsLoading(true);\n const data = await ilertApi.fetchAlertSourceOnCalls(alertSource);\n setOnCallsList(data || []);\n setIsLoading(false);\n } catch (e) {\n setIsLoading(false);\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n\n const { error, retry } = useAsyncRetry(fetchAlertSourceOnCallsCall, [\n alertSource,\n ]);\n\n return [\n {\n onCalls: onCallsList,\n error,\n isLoading,\n },\n {\n retry,\n setIsLoading,\n refetchAlertSourceOnCalls: fetchAlertSourceOnCallsCall,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,qBAAA,GAAwB,CAAC,WAAqC,KAAA;AACzE,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc,IAAI,KAAM,CAAA,QAAA,CAAmB,EAAE,CAAA;AACjE,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAEtD,EAAA,MAAM,8BAA8B,YAAY;AAC9C,IAAI,IAAA;AACF,MAAA,IAAI,CAAC,WAAa,EAAA;AAChB,QAAA;AAAA;AAEF,MAAA,YAAA,CAAa,IAAI,CAAA;AACjB,MAAA,MAAM,IAAO,GAAA,MAAM,QAAS,CAAA,uBAAA,CAAwB,WAAW,CAAA;AAC/D,MAAe,cAAA,CAAA,IAAA,IAAQ,EAAE,CAAA;AACzB,MAAA,YAAA,CAAa,KAAK,CAAA;AAAA,aACX,CAAG,EAAA;AACV,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,2BAA6B,EAAA;AAAA,IAClE;AAAA,GACD,CAAA;AAED,EAAO,OAAA;AAAA,IACL;AAAA,MACE,OAAS,EAAA,WAAA;AAAA,MACT,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,YAAA;AAAA,MACA,yBAA2B,EAAA;AAAA;AAC7B,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useAlertSourceOnCalls.esm.js","sources":["../../src/hooks/useAlertSourceOnCalls.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { AlertSource, OnCall } from '../types';\n\nexport const useAlertSourceOnCalls = (alertSource?: AlertSource | null) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [onCallsList, setOnCallsList] = useState<OnCall[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n\n const fetchAlertSourceOnCallsCall = async () => {\n try {\n if (!alertSource) {\n return;\n }\n setIsLoading(true);\n const data = await ilertApi.fetchAlertSourceOnCalls(alertSource);\n setOnCallsList(data || []);\n setIsLoading(false);\n } catch (e) {\n setIsLoading(false);\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n\n const { error, retry } = useAsyncRetry(fetchAlertSourceOnCallsCall, [\n alertSource,\n ]);\n\n return [\n {\n onCalls: onCallsList,\n error,\n isLoading,\n },\n {\n retry,\n setIsLoading,\n refetchAlertSourceOnCalls: fetchAlertSourceOnCallsCall,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,qBAAA,GAAwB,CAAC,WAAqC,KAAA;AACzE,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;AAC3D,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,MAAM,8BAA8B,YAAY;AAC9C,IAAI,IAAA;AACF,MAAA,IAAI,CAAC,WAAa,EAAA;AAChB,QAAA;AAAA;AAEF,MAAA,YAAA,CAAa,IAAI,CAAA;AACjB,MAAA,MAAM,IAAO,GAAA,MAAM,QAAS,CAAA,uBAAA,CAAwB,WAAW,CAAA;AAC/D,MAAe,cAAA,CAAA,IAAA,IAAQ,EAAE,CAAA;AACzB,MAAA,YAAA,CAAa,KAAK,CAAA;AAAA,aACX,CAAG,EAAA;AACV,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,KAAM,EAAA,GAAI,cAAc,2BAA6B,EAAA;AAAA,IAClE;AAAA,GACD,CAAA;AAED,EAAO,OAAA;AAAA,IACL;AAAA,MACE,OAAS,EAAA,WAAA;AAAA,MACT,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,YAAA;AAAA,MACA,yBAA2B,EAAA;AAAA;AAC7B,GACF;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
  import { ACCEPTED, PENDING } from '../types.esm.js';
@@ -8,17 +8,14 @@ import { ACCEPTED, PENDING } from '../types.esm.js';
8
8
  const useAlerts = (paging, singleSource, alertSource) => {
9
9
  const ilertApi = useApi(ilertApiRef);
10
10
  const errorApi = useApi(errorApiRef);
11
- const [tableState, setTableState] = React.useState({
11
+ const [tableState, setTableState] = useState({
12
12
  page: 0,
13
13
  pageSize: 10
14
14
  });
15
- const [states, setStates] = React.useState([
16
- ACCEPTED,
17
- PENDING
18
- ]);
19
- const [alertsList, setAlertsList] = React.useState([]);
20
- const [alertsCount, setAlertsCount] = React.useState(0);
21
- const [isLoading, setIsLoading] = React.useState(false);
15
+ const [states, setStates] = useState([ACCEPTED, PENDING]);
16
+ const [alertsList, setAlertsList] = useState([]);
17
+ const [alertsCount, setAlertsCount] = useState(0);
18
+ const [isLoading, setIsLoading] = useState(false);
22
19
  const fetchAlertsCall = async () => {
23
20
  try {
24
21
  if (singleSource && !alertSource) {
@@ -1 +1 @@
1
- {"version":3,"file":"useAlerts.esm.js","sources":["../../src/hooks/useAlerts.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport React from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { GetAlertsOpts, ilertApiRef, TableState } from '../api';\nimport { ACCEPTED, Alert, AlertSource, AlertStatus, PENDING } from '../types';\n\nexport const useAlerts = (\n paging: boolean,\n singleSource?: boolean,\n alertSource?: AlertSource | null,\n) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [tableState, setTableState] = React.useState<TableState>({\n page: 0,\n pageSize: 10,\n });\n const [states, setStates] = React.useState<AlertStatus[]>([\n ACCEPTED,\n PENDING,\n ]);\n const [alertsList, setAlertsList] = React.useState<Alert[]>([]);\n const [alertsCount, setAlertsCount] = React.useState(0);\n const [isLoading, setIsLoading] = React.useState(false);\n\n const fetchAlertsCall = async () => {\n try {\n if (singleSource && !alertSource) {\n return;\n }\n setIsLoading(true);\n const opts: GetAlertsOpts = {\n states,\n alertSources: alertSource ? [alertSource.id] : [],\n };\n if (paging) {\n opts.maxResults = tableState.pageSize;\n opts.startIndex = tableState.page * tableState.pageSize;\n }\n const data = await ilertApi.fetchAlerts(opts);\n setAlertsList(data || []);\n setIsLoading(false);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n setIsLoading(false);\n throw e;\n }\n };\n\n const fetchAlertsCountCall = async () => {\n try {\n const count = await ilertApi.fetchAlertsCount({ states });\n setAlertsCount(count || 0);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n const fetchAlerts = useAsyncRetry(fetchAlertsCall, [\n tableState,\n states,\n singleSource,\n alertSource,\n ]);\n\n const refetchAlerts = () => {\n setTableState({ ...tableState, page: 0 });\n Promise.all([fetchAlertsCall(), fetchAlertsCountCall()]);\n };\n\n const fetchAlertsCount = useAsyncRetry(fetchAlertsCountCall, [states]);\n\n const error = fetchAlerts.error || fetchAlertsCount.error;\n const retry = () => {\n fetchAlerts.retry();\n fetchAlertsCount.retry();\n };\n\n const onAlertChanged = (newAlert: Alert) => {\n let shouldRefetchAlerts = false;\n setAlertsList(\n alertsList.reduce((acc: Alert[], alert: Alert) => {\n if (newAlert.id === alert.id) {\n if (states.includes(newAlert.status)) {\n acc.push(newAlert);\n } else {\n shouldRefetchAlerts = true;\n }\n return acc;\n }\n acc.push(alert);\n return acc;\n }, []),\n );\n if (shouldRefetchAlerts) {\n refetchAlerts();\n }\n };\n\n const onChangePage = (page: number) => {\n setTableState({ ...tableState, page });\n };\n const onChangeRowsPerPage = (p: number) => {\n setTableState({ ...tableState, pageSize: p });\n };\n const onAlertStatesChange = (s: AlertStatus[]) => {\n setStates(s);\n };\n\n return [\n {\n tableState,\n states,\n alerts: alertsList,\n alertsCount,\n error,\n isLoading,\n },\n {\n setTableState,\n setStates,\n setAlertsList,\n setIsLoading,\n retry,\n onAlertChanged,\n refetchAlerts,\n onChangePage,\n onChangeRowsPerPage,\n onAlertStatesChange,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;;AAsBO,MAAM,SAAY,GAAA,CACvB,MACA,EAAA,YAAA,EACA,WACG,KAAA;AACH,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,MAAM,QAAqB,CAAA;AAAA,IAC7D,IAAM,EAAA,CAAA;AAAA,IACN,QAAU,EAAA;AAAA,GACX,CAAA;AACD,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,MAAM,QAAwB,CAAA;AAAA,IACxD,QAAA;AAAA,IACA;AAAA,GACD,CAAA;AACD,EAAA,MAAM,CAAC,UAAY,E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AA,OACT,EAAG,EAAE;AAAA,KACP;AACA,IAAA,IAAI,mBAAqB,EAAA;AACvB,MAAc,aAAA,EAAA;AAAA;AAChB,GACF;AAEA,EAAM,MAAA,YAAA,GAAe,CAAC,IAAiB,KAAA;AACrC,IAAA,aAAA,CAAc,EAAE,GAAG,UAAY,EAAA,IAAA,EAAM,CAAA;AAAA,GACvC;AACA,EAAM,MAAA,mBAAA,GAAsB,CAAC,CAAc,KAAA;AACzC,IAAA,aAAA,CAAc,EAAE,GAAG,UAAY,EAAA,QAAA,EAAU,GAAG,CAAA;AAAA,GAC9C;AACA,EAAM,MAAA,mBAAA,GAAsB,CAAC,CAAqB,KAAA;AAChD,IAAA,SAAA,CAAU,CAAC,CAAA;AAAA,GACb;AAEA,EAAO,OAAA;AAAA,IACL;AAAA,MACE,UAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAQ,EAAA,UAAA;AAAA,MACR,WAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,aAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA;AAAA,MACA,YAAA;AAAA,MACA,KAAA;AAAA,MACA,cAAA;AAAA,MACA,aAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useAlerts.esm.js","sources":["../../src/hooks/useAlerts.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { GetAlertsOpts, ilertApiRef, TableState } from '../api';\nimport { ACCEPTED, Alert, AlertSource, AlertStatus, PENDING } from '../types';\n\nexport const useAlerts = (\n paging: boolean,\n singleSource?: boolean,\n alertSource?: AlertSource | null,\n) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [tableState, setTableState] = useState<TableState>({\n page: 0,\n pageSize: 10,\n });\n const [states, setStates] = useState<AlertStatus[]>([ACCEPTED, PENDING]);\n const [alertsList, setAlertsList] = useState<Alert[]>([]);\n const [alertsCount, setAlertsCount] = useState(0);\n const [isLoading, setIsLoading] = useState(false);\n\n const fetchAlertsCall = async () => {\n try {\n if (singleSource && !alertSource) {\n return;\n }\n setIsLoading(true);\n const opts: GetAlertsOpts = {\n states,\n alertSources: alertSource ? [alertSource.id] : [],\n };\n if (paging) {\n opts.maxResults = tableState.pageSize;\n opts.startIndex = tableState.page * tableState.pageSize;\n }\n const data = await ilertApi.fetchAlerts(opts);\n setAlertsList(data || []);\n setIsLoading(false);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n setIsLoading(false);\n throw e;\n }\n };\n\n const fetchAlertsCountCall = async () => {\n try {\n const count = await ilertApi.fetchAlertsCount({ states });\n setAlertsCount(count || 0);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n const fetchAlerts = useAsyncRetry(fetchAlertsCall, [\n tableState,\n states,\n singleSource,\n alertSource,\n ]);\n\n const refetchAlerts = () => {\n setTableState({ ...tableState, page: 0 });\n Promise.all([fetchAlertsCall(), fetchAlertsCountCall()]);\n };\n\n const fetchAlertsCount = useAsyncRetry(fetchAlertsCountCall, [states]);\n\n const error = fetchAlerts.error || fetchAlertsCount.error;\n const retry = () => {\n fetchAlerts.retry();\n fetchAlertsCount.retry();\n };\n\n const onAlertChanged = (newAlert: Alert) => {\n let shouldRefetchAlerts = false;\n setAlertsList(\n alertsList.reduce((acc: Alert[], alert: Alert) => {\n if (newAlert.id === alert.id) {\n if (states.includes(newAlert.status)) {\n acc.push(newAlert);\n } else {\n shouldRefetchAlerts = true;\n }\n return acc;\n }\n acc.push(alert);\n return acc;\n }, []),\n );\n if (shouldRefetchAlerts) {\n refetchAlerts();\n }\n };\n\n const onChangePage = (page: number) => {\n setTableState({ ...tableState, page });\n };\n const onChangeRowsPerPage = (p: number) => {\n setTableState({ ...tableState, pageSize: p });\n };\n const onAlertStatesChange = (s: AlertStatus[]) => {\n setStates(s);\n };\n\n return [\n {\n tableState,\n states,\n alerts: alertsList,\n alertsCount,\n error,\n isLoading,\n },\n {\n setTableState,\n setStates,\n setAlertsList,\n setIsLoading,\n retry,\n onAlertChanged,\n refetchAlerts,\n onChangePage,\n onChangeRowsPerPage,\n onAlertStatesChange,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;;AAsBO,MAAM,SAAY,GAAA,CACvB,MACA,EAAA,YAAA,EACA,WACG,KAAA;AACH,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,QAAqB,CAAA;AAAA,IACvD,IAAM,EAAA,CAAA;AAAA,IACN,QAAU,EAAA;AAAA,GACX,CAAA;AACD,EAAM,MAAA,CAAC,QAAQ,SAAS,CAAA,GAAI,SAAwB,CAAC,QAAA,EAAU,OAAO,CAAC,CAAA;AACvE,EAAA,MAAM,CAAC,UAAY,EAAA,aAAa,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA;AACxD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,CAAC,CAAA;AAChD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,MAAM,kBA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,mBAAA,GAAsB,CAAC,CAAc,KAAA;AACzC,IAAA,aAAA,CAAc,EAAE,GAAG,UAAY,EAAA,QAAA,EAAU,GAAG,CAAA;AAAA,GAC9C;AACA,EAAM,MAAA,mBAAA,GAAsB,CAAC,CAAqB,KAAA;AAChD,IAAA,SAAA,CAAU,CAAC,CAAA;AAAA,GACb;AAEA,EAAO,OAAA;AAAA,IACL;AAAA,MACE,UAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAQ,EAAA,UAAA;AAAA,MACR,WAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,aAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA;AAAA,MACA,YAAA;AAAA,MACA,KAAA;AAAA,MACA,cAAA;AAAA,MACA,aAAA;AAAA,MACA,YAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
@@ -1,15 +1,17 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
 
7
7
  const useAssignAlert = (alert, open) => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [alertRespondersList, setAlertRespondersList] = React.useState([]);
11
- const [alertResponder, setAlertResponder] = React.useState(null);
12
- const [isLoading, setIsLoading] = React.useState(false);
10
+ const [alertRespondersList, setAlertRespondersList] = useState([]);
11
+ const [alertResponder, setAlertResponder] = useState(
12
+ null
13
+ );
14
+ const [isLoading, setIsLoading] = useState(false);
13
15
  const { error, retry } = useAsyncRetry(async () => {
14
16
  try {
15
17
  if (!alert || !open) {
@@ -1 +1 @@
1
- {"version":3,"file":"useAssignAlert.esm.js","sources":["../../src/hooks/useAssignAlert.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport React from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { Alert, AlertResponder } from '../types';\n\nexport const useAssignAlert = (alert: Alert | null, open: boolean) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertRespondersList, setAlertRespondersList] = React.useState<\n AlertResponder[]\n >([]);\n const [alertResponder, setAlertResponder] =\n React.useState<AlertResponder | null>(null);\n const [isLoading, setIsLoading] = React.useState(false);\n\n const { error, retry } = useAsyncRetry(async () => {\n try {\n if (!alert || !open) {\n return;\n }\n const data = await ilertApi.fetchAlertResponders(alert);\n if (data && Array.isArray(data)) {\n const groups = [\n 'SUGGESTED',\n 'USER',\n 'ESCALATION_POLICY',\n 'ON_CALL_SCHEDULE',\n ];\n data.sort((a, b) => groups.indexOf(a.group) - groups.indexOf(b.group));\n setAlertRespondersList(data);\n }\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n }, [alert, open]);\n\n return [\n {\n alertRespondersList,\n alertResponder,\n error,\n isLoading,\n },\n {\n setAlertRespondersList,\n setAlertResponder,\n setIsLoading,\n retry,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,cAAA,GAAiB,CAAC,KAAA,EAAqB,IAAkB,KAAA;AACpE,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM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AAA,KACF;AAAA,IACA;AAAA,MACE,sBAAA;AAAA,MACA,iBAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useAssignAlert.esm.js","sources":["../../src/hooks/useAssignAlert.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { Alert, AlertResponder } from '../types';\n\nexport const useAssignAlert = (alert: Alert | null, open: boolean) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertRespondersList, setAlertRespondersList] = useState<\n AlertResponder[]\n >([]);\n const [alertResponder, setAlertResponder] = useState<AlertResponder | null>(\n null,\n );\n const [isLoading, setIsLoading] = useState(false);\n\n const { error, retry } = useAsyncRetry(async () => {\n try {\n if (!alert || !open) {\n return;\n }\n const data = await ilertApi.fetchAlertResponders(alert);\n if (data && Array.isArray(data)) {\n const groups = [\n 'SUGGESTED',\n 'USER',\n 'ESCALATION_POLICY',\n 'ON_CALL_SCHEDULE',\n ];\n data.sort((a, b) => groups.indexOf(a.group) - groups.indexOf(b.group));\n setAlertRespondersList(data);\n }\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n }, [alert, open]);\n\n return [\n {\n alertRespondersList,\n alertResponder,\n error,\n isLoading,\n },\n {\n set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AEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACC,EAAA,CAAC,KAAO,EAAA,IAAI,CAAC,CAAA;AAEhB,EAAO,OAAA;AAAA,IACL;AAAA,MACE,mBAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,sBAAA;AAAA,MACA,iBAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
@@ -1,21 +1,17 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
 
7
7
  const useNewAlert = (open, initialAlertSource) => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [alertSourcesList, setAlertSourcesList] = React.useState(
11
- []
12
- );
13
- const [alertSource, setAlertSource] = React.useState(
14
- null
15
- );
16
- const [summary, setSummary] = React.useState("");
17
- const [details, setDetails] = React.useState("");
18
- const [isLoading, setIsLoading] = React.useState(false);
10
+ const [alertSourcesList, setAlertSourcesList] = useState([]);
11
+ const [alertSource, setAlertSource] = useState(null);
12
+ const [summary, setSummary] = useState("");
13
+ const [details, setDetails] = useState("");
14
+ const [isLoading, setIsLoading] = useState(false);
19
15
  const fetchAlertSources = useAsyncRetry(async () => {
20
16
  try {
21
17
  if (!open || initialAlertSource) {
@@ -1 +1 @@
1
- {"version":3,"file":"useNewAlert.esm.js","sources":["../../src/hooks/useNewAlert.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport React from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { AlertSource } from '../types';\n\nexport const useNewAlert = (\n open: boolean,\n initialAlertSource?: AlertSource | null,\n) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertSourcesList, setAlertSourcesList] = React.useState<AlertSource[]>(\n [],\n );\n const [alertSource, setAlertSource] = React.useState<AlertSource | null>(\n null,\n );\n const [summary, setSummary] = React.useState('');\n const [details, setDetails] = React.useState('');\n const [isLoading, setIsLoading] = React.useState(false);\n\n const fetchAlertSources = useAsyncRetry(async () => {\n try {\n if (!open || initialAlertSource) {\n return;\n }\n const count = await ilertApi.fetchAlertSources();\n setAlertSourcesList(count || 0);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n }, [open]);\n\n const error = fetchAlertSources.error;\n const retry = () => {\n fetchAlertSources.retry();\n };\n\n return [\n {\n alertSources: alertSourcesList,\n alertSource: initialAlertSource ? initialAlertSource : alertSource,\n summary,\n details,\n error,\n isLoading,\n },\n {\n setAlertSourcesList,\n setAlertSource,\n setSummary,\n setDetails,\n setIsLoading,\n retry,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,WAAA,GAAc,CACzB,IAAA,EACA,kBACG,KAAA;AACH,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IACpD;AAAC,GACH;AACA,EAAA,MAAM,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.esm.js","sources":["../../src/hooks/useNewAlert.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { AuthenticationError } from '@backstage/errors';\nimport { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { ilertApiRef } from '../api';\nimport { AlertSource } from '../types';\n\nexport const useNewAlert = (\n open: boolean,\n initialAlertSource?: AlertSource | null,\n) => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [alertSourcesList, setAlertSourcesList] = useState<AlertSource[]>([]);\n const [alertSource, setAlertSource] = useState<AlertSource | null>(null);\n const [summary, setSummary] = useState('');\n const [details, setDetails] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n\n const fetchAlertSources = useAsyncRetry(async () => {\n try {\n if (!open || initialAlertSource) {\n return;\n }\n const count = await ilertApi.fetchAlertSources();\n setAlertSourcesList(count || 0);\n } catch (e) {\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n }, [open]);\n\n const error = fetchAlertSources.error;\n const retry = () => {\n fetchAlertSources.retry();\n };\n\n return [\n {\n alertSources: alertSourcesList,\n alertSource: initialAlertSource ? initialAlertSource : alertSource,\n summary,\n details,\n error,\n isLoading,\n },\n {\n setAlertSourcesList,\n setAlertSource,\n setSummary,\n setDetails,\n setIsLoading,\n retry,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,WAAA,GAAc,CACzB,IAAA,EACA,kBACG,KAAA;AACH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BAAA;AAAA,MACA,cAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { useState } from 'react';
2
2
  import { ilertApiRef } from '../api/client.esm.js';
3
3
  import { AuthenticationError } from '@backstage/errors';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
@@ -7,8 +7,10 @@ import { useApi, errorApiRef } from '@backstage/core-plugin-api';
7
7
  const useOnCallSchedules = () => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [onCallSchedulesList, setOnCallSchedulesList] = React.useState([]);
11
- const [isLoading, setIsLoading] = React.useState(false);
10
+ const [onCallSchedulesList, setOnCallSchedulesList] = useState(
11
+ []
12
+ );
13
+ const [isLoading, setIsLoading] = useState(false);
12
14
  const fetchOnCallSchedulesCall = async () => {
13
15
  try {
14
16
  setIsLoading(true);
@@ -1 +1 @@
1
- {"version":3,"file":"useOnCallSchedules.esm.js","sources":["../../src/hooks/useOnCallSchedules.ts"],"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 React from 'react';\nimport { ilertApiRef } from '../api';\nimport { AuthenticationError } from '@backstage/errors';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { Schedule } from '../types';\nimport { useApi, errorApiRef } from '@backstage/core-plugin-api';\n\nexport const useOnCallSchedules = () => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [onCallSchedulesList, setOnCallSchedulesList] = React.useState<\n Schedule[]\n >([]);\n const [isLoading, setIsLoading] = React.useState(false);\n\n const fetchOnCallSchedulesCall = async () => {\n try {\n setIsLoading(true);\n const data = await ilertApi.fetchOnCallSchedules();\n setOnCallSchedulesList(data || []);\n setIsLoading(false);\n } catch (e) {\n setIsLoading(false);\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n\n const { error, retry } = useAsyncRetry(fetchOnCallSchedulesCall, []);\n\n return [\n {\n onCallSchedules: onCallSchedulesList,\n error,\n isLoading,\n },\n {\n retry,\n setIsLoading,\n refetchOnCallSchedules: fetchOnCallSchedulesCall,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,qBAAqB,MAAM;AACtC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,mBAAqB,EAAA,sBAAsB,IAAI,KAAM,CAAA,QAAA,CAE1D,EAAE,CAAA;AACJ,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAEtD,EAAA,MAAM,2BAA2B,YAAY;AAC3C,IAAI,IAAA;AACF,MAAA,YAAA,CAAa,IAAI,CAAA;AACjB,MAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,oBAAqB,EAAA;AACjD,MAAuB,sBAAA,CAAA,IAAA,IAAQ,EAAE,CAAA;AACjC,MAAA,YAAA,CAAa,KAAK,CAAA;AAAA,aACX,CAAG,EAAA;AACV,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACF;AAEA,EAAA,MAAM,EAAE,KAAO,EAAA,KAAA,KAAU,aAAc,CAAA,wBAAA,EAA0B,EAAE,CAAA;AAEnE,EAAO,OAAA;AAAA,IACL;AAAA,MACE,eAAiB,EAAA,mBAAA;AAAA,MACjB,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,YAAA;AAAA,MACA,sBAAwB,EAAA;AAAA;AAC1B,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useOnCallSchedules.esm.js","sources":["../../src/hooks/useOnCallSchedules.ts"],"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 { ilertApiRef } from '../api';\nimport { AuthenticationError } from '@backstage/errors';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { Schedule } from '../types';\nimport { useApi, errorApiRef } from '@backstage/core-plugin-api';\n\nexport const useOnCallSchedules = () => {\n const ilertApi = useApi(ilertApiRef);\n const errorApi = useApi(errorApiRef);\n\n const [onCallSchedulesList, setOnCallSchedulesList] = useState<Schedule[]>(\n [],\n );\n const [isLoading, setIsLoading] = useState(false);\n\n const fetchOnCallSchedulesCall = async () => {\n try {\n setIsLoading(true);\n const data = await ilertApi.fetchOnCallSchedules();\n setOnCallSchedulesList(data || []);\n setIsLoading(false);\n } catch (e) {\n setIsLoading(false);\n if (!(e instanceof AuthenticationError)) {\n errorApi.post(e);\n }\n throw e;\n }\n };\n\n const { error, retry } = useAsyncRetry(fetchOnCallSchedulesCall, []);\n\n return [\n {\n onCallSchedules: onCallSchedulesList,\n error,\n isLoading,\n },\n {\n retry,\n setIsLoading,\n refetchOnCallSchedules: fetchOnCallSchedulesCall,\n },\n ] as const;\n};\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,qBAAqB,MAAM;AACtC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAM,MAAA,CAAC,mBAAqB,EAAA,sBAAsB,CAAI,GAAA,QAAA;AAAA,IACpD;AAAC,GACH;AACA,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,MAAM,2BAA2B,YAAY;AAC3C,IAAI,IAAA;AACF,MAAA,YAAA,CAAa,IAAI,CAAA;AACjB,MAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,oBAAqB,EAAA;AACjD,MAAuB,sBAAA,CAAA,IAAA,IAAQ,EAAE,CAAA;AACjC,MAAA,YAAA,CAAa,KAAK,CAAA;AAAA,aACX,CAAG,EAAA;AACV,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAI,IAAA,EAAE,aAAa,mBAAsB,CAAA,EAAA;AACvC,QAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA;AAEjB,MAAM,MAAA,CAAA;AAAA;AACR,GACF;AAEA,EAAA,MAAM,EAAE,KAAO,EAAA,KAAA,KAAU,aAAc,CAAA,wBAAA,EAA0B,EAAE,CAAA;AAEnE,EAAO,OAAA;AAAA,IACL;AAAA,MACE,eAAiB,EAAA,mBAAA;AAAA,MACjB,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,YAAA;AAAA,MACA,sBAAwB,EAAA;AAAA;AAC1B,GACF;AACF;;;;"}
@@ -1,18 +1,18 @@
1
1
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { AuthenticationError } from '@backstage/errors';
3
- import React from 'react';
3
+ import { useState } from 'react';
4
4
  import useAsyncRetry from 'react-use/esm/useAsyncRetry';
5
5
  import { ilertApiRef } from '../api/client.esm.js';
6
6
 
7
7
  const useServices = (paging) => {
8
8
  const ilertApi = useApi(ilertApiRef);
9
9
  const errorApi = useApi(errorApiRef);
10
- const [tableState, setTableState] = React.useState({
10
+ const [tableState, setTableState] = useState({
11
11
  page: 0,
12
12
  pageSize: 10
13
13
  });
14
- const [servicesList, setServicesList] = React.useState([]);
15
- const [isLoading, setIsLoading] = React.useState(false);
14
+ const [servicesList, setServicesList] = useState([]);
15
+ const [isLoading, setIsLoading] = useState(false);
16
16
  const fetchServicesCall = async () => {
17
17
  try {
18
18
  setIsLoading(true);