@backstage-community/plugin-cost-insights 0.15.1 → 0.16.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 (150) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/alerts/ProjectGrowthAlert.esm.js +2 -2
  3. package/dist/alerts/ProjectGrowthAlert.esm.js.map +1 -1
  4. package/dist/alerts/UnlabeledDataflowAlert.esm.js +2 -2
  5. package/dist/alerts/UnlabeledDataflowAlert.esm.js.map +1 -1
  6. package/dist/components/ActionItems/ActionItemCard.esm.js +3 -3
  7. package/dist/components/ActionItems/ActionItemCard.esm.js.map +1 -1
  8. package/dist/components/ActionItems/ActionItems.esm.js +52 -41
  9. package/dist/components/ActionItems/ActionItems.esm.js.map +1 -1
  10. package/dist/components/AlertInsights/AlertDialog.esm.js +79 -58
  11. package/dist/components/AlertInsights/AlertDialog.esm.js.map +1 -1
  12. package/dist/components/AlertInsights/AlertInsights.esm.js +57 -44
  13. package/dist/components/AlertInsights/AlertInsights.esm.js.map +1 -1
  14. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js +10 -2
  15. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js.map +1 -1
  16. package/dist/components/AlertInsights/AlertInsightsSection.esm.js +42 -34
  17. package/dist/components/AlertInsights/AlertInsightsSection.esm.js.map +1 -1
  18. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js +23 -12
  19. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js.map +1 -1
  20. package/dist/components/AlertInsights/AlertStatusSummary.esm.js +63 -55
  21. package/dist/components/AlertInsights/AlertStatusSummary.esm.js.map +1 -1
  22. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js +7 -6
  23. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js.map +1 -1
  24. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js +23 -17
  25. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js.map +1 -1
  26. package/dist/components/BarChart/BarChart.esm.js +83 -78
  27. package/dist/components/BarChart/BarChart.esm.js.map +1 -1
  28. package/dist/components/BarChart/BarChartLabel.esm.js +8 -5
  29. package/dist/components/BarChart/BarChartLabel.esm.js.map +1 -1
  30. package/dist/components/BarChart/BarChartLegend.esm.js +20 -16
  31. package/dist/components/BarChart/BarChartLegend.esm.js.map +1 -1
  32. package/dist/components/BarChart/BarChartStepper.esm.js +51 -48
  33. package/dist/components/BarChart/BarChartStepper.esm.js.map +1 -1
  34. package/dist/components/BarChart/BarChartStepperButton.esm.js +6 -5
  35. package/dist/components/BarChart/BarChartStepperButton.esm.js.map +1 -1
  36. package/dist/components/BarChart/BarChartSteps.esm.js +3 -3
  37. package/dist/components/BarChart/BarChartSteps.esm.js.map +1 -1
  38. package/dist/components/BarChart/BarChartTick.esm.js +5 -5
  39. package/dist/components/BarChart/BarChartTick.esm.js.map +1 -1
  40. package/dist/components/BarChart/BarChartTooltip.esm.js +27 -14
  41. package/dist/components/BarChart/BarChartTooltip.esm.js.map +1 -1
  42. package/dist/components/BarChart/BarChartTooltipItem.esm.js +11 -6
  43. package/dist/components/BarChart/BarChartTooltipItem.esm.js.map +1 -1
  44. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js +3 -2
  45. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js.map +1 -1
  46. package/dist/components/CostGrowth/CostGrowth.esm.js +26 -7
  47. package/dist/components/CostGrowth/CostGrowth.esm.js.map +1 -1
  48. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js +6 -2
  49. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js.map +1 -1
  50. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js +77 -8
  51. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js.map +1 -1
  52. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js +16 -10
  53. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js.map +1 -1
  54. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js +41 -35
  55. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js.map +1 -1
  56. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js +116 -79
  57. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js.map +1 -1
  58. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js +2 -2
  59. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js.map +1 -1
  60. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js +5 -5
  61. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js.map +1 -1
  62. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js +58 -51
  63. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js.map +1 -1
  64. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js +74 -59
  65. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js.map +1 -1
  66. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js +45 -35
  67. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js.map +1 -1
  68. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js +86 -73
  69. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js.map +1 -1
  70. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js +11 -6
  71. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js.map +1 -1
  72. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js +21 -15
  73. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js.map +1 -1
  74. package/dist/components/CurrencySelect/CurrencySelect.esm.js +24 -21
  75. package/dist/components/CurrencySelect/CurrencySelect.esm.js.map +1 -1
  76. package/dist/components/EntityCosts/EntityCosts.esm.js +8 -7
  77. package/dist/components/EntityCosts/EntityCosts.esm.js.map +1 -1
  78. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js +65 -20
  79. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map +1 -1
  80. package/dist/components/LegendItem/LegendItem.esm.js +34 -29
  81. package/dist/components/LegendItem/LegendItem.esm.js.map +1 -1
  82. package/dist/components/MetricSelect/MetricSelect.esm.js +19 -14
  83. package/dist/components/MetricSelect/MetricSelect.esm.js.map +1 -1
  84. package/dist/components/PeriodSelect/PeriodSelect.esm.js +15 -15
  85. package/dist/components/PeriodSelect/PeriodSelect.esm.js.map +1 -1
  86. package/dist/components/ProductInsights/ProductInsights.esm.js +12 -8
  87. package/dist/components/ProductInsights/ProductInsights.esm.js.map +1 -1
  88. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js +20 -15
  89. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js.map +1 -1
  90. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js +9 -9
  91. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js.map +1 -1
  92. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js +25 -15
  93. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js.map +1 -1
  94. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js +14 -14
  95. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js.map +1 -1
  96. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js +43 -35
  97. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js.map +1 -1
  98. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js +5 -5
  99. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js.map +1 -1
  100. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js +5 -2
  101. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js.map +1 -1
  102. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js +55 -9
  103. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js.map +1 -1
  104. package/dist/components/ProjectSelect/ProjectSelect.esm.js +15 -15
  105. package/dist/components/ProjectSelect/ProjectSelect.esm.js.map +1 -1
  106. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js +12 -9
  107. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js.map +1 -1
  108. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js +40 -10
  109. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js.map +1 -1
  110. package/dist/example/alerts/KubernetesMigrationAlert.esm.js +10 -3
  111. package/dist/example/alerts/KubernetesMigrationAlert.esm.js.map +1 -1
  112. package/dist/example/client.esm.js +1 -1
  113. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js +20 -17
  114. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js.map +1 -1
  115. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js +3 -2
  116. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js.map +1 -1
  117. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js +14 -9
  118. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js.map +1 -1
  119. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js +21 -17
  120. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js.map +1 -1
  121. package/dist/forms/AlertAcceptForm.esm.js +5 -4
  122. package/dist/forms/AlertAcceptForm.esm.js.map +1 -1
  123. package/dist/forms/AlertDismissForm.esm.js +47 -38
  124. package/dist/forms/AlertDismissForm.esm.js.map +1 -1
  125. package/dist/forms/AlertSnoozeForm.esm.js +20 -16
  126. package/dist/forms/AlertSnoozeForm.esm.js.map +1 -1
  127. package/dist/hooks/useConfig.esm.js +3 -2
  128. package/dist/hooks/useConfig.esm.js.map +1 -1
  129. package/dist/hooks/useCurrency.esm.js +6 -3
  130. package/dist/hooks/useCurrency.esm.js.map +1 -1
  131. package/dist/hooks/useFilters.esm.js +10 -7
  132. package/dist/hooks/useFilters.esm.js.map +1 -1
  133. package/dist/hooks/useGroups.esm.js +7 -4
  134. package/dist/hooks/useGroups.esm.js.map +1 -1
  135. package/dist/hooks/useLastCompleteBillingDate.esm.js +8 -7
  136. package/dist/hooks/useLastCompleteBillingDate.esm.js.map +1 -1
  137. package/dist/hooks/useLoading.esm.js +6 -2
  138. package/dist/hooks/useLoading.esm.js.map +1 -1
  139. package/dist/hooks/useScroll.esm.js +6 -3
  140. package/dist/hooks/useScroll.esm.js.map +1 -1
  141. package/dist/index.d.ts +17 -17
  142. package/dist/index.esm.js +2 -1
  143. package/dist/index.esm.js.map +1 -1
  144. package/dist/testUtils/providers.esm.js +3 -3
  145. package/dist/testUtils/providers.esm.js.map +1 -1
  146. package/dist/utils/navigation.esm.js +10 -10
  147. package/dist/utils/navigation.esm.js.map +1 -1
  148. package/dist/utils/scroll.esm.js +3 -2
  149. package/dist/utils/scroll.esm.js.map +1 -1
  150. package/package.json +18 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @backstage-community/plugin-cost-insights
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 74ab831: Backstage version bump to v1.40.2
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [74ab831]
12
+ - @backstage-community/plugin-cost-insights-common@0.5.0
13
+
14
+ ## 0.15.2
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [6c0f6ee]
19
+ - @backstage-community/plugin-cost-insights-common@0.4.1
20
+
3
21
  ## 0.15.1
4
22
 
5
23
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { ProjectGrowthAlertCard } from '../components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js';
3
3
 
4
4
  class ProjectGrowthAlert {
@@ -16,7 +16,7 @@ class ProjectGrowthAlert {
16
16
  return "Cost growth outpacing business growth is unsustainable long-term.";
17
17
  }
18
18
  get element() {
19
- return /* @__PURE__ */ React.createElement(ProjectGrowthAlertCard, { alert: this.data });
19
+ return /* @__PURE__ */ jsx(ProjectGrowthAlertCard, { alert: this.data });
20
20
  }
21
21
  }
22
22
 
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectGrowthAlert.esm.js","sources":["../../src/alerts/ProjectGrowthAlert.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 React from 'react';\nimport { ProjectGrowthAlertCard } from '../components/ProjectGrowthAlertCard';\nimport { Alert, ProjectGrowthData } from '../types';\n\n/**\n * The alert below is an example of an Alert implementation; the CostInsightsApi permits returning\n * any implementation of the Alert type, so adopters can create their own. The CostInsightsApi\n * fetches alert data from the backend, then creates Alert classes with the data.\n *\n * @public\n */\nexport class ProjectGrowthAlert implements Alert {\n data: ProjectGrowthData;\n\n constructor(data: ProjectGrowthData) {\n this.data = data;\n }\n\n get url() {\n return '/cost-insights/investigating-growth';\n }\n\n get title() {\n return `Investigate cost growth in project ${this.data.project}`;\n }\n\n get subtitle() {\n return 'Cost growth outpacing business growth is unsustainable long-term.';\n }\n\n get element() {\n return <ProjectGrowthAlertCard alert={this.data} />;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,kBAAoC,CAAA;AAAA,EAC/C,IAAA;AAAA,EAEA,YAAY,IAAyB,EAAA;AACnC,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AAAA;AACd,EAEA,IAAI,GAAM,GAAA;AACR,IAAO,OAAA,qCAAA;AAAA;AACT,EAEA,IAAI,KAAQ,GAAA;AACV,IAAO,OAAA,CAAA,mCAAA,EAAsC,IAAK,CAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAAA;AAChE,EAEA,IAAI,QAAW,GAAA;AACb,IAAO,OAAA,mEAAA;AAAA;AACT,EAEA,IAAI,OAAU,GAAA;AACZ,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAuB,KAAO,EAAA,IAAA,CAAK,IAAM,EAAA,CAAA;AAAA;AAErD;;;;"}
1
+ {"version":3,"file":"ProjectGrowthAlert.esm.js","sources":["../../src/alerts/ProjectGrowthAlert.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 { ProjectGrowthAlertCard } from '../components/ProjectGrowthAlertCard';\nimport { Alert, ProjectGrowthData } from '../types';\n\n/**\n * The alert below is an example of an Alert implementation; the CostInsightsApi permits returning\n * any implementation of the Alert type, so adopters can create their own. The CostInsightsApi\n * fetches alert data from the backend, then creates Alert classes with the data.\n *\n * @public\n */\nexport class ProjectGrowthAlert implements Alert {\n data: ProjectGrowthData;\n\n constructor(data: ProjectGrowthData) {\n this.data = data;\n }\n\n get url() {\n return '/cost-insights/investigating-growth';\n }\n\n get title() {\n return `Investigate cost growth in project ${this.data.project}`;\n }\n\n get subtitle() {\n return 'Cost growth outpacing business growth is unsustainable long-term.';\n }\n\n get element() {\n return <ProjectGrowthAlertCard alert={this.data} />;\n }\n}\n"],"names":[],"mappings":";;;AA0BO,MAAM,kBAAoC,CAAA;AAAA,EAC/C,IAAA;AAAA,EAEA,YAAY,IAAyB,EAAA;AACnC,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AAAA;AACd,EAEA,IAAI,GAAM,GAAA;AACR,IAAO,OAAA,qCAAA;AAAA;AACT,EAEA,IAAI,KAAQ,GAAA;AACV,IAAO,OAAA,CAAA,mCAAA,EAAsC,IAAK,CAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAAA;AAChE,EAEA,IAAI,QAAW,GAAA;AACb,IAAO,OAAA,mEAAA;AAAA;AACT,EAEA,IAAI,OAAU,GAAA;AACZ,IAAA,uBAAQ,GAAA,CAAA,sBAAA,EAAA,EAAuB,KAAO,EAAA,IAAA,CAAK,IAAM,EAAA,CAAA;AAAA;AAErD;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { UnlabeledDataflowAlertCard } from '../components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js';
3
3
 
4
4
  class UnlabeledDataflowAlert {
@@ -17,7 +17,7 @@ class UnlabeledDataflowAlert {
17
17
  return "Labels show in billing data, enabling cost insights for each workflow.";
18
18
  }
19
19
  get element() {
20
- return /* @__PURE__ */ React.createElement(UnlabeledDataflowAlertCard, { alert: this.data });
20
+ return /* @__PURE__ */ jsx(UnlabeledDataflowAlertCard, { alert: this.data });
21
21
  }
22
22
  }
23
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"UnlabeledDataflowAlert.esm.js","sources":["../../src/alerts/UnlabeledDataflowAlert.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 React from 'react';\nimport { UnlabeledDataflowAlertCard } from '../components/UnlabeledDataflowAlertCard';\nimport { Alert, AlertStatus, UnlabeledDataflowData } from '../types';\n\n/**\n * The alert below is an example of an Alert implementation; the CostInsightsApi permits returning\n * any implementation of the Alert type, so adopters can create their own. The CostInsightsApi\n * fetches alert data from the backend, then creates Alert classes with the data.\n *\n * @public\n */\nexport class UnlabeledDataflowAlert implements Alert {\n data: UnlabeledDataflowData;\n status?: AlertStatus;\n\n constructor(data: UnlabeledDataflowData) {\n this.data = data;\n }\n\n get url() {\n return '/cost-insights/labeling-jobs';\n }\n\n get title() {\n return 'Add labels to workflows';\n }\n\n get subtitle() {\n return 'Labels show in billing data, enabling cost insights for each workflow.';\n }\n\n get element() {\n return <UnlabeledDataflowAlertCard alert={this.data} />;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,sBAAwC,CAAA;AAAA,EACnD,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAY,IAA6B,EAAA;AACvC,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AAAA;AACd,EAEA,IAAI,GAAM,GAAA;AACR,IAAO,OAAA,8BAAA;AAAA;AACT,EAEA,IAAI,KAAQ,GAAA;AACV,IAAO,OAAA,yBAAA;AAAA;AACT,EAEA,IAAI,QAAW,GAAA;AACb,IAAO,OAAA,wEAAA;AAAA;AACT,EAEA,IAAI,OAAU,GAAA;AACZ,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,0BAAA,EAAA,EAA2B,KAAO,EAAA,IAAA,CAAK,IAAM,EAAA,CAAA;AAAA;AAEzD;;;;"}
1
+ {"version":3,"file":"UnlabeledDataflowAlert.esm.js","sources":["../../src/alerts/UnlabeledDataflowAlert.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 { UnlabeledDataflowAlertCard } from '../components/UnlabeledDataflowAlertCard';\nimport { Alert, AlertStatus, UnlabeledDataflowData } from '../types';\n\n/**\n * The alert below is an example of an Alert implementation; the CostInsightsApi permits returning\n * any implementation of the Alert type, so adopters can create their own. The CostInsightsApi\n * fetches alert data from the backend, then creates Alert classes with the data.\n *\n * @public\n */\nexport class UnlabeledDataflowAlert implements Alert {\n data: UnlabeledDataflowData;\n status?: AlertStatus;\n\n constructor(data: UnlabeledDataflowData) {\n this.data = data;\n }\n\n get url() {\n return '/cost-insights/labeling-jobs';\n }\n\n get title() {\n return 'Add labels to workflows';\n }\n\n get subtitle() {\n return 'Labels show in billing data, enabling cost insights for each workflow.';\n }\n\n get element() {\n return <UnlabeledDataflowAlertCard alert={this.data} />;\n }\n}\n"],"names":[],"mappings":";;;AA0BO,MAAM,sBAAwC,CAAA;AAAA,EACnD,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAY,IAA6B,EAAA;AACvC,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AAAA;AACd,EAEA,IAAI,GAAM,GAAA;AACR,IAAO,OAAA,8BAAA;AAAA;AACT,EAEA,IAAI,KAAQ,GAAA;AACV,IAAO,OAAA,yBAAA;AAAA;AACT,EAEA,IAAI,QAAW,GAAA;AACb,IAAO,OAAA,wEAAA;AAAA;AACT,EAEA,IAAI,OAAU,GAAA;AACZ,IAAA,uBAAQ,GAAA,CAAA,0BAAA,EAAA,EAA2B,KAAO,EAAA,IAAA,CAAK,IAAM,EAAA,CAAA;AAAA;AAEzD;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import classnames from 'classnames';
3
3
  import Card from '@material-ui/core/Card';
4
4
  import CardHeader from '@material-ui/core/CardHeader';
@@ -27,7 +27,7 @@ const ActionItemCard = ({
27
27
  setScroll(`alert-${number}`);
28
28
  }
29
29
  };
30
- return /* @__PURE__ */ React.createElement(Card, { className: classes.card, raised: false, onClick: onActionItemClick }, /* @__PURE__ */ React.createElement(
30
+ return /* @__PURE__ */ jsx(Card, { className: classes.card, raised: false, onClick: onActionItemClick, children: /* @__PURE__ */ jsx(
31
31
  CardHeader,
32
32
  {
33
33
  classes: {
@@ -39,7 +39,7 @@ const ActionItemCard = ({
39
39
  subheader: alert.subtitle,
40
40
  avatar
41
41
  }
42
- ));
42
+ ) });
43
43
  };
44
44
 
45
45
  export { ActionItemCard };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionItemCard.esm.js","sources":["../../../src/components/ActionItems/ActionItemCard.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 React, { MouseEventHandler } from 'react';\nimport classnames from 'classnames';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport { useScroll } from '../../hooks';\nimport { Alert } from '../../types';\nimport { useActionItemCardStyles as useStyles } from '../../utils/styles';\n\ntype ActionItemCardProps = {\n alert: Alert;\n number?: number;\n avatar?: JSX.Element;\n disableScroll?: boolean;\n};\n\nexport const ActionItemCard = ({\n alert,\n avatar,\n number,\n disableScroll = false,\n}: ActionItemCardProps) => {\n const classes = useStyles();\n const rootClasses = classnames(classes.root, {\n [classes.activeRoot]: !disableScroll,\n });\n const [, setScroll] = useScroll();\n\n const onActionItemClick: MouseEventHandler = () => {\n if (!disableScroll && number) {\n setScroll(`alert-${number}`);\n }\n };\n\n return (\n <Card className={classes.card} raised={false} onClick={onActionItemClick}>\n <CardHeader\n classes={{\n root: rootClasses,\n action: classes.action,\n title: classes.title,\n }}\n title={alert.title}\n subheader={alert.subtitle}\n avatar={avatar}\n />\n </Card>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;AA8BO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,KAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAgB,GAAA;AAClB,CAA2B,KAAA;AACzB,EAAA,MAAM,UAAUA,uBAAU,EAAA;AAC1B,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,OAAA,CAAQ,IAAM,EAAA;AAAA,IAC3C,CAAC,OAAA,CAAQ,UAAU,GAAG,CAAC;AAAA,GACxB,CAAA;AACD,EAAA,MAAM,GAAG,SAAS,CAAA,GAAI,SAAU,EAAA;AAEhC,EAAA,MAAM,oBAAuC,MAAM;AACjD,IAAI,IAAA,CAAC,iBAAiB,MAAQ,EAAA;AAC5B,MAAU,SAAA,CAAA,CAAA,MAAA,EAAS,MAAM,CAAE,CAAA,CAAA;AAAA;AAC7B,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,SAAW,EAAA,OAAA,CAAQ,MAAM,MAAQ,EAAA,KAAA,EAAO,SAAS,iBACrD,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,WAAA;AAAA,QACN,QAAQ,OAAQ,CAAA,MAAA;AAAA,QAChB,OAAO,OAAQ,CAAA;AAAA,OACjB;AAAA,MACA,OAAO,KAAM,CAAA,KAAA;AAAA,MACb,WAAW,KAAM,CAAA,QAAA;AAAA,MACjB;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ActionItemCard.esm.js","sources":["../../../src/components/ActionItems/ActionItemCard.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 { MouseEventHandler } from 'react';\nimport classnames from 'classnames';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport { useScroll } from '../../hooks';\nimport { Alert } from '../../types';\nimport { useActionItemCardStyles as useStyles } from '../../utils/styles';\n\ntype ActionItemCardProps = {\n alert: Alert;\n number?: number;\n avatar?: JSX.Element;\n disableScroll?: boolean;\n};\n\nexport const ActionItemCard = ({\n alert,\n avatar,\n number,\n disableScroll = false,\n}: ActionItemCardProps) => {\n const classes = useStyles();\n const rootClasses = classnames(classes.root, {\n [classes.activeRoot]: !disableScroll,\n });\n const [, setScroll] = useScroll();\n\n const onActionItemClick: MouseEventHandler = () => {\n if (!disableScroll && number) {\n setScroll(`alert-${number}`);\n }\n };\n\n return (\n <Card className={classes.card} raised={false} onClick={onActionItemClick}>\n <CardHeader\n classes={{\n root: rootClasses,\n action: classes.action,\n title: classes.title,\n }}\n title={alert.title}\n subheader={alert.subtitle}\n avatar={avatar}\n />\n </Card>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;AA8BO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,KAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAgB,GAAA;AAClB,CAA2B,KAAA;AACzB,EAAA,MAAM,UAAUA,uBAAU,EAAA;AAC1B,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,OAAA,CAAQ,IAAM,EAAA;AAAA,IAC3C,CAAC,OAAA,CAAQ,UAAU,GAAG,CAAC;AAAA,GACxB,CAAA;AACD,EAAA,MAAM,GAAG,SAAS,CAAA,GAAI,SAAU,EAAA;AAEhC,EAAA,MAAM,oBAAuC,MAAM;AACjD,IAAI,IAAA,CAAC,iBAAiB,MAAQ,EAAA;AAC5B,MAAU,SAAA,CAAA,CAAA,MAAA,EAAS,MAAM,CAAE,CAAA,CAAA;AAAA;AAC7B,GACF;AAEA,EACE,uBAAA,GAAA,CAAC,QAAK,SAAW,EAAA,OAAA,CAAQ,MAAM,MAAQ,EAAA,KAAA,EAAO,SAAS,iBACrD,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,WAAA;AAAA,QACN,QAAQ,OAAQ,CAAA,MAAA;AAAA,QAChB,OAAO,OAAQ,CAAA;AAAA,OACjB;AAAA,MACA,OAAO,KAAM,CAAA,KAAA;AAAA,MACb,WAAW,KAAM,CAAA,QAAA;AAAA,MACjB;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { Fragment } from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { Fragment as Fragment$1 } from 'react';
2
3
  import Avatar from '@material-ui/core/Avatar';
3
4
  import Tooltip from '@material-ui/core/Tooltip';
4
5
  import IconButton from '@material-ui/core/IconButton';
@@ -26,16 +27,16 @@ const AlertStatusButton = ({
26
27
  icon,
27
28
  onClick,
28
29
  ...buttonProps
29
- }) => /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(
30
+ }) => /* @__PURE__ */ jsx(Tooltip, { title, children: /* @__PURE__ */ jsx(
30
31
  IconButton,
31
32
  {
32
33
  onClick,
33
34
  role: "button",
34
35
  "aria-hidden": false,
35
- ...buttonProps
36
- },
37
- /* @__PURE__ */ React.createElement(Badge, { badgeContent: amount }, icon)
38
- ));
36
+ ...buttonProps,
37
+ children: /* @__PURE__ */ jsx(Badge, { badgeContent: amount, children: icon })
38
+ }
39
+ ) });
39
40
  const ActionItems = ({
40
41
  active,
41
42
  snoozed,
@@ -49,41 +50,51 @@ const ActionItems = ({
49
50
  const isDismissedButtonDisplayed = !!dismissed.length;
50
51
  const isStatusButtonGroupDisplayed = !!active.length;
51
52
  const onStatusButtonClick = () => setScroll(ScrollType.AlertSummary);
52
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Paper, null, active.map((alert, index) => /* @__PURE__ */ React.createElement(Fragment, { key: `alert-${index}` }, /* @__PURE__ */ React.createElement(
53
- ActionItemCard,
54
- {
55
- alert,
56
- number: index + 1,
57
- avatar: /* @__PURE__ */ React.createElement(Avatar, { className: classes.avatar }, index + 1)
58
- }
59
- ), index < active.length - 1 && /* @__PURE__ */ React.createElement(Divider, null)))), isStatusButtonGroupDisplayed && /* @__PURE__ */ React.createElement(Box, { display: "flex", justifyContent: "flex-end", mt: 2 }, isAcceptedButtonDisplayed && /* @__PURE__ */ React.createElement(
60
- AlertStatusButton,
61
- {
62
- title: "Accepted",
63
- "aria-label": AlertStatus.Accepted,
64
- icon: /* @__PURE__ */ React.createElement(AcceptIcon, null),
65
- amount: accepted.length,
66
- onClick: onStatusButtonClick
67
- }
68
- ), isSnoozedButtonDisplayed && /* @__PURE__ */ React.createElement(
69
- AlertStatusButton,
70
- {
71
- title: "Snoozed",
72
- "aria-label": AlertStatus.Snoozed,
73
- amount: snoozed.length,
74
- icon: /* @__PURE__ */ React.createElement(SnoozeIcon, null),
75
- onClick: onStatusButtonClick
76
- }
77
- ), isDismissedButtonDisplayed && /* @__PURE__ */ React.createElement(
78
- AlertStatusButton,
79
- {
80
- title: "Dismissed",
81
- "aria-label": AlertStatus.Dismissed,
82
- icon: /* @__PURE__ */ React.createElement(DismissIcon, null),
83
- amount: dismissed.length,
84
- onClick: onStatusButtonClick
85
- }
86
- )));
53
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ /* @__PURE__ */ jsx(Paper, { children: active.map((alert, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
55
+ /* @__PURE__ */ jsx(
56
+ ActionItemCard,
57
+ {
58
+ alert,
59
+ number: index + 1,
60
+ avatar: /* @__PURE__ */ jsx(Avatar, { className: classes.avatar, children: index + 1 })
61
+ }
62
+ ),
63
+ index < active.length - 1 && /* @__PURE__ */ jsx(Divider, {})
64
+ ] }, `alert-${index}`)) }),
65
+ isStatusButtonGroupDisplayed && /* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "flex-end", mt: 2, children: [
66
+ isAcceptedButtonDisplayed && /* @__PURE__ */ jsx(
67
+ AlertStatusButton,
68
+ {
69
+ title: "Accepted",
70
+ "aria-label": AlertStatus.Accepted,
71
+ icon: /* @__PURE__ */ jsx(AcceptIcon, {}),
72
+ amount: accepted.length,
73
+ onClick: onStatusButtonClick
74
+ }
75
+ ),
76
+ isSnoozedButtonDisplayed && /* @__PURE__ */ jsx(
77
+ AlertStatusButton,
78
+ {
79
+ title: "Snoozed",
80
+ "aria-label": AlertStatus.Snoozed,
81
+ amount: snoozed.length,
82
+ icon: /* @__PURE__ */ jsx(SnoozeIcon, {}),
83
+ onClick: onStatusButtonClick
84
+ }
85
+ ),
86
+ isDismissedButtonDisplayed && /* @__PURE__ */ jsx(
87
+ AlertStatusButton,
88
+ {
89
+ title: "Dismissed",
90
+ "aria-label": AlertStatus.Dismissed,
91
+ icon: /* @__PURE__ */ jsx(DismissIcon, {}),
92
+ amount: dismissed.length,
93
+ onClick: onStatusButtonClick
94
+ }
95
+ )
96
+ ] })
97
+ ] });
87
98
  };
88
99
 
89
100
  export { ActionItems };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionItems.esm.js","sources":["../../../src/components/ActionItems/ActionItems.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 React, { Fragment, MouseEventHandler } from 'react';\nimport Avatar from '@material-ui/core/Avatar';\nimport { IconButtonProps } from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Badge from '@material-ui/core/Badge';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport Divider from '@material-ui/core/Divider';\nimport { default as SnoozeIcon } from '@material-ui/icons/AccessTime';\nimport { default as AcceptIcon } from '@material-ui/icons/Check';\nimport { default as DismissIcon } from '@material-ui/icons/Delete';\nimport { ActionItemCard } from './ActionItemCard';\nimport { Alert, AlertStatus } from '../../types';\nimport { useScroll, ScrollType } from '../../hooks';\nimport { useActionItemCardStyles as useStyles } from '../../utils/styles';\n\ntype AlertStatusButtonProps = {\n title: string;\n amount: number;\n icon: JSX.Element;\n onClick: MouseEventHandler;\n} & IconButtonProps;\n\nconst AlertStatusButton = ({\n title,\n amount,\n icon,\n onClick,\n ...buttonProps\n}: AlertStatusButtonProps) => (\n <Tooltip title={title}>\n <IconButton\n onClick={onClick}\n role=\"button\"\n aria-hidden={false}\n {...buttonProps}\n >\n <Badge badgeContent={amount}>{icon}</Badge>\n </IconButton>\n </Tooltip>\n);\n\ntype ActionItemsProps = {\n active: Alert[];\n snoozed: Alert[];\n accepted: Alert[];\n dismissed: Alert[];\n};\n\nexport const ActionItems = ({\n active,\n snoozed,\n accepted,\n dismissed,\n}: ActionItemsProps) => {\n const classes = useStyles();\n const [, setScroll] = useScroll();\n\n const isSnoozedButtonDisplayed = !!snoozed.length;\n const isAcceptedButtonDisplayed = !!accepted.length;\n const isDismissedButtonDisplayed = !!dismissed.length;\n const isStatusButtonGroupDisplayed = !!active.length;\n\n const onStatusButtonClick: MouseEventHandler = () =>\n setScroll(ScrollType.AlertSummary);\n\n return (\n <>\n <Paper>\n {active.map((alert, index) => (\n <Fragment key={`alert-${index}`}>\n <ActionItemCard\n alert={alert}\n number={index + 1}\n avatar={<Avatar className={classes.avatar}>{index + 1}</Avatar>}\n />\n {index < active.length - 1 && <Divider />}\n </Fragment>\n ))}\n </Paper>\n {isStatusButtonGroupDisplayed && (\n <Box display=\"flex\" justifyContent=\"flex-end\" mt={2}>\n {isAcceptedButtonDisplayed && (\n <AlertStatusButton\n title=\"Accepted\"\n aria-label={AlertStatus.Accepted}\n icon={<AcceptIcon />}\n amount={accepted.length}\n onClick={onStatusButtonClick}\n />\n )}\n {isSnoozedButtonDisplayed && (\n <AlertStatusButton\n title=\"Snoozed\"\n aria-label={AlertStatus.Snoozed}\n amount={snoozed.length}\n icon={<SnoozeIcon />}\n onClick={onStatusButtonClick}\n />\n )}\n {isDismissedButtonDisplayed && (\n <AlertStatusButton\n title=\"Dismissed\"\n aria-label={AlertStatus.Dismissed}\n icon={<DismissIcon />}\n amount={dismissed.length}\n onClick={onStatusButtonClick}\n />\n )}\n </Box>\n )}\n </>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,oBAAoB,CAAC;AAAA,EACzB,KAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CACE,qBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KACP,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA;AAAA,IACA,IAAK,EAAA,QAAA;AAAA,IACL,aAAa,EAAA,KAAA;AAAA,IACZ,GAAG;A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A,CAAA,OAAA,EAAA,IAAQ,CACzC,CACD,CACH,GACC,4BACC,oBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,OAAQ,EAAA,MAAA,EAAO,gBAAe,UAAW,EAAA,EAAA,EAAI,KAC/C,yBACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,UAAA;AAAA,MACN,cAAY,WAAY,CAAA,QAAA;AAAA,MACxB,IAAA,sCAAO,UAAW,EAAA,IAAA,CAAA;AAAA,MAClB,QAAQ,QAAS,CAAA,MAAA;AAAA,MACjB,OAAS,EAAA;AAAA;AAAA,KAGZ,wBACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,cAAY,WAAY,CAAA,OAAA;AAAA,MACxB,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,IAAA,sCAAO,UAAW,EAAA,IAAA,CAAA;AAAA,MAClB,OAAS,EAAA;AAAA;AAAA,KAGZ,0BACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,cAAY,WAAY,CAAA,SAAA;AAAA,MACxB,IAAA,sCAAO,WAAY,EAAA,IAAA,CAAA;AAAA,MACnB,QAAQ,SAAU,CAAA,MAAA;AAAA,MAClB,OAAS,EAAA;AAAA;AAAA,GAGf,CAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ActionItems.esm.js","sources":["../../../src/components/ActionItems/ActionItems.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 { Fragment, MouseEventHandler } from 'react';\nimport Avatar from '@material-ui/core/Avatar';\nimport { IconButtonProps } from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport Badge from '@material-ui/core/Badge';\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport Divider from '@material-ui/core/Divider';\nimport { default as SnoozeIcon } from '@material-ui/icons/AccessTime';\nimport { default as AcceptIcon } from '@material-ui/icons/Check';\nimport { default as DismissIcon } from '@material-ui/icons/Delete';\nimport { ActionItemCard } from './ActionItemCard';\nimport { Alert, AlertStatus } from '../../types';\nimport { useScroll, ScrollType } from '../../hooks';\nimport { useActionItemCardStyles as useStyles } from '../../utils/styles';\n\ntype AlertStatusButtonProps = {\n title: string;\n amount: number;\n icon: JSX.Element;\n onClick: MouseEventHandler;\n} & IconButtonProps;\n\nconst AlertStatusButton = ({\n title,\n amount,\n icon,\n onClick,\n ...buttonProps\n}: AlertStatusButtonProps) => (\n <Tooltip title={title}>\n <IconButton\n onClick={onClick}\n role=\"button\"\n aria-hidden={false}\n {...buttonProps}\n >\n <Badge badgeContent={amount}>{icon}</Badge>\n </IconButton>\n </Tooltip>\n);\n\ntype ActionItemsProps = {\n active: Alert[];\n snoozed: Alert[];\n accepted: Alert[];\n dismissed: Alert[];\n};\n\nexport const ActionItems = ({\n active,\n snoozed,\n accepted,\n dismissed,\n}: ActionItemsProps) => {\n const classes = useStyles();\n const [, setScroll] = useScroll();\n\n const isSnoozedButtonDisplayed = !!snoozed.length;\n const isAcceptedButtonDisplayed = !!accepted.length;\n const isDismissedButtonDisplayed = !!dismissed.length;\n const isStatusButtonGroupDisplayed = !!active.length;\n\n const onStatusButtonClick: MouseEventHandler = () =>\n setScroll(ScrollType.AlertSummary);\n\n return (\n <>\n <Paper>\n {active.map((alert, index) => (\n <Fragment key={`alert-${index}`}>\n <ActionItemCard\n alert={alert}\n number={index + 1}\n avatar={<Avatar className={classes.avatar}>{index + 1}</Avatar>}\n />\n {index < active.length - 1 && <Divider />}\n </Fragment>\n ))}\n </Paper>\n {isStatusButtonGroupDisplayed && (\n <Box display=\"flex\" justifyContent=\"flex-end\" mt={2}>\n {isAcceptedButtonDisplayed && (\n <AlertStatusButton\n title=\"Accepted\"\n aria-label={AlertStatus.Accepted}\n icon={<AcceptIcon />}\n amount={accepted.length}\n onClick={onStatusButtonClick}\n />\n )}\n {isSnoozedButtonDisplayed && (\n <AlertStatusButton\n title=\"Snoozed\"\n aria-label={AlertStatus.Snoozed}\n amount={snoozed.length}\n icon={<SnoozeIcon />}\n onClick={onStatusButtonClick}\n />\n )}\n {isDismissedButtonDisplayed && (\n <AlertStatusButton\n title=\"Dismissed\"\n aria-label={AlertStatus.Dismissed}\n icon={<DismissIcon />}\n amount={dismissed.length}\n onClick={onStatusButtonClick}\n />\n )}\n </Box>\n )}\n </>\n );\n};\n"],"names":["useStyles","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,oBAAoB,CAAC;AAAA,EACzB,KAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CACE,qBAAA,GAAA,CAAC,WAAQ,KACP,EAAA,QAAA,kBAAA,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA;AAAA,IACA,IAAK,EAAA,QAAA;AAAA,IACL,aAAa,EAAA,KAAA;AAAA,IACZ,GAAG,WAAA;AAAA,IAEJ,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAM,YAAc,EAAA,MAAA,EAAS,QAAK,EAAA,IAAA,EAAA;AAAA;AACrC,CACF,EAAA,CAAA;AAUK,MAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA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UACN,cAAY,WAAY,CAAA,QAAA;AAAA,UACxB,IAAA,sBAAO,UAAW,EAAA,EAAA,CAAA;AAAA,UAClB,QAAQ,QAAS,CAAA,MAAA;AAAA,UACjB,OAAS,EAAA;AAAA;AAAA,OACX;AAAA,MAED,wBACC,oBAAA,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,KAAM,EAAA,SAAA;AAAA,UACN,cAAY,WAAY,CAAA,OAAA;AAAA,UACxB,QAAQ,OAAQ,CAAA,MAAA;AAAA,UAChB,IAAA,sBAAO,UAAW,EAAA,EAAA,CAAA;AAAA,UAClB,OAAS,EAAA;AAAA;AAAA,OACX;AAAA,MAED,0BACC,oBAAA,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,KAAM,EAAA,WAAA;AAAA,UACN,cAAY,WAAY,CAAA,SAAA;AAAA,UACxB,IAAA,sBAAO,WAAY,EAAA,EAAA,CAAA;AAAA,UACnB,QAAQ,SAAU,CAAA,MAAA;AAAA,UAClB,OAAS,EAAA;AAAA;AAAA;AACX,KAEJ,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useRef, useEffect } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useRef, useEffect } from 'react';
2
3
  import { capitalize } from '@material-ui/core/utils';
3
4
  import Box from '@material-ui/core/Box';
4
5
  import Button from '@material-ui/core/Button';
@@ -53,69 +54,89 @@ const AlertDialog = ({
53
54
  }
54
55
  };
55
56
  const Form = formOf(alert, status);
56
- return /* @__PURE__ */ React.createElement(
57
+ return /* @__PURE__ */ jsxs(
57
58
  Dialog,
58
59
  {
59
60
  open,
60
61
  onClose: onDialogClose,
61
62
  scroll: "body",
62
63
  maxWidth: "lg",
63
- TransitionProps
64
- },
65
- /* @__PURE__ */ React.createElement(Box, { display: "flex", justifyContent: "flex-end" }, /* @__PURE__ */ React.createElement(
66
- IconButton,
67
- {
68
- className: classes.icon,
69
- disableRipple: true,
70
- "aria-label": "Close",
71
- onClick: onDialogClose
72
- },
73
- /* @__PURE__ */ React.createElement(CloseIcon, null)
74
- )),
75
- /* @__PURE__ */ React.createElement(DialogContent, { className: classes.content }, /* @__PURE__ */ React.createElement(Box, { mb: 1.5 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, /* @__PURE__ */ React.createElement("b", null, capitalize(action), " this action item?")), /* @__PURE__ */ React.createElement(Typography, { variant: "h6", color: "textSecondary" }, /* @__PURE__ */ React.createElement("b", null, "This action item will be ", actioned, " for all of ", group, "."))), /* @__PURE__ */ React.createElement(
76
- Box,
77
- {
78
- display: "flex",
79
- flexDirection: "column",
80
- bgcolor: "alertBackground",
81
- p: 2,
82
- mb: 1.5,
83
- borderRadius: 4
84
- },
85
- /* @__PURE__ */ React.createElement(Typography, null, /* @__PURE__ */ React.createElement("b", null, alert?.title)),
86
- /* @__PURE__ */ React.createElement(Typography, { color: "textSecondary" }, alert?.subtitle)
87
- ), Form && /* @__PURE__ */ React.createElement(
88
- Form,
89
- {
90
- ref: formRef,
91
- alert,
92
- onSubmit,
93
- disableSubmit
94
- }
95
- )),
96
- /* @__PURE__ */ React.createElement(Divider, null),
97
- /* @__PURE__ */ React.createElement(DialogActions, { className: classes.actions, disableSpacing: true }, Form ? /* @__PURE__ */ React.createElement(
98
- Button,
99
- {
100
- type: "submit",
101
- color: "primary",
102
- variant: "contained",
103
- "aria-label": action,
104
- form: DEFAULT_FORM_ID,
105
- disabled: isSubmitDisabled
106
- },
107
- capitalize(action)
108
- ) : /* @__PURE__ */ React.createElement(
109
- Button,
110
- {
111
- type: "button",
112
- color: "primary",
113
- variant: "contained",
114
- "aria-label": action,
115
- onClick: () => onSubmit(null)
116
- },
117
- capitalize(action)
118
- ))
64
+ TransitionProps,
65
+ children: [
66
+ /* @__PURE__ */ jsx(Box, { display: "flex", justifyContent: "flex-end", children: /* @__PURE__ */ jsx(
67
+ IconButton,
68
+ {
69
+ className: classes.icon,
70
+ disableRipple: true,
71
+ "aria-label": "Close",
72
+ onClick: onDialogClose,
73
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
74
+ }
75
+ ) }),
76
+ /* @__PURE__ */ jsxs(DialogContent, { className: classes.content, children: [
77
+ /* @__PURE__ */ jsxs(Box, { mb: 1.5, children: [
78
+ /* @__PURE__ */ jsx(Typography, { variant: "h5", children: /* @__PURE__ */ jsxs("b", { children: [
79
+ capitalize(action),
80
+ " this action item?"
81
+ ] }) }),
82
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", color: "textSecondary", children: /* @__PURE__ */ jsxs("b", { children: [
83
+ "This action item will be ",
84
+ actioned,
85
+ " for all of ",
86
+ group,
87
+ "."
88
+ ] }) })
89
+ ] }),
90
+ /* @__PURE__ */ jsxs(
91
+ Box,
92
+ {
93
+ display: "flex",
94
+ flexDirection: "column",
95
+ bgcolor: "alertBackground",
96
+ p: 2,
97
+ mb: 1.5,
98
+ borderRadius: 4,
99
+ children: [
100
+ /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx("b", { children: alert?.title }) }),
101
+ /* @__PURE__ */ jsx(Typography, { color: "textSecondary", children: alert?.subtitle })
102
+ ]
103
+ }
104
+ ),
105
+ Form && /* @__PURE__ */ jsx(
106
+ Form,
107
+ {
108
+ ref: formRef,
109
+ alert,
110
+ onSubmit,
111
+ disableSubmit
112
+ }
113
+ )
114
+ ] }),
115
+ /* @__PURE__ */ jsx(Divider, {}),
116
+ /* @__PURE__ */ jsx(DialogActions, { className: classes.actions, disableSpacing: true, children: Form ? /* @__PURE__ */ jsx(
117
+ Button,
118
+ {
119
+ type: "submit",
120
+ color: "primary",
121
+ variant: "contained",
122
+ "aria-label": action,
123
+ form: DEFAULT_FORM_ID,
124
+ disabled: isSubmitDisabled,
125
+ children: capitalize(action)
126
+ }
127
+ ) : /* @__PURE__ */ jsx(
128
+ Button,
129
+ {
130
+ type: "button",
131
+ color: "primary",
132
+ variant: "contained",
133
+ "aria-label": action,
134
+ onClick: () => onSubmit(null),
135
+ children: capitalize(action)
136
+ }
137
+ ) })
138
+ ]
139
+ }
119
140
  );
120
141
  };
121
142
 
@@ -1 +1 @@
1
- {"version":3,"file":"AlertDialog.esm.js","sources":["../../../src/components/AlertInsights/AlertDialog.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 React, { useEffect, useRef, useState } from 'react';\nimport { capitalize } from '@material-ui/core/utils';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport Divider from '@material-ui/core/Divider';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport IconButton from '@material-ui/core/IconButton';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport Typography from '@material-ui/core/Typography';\nimport { default as CloseIcon } from '@material-ui/icons/Close';\nimport { useAlertDialogStyles as useStyles } from '../../utils/styles';\nimport { Alert, AlertStatus } from '../../types';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\nimport { choose, formOf } from '../../utils/alerts';\n\nconst DEFAULT_FORM_ID = 'alert-form';\n\ntype AlertDialogProps = {\n open: boolean;\n group: string;\n alert: Maybe<Alert>;\n status: Maybe<AlertStatus>;\n onClose: () => void;\n onSubmit: (data: any) => void;\n};\n\nexport const AlertDialog = ({\n open,\n group,\n alert,\n status,\n onClose,\n onSubmit,\n}: AlertDialogProps) => {\n const classes = useStyles();\n const [isSubmitDisabled, setSubmitDisabled] = useState(true);\n const formRef = useRef<Maybe<HTMLFormElement>>(null);\n\n useEffect(() => {\n setSubmitDisabled(open);\n }, [open]);\n\n function disableSubmit(isDisabled: boolean) {\n setSubmitDisabled(isDisabled);\n }\n\n function onDialogClose() {\n onClose();\n setSubmitDisabled(true);\n }\n\n const [action, actioned] = choose(\n status,\n [\n ['snooze', 'snoozed'],\n ['accept', 'accepted'],\n ['dismiss', 'dismissed'],\n ],\n ['', ''],\n );\n\n const TransitionProps = {\n mountOnEnter: true,\n unmountOnExit: true,\n onEntered() {\n if (formRef.current) {\n formRef.current.id = DEFAULT_FORM_ID;\n }\n },\n };\n\n const Form = formOf(alert, status);\n\n return (\n <Dialog\n open={open}\n onClose={onDialogClose}\n scroll=\"body\"\n maxWidth=\"lg\"\n TransitionProps={TransitionProps}\n >\n <Box display=\"flex\" justifyContent=\"flex-end\">\n <IconButton\n className={classes.icon}\n disableRipple\n aria-label=\"Close\"\n onClick={onDialogClose}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n <DialogContent className={classes.content}>\n <Box mb={1.5}>\n <Typography variant=\"h5\">\n <b>{capitalize(action)} this action item?</b>\n </Typography>\n <Typography variant=\"h6\" color=\"textSecondary\">\n <b>\n This action item will be {actioned} for all of {group}.\n </b>\n </Typography>\n </Box>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n bgcolor=\"alertBackground\"\n p={2}\n mb={1.5}\n borderRadius={4}\n >\n <Typography>\n <b>{alert?.title}</b>\n </Typography>\n <Typography color=\"textSecondary\">{alert?.subtitle}</Typography>\n </Box>\n {Form && (\n <Form\n ref={formRef}\n alert={alert}\n onSubmit={onSubmit}\n disableSubmit={disableSubmit}\n />\n )}\n </DialogContent>\n <Divider />\n <DialogActions className={classes.actions} disableSpacing>\n {Form ? (\n <Button\n type=\"submit\"\n color=\"primary\"\n variant=\"contained\"\n aria-label={action}\n form={DEFAULT_FORM_ID}\n disabled={isSubmitDisabled}\n >\n {capitalize(action)}\n </Button>\n ) : (\n <Button\n type=\"button\"\n color=\"primary\"\n variant=\"contained\"\n aria-label={action}\n onClick={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 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 { useEffect, useRef, useState } from 'react';\nimport { capitalize } from '@material-ui/core/utils';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport Divider from '@material-ui/core/Divider';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport IconButton from '@material-ui/core/IconButton';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport Typography from '@material-ui/core/Typography';\nimport { default as CloseIcon } from '@material-ui/icons/Close';\nimport { useAlertDialogStyles as useStyles } from '../../utils/styles';\nimport { Alert, AlertStatus } from '../../types';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\nimport { choose, formOf } from '../../utils/alerts';\n\nconst DEFAULT_FORM_ID = 'alert-form';\n\ntype AlertDialogProps = {\n open: boolean;\n group: string;\n alert: Maybe<Alert>;\n status: Maybe<AlertStatus>;\n onClose: () => void;\n onSubmit: (data: any) => void;\n};\n\nexport const AlertDialog = ({\n open,\n group,\n alert,\n status,\n onClose,\n onSubmit,\n}: AlertDialogProps) => {\n const classes = useStyles();\n const [isSubmitDisabled, setSubmitDisabled] = useState(true);\n const formRef = useRef<Maybe<HTMLFormElement>>(null);\n\n useEffect(() => {\n setSubmitDisabled(open);\n }, [open]);\n\n function disableSubmit(isDisabled: boolean) {\n setSubmitDisabled(isDisabled);\n }\n\n function onDialogClose() {\n onClose();\n setSubmitDisabled(true);\n }\n\n const [action, actioned] = choose(\n status,\n [\n ['snooze', 'snoozed'],\n ['accept', 'accepted'],\n ['dismiss', 'dismissed'],\n ],\n ['', ''],\n );\n\n const TransitionProps = {\n mountOnEnter: true,\n unmountOnExit: true,\n onEntered() {\n if (formRef.current) {\n formRef.current.id = DEFAULT_FORM_ID;\n }\n },\n };\n\n const Form = formOf(alert, status);\n\n return (\n <Dialog\n open={open}\n onClose={onDialogClose}\n scroll=\"body\"\n maxWidth=\"lg\"\n TransitionProps={TransitionProps}\n >\n <Box display=\"flex\" justifyContent=\"flex-end\">\n <IconButton\n className={classes.icon}\n disableRipple\n aria-label=\"Close\"\n onClick={onDialogClose}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n <DialogContent className={classes.content}>\n <Box mb={1.5}>\n <Typography variant=\"h5\">\n <b>{capitalize(action)} this action item?</b>\n </Typography>\n <Typography variant=\"h6\" color=\"textSecondary\">\n <b>\n This action item will be {actioned} for all of {group}.\n </b>\n </Typography>\n </Box>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n bgcolor=\"alertBackground\"\n p={2}\n mb={1.5}\n borderRadius={4}\n >\n <Typography>\n <b>{alert?.title}</b>\n </Typography>\n <Typography color=\"textSecondary\">{alert?.subtitle}</Typography>\n </Box>\n {Form && (\n <Form\n ref={formRef}\n alert={alert}\n onSubmit={onSubmit}\n disableSubmit={disableSubmit}\n />\n )}\n </DialogContent>\n <Divider />\n <DialogActions className={classes.actions} disableSpacing>\n {Form ? (\n <Button\n type=\"submit\"\n color=\"primary\"\n variant=\"contained\"\n aria-label={action}\n form={DEFAULT_FORM_ID}\n disabled={isSubmitDisabled}\n >\n {capitalize(action)}\n </Button>\n ) : (\n <Button\n type=\"button\"\n color=\"primary\"\n variant=\"contained\"\n aria-label={action}\n onClick={() => onSubmit(null)}\n >\n {capitalize(action)}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,eAAkB,GAAA,YAAA;AAWjB,MAAM,cAAc,CAAC;AAAA,EAC1B,IAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA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AAA,gCAAA,GAAA,CAAC,UACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,GAAG,EAAA,EAAA,QAAA,EAAA,KAAA,EAAO,OAAM,CACnB,EAAA,CAAA;AAAA,gCACC,GAAA,CAAA,UAAA,EAAA,EAAW,KAAM,EAAA,eAAA,EAAiB,iBAAO,QAAS,EAAA;AAAA;AAAA;AAAA,WACrD;AAAA,UACC,IACC,oBAAA,GAAA;AAAA,YAAC,IAAA;AAAA,YAAA;AAAA,cACC,GAAK,EAAA,OAAA;AAAA,cACL,KAAA;AAAA,cACA,QAAA;AAAA,cACA;AAAA;AAAA;AACF,SAEJ,EAAA,CAAA;AAAA,4BACC,OAAQ,EAAA,EAAA,CAAA;AAAA,4BACR,aAAc,EAAA,EAAA,SAAA,EAAW,QAAQ,OAAS,EAAA,cAAA,EAAc,MACtD,QACC,EAAA,IAAA,mBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,IAAK,EAAA,QAAA;AAAA,YACL,KAAM,EAAA,SAAA;AAAA,YACN,OAAQ,EAAA,WAAA;AAAA,YACR,YAAY,EAAA,MAAA;AAAA,YACZ,IAAM,EAAA,eAAA;AAAA,YACN,QAAU,EAAA,gBAAA;AAAA,YAET,qBAAW,MAAM;AAAA;AAAA,SAGpB,mBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,IAAK,EAAA,QAAA;AAAA,YACL,KAAM,EAAA,SAAA;AAAA,YACN,OAAQ,EAAA,WAAA;AAAA,YACR,YAAY,EAAA,MAAA;AAAA,YACZ,OAAA,EAAS,MAAM,QAAA,CAAS,IAAI,CAAA;AAAA,YAE3B,qBAAW,MAAM;AAAA;AAAA,SAGxB,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
2
3
  import pluralize from 'pluralize';
3
4
  import Box from '@material-ui/core/Box';
4
5
  import Grid from '@material-ui/core/Grid';
@@ -108,49 +109,61 @@ const AlertInsights = ({
108
109
  const total = [accepted, snoozed, dismissed].reduce(sumOfAllAlerts, 0);
109
110
  const isAlertStatusSummaryDisplayed = !!total;
110
111
  const isAlertInsightSectionDisplayed = !!active.length;
111
- return /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "column", spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
112
- AlertInsightsHeader,
113
- {
114
- title: "Your team's action items",
115
- subtitle: isAlertInsightSectionDisplayed ? "This section outlines suggested action items your team can address to improve cloud costs." : "All of your team's action items are hidden. Maybe it's time to give them another look?"
116
- }
117
- )), isAlertInsightSectionDisplayed && /* @__PURE__ */ React.createElement(Grid, { item: true, container: true, direction: "column", spacing: 4 }, active.map((activeAlert, index) => /* @__PURE__ */ React.createElement(Grid, { item: true, key: `alert-insights-section-${index}` }, /* @__PURE__ */ React.createElement(
118
- AlertInsightsSection,
119
- {
120
- alert: activeAlert,
121
- number: index + 1,
122
- onSnooze,
123
- onAccept,
124
- onDismiss
125
- }
126
- )))), isAlertStatusSummaryDisplayed && /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Box, { position: "relative", display: "flex", justifyContent: "flex-end" }, /* @__PURE__ */ React.createElement(ScrollAnchor, { id: ScrollType.AlertSummary }), /* @__PURE__ */ React.createElement(AlertStatusSummaryButton, { onClick: onSummaryButtonClick }, pluralize("Hidden Action Item", total))), /* @__PURE__ */ React.createElement(
127
- AlertStatusSummary,
128
- {
129
- open: isSummaryOpen,
130
- snoozed,
131
- accepted,
132
- dismissed
133
- }
134
- )), /* @__PURE__ */ React.createElement(
135
- AlertDialog,
136
- {
137
- group,
138
- open: isDialogOpen,
139
- alert,
140
- status,
141
- onClose: onDialogClose,
142
- onSubmit: onDialogFormSubmit
143
- }
144
- ), /* @__PURE__ */ React.createElement(
145
- Snackbar,
146
- {
147
- open: isSnackbarOpen,
148
- autoHideDuration: 6e3,
149
- anchorOrigin: { vertical: "top", horizontal: "center" },
150
- onClose: onSnackbarClose
151
- },
152
- /* @__PURE__ */ React.createElement(Alert, { onClose: onSnackbarClose, severity: "error" }, error?.message)
153
- ));
112
+ return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 2, children: [
113
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
114
+ AlertInsightsHeader,
115
+ {
116
+ title: "Your team's action items",
117
+ subtitle: isAlertInsightSectionDisplayed ? "This section outlines suggested action items your team can address to improve cloud costs." : "All of your team's action items are hidden. Maybe it's time to give them another look?"
118
+ }
119
+ ) }),
120
+ isAlertInsightSectionDisplayed && /* @__PURE__ */ jsx(Grid, { item: true, container: true, direction: "column", spacing: 4, children: active.map((activeAlert, index) => /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
121
+ AlertInsightsSection,
122
+ {
123
+ alert: activeAlert,
124
+ number: index + 1,
125
+ onSnooze,
126
+ onAccept,
127
+ onDismiss
128
+ }
129
+ ) }, `alert-insights-section-${index}`)) }),
130
+ isAlertStatusSummaryDisplayed && /* @__PURE__ */ jsxs(Grid, { item: true, children: [
131
+ /* @__PURE__ */ jsxs(Box, { position: "relative", display: "flex", justifyContent: "flex-end", children: [
132
+ /* @__PURE__ */ jsx(ScrollAnchor, { id: ScrollType.AlertSummary }),
133
+ /* @__PURE__ */ jsx(AlertStatusSummaryButton, { onClick: onSummaryButtonClick, children: pluralize("Hidden Action Item", total) })
134
+ ] }),
135
+ /* @__PURE__ */ jsx(
136
+ AlertStatusSummary,
137
+ {
138
+ open: isSummaryOpen,
139
+ snoozed,
140
+ accepted,
141
+ dismissed
142
+ }
143
+ )
144
+ ] }),
145
+ /* @__PURE__ */ jsx(
146
+ AlertDialog,
147
+ {
148
+ group,
149
+ open: isDialogOpen,
150
+ alert,
151
+ status,
152
+ onClose: onDialogClose,
153
+ onSubmit: onDialogFormSubmit
154
+ }
155
+ ),
156
+ /* @__PURE__ */ jsx(
157
+ Snackbar,
158
+ {
159
+ open: isSnackbarOpen,
160
+ autoHideDuration: 6e3,
161
+ anchorOrigin: { vertical: "top", horizontal: "center" },
162
+ onClose: onSnackbarClose,
163
+ children: /* @__PURE__ */ jsx(Alert, { onClose: onSnackbarClose, severity: "error", children: error?.message })
164
+ }
165
+ )
166
+ ] });
154
167
  };
155
168
 
156
169
  export { AlertInsights };