@pagerduty/backstage-plugin 0.15.8 → 0.15.9-next.5

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 (58) hide show
  1. package/README.md +36 -0
  2. package/config.d.ts +4 -1
  3. package/dist/alpha.d.ts +8 -0
  4. package/dist/alpha.esm.js +67 -0
  5. package/dist/alpha.esm.js.map +1 -0
  6. package/dist/api/client.esm.js +9 -3
  7. package/dist/api/client.esm.js.map +1 -1
  8. package/dist/components/ChangeEvents/ChangeEventEmptyState.esm.js +20 -11
  9. package/dist/components/ChangeEvents/ChangeEventEmptyState.esm.js.map +1 -1
  10. package/dist/components/ChangeEvents/ChangeEventForbiddenState.esm.js +20 -11
  11. package/dist/components/ChangeEvents/ChangeEventForbiddenState.esm.js.map +1 -1
  12. package/dist/components/ChangeEvents/ChangeEventListItem.esm.js +37 -34
  13. package/dist/components/ChangeEvents/ChangeEventListItem.esm.js.map +1 -1
  14. package/dist/components/ChangeEvents/ChangeEvents.esm.js +14 -3
  15. package/dist/components/ChangeEvents/ChangeEvents.esm.js.map +1 -1
  16. package/dist/components/EntityPagerDutyCard/index.esm.js +13 -10
  17. package/dist/components/EntityPagerDutyCard/index.esm.js.map +1 -1
  18. package/dist/components/EntityPagerDutySmallCard/index.esm.js +13 -10
  19. package/dist/components/EntityPagerDutySmallCard/index.esm.js.map +1 -1
  20. package/dist/components/Escalation/EscalationPolicy.esm.js +9 -24
  21. package/dist/components/Escalation/EscalationPolicy.esm.js.map +1 -1
  22. package/dist/components/Escalation/EscalationUser.esm.js +16 -26
  23. package/dist/components/Escalation/EscalationUser.esm.js.map +1 -1
  24. package/dist/components/Icons/index.esm.js.map +1 -1
  25. package/dist/components/Incident/IncidentEmptyState.esm.js.map +1 -1
  26. package/dist/components/Incident/IncidentForbiddenState.esm.js +20 -11
  27. package/dist/components/Incident/IncidentForbiddenState.esm.js.map +1 -1
  28. package/dist/components/Incident/IncidentListItem.esm.js +17 -15
  29. package/dist/components/Incident/IncidentListItem.esm.js.map +1 -1
  30. package/dist/components/Incident/Incidents.esm.js +10 -2
  31. package/dist/components/Incident/Incidents.esm.js.map +1 -1
  32. package/dist/components/PagerDutyCard/index.esm.js +81 -89
  33. package/dist/components/PagerDutyCard/index.esm.js.map +1 -1
  34. package/dist/components/PagerDutyCardCommon/InsightsCard.esm.js +2 -1
  35. package/dist/components/PagerDutyCardCommon/InsightsCard.esm.js.map +1 -1
  36. package/dist/components/PagerDutyCardCommon/OpenServiceButton.esm.js +28 -30
  37. package/dist/components/PagerDutyCardCommon/OpenServiceButton.esm.js.map +1 -1
  38. package/dist/components/PagerDutyCardCommon/ServiceStandardsCard.esm.js +59 -38
  39. package/dist/components/PagerDutyCardCommon/ServiceStandardsCard.esm.js.map +1 -1
  40. package/dist/components/PagerDutyCardCommon/StatusCard.esm.js +9 -6
  41. package/dist/components/PagerDutyCardCommon/StatusCard.esm.js.map +1 -1
  42. package/dist/components/PagerDutyCardCommon/TriggerIncidentButton.esm.js +30 -30
  43. package/dist/components/PagerDutyCardCommon/TriggerIncidentButton.esm.js.map +1 -1
  44. package/dist/components/PagerDutyPage/MappingTable.esm.js +30 -19
  45. package/dist/components/PagerDutyPage/MappingTable.esm.js.map +1 -1
  46. package/dist/components/PagerDutyPage/ServiceMappingComponent.esm.js.map +1 -1
  47. package/dist/components/PagerDutyPage/index.esm.js +55 -77
  48. package/dist/components/PagerDutyPage/index.esm.js.map +1 -1
  49. package/dist/components/PagerDutySmallCard/index.esm.js +42 -54
  50. package/dist/components/PagerDutySmallCard/index.esm.js.map +1 -1
  51. package/dist/components/TriggerDialog/TriggerDialog.esm.js +14 -9
  52. package/dist/components/TriggerDialog/TriggerDialog.esm.js.map +1 -1
  53. package/dist/components/pagerDutyEntity.esm.js.map +1 -1
  54. package/dist/index.d.ts +5 -3
  55. package/dist/index.esm.js +1 -0
  56. package/dist/index.esm.js.map +1 -1
  57. package/dist/plugin.esm.js.map +1 -1
  58. package/package.json +33 -9
@@ -10,16 +10,19 @@ const isPluginApplicableToEntity = (entity) => Boolean(
10
10
  const EntityPagerDutySmallCard = (props) => {
11
11
  const { readOnly, disableInsights, disableOnCall } = props;
12
12
  const { entity } = useEntity();
13
- const pagerDutyEntity = getPagerDutyEntity(entity);
14
- return /* @__PURE__ */ jsx(
15
- PagerDutySmallCard,
16
- {
17
- ...pagerDutyEntity,
18
- readOnly,
19
- disableInsights,
20
- disableOnCall
21
- }
22
- );
13
+ if (isPluginApplicableToEntity(entity)) {
14
+ const pagerDutyEntity = getPagerDutyEntity(entity);
15
+ return /* @__PURE__ */ jsx(
16
+ PagerDutySmallCard,
17
+ {
18
+ ...pagerDutyEntity,
19
+ readOnly,
20
+ disableInsights,
21
+ disableOnCall
22
+ }
23
+ );
24
+ }
25
+ return null;
23
26
  };
24
27
 
25
28
  export { EntityPagerDutySmallCard, isPluginApplicableToEntity };
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutySmallCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Entity } from '@backstage/catalog-model';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getPagerDutyEntity } from '../pagerDutyEntity';\nimport { PagerDutySmallCard } from '../PagerDutySmallCard';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(\n entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] ||\n entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID],\n );\n\n/** @public */\nexport type EntityPagerDutySmallCardProps = {\n readOnly?: boolean;\n disableInsights?: boolean;\n disableOnCall?: boolean;\n};\n\n/** @public */\nexport const EntityPagerDutySmallCard = (props: EntityPagerDutySmallCardProps) => {\n const { readOnly, disableInsights, disableOnCall } = props;\n const { entity } = useEntity();\n const pagerDutyEntity = getPagerDutyEntity(entity);\n return (\n <PagerDutySmallCard\n {...pagerDutyEntity}\n readOnly={readOnly}\n disableInsights={disableInsights}\n disableOnCall={disableOnCall}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,0BAAA,GAA6B,CAAC,MAAA,KACzC,OAAA;AAAA,EACE,MAAA,CAAO,SAAS,WAAA,GAAc,yBAAyB,KACrD,MAAA,CAAO,QAAA,CAAS,cAAc,oBAAoB;AACtD;AAUK,MAAM,wBAAA,GAA2B,CAAC,KAAA,KAAyC;AAChF,EAAA,MAAM,EAAE,QAAA,EAAU,eAAA,EAAiB,aAAA,EAAc,GAAI,KAAA;AACrD,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,eAAA,GAAkB,mBAAmB,MAAM,CAAA;AACjD,EAAA,uBACE,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,QAAA;AAAA,MACA,eAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutySmallCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getPagerDutyEntity } from '../pagerDutyEntity';\nimport { PagerDutySmallCard } from '../PagerDutySmallCard';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(\n entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] ||\n entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID],\n );\n\n/** @public */\nexport type EntityPagerDutySmallCardProps = {\n readOnly?: boolean;\n disableInsights?: boolean;\n disableOnCall?: boolean;\n};\n\n/** @public */\nexport const EntityPagerDutySmallCard = (\n props: EntityPagerDutySmallCardProps,\n) => {\n const { readOnly, disableInsights, disableOnCall } = props;\n const { entity } = useEntity();\n\n if (isPluginApplicableToEntity(entity)) {\n const pagerDutyEntity = getPagerDutyEntity(entity);\n\n return (\n <PagerDutySmallCard\n {...pagerDutyEntity}\n readOnly={readOnly}\n disableInsights={disableInsights}\n disableOnCall={disableOnCall}\n />\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,0BAAA,GAA6B,CAAC,MAAA,KACzC,OAAA;AAAA,EACE,MAAA,CAAO,SAAS,WAAA,GAAc,yBAAyB,KACrD,MAAA,CAAO,QAAA,CAAS,cAAc,oBAAoB;AACtD;AAUK,MAAM,wBAAA,GAA2B,CACtC,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,eAAA,EAAiB,aAAA,EAAc,GAAI,KAAA;AACrD,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAE7B,EAAA,IAAI,0BAAA,CAA2B,MAAM,CAAA,EAAG;AACtC,IAAA,MAAM,eAAA,GAAkB,mBAAmB,MAAM,CAAA;AAEjD,IAAA,uBACE,GAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACE,GAAG,eAAA;AAAA,QACJ,QAAA;AAAA,QACA,eAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,EAEJ;AAEA,EAAA,OAAO,IAAA;AACT;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { makeStyles, List, ListSubheader, createStyles } from '@material-ui/core';
2
+ import { List, ListSubheader } from '@material-ui/core';
3
3
  import { EscalationUsersEmptyState } from './EscalationUsersEmptyState.esm.js';
4
4
  import { EscalationUsersForbiddenState } from './EscalationUsersForbiddenState.esm.js';
5
5
  import { EscalationUser } from './EscalationUser.esm.js';
@@ -9,13 +9,6 @@ import { Alert } from '@material-ui/lab';
9
9
  import { useApi } from '@backstage/core-plugin-api';
10
10
  import { Progress } from '@backstage/core-components';
11
11
 
12
- const useStyles = makeStyles(
13
- () => createStyles({
14
- listStyle: {
15
- marginLeft: "-15px"
16
- }
17
- })
18
- );
19
12
  const EscalationPolicy = ({
20
13
  policyId,
21
14
  policyUrl,
@@ -23,7 +16,6 @@ const EscalationPolicy = ({
23
16
  account
24
17
  }) => {
25
18
  const api = useApi(pagerDutyApiRef);
26
- const classes = useStyles();
27
19
  const {
28
20
  value: users,
29
21
  loading,
@@ -46,22 +38,15 @@ const EscalationPolicy = ({
46
38
  if (!users?.length) {
47
39
  return /* @__PURE__ */ jsx(EscalationUsersEmptyState, {});
48
40
  }
49
- return /* @__PURE__ */ jsx(
50
- List,
41
+ return /* @__PURE__ */ jsx(List, { dense: true, children: users.map((user, index) => /* @__PURE__ */ jsx(
42
+ EscalationUser,
51
43
  {
52
- dense: true,
53
- className: classes.listStyle,
54
- children: users.map((user, index) => /* @__PURE__ */ jsx(
55
- EscalationUser,
56
- {
57
- user,
58
- policyUrl,
59
- policyName
60
- },
61
- index
62
- ))
63
- }
64
- );
44
+ user,
45
+ policyUrl,
46
+ policyName
47
+ },
48
+ index
49
+ )) });
65
50
  };
66
51
 
67
52
  export { EscalationPolicy };
@@ -1 +1 @@
1
- {"version":3,"file":"EscalationPolicy.esm.js","sources":["../../../src/components/Escalation/EscalationPolicy.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { List, ListSubheader, createStyles, makeStyles } from \"@material-ui/core\";\nimport { EscalationUsersEmptyState } from \"./EscalationUsersEmptyState\";\nimport { EscalationUsersForbiddenState } from \"./EscalationUsersForbiddenState\";\nimport { EscalationUser } from \"./EscalationUser\";\nimport useAsync from \"react-use/lib/useAsync\";\nimport { pagerDutyApiRef } from \"../../api\";\nimport { Alert } from \"@material-ui/lab\";\n\nimport { useApi } from \"@backstage/core-plugin-api\";\nimport { Progress } from \"@backstage/core-components\";\nimport { BackstageTheme } from \"@backstage/theme\";\n\ntype Props = {\n policyId: string;\n policyUrl: string;\n policyName: string;\n account?: string;\n};\nconst useStyles = makeStyles<BackstageTheme>(() =>\n createStyles({\n listStyle: {\n marginLeft: \"-15px\",\n },\n })\n);\n\nexport const EscalationPolicy = ({\n policyId,\n policyUrl,\n policyName,\n account,\n}: Props) => {\n const api = useApi(pagerDutyApiRef);\n const classes = useStyles();\n\n const {\n value: users,\n loading,\n error,\n } = useAsync(async () => {\n return await api.getOnCallByPolicyId(policyId, account);\n });\n\n if (error) {\n if (error.message.includes(\"Forbidden\")) {\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <EscalationUsersForbiddenState />\n </List>\n );\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return <Progress data-testid=\"escalation-progress\" />;\n }\n\n if (!users?.length) {\n return <EscalationUsersEmptyState />;\n }\n\n return (\n <List\n dense\n className={classes.listStyle}\n >\n {users!.map((user, index) => (\n <EscalationUser\n key={index}\n user={user}\n policyUrl={policyUrl}\n policyName={policyName}\n />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAA2B,MAC3C,YAAA,CAAa;AAAA,IACX,SAAA,EAAW;AAAA,MACT,UAAA,EAAY;AAAA;AACd,GACD;AACH,CAAA;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,QAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,KAAa;AACX,EAAA,MAAM,GAAA,GAAM,OAAO,eAAe,CAAA;AAClC,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,KAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,SAAS,YAAY;AACvB,IAAA,OAAO,MAAM,GAAA,CAAI,mBAAA,CAAoB,QAAA,EAAU,OAAO,CAAA;AAAA,EACxD,CAAC,CAAA;AAED,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,WAAW,CAAA,EAAG;AACvC,MAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAK,IAAA,EAAC,SAAA,kBAAW,GAAA,CAAC,aAAA,EAAA,EAAc,QAAA,EAAA,SAAA,EAAO,CAAA,EAC3C,QAAA,kBAAA,GAAA,CAAC,6BAAA,EAAA,EAA8B,CAAA,EACjC,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,gDAAA;AAAA,MACyB,KAAA,CAAM;AAAA,KAAA,EACvD,CAAA;AAAA,EAEJ;AAEA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,uBAAO,GAAA,CAAC,QAAA,EAAA,EAAS,aAAA,EAAY,qBAAA,EAAsB,CAAA;AAAA,EACrD;AAEA,EAAA,IAAI,CAAC,OAAO,MAAA,EAAQ;AAClB,IAAA,2BAAQ,yBAAA,EAAA,EAA0B,CAAA;AAAA,EACpC;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAK,IAAA;AAAA,MACL,WAAW,OAAA,CAAQ,SAAA;AAAA,MAElB,QAAA,EAAA,KAAA,CAAO,GAAA,CAAI,CAAC,IAAA,EAAM,KAAA,qBACjB,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UAEC,IAAA;AAAA,UACA,SAAA;AAAA,UACA;AAAA,SAAA;AAAA,QAHK;AAAA,OAKR;AAAA;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"EscalationPolicy.esm.js","sources":["../../../src/components/Escalation/EscalationPolicy.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { List, ListSubheader } from '@material-ui/core';\nimport { EscalationUsersEmptyState } from './EscalationUsersEmptyState';\nimport { EscalationUsersForbiddenState } from './EscalationUsersForbiddenState';\nimport { EscalationUser } from './EscalationUser';\nimport useAsync from 'react-use/lib/useAsync';\nimport { pagerDutyApiRef } from '../../api';\nimport { Alert } from '@material-ui/lab';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\n\ntype Props = {\n policyId: string;\n policyUrl: string;\n policyName: string;\n account?: string;\n};\n\nexport const EscalationPolicy = ({\n policyId,\n policyUrl,\n policyName,\n account,\n}: Props) => {\n const api = useApi(pagerDutyApiRef);\n\n const {\n value: users,\n loading,\n error,\n } = useAsync(async () => {\n return await api.getOnCallByPolicyId(policyId, account);\n });\n\n if (error) {\n if (error.message.includes('Forbidden')) {\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <EscalationUsersForbiddenState />\n </List>\n );\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return <Progress data-testid=\"escalation-progress\" />;\n }\n\n if (!users?.length) {\n return <EscalationUsersEmptyState />;\n }\n\n return (\n <List dense>\n {users!.map((user, index) => (\n <EscalationUser\n key={index}\n user={user}\n policyUrl={policyUrl}\n policyName={policyName}\n />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAiCO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,QAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,KAAa;AACX,EAAA,MAAM,GAAA,GAAM,OAAO,eAAe,CAAA;AAElC,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,KAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,SAAS,YAAY;AACvB,IAAA,OAAO,MAAM,GAAA,CAAI,mBAAA,CAAoB,QAAA,EAAU,OAAO,CAAA;AAAA,EACxD,CAAC,CAAA;AAED,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,WAAW,CAAA,EAAG;AACvC,MAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAK,IAAA,EAAC,SAAA,kBAAW,GAAA,CAAC,aAAA,EAAA,EAAc,QAAA,EAAA,SAAA,EAAO,CAAA,EAC3C,QAAA,kBAAA,GAAA,CAAC,6BAAA,EAAA,EAA8B,CAAA,EACjC,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,gDAAA;AAAA,MACyB,KAAA,CAAM;AAAA,KAAA,EACvD,CAAA;AAAA,EAEJ;AAEA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,uBAAO,GAAA,CAAC,QAAA,EAAA,EAAS,aAAA,EAAY,qBAAA,EAAsB,CAAA;AAAA,EACrD;AAEA,EAAA,IAAI,CAAC,OAAO,MAAA,EAAQ;AAClB,IAAA,2BAAQ,yBAAA,EAAA,EAA0B,CAAA;AAAA,EACpC;AAEA,EAAA,uBACE,GAAA,CAAC,QAAK,KAAA,EAAK,IAAA,EACR,gBAAO,GAAA,CAAI,CAAC,MAAM,KAAA,qBACjB,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MAEC,IAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KAAA;AAAA,IAHK;AAAA,GAKR,CAAA,EACH,CAAA;AAEJ;;;;"}
@@ -1,33 +1,26 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { makeStyles, ListItem, ListItemIcon, ListItemText, IconButton, Tooltip, Typography } from '@material-ui/core';
3
- import Avatar from '@material-ui/core/Avatar';
2
+ import { makeStyles, ListItem, ListItemIcon, ListItemText, Typography, Tooltip } from '@material-ui/core';
4
3
  import NotificationsIcon from '@material-ui/icons/Notifications';
4
+ import { Avatar, Button } from '@backstage/ui';
5
5
 
6
- const useStyles = makeStyles((theme) => ({
6
+ const useStyles = makeStyles(() => ({
7
7
  listItemPrimary: {
8
8
  fontWeight: "bold"
9
9
  },
10
10
  listItemSecondary: {
11
11
  fontWeight: "normal",
12
12
  textDecoration: "underline",
13
- marginTop: "-5px"
13
+ marginTop: "-5px",
14
+ paddingLeft: "5px"
14
15
  },
15
16
  buttonStyle: {
16
- marginLeft: "-11px",
17
- marginTop: "-10px",
18
17
  fontSize: "15px",
19
- color: theme.palette.text.primary,
20
18
  "&:hover": {
21
- backgroundColor: "transparent",
22
19
  textDecoration: "underline"
23
20
  }
24
21
  },
25
22
  userTextButtonStyle: {
26
- marginLeft: "-11px",
27
- marginTop: "-10px",
28
- marginBottom: "-10px",
29
23
  fontSize: "15px",
30
- color: theme.palette.text.primary,
31
24
  "&:hover": {
32
25
  backgroundColor: "transparent",
33
26
  textDecoration: "underline"
@@ -40,14 +33,10 @@ const useStyles = makeStyles((theme) => ({
40
33
  },
41
34
  iconStyle: {
42
35
  fontSize: "25px",
43
- marginLeft: "-4px",
44
- color: theme.palette.text.primary
45
- },
46
- smallIconStyle: {
47
- color: theme.palette.text.primary
36
+ marginLeft: "-4px"
48
37
  },
49
38
  avatarStyle: {
50
- marginTop: "-20px"
39
+ marginTop: "-30px"
51
40
  }
52
41
  }));
53
42
  function navigateToUrl(url) {
@@ -59,7 +48,7 @@ const EscalationUser = ({ user, policyUrl, policyName }) => {
59
48
  /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(
60
49
  Avatar,
61
50
  {
62
- alt: user.name,
51
+ name: user.name,
63
52
  src: user.avatar_url,
64
53
  className: classes.avatarStyle
65
54
  }
@@ -69,12 +58,13 @@ const EscalationUser = ({ user, policyUrl, policyName }) => {
69
58
  {
70
59
  primary: /* @__PURE__ */ jsxs(Fragment, { children: [
71
60
  /* @__PURE__ */ jsx(Tooltip, { title: "Open user in PagerDuty", placement: "top", children: /* @__PURE__ */ jsx(
72
- IconButton,
61
+ Button,
73
62
  {
63
+ variant: "tertiary",
74
64
  "aria-label": "open-user-in-browser",
75
65
  onClick: () => navigateToUrl(user.html_url),
76
66
  className: classes.userTextButtonStyle,
77
- children: /* @__PURE__ */ jsx("span", { className: classes.containerStyle, children: user.name })
67
+ children: /* @__PURE__ */ jsx(Typography, { className: classes.containerStyle, children: user.name })
78
68
  }
79
69
  ) }),
80
70
  /* @__PURE__ */ jsx(
@@ -87,15 +77,15 @@ const EscalationUser = ({ user, policyUrl, policyName }) => {
87
77
  )
88
78
  ] }),
89
79
  secondary: /* @__PURE__ */ jsx(
90
- IconButton,
80
+ Button,
91
81
  {
92
82
  "aria-label": "open-escalation-policy-in-browser",
93
83
  onClick: () => navigateToUrl(policyUrl),
84
+ variant: "tertiary",
85
+ size: "small",
94
86
  className: classes.buttonStyle,
95
- children: /* @__PURE__ */ jsxs("span", { className: classes.containerStyle, children: [
96
- /* @__PURE__ */ jsx(NotificationsIcon, { className: classes.iconStyle }),
97
- policyName
98
- ] })
87
+ iconStart: /* @__PURE__ */ jsx(NotificationsIcon, { className: classes.iconStyle }),
88
+ children: /* @__PURE__ */ jsx(Typography, { className: classes.containerStyle, children: policyName })
99
89
  }
100
90
  )
101
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EscalationUser.esm.js","sources":["../../../src/components/Escalation/EscalationUser.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport {\n ListItem,\n ListItemIcon,\n Tooltip,\n ListItemText,\n makeStyles,\n IconButton,\n Typography,\n} from '@material-ui/core';\nimport Avatar from '@material-ui/core/Avatar';\nimport { PagerDutyUser } from '@pagerduty/backstage-plugin-common';\nimport NotificationsIcon from \"@material-ui/icons/Notifications\";\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles<BackstageTheme>((theme) => ({\n listItemPrimary: {\n fontWeight: \"bold\",\n },\n listItemSecondary: {\n fontWeight: \"normal\",\n textDecoration: \"underline\",\n marginTop: \"-5px\",\n },\n buttonStyle: {\n marginLeft: \"-11px\",\n marginTop: \"-10px\",\n fontSize: \"15px\",\n color: theme.palette.text.primary,\n \"&:hover\": {\n backgroundColor: \"transparent\",\n textDecoration: \"underline\",\n },\n },\n userTextButtonStyle: {\n marginLeft: \"-11px\",\n marginTop: \"-10px\",\n marginBottom: \"-10px\",\n fontSize: \"15px\",\n color: theme.palette.text.primary,\n \"&:hover\": {\n backgroundColor: \"transparent\",\n textDecoration: \"underline\",\n },\n },\n containerStyle: {\n display: \"flex\",\n alignItems: \"center\",\n fontWeight: \"bold\",\n },\n iconStyle: {\n fontSize: \"25px\",\n marginLeft: \"-4px\",\n color: theme.palette.text.primary,\n },\n smallIconStyle: {\n color: theme.palette.text.primary,\n },\n avatarStyle: {\n marginTop: \"-20px\",\n },\n}));\n\ntype Props = {\n user: PagerDutyUser;\n policyUrl: string;\n policyName: string;\n};\n\nfunction navigateToUrl(url: string) {\n // open url in new browser window\n window.open(url, \"_blank\");\n}\n\nexport const EscalationUser = ({ user, policyUrl, policyName }: Props) => {\n const classes = useStyles();\n\n return (\n <ListItem>\n <ListItemIcon>\n <Avatar\n alt={user.name}\n src={user.avatar_url}\n className={classes.avatarStyle}\n />\n </ListItemIcon>\n <ListItemText\n primary={\n <>\n <Tooltip title=\"Open user in PagerDuty\" placement=\"top\">\n <IconButton\n aria-label=\"open-user-in-browser\"\n onClick={() => navigateToUrl(user.html_url)}\n className={classes.userTextButtonStyle}\n >\n <span className={classes.containerStyle}>{user.name}</span>\n </IconButton>\n </Tooltip>\n\n <Typography\n className={classes.listItemSecondary}\n color=\"textSecondary\"\n >\n {user.email}\n </Typography>\n </>\n }\n secondary={\n <IconButton\n aria-label=\"open-escalation-policy-in-browser\"\n onClick={() => navigateToUrl(policyUrl)}\n className={classes.buttonStyle}\n >\n <span className={classes.containerStyle}>\n <NotificationsIcon className={classes.iconStyle} />\n {policyName}\n </span>\n </IconButton>\n }\n />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;AA8BA,MAAM,SAAA,GAAY,UAAA,CAA2B,CAAC,KAAA,MAAW;AAAA,EACvD,eAAA,EAAiB;AAAA,IACf,UAAA,EAAY;AAAA,GACd;AAAA,EACA,iBAAA,EAAmB;AAAA,IACjB,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB,WAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,WAAA,EAAa;AAAA,IACX,UAAA,EAAY,OAAA;AAAA,IACZ,SAAA,EAAW,OAAA;AAAA,IACX,QAAA,EAAU,MAAA;AAAA,IACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,OAAA;AAAA,IAC1B,SAAA,EAAW;AAAA,MACT,eAAA,EAAiB,aAAA;AAAA,MACjB,cAAA,EAAgB;AAAA;AAClB,GACF;AAAA,EACA,mBAAA,EAAqB;AAAA,IACnB,UAAA,EAAY,OAAA;AAAA,IACZ,SAAA,EAAW,OAAA;AAAA,IACX,YAAA,EAAc,OAAA;AAAA,IACd,QAAA,EAAU,MAAA;AAAA,IACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,OAAA;AAAA,IAC1B,SAAA,EAAW;AAAA,MACT,eAAA,EAAiB,aAAA;AAAA,MACjB,cAAA,EAAgB;AAAA;AAClB,GACF;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACd;AAAA,EACA,SAAA,EAAW;AAAA,IACT,QAAA,EAAU,MAAA;AAAA,IACV,UAAA,EAAY,MAAA;AAAA,IACZ,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,GAC5B;AAAA,EACA,cAAA,EAAgB;AAAA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AAA;AAAA,cAEL,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA;AACR,SAAA,EACF,CAAA;AAAA,QAEF,SAAA,kBACE,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,YAAA,EAAW,mCAAA;AAAA,YACX,OAAA,EAAS,MAAM,aAAA,CAAc,SAAS,CAAA;AAAA,YACtC,WAAW,OAAA,CAAQ,WAAA;AAAA,YAEnB,QAAA,kBAAA,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,cAAA,EACvB,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,cAChD;AAAA,aAAA,EACH;AAAA;AAAA;AACF;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EscalationUser.esm.js","sources":["../../../src/components/Escalation/EscalationUser.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport {\n ListItem,\n ListItemIcon,\n Tooltip,\n ListItemText,\n makeStyles,\n Typography,\n} from '@material-ui/core';\nimport { PagerDutyUser } from '@pagerduty/backstage-plugin-common';\nimport NotificationsIcon from '@material-ui/icons/Notifications';\nimport { BackstageTheme } from '@backstage/theme';\nimport { Avatar, Button } from '@backstage/ui';\n\nconst useStyles = makeStyles<BackstageTheme>(() => ({\n listItemPrimary: {\n fontWeight: 'bold',\n },\n listItemSecondary: {\n fontWeight: 'normal',\n textDecoration: 'underline',\n marginTop: '-5px',\n paddingLeft: '5px',\n },\n buttonStyle: {\n fontSize: '15px',\n '&:hover': {\n textDecoration: 'underline',\n },\n },\n userTextButtonStyle: {\n fontSize: '15px',\n '&:hover': {\n backgroundColor: 'transparent',\n textDecoration: 'underline',\n },\n },\n containerStyle: {\n display: 'flex',\n alignItems: 'center',\n fontWeight: 'bold',\n },\n iconStyle: {\n fontSize: '25px',\n marginLeft: '-4px',\n },\n avatarStyle: {\n marginTop: '-30px',\n },\n}));\n\ntype Props = {\n user: PagerDutyUser;\n policyUrl: string;\n policyName: string;\n};\n\nfunction navigateToUrl(url: string) {\n // open url in new browser window\n window.open(url, '_blank');\n}\n\nexport const EscalationUser = ({ user, policyUrl, policyName }: Props) => {\n const classes = useStyles();\n\n return (\n <ListItem>\n <ListItemIcon>\n <Avatar\n name={user.name}\n src={user.avatar_url}\n className={classes.avatarStyle}\n />\n </ListItemIcon>\n <ListItemText\n primary={\n <>\n <Tooltip title=\"Open user in PagerDuty\" placement=\"top\">\n <Button\n variant=\"tertiary\"\n aria-label=\"open-user-in-browser\"\n onClick={() => navigateToUrl(user.html_url)}\n className={classes.userTextButtonStyle}\n >\n <Typography className={classes.containerStyle}>\n {user.name}\n </Typography>\n </Button>\n </Tooltip>\n\n <Typography\n className={classes.listItemSecondary}\n color=\"textSecondary\"\n >\n {user.email}\n </Typography>\n </>\n }\n secondary={\n <Button\n aria-label=\"open-escalation-policy-in-browser\"\n onClick={() => navigateToUrl(policyUrl)}\n variant=\"tertiary\"\n size=\"small\"\n className={classes.buttonStyle}\n iconStart={<NotificationsIcon className={classes.iconStyle} />}\n >\n <Typography className={classes.containerStyle}>\n {policyName}\n </Typography>\n </Button>\n }\n />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;AA6BA,MAAM,SAAA,GAAY,WAA2B,OAAO;AAAA,EAClD,eAAA,EAAiB;AAAA,IACf,UAAA,EAAY;AAAA,GACd;AAAA,EACA,iBAAA,EA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/PD-Icon.svg\";\n\n/** @public */\nexport function PagerDutyIcon() {\n\n return <img src={PDIcon} alt=\"PagerDuty\" height=\"20px\" />;\n};\n"],"names":[],"mappings":";;;AAGO,SAAS,aAAA,GAAgB;AAE9B,EAAA,2BAAQ,KAAA,EAAA,EAAI,GAAA,EAAK,QAAQ,GAAA,EAAI,WAAA,EAAY,QAAO,MAAA,EAAO,CAAA;AACzD;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/Icons/index.tsx"],"sourcesContent":["import PDIcon from '../../assets/PD-Icon.svg';\n\n/** @public */\nexport function PagerDutyIcon() {\n return <img src={PDIcon} alt=\"PagerDuty\" height=\"20px\" />;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,aAAA,GAAgB;AAC9B,EAAA,2BAAQ,KAAA,EAAA,EAAI,GAAA,EAAK,QAAQ,GAAA,EAAI,WAAA,EAAY,QAAO,MAAA,EAAO,CAAA;AACzD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IncidentEmptyState.esm.js","sources":["../../../src/components/Incident/IncidentEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Grid, Typography } from '@material-ui/core';\nimport EmptyStateImage from \"../../assets/emptystate.svg\";\n\nexport const IncidentsEmptyState = () => {\n return (\n <Grid\n container\n justifyContent=\"center\"\n direction=\"column\"\n alignItems=\"center\"\n >\n <Grid item xs={12}>\n <Typography variant=\"h5\">Nice! No incidents found!</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={EmptyStateImage}\n alt=\"EmptyState\"\n data-testid=\"emptyStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAmBO,MAAM,sBAAsB,MAAM;AACvC,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,cAAA,EAAe,QAAA;AAAA,MACf,SAAA,EAAU,QAAA;AAAA,MACV,UAAA,EAAW,QAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,2BAAA,EAAyB,CAAA,EACpD,CAAA;AAAA,wBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,kBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,GAAA,EAAK,eAAA;AAAA,YACL,GAAA,EAAI,YAAA;AAAA,YACJ,aAAA,EAAY;AAAA;AAAA,SACd,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"IncidentEmptyState.esm.js","sources":["../../../src/components/Incident/IncidentEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Grid, Typography } from '@material-ui/core';\nimport EmptyStateImage from '../../assets/emptystate.svg';\n\nexport const IncidentsEmptyState = () => {\n return (\n <Grid\n container\n justifyContent=\"center\"\n direction=\"column\"\n alignItems=\"center\"\n >\n <Grid item xs={12}>\n <Typography variant=\"h5\">Nice! No incidents found!</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={EmptyStateImage}\n alt=\"EmptyState\"\n data-testid=\"emptyStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAmBO,MAAM,sBAAsB,MAAM;AACvC,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,cAAA,EAAe,QAAA;AAAA,MACf,SAAA,EAAU,QAAA;AAAA,MACV,UAAA,EAAW,QAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,2BAAA,EAAyB,CAAA,EACpD,CAAA;AAAA,wBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,kBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,GAAA,EAAK,eAAA;AAAA,YACL,GAAA,EAAI,YAAA;AAAA,YACJ,aAAA,EAAY;AAAA;AAAA,SACd,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -3,17 +3,26 @@ import { Grid, Typography } from '@material-ui/core';
3
3
  import ForbiddenStateImage from '../../assets/forbiddenstate.svg';
4
4
 
5
5
  const IncidentForbiddenState = () => {
6
- return /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center", children: [
7
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Feature not available with your account or token." }) }),
8
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
9
- "img",
10
- {
11
- src: ForbiddenStateImage,
12
- alt: "ForbiddenState",
13
- "data-testid": "forbiddenStateImg"
14
- }
15
- ) })
16
- ] });
6
+ return /* @__PURE__ */ jsxs(
7
+ Grid,
8
+ {
9
+ container: true,
10
+ justifyContent: "center",
11
+ direction: "column",
12
+ alignItems: "center",
13
+ children: [
14
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Feature not available with your account or token." }) }),
15
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
16
+ "img",
17
+ {
18
+ src: ForbiddenStateImage,
19
+ alt: "ForbiddenState",
20
+ "data-testid": "forbiddenStateImg"
21
+ }
22
+ ) })
23
+ ]
24
+ }
25
+ );
17
26
  };
18
27
 
19
28
  export { IncidentForbiddenState };
@@ -1 +1 @@
1
- {"version":3,"file":"IncidentForbiddenState.esm.js","sources":["../../../src/components/Incident/IncidentForbiddenState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Grid, Typography } from '@material-ui/core';\nimport ForbiddenStateImage from '../../assets/forbiddenstate.svg';\n\nexport const IncidentForbiddenState = () => {\n return (\n <Grid container justifyContent=\"center\" direction=\"column\" alignItems=\"center\">\n <Grid item xs={12}>\n <Typography variant=\"h5\">Feature not available with your account or token.</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={ForbiddenStateImage}\n alt=\"ForbiddenState\"\n data-testid=\"forbiddenStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,yBAAyB,MAAM;AAC1C,EAAA,uBACE,IAAA,CAAC,QAAK,SAAA,EAAS,IAAA,EAAC,gBAAe,QAAA,EAAS,SAAA,EAAU,QAAA,EAAS,UAAA,EAAW,QAAA,EACpE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,mDAAA,EAAiD,CAAA,EAC5E,CAAA;AAAA,oBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,mBAAA;AAAA,QACL,GAAA,EAAI,gBAAA;AAAA,QACJ,aAAA,EAAY;AAAA;AAAA,KACd,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"IncidentForbiddenState.esm.js","sources":["../../../src/components/Incident/IncidentForbiddenState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Grid, Typography } from '@material-ui/core';\nimport ForbiddenStateImage from '../../assets/forbiddenstate.svg';\n\nexport const IncidentForbiddenState = () => {\n return (\n <Grid\n container\n justifyContent=\"center\"\n direction=\"column\"\n alignItems=\"center\"\n >\n <Grid item xs={12}>\n <Typography variant=\"h5\">\n Feature not available with your account or token.\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={ForbiddenStateImage}\n alt=\"ForbiddenState\"\n data-testid=\"forbiddenStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,yBAAyB,MAAM;AAC1C,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,cAAA,EAAe,QAAA;AAAA,MACf,SAAA,EAAU,QAAA;AAAA,MACV,UAAA,EAAW,QAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,mDAAA,EAEzB,CAAA,EACF,CAAA;AAAA,wBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,kBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,GAAA,EAAK,mBAAA;AAAA,YACL,GAAA,EAAI,gBAAA;AAAA,YACJ,aAAA,EAAY;AAAA;AAAA,SACd,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { makeStyles, ListItem, ListItemText, Typography, Chip, ListItemSecondaryAction, Tooltip, IconButton } from '@material-ui/core';
2
+ import { makeStyles, ListItem, ListItemText, Typography, Chip, ListItemSecondaryAction } from '@material-ui/core';
3
+ import { TooltipTrigger, ButtonIcon, Tooltip } from '@backstage/ui';
3
4
  import { DateTime, Duration } from 'luxon';
4
5
  import OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';
5
6
  import { Link } from '@backstage/core-components';
@@ -58,10 +59,6 @@ const useStyles = makeStyles((theme) => ({
58
59
  textContainer: {
59
60
  display: "flex",
60
61
  alignItems: "baseline"
61
- },
62
- smallIconStyle: {
63
- color: theme.palette.text.primary,
64
- marginRight: "-20px"
65
62
  }
66
63
  }));
67
64
  const IncidentListItem = ({ incident }) => {
@@ -69,6 +66,9 @@ const IncidentListItem = ({ incident }) => {
69
66
  const duration = (/* @__PURE__ */ new Date()).getTime() - new Date(incident.created_at).getTime();
70
67
  const createdAt = DateTime.local().minus(Duration.fromMillis(duration)).toRelative({ locale: "en" });
71
68
  const user = incident.assignments[0]?.assignee;
69
+ const handleIncidentClick = () => {
70
+ window.open(incident.html_url, "_blank", "noopener,noreferrer");
71
+ };
72
72
  return /* @__PURE__ */ jsxs(ListItem, { dense: true, children: [
73
73
  /* @__PURE__ */ jsx(
74
74
  ListItemText,
@@ -109,16 +109,18 @@ const IncidentListItem = ({ incident }) => {
109
109
  ] })
110
110
  }
111
111
  ),
112
- /* @__PURE__ */ jsx(ListItemSecondaryAction, { children: /* @__PURE__ */ jsx(Tooltip, { title: "View in PagerDuty", placement: "top", children: /* @__PURE__ */ jsx(
113
- IconButton,
114
- {
115
- href: incident.html_url,
116
- target: "_blank",
117
- rel: "noopener noreferrer",
118
- className: classes.smallIconStyle,
119
- children: /* @__PURE__ */ jsx(OpenInBrowserIcon, {})
120
- }
121
- ) }) })
112
+ /* @__PURE__ */ jsx(ListItemSecondaryAction, { children: /* @__PURE__ */ jsxs(TooltipTrigger, { children: [
113
+ /* @__PURE__ */ jsx(
114
+ ButtonIcon,
115
+ {
116
+ "aria-label": "view-in-pd-button",
117
+ icon: /* @__PURE__ */ jsx(OpenInBrowserIcon, {}),
118
+ variant: "tertiary",
119
+ onClick: handleIncidentClick
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx(Tooltip, { children: "View in PagerDuty" })
123
+ ] }) })
122
124
  ] }, incident.id);
123
125
  };
124
126
 
@@ -1 +1 @@
1
- {"version":3,"file":"IncidentListItem.esm.js","sources":["../../../src/components/Incident/IncidentListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport {\n ListItem,\n ListItemSecondaryAction,\n Tooltip,\n ListItemText,\n makeStyles,\n IconButton,\n Typography,\n Chip,\n} from '@material-ui/core';\nimport { DateTime, Duration } from 'luxon';\nimport { PagerDutyIncident } from '@pagerduty/backstage-plugin-common';\nimport OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';\nimport { BackstageTheme } from '@backstage/theme';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles<BackstageTheme>((theme) => ({\n denseListIcon: {\n marginRight: 0,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n listItemPrimary: {\n fontWeight: \"bold\",\n },\n warning: {\n borderColor: theme.palette.warning.main,\n color: \"#fff\",\n backgroundColor: theme.palette.warning.main,\n boxShadow: \"0 4px 4px 0 rgba(0,0,0,0.2)\",\n textTransform: \"uppercase\",\n \"& *\": {\n color: \"#fff\",\n },\n },\n error: {\n borderColor: theme.palette.error.main,\n color: \"#fff\",\n backgroundColor: theme.palette.error.main,\n boxShadow: \"0 4px 4px 0 rgba(0,0,0,0.2)\",\n textTransform: \"uppercase\",\n \"& *\": {\n color: \"#fff\",\n },\n },\n lowUrgency: {\n borderColor: theme.palette.warning.main,\n color: theme.palette.warning.main,\n backgroundColor: \"#fff\",\n boxShadow: \"0 4px 4px 0 rgba(0,0,0,0.2)\",\n textTransform: \"uppercase\",\n \"& *\": {\n color: theme.palette.warning.main,\n },\n },\n highUrgency: {\n borderColor: theme.palette.error.main,\n color: theme.palette.error.main,\n backgroundColor: \"#fff\",\n boxShadow: \"0 4px 4px 0 rgba(0,0,0,0.2)\",\n textTransform: \"uppercase\",\n \"& *\": {\n color: theme.palette.error.main,\n },\n },\n textContainer: {\n display: \"flex\",\n alignItems: \"baseline\",\n },\n smallIconStyle: {\n color: theme.palette.text.primary,\n marginRight: \"-20px\",\n },\n}));\n\ntype Props = {\n incident: PagerDutyIncident;\n};\n\nexport const IncidentListItem = ({ incident }: Props) => {\n const classes = useStyles();\n const duration =\n new Date().getTime() - new Date(incident.created_at).getTime();\n const createdAt = DateTime.local()\n .minus(Duration.fromMillis(duration))\n .toRelative({ locale: 'en' });\n const user = incident.assignments[0]?.assignee;\n\n return (\n <ListItem dense key={incident.id}>\n <ListItemText\n primary={\n <div className={classes.textContainer}>\n <Chip\n data-testid={`chip-${incident.status}`}\n label={incident.status}\n size=\"small\"\n variant=\"outlined\"\n className={\n incident.status === \"triggered\"\n ? classes.error\n : classes.warning\n }\n />\n <Chip\n data-testid={`chip-${incident.urgency}`}\n label={`${incident.urgency} urgency`}\n size=\"small\"\n variant=\"outlined\"\n className={\n incident.urgency === \"high\"\n ? classes.highUrgency\n : classes.lowUrgency\n }\n />\n {incident.title}\n </div>\n }\n primaryTypographyProps={{\n variant: \"body1\",\n className: classes.listItemPrimary,\n }}\n secondary={\n <Typography noWrap variant=\"body2\" color=\"textSecondary\">\n Created {createdAt} and assigned to{\" \"}\n <Link to={user?.html_url ?? \"#\"}>{user?.summary ?? \"nobody\"}</Link>\n </Typography>\n }\n />\n <ListItemSecondaryAction>\n <Tooltip title=\"View in PagerDuty\" placement=\"top\">\n <IconButton\n href={incident.html_url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={classes.smallIconSty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AAK,EAAA,EAAI,IAAA,EAAM,YAAY,GAAA,EAAM,QAAA,EAAA,IAAA,EAAM,WAAW,QAAA,EAAS;AAAA,SAAA,EAC9D;AAAA;AAAA,KAEJ;AAAA,wBACC,uBAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,WAAQ,KAAA,EAAM,mBAAA,EAAoB,WAAU,KAAA,EAC3C,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,MAAM,QAAA,CAAS,QAAA;AAAA,QACf,MAAA,EAAO,QAAA;AAAA,QACP,GAAA,EAAI,qBAAA;AAAA,QACJ,WAAW,OAAA,CAAQ,cAAA;AAAA,QAEnB,8BAAC,iBAAA,EAAA,EAAkB;AAAA;AAAA,OAEvB,CAAA,EACF;AAAA,GAAA,EAAA,EAnDmB,SAAS,EAoD9B,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"IncidentListItem.esm.js","sources":["../../../src/components/Incident/IncidentListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport {\n ListItem,\n ListItemSecondaryAction,\n ListItemText,\n makeStyles,\n Typography,\n Chip,\n} from '@material-ui/core';\nimport { ButtonIcon, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport { DateTime, Duration } from 'luxon';\nimport { PagerDutyIncident } from '@pagerduty/backstage-plugin-common';\nimport OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';\nimport { BackstageTheme } from '@backstage/theme';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n denseListIcon: {\n marginRight: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n listItemPrimary: {\n fontWeight: 'bold',\n },\n warning: {\n borderColor: theme.palette.warning.main,\n color: '#fff',\n backgroundColor: theme.palette.warning.main,\n boxShadow: '0 4px 4px 0 rgba(0,0,0,0.2)',\n textTransform: 'uppercase',\n '& *': {\n color: '#fff',\n },\n },\n error: {\n borderColor: theme.palette.error.main,\n color: '#fff',\n backgroundColor: theme.palette.error.main,\n boxShadow: '0 4px 4px 0 rgba(0,0,0,0.2)',\n textTransform: 'uppercase',\n '& *': {\n color: '#fff',\n },\n },\n lowUrgency: {\n borderColor: theme.palette.warning.main,\n color: theme.palette.warning.main,\n backgroundColor: '#fff',\n boxShadow: '0 4px 4px 0 rgba(0,0,0,0.2)',\n textTransform: 'uppercase',\n '& *': {\n color: theme.palette.warning.main,\n },\n },\n highUrgency: {\n borderColor: theme.palette.error.main,\n color: theme.palette.error.main,\n backgroundColor: '#fff',\n boxShadow: '0 4px 4px 0 rgba(0,0,0,0.2)',\n textTransform: 'uppercase',\n '& *': {\n color: theme.palette.error.main,\n },\n },\n textContainer: {\n display: 'flex',\n alignItems: 'baseline',\n },\n}));\n\ntype Props = {\n incident: PagerDutyIncident;\n};\n\nexport const IncidentListItem = ({ incident }: Props) => {\n const classes = useStyles();\n const duration =\n new Date().getTime() - new Date(incident.created_at).getTime();\n const createdAt = DateTime.local()\n .minus(Duration.fromMillis(duration))\n .toRelative({ locale: 'en' });\n const user = incident.assignments[0]?.assignee;\n\n const handleIncidentClick = () => {\n window.open(incident.html_url, '_blank', 'noopener,noreferrer');\n };\n\n return (\n <ListItem dense key={incident.id}>\n <ListItemText\n primary={\n <div className={classes.textContainer}>\n <Chip\n data-testid={`chip-${incident.status}`}\n label={incident.status}\n size=\"small\"\n variant=\"outlined\"\n className={\n incident.status === 'triggered'\n ? classes.error\n : classes.warning\n }\n />\n <Chip\n data-testid={`chip-${incident.urgency}`}\n label={`${incident.urgency} urgency`}\n size=\"small\"\n variant=\"outlined\"\n className={\n incident.urgency === 'high'\n ? classes.highUrgency\n : classes.lowUrgency\n }\n />\n {incident.title}\n </div>\n }\n primaryTypographyProps={{\n variant: 'body1',\n className: classes.listItemPrimary,\n }}\n secondary={\n <Typography noWrap variant=\"body2\" color=\"textSecondary\">\n Created {createdAt} and assigned to{' '}\n <Link to={user?.html_url ?? '#'}>{user?.summary ?? 'nobody'}</Link>\n </Typography>\n }\n />\n <ListItemSecondaryAction>\n <TooltipTrigger>\n <ButtonIcon\n aria-label=\"view-in-pd-button\"\n icon={<OpenInBrowserIcon />}\n variant=\"tertiary\"\n onClick={handleIncidentClick}\n />\n <Tooltip>View in PagerDuty</Tooltip>\n </TooltipTrigger>\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA+BA,MAAM,SAAA,GAAY,WAA2B,CAAA,KAAA,MAAU;AAAA,EACrD,aAAA,EAAe;AAAA,IACb,WAAA,EAAa,CAAA;AAAA,IACb,OAAA,EAAS,MAAA;AAAA,IACT,aAAA,EAAe,QAAA;AAAA,IACf,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,UAAA,EAAY;AAAA,GACd;AAAA,EACA,OAAA,EAAS;AAAA,IACP,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ,IAAA;AAAA,IACnC,KAAA,EAAO,MAAA;AAAA,IACP,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ,IAAA;AAAA,IACvC,SAAA,EAAW,6BAAA;AAAA,IACX,aAAA,EAAe,WAAA;AAAA,IACf,KAAA,EAAO;AAAA,MACL,KAAA,EAAO;AAAA;AACT,GACF;AAAA,EACA,KAAA,EAAO;AAAA,IACL,WAAA,EAAa,KAAA,CAAM,OAAA,C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UAAA;AAAA,cACR,WACE,QAAA,CAAS,OAAA,KAAY,MAAA,GACjB,OAAA,CAAQ,cACR,OAAA,CAAQ;AAAA;AAAA,WAEhB;AAAA,UACC,QAAA,CAAS;AAAA,SAAA,EACZ,CAAA;AAAA,QAEF,sBAAA,EAAwB;AAAA,UACtB,OAAA,EAAS,OAAA;AAAA,UACT,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,QACA,SAAA,uBACG,UAAA,EAAA,EAAW,MAAA,EAAM,MAAC,OAAA,EAAQ,OAAA,EAAQ,OAAM,eAAA,EAAgB,QAAA,EAAA;AAAA,UAAA,UAAA;AAAA,UAC9C,SAAA;AAAA,UAAU,kBAAA;AAAA,UAAiB,GAAA;AAAA,0BACpC,GAAA,CAAC,QAAK,EAAA,EAAI,IAAA,EAAM,YAAY,GAAA,EAAM,QAAA,EAAA,IAAA,EAAM,WAAW,QAAA,EAAS;AAAA,SAAA,EAC9D;AAAA;AAAA,KAEJ;AAAA,oBACA,GAAA,CAAC,uBAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAW,mBAAA;AAAA,UACX,IAAA,sBAAO,iBAAA,EAAA,EAAkB,CAAA;AAAA,UACzB,OAAA,EAAQ,UAAA;AAAA,UACR,OAAA,EAAS;AAAA;AAAA,OACX;AAAA,sBACA,GAAA,CAAC,WAAQ,QAAA,EAAA,mBAAA,EAAiB;AAAA,KAAA,EAC5B,CAAA,EACF;AAAA,GAAA,EAAA,EAlDmB,SAAS,EAmD9B,CAAA;AAEJ;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useEffect } from 'react';
3
- import { List } from '@material-ui/core';
3
+ import { makeStyles, List, createStyles } from '@material-ui/core';
4
4
  import { IncidentListItem } from './IncidentListItem.esm.js';
5
5
  import { IncidentsEmptyState } from './IncidentEmptyState.esm.js';
6
6
  import useAsyncFn from 'react-use/lib/useAsyncFn';
@@ -10,8 +10,16 @@ import { useApi } from '@backstage/core-plugin-api';
10
10
  import { Progress } from '@backstage/core-components';
11
11
  import { IncidentForbiddenState } from './IncidentForbiddenState.esm.js';
12
12
 
13
+ const useStyles = makeStyles(
14
+ () => createStyles({
15
+ loadingStyles: {
16
+ height: "253px"
17
+ }
18
+ })
19
+ );
13
20
  const Incidents = ({ serviceId, account, refreshIncidents }) => {
14
21
  const api = useApi(pagerDutyApiRef);
22
+ const { loadingStyles } = useStyles();
15
23
  const [{ value: incidents, loading, error }, getIncidents] = useAsyncFn(
16
24
  async () => {
17
25
  const { incidents: foundIncidents } = await api.getIncidentsByServiceId(
@@ -34,7 +42,7 @@ const Incidents = ({ serviceId, account, refreshIncidents }) => {
34
42
  ] });
35
43
  }
36
44
  if (loading) {
37
- return /* @__PURE__ */ jsx(Progress, {});
45
+ return /* @__PURE__ */ jsx("div", { className: loadingStyles, children: /* @__PURE__ */ jsx(Progress, {}) });
38
46
  }
39
47
  if (!incidents?.length) {
40
48
  return /* @__PURE__ */ jsx(IncidentsEmptyState, {});
@@ -1 +1 @@
1
- {"version":3,"file":"Incidents.esm.js","sources":["../../../src/components/Incident/Incidents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { useEffect } from 'react';\nimport { List } from '@material-ui/core';\nimport { IncidentListItem } from './IncidentListItem';\nimport { IncidentsEmptyState } from './IncidentEmptyState';\nimport useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { pagerDutyApiRef } from '../../api';\nimport { Alert } from '@material-ui/lab';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\nimport { IncidentForbiddenState } from './IncidentForbiddenState';\n\ntype Props = {\n serviceId: string;\n account?: string;\n refreshIncidents: boolean;\n};\n\nexport const Incidents = ({ serviceId, account, refreshIncidents }: Props) => {\n const api = useApi(pagerDutyApiRef);\n\n const [{ value: incidents, loading, error }, getIncidents] = useAsyncFn(\n async () => {\n const { incidents: foundIncidents } = await api.getIncidentsByServiceId(\n serviceId,\n account\n );\n return foundIncidents;\n },\n );\n\n useEffect(() => {\n getIncidents();\n }, [refreshIncidents, getIncidents]);\n\n if (error) {\n if (error.message.includes('Forbidden')) {\n return <IncidentForbiddenState />;\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (!incidents?.length) {\n return <IncidentsEmptyState />;\n }\n\n return (\n <List dense>\n {incidents!.map((incident, index) => (\n <IncidentListItem key={incident.id + index} incident={incident} />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,YAAY,CAAC,EAAE,SAAA,EAAW,OAAA,EAAS,kBAAiB,KAAa;AAC5E,EAAA,MAAM,GAAA,GAAM,OAAO,eAAe,CAAA;AAElC,EAAA,MAAM,CAAC,EAAE,KAAA,EAAO,SAAA,EAAW,SAAS,KAAA,EAAM,EAAG,YAAY,CAAA,GAAI,UAAA;AAAA,IAC3D,YAAY;AACV,MAAA,MAAM,EAAE,SAAA,EAAW,cAAA,EAAe,GAAI,MAAM,GAAA,CAAI,uBAAA;AAAA,QAC9C,SAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA,OAAO,cAAA;AAAA,IACT;AAAA,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,YAAA,EAAa;AAAA,EACf,CAAA,EAAG,CAAC,gBAAA,EAAkB,YAAY,CAAC,CAAA;AAEnC,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,WAAW,CAAA,EAAG;AACvC,MAAA,2BAAQ,sBAAA,EAAA,EAAuB,CAAA;AAAA,IACjC;AAEA,IAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,gDAAA;AAAA,MACyB,KAAA,CAAM;AAAA,KAAA,EACvD,CAAA;AAAA,EAEJ;AAEA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AAEA,EAAA,IAAI,CAAC,WAAW,MAAA,EAAQ;AACtB,IAAA,2BAAQ,mBAAA,EAAA,EAAoB,CAAA;AAAA,EAC9B;AAEA,EAAA,2BACG,IAAA,EAAA,EAAK,KAAA,EAAK,IAAA,EACR,QAAA,EAAA,SAAA,CAAW,IAAI,CAAC,QAAA,EAAU,KAAA,qBACzB,GAAA,CAAC,oBAA2C,QAAA,EAAA,EAArB,QAAA,CAAS,EAAA,GAAK,KAA2B,CACjE,CAAA,EACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Incidents.esm.js","sources":["../../../src/components/Incident/Incidents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { useEffect } from 'react';\nimport { createStyles, List, makeStyles } from '@material-ui/core';\nimport { IncidentListItem } from './IncidentListItem';\nimport { IncidentsEmptyState } from './IncidentEmptyState';\nimport useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { pagerDutyApiRef } from '../../api';\nimport { Alert } from '@material-ui/lab';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\nimport { IncidentForbiddenState } from './IncidentForbiddenState';\nimport { BackstageTheme } from '@backstage/theme';\n\ntype Props = {\n serviceId: string;\n account?: string;\n refreshIncidents: boolean;\n};\n\nconst useStyles = makeStyles<BackstageTheme>(() =>\n createStyles({\n loadingStyles: {\n height: '253px',\n },\n }),\n);\n\nexport const Incidents = ({ serviceId, account, refreshIncidents }: Props) => {\n const api = useApi(pagerDutyApiRef);\n const { loadingStyles } = useStyles();\n\n const [{ value: incidents, loading, error }, getIncidents] = useAsyncFn(\n async () => {\n const { incidents: foundIncidents } = await api.getIncidentsByServiceId(\n serviceId,\n account,\n );\n return foundIncidents;\n },\n );\n\n useEffect(() => {\n getIncidents();\n }, [refreshIncidents, getIncidents]);\n\n if (error) {\n if (error.message.includes('Forbidden')) {\n return <IncidentForbiddenState />;\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return (\n <div className={loadingStyles}>\n <Progress />\n </div>\n );\n }\n\n if (!incidents?.length) {\n return <IncidentsEmptyState />;\n }\n\n return (\n <List dense>\n {incidents!.map((incident, index) => (\n <IncidentListItem key={incident.id + index} incident={incident} />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAmCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAA2B,MAC3C,YAAA,CAAa;AAAA,IACX,aAAA,EAAe;AAAA,MACb,MAAA,EAAQ;AAAA;AACV,GACD;AACH,CAAA;AAEO,MAAM,YAAY,CAAC,EAAE,SAAA,EAAW,OAAA,EAAS,kBAAiB,KAAa;AAC5E,EAAA,MAAM,GAAA,GAAM,OAAO,eAA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