@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.
- package/CHANGELOG.md +18 -0
- package/dist/alerts/ProjectGrowthAlert.esm.js +2 -2
- package/dist/alerts/ProjectGrowthAlert.esm.js.map +1 -1
- package/dist/alerts/UnlabeledDataflowAlert.esm.js +2 -2
- package/dist/alerts/UnlabeledDataflowAlert.esm.js.map +1 -1
- package/dist/components/ActionItems/ActionItemCard.esm.js +3 -3
- package/dist/components/ActionItems/ActionItemCard.esm.js.map +1 -1
- package/dist/components/ActionItems/ActionItems.esm.js +52 -41
- package/dist/components/ActionItems/ActionItems.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertDialog.esm.js +79 -58
- package/dist/components/AlertInsights/AlertDialog.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertInsights.esm.js +57 -44
- package/dist/components/AlertInsights/AlertInsights.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertInsightsHeader.esm.js +10 -2
- package/dist/components/AlertInsights/AlertInsightsHeader.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertInsightsSection.esm.js +42 -34
- package/dist/components/AlertInsights/AlertInsightsSection.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js +23 -12
- package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertStatusSummary.esm.js +63 -55
- package/dist/components/AlertInsights/AlertStatusSummary.esm.js.map +1 -1
- package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js +7 -6
- package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js.map +1 -1
- package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js +23 -17
- package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js.map +1 -1
- package/dist/components/BarChart/BarChart.esm.js +83 -78
- package/dist/components/BarChart/BarChart.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartLabel.esm.js +8 -5
- package/dist/components/BarChart/BarChartLabel.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartLegend.esm.js +20 -16
- package/dist/components/BarChart/BarChartLegend.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartStepper.esm.js +51 -48
- package/dist/components/BarChart/BarChartStepper.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartStepperButton.esm.js +6 -5
- package/dist/components/BarChart/BarChartStepperButton.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartSteps.esm.js +3 -3
- package/dist/components/BarChart/BarChartSteps.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartTick.esm.js +5 -5
- package/dist/components/BarChart/BarChartTick.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartTooltip.esm.js +27 -14
- package/dist/components/BarChart/BarChartTooltip.esm.js.map +1 -1
- package/dist/components/BarChart/BarChartTooltipItem.esm.js +11 -6
- package/dist/components/BarChart/BarChartTooltipItem.esm.js.map +1 -1
- package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js +3 -2
- package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js.map +1 -1
- package/dist/components/CostGrowth/CostGrowth.esm.js +26 -7
- package/dist/components/CostGrowth/CostGrowth.esm.js.map +1 -1
- package/dist/components/CostGrowth/CostGrowthIndicator.esm.js +6 -2
- package/dist/components/CostGrowth/CostGrowthIndicator.esm.js.map +1 -1
- package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js +77 -8
- package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js.map +1 -1
- package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js +16 -10
- package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js.map +1 -1
- package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js +41 -35
- package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js.map +1 -1
- package/dist/components/CostInsightsPage/CostInsightsPage.esm.js +116 -79
- package/dist/components/CostInsightsPage/CostInsightsPage.esm.js.map +1 -1
- package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js +2 -2
- package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js.map +1 -1
- package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js +5 -5
- package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js.map +1 -1
- package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js +58 -51
- package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js.map +1 -1
- package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js +74 -59
- package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js.map +1 -1
- package/dist/components/CostOverviewCard/CostOverviewCard.esm.js +45 -35
- package/dist/components/CostOverviewCard/CostOverviewCard.esm.js.map +1 -1
- package/dist/components/CostOverviewCard/CostOverviewChart.esm.js +86 -73
- package/dist/components/CostOverviewCard/CostOverviewChart.esm.js.map +1 -1
- package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js +11 -6
- package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js.map +1 -1
- package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js +21 -15
- package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js.map +1 -1
- package/dist/components/CurrencySelect/CurrencySelect.esm.js +24 -21
- package/dist/components/CurrencySelect/CurrencySelect.esm.js.map +1 -1
- package/dist/components/EntityCosts/EntityCosts.esm.js +8 -7
- package/dist/components/EntityCosts/EntityCosts.esm.js.map +1 -1
- package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js +65 -20
- package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map +1 -1
- package/dist/components/LegendItem/LegendItem.esm.js +34 -29
- package/dist/components/LegendItem/LegendItem.esm.js.map +1 -1
- package/dist/components/MetricSelect/MetricSelect.esm.js +19 -14
- package/dist/components/MetricSelect/MetricSelect.esm.js.map +1 -1
- package/dist/components/PeriodSelect/PeriodSelect.esm.js +15 -15
- package/dist/components/PeriodSelect/PeriodSelect.esm.js.map +1 -1
- package/dist/components/ProductInsights/ProductInsights.esm.js +12 -8
- package/dist/components/ProductInsights/ProductInsights.esm.js.map +1 -1
- package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js +20 -15
- package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js.map +1 -1
- package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js +9 -9
- package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js.map +1 -1
- package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js +25 -15
- package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js.map +1 -1
- package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js +14 -14
- package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js.map +1 -1
- package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js +43 -35
- package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js.map +1 -1
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js +5 -5
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js.map +1 -1
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js +5 -2
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js.map +1 -1
- package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js +55 -9
- package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js.map +1 -1
- package/dist/components/ProjectSelect/ProjectSelect.esm.js +15 -15
- package/dist/components/ProjectSelect/ProjectSelect.esm.js.map +1 -1
- package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js +12 -9
- package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js.map +1 -1
- package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js +40 -10
- package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js.map +1 -1
- package/dist/example/alerts/KubernetesMigrationAlert.esm.js +10 -3
- package/dist/example/alerts/KubernetesMigrationAlert.esm.js.map +1 -1
- package/dist/example/client.esm.js +1 -1
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js +20 -17
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js.map +1 -1
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js +3 -2
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js.map +1 -1
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js +14 -9
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js.map +1 -1
- package/dist/example/forms/KubernetesMigrationDismissForm.esm.js +21 -17
- package/dist/example/forms/KubernetesMigrationDismissForm.esm.js.map +1 -1
- package/dist/forms/AlertAcceptForm.esm.js +5 -4
- package/dist/forms/AlertAcceptForm.esm.js.map +1 -1
- package/dist/forms/AlertDismissForm.esm.js +47 -38
- package/dist/forms/AlertDismissForm.esm.js.map +1 -1
- package/dist/forms/AlertSnoozeForm.esm.js +20 -16
- package/dist/forms/AlertSnoozeForm.esm.js.map +1 -1
- package/dist/hooks/useConfig.esm.js +3 -2
- package/dist/hooks/useConfig.esm.js.map +1 -1
- package/dist/hooks/useCurrency.esm.js +6 -3
- package/dist/hooks/useCurrency.esm.js.map +1 -1
- package/dist/hooks/useFilters.esm.js +10 -7
- package/dist/hooks/useFilters.esm.js.map +1 -1
- package/dist/hooks/useGroups.esm.js +7 -4
- package/dist/hooks/useGroups.esm.js.map +1 -1
- package/dist/hooks/useLastCompleteBillingDate.esm.js +8 -7
- package/dist/hooks/useLastCompleteBillingDate.esm.js.map +1 -1
- package/dist/hooks/useLoading.esm.js +6 -2
- package/dist/hooks/useLoading.esm.js.map +1 -1
- package/dist/hooks/useScroll.esm.js +6 -3
- package/dist/hooks/useScroll.esm.js.map +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.esm.js +2 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/testUtils/providers.esm.js +3 -3
- package/dist/testUtils/providers.esm.js.map +1 -1
- package/dist/utils/navigation.esm.js +10 -10
- package/dist/utils/navigation.esm.js.map +1 -1
- package/dist/utils/scroll.esm.js +3 -2
- package/dist/utils/scroll.esm.js.map +1 -1
- 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
|
|
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__ */
|
|
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
|
|
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
|
|
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__ */
|
|
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
|
|
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
|
|
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__ */
|
|
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
|
|
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
|
|
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__ */
|
|
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
|
-
|
|
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__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
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}\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,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
|
|
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__ */
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
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 { 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};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AAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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__ */
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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 };
|