@backstage-community/plugin-cost-insights 0.12.25 → 0.12.26
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 +8 -0
- package/dist/alerts/ProjectGrowthAlert.esm.js +24 -0
- package/dist/alerts/ProjectGrowthAlert.esm.js.map +1 -0
- package/dist/alerts/UnlabeledDataflowAlert.esm.js +25 -0
- package/dist/alerts/UnlabeledDataflowAlert.esm.js.map +1 -0
- package/dist/api/CostInsightsApi.esm.js +8 -0
- package/dist/api/CostInsightsApi.esm.js.map +1 -0
- package/dist/components/ActionItems/ActionItemCard.esm.js +46 -0
- package/dist/components/ActionItems/ActionItemCard.esm.js.map +1 -0
- package/dist/components/ActionItems/ActionItems.esm.js +90 -0
- package/dist/components/ActionItems/ActionItems.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertDialog.esm.js +123 -0
- package/dist/components/AlertInsights/AlertDialog.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertInsights.esm.js +157 -0
- package/dist/components/AlertInsights/AlertInsights.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertInsightsHeader.esm.js +17 -0
- package/dist/components/AlertInsights/AlertInsightsHeader.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertInsightsSection.esm.js +57 -0
- package/dist/components/AlertInsights/AlertInsightsSection.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js +30 -0
- package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertStatusSummary.esm.js +93 -0
- package/dist/components/AlertInsights/AlertStatusSummary.esm.js.map +1 -0
- package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js +35 -0
- package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js.map +1 -0
- package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js +47 -0
- package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js.map +1 -0
- package/dist/components/BarChart/BarChart.esm.js +167 -0
- package/dist/components/BarChart/BarChart.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartLabel.esm.js +31 -0
- package/dist/components/BarChart/BarChartLabel.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartLegend.esm.js +47 -0
- package/dist/components/BarChart/BarChartLegend.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartStepper.esm.js +91 -0
- package/dist/components/BarChart/BarChartStepper.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartStepperButton.esm.js +27 -0
- package/dist/components/BarChart/BarChartStepperButton.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartSteps.esm.js +25 -0
- package/dist/components/BarChart/BarChartSteps.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartTick.esm.js +29 -0
- package/dist/components/BarChart/BarChartTick.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartTooltip.esm.js +30 -0
- package/dist/components/BarChart/BarChartTooltip.esm.js.map +1 -0
- package/dist/components/BarChart/BarChartTooltipItem.esm.js +24 -0
- package/dist/components/BarChart/BarChartTooltipItem.esm.js.map +1 -0
- package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js +44 -0
- package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js.map +1 -0
- package/dist/components/CostGrowth/CostGrowth.esm.js +55 -0
- package/dist/components/CostGrowth/CostGrowth.esm.js.map +1 -0
- package/dist/components/CostGrowth/CostGrowthIndicator.esm.js +31 -0
- package/dist/components/CostGrowth/CostGrowthIndicator.esm.js.map +1 -0
- package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js +57 -0
- package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js.map +1 -0
- package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js +35 -0
- package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js.map +1 -0
- package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js +87 -0
- package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js.map +1 -0
- package/dist/components/CostInsightsPage/CostInsightsPage.esm.js +229 -0
- package/dist/components/CostInsightsPage/CostInsightsPage.esm.js.map +1 -0
- package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js +15 -0
- package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js.map +1 -0
- package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js +24 -0
- package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js.map +1 -0
- package/dist/components/CostInsightsPage/index.esm.js +2 -0
- package/dist/components/CostInsightsPage/index.esm.js.map +1 -0
- package/dist/components/CostInsightsPage/selector.esm.js +15 -0
- package/dist/components/CostInsightsPage/selector.esm.js.map +1 -0
- package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js +89 -0
- package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js.map +1 -0
- package/dist/components/CostInsightsTabs/selector.esm.js +17 -0
- package/dist/components/CostInsightsTabs/selector.esm.js.map +1 -0
- package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js +196 -0
- package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js.map +1 -0
- package/dist/components/CostOverviewCard/CostOverviewCard.esm.js +99 -0
- package/dist/components/CostOverviewCard/CostOverviewCard.esm.js.map +1 -0
- package/dist/components/CostOverviewCard/CostOverviewChart.esm.js +157 -0
- package/dist/components/CostOverviewCard/CostOverviewChart.esm.js.map +1 -0
- package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js +25 -0
- package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js.map +1 -0
- package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js +54 -0
- package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js.map +1 -0
- package/dist/components/CostOverviewCard/selector.esm.js +22 -0
- package/dist/components/CostOverviewCard/selector.esm.js.map +1 -0
- package/dist/components/CurrencySelect/CurrencySelect.esm.js +52 -0
- package/dist/components/CurrencySelect/CurrencySelect.esm.js.map +1 -0
- package/dist/{esm/index-BPzWHt3A.esm.js → components/EntityCosts/EntityCosts.esm.js} +14 -80
- package/dist/{esm/index-BPzWHt3A.esm.js.map → components/EntityCosts/EntityCosts.esm.js.map} +1 -1
- package/dist/components/EntityCosts/index.esm.js +2 -0
- package/dist/components/EntityCosts/index.esm.js.map +1 -0
- package/dist/{esm/index-BA6m_qFS.esm.js → components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js} +2 -79
- package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map +1 -0
- package/dist/components/LabelDataflowInstructionsPage/index.esm.js +2 -0
- package/dist/components/LabelDataflowInstructionsPage/index.esm.js.map +1 -0
- package/dist/components/LegendItem/LegendItem.esm.js +44 -0
- package/dist/components/LegendItem/LegendItem.esm.js.map +1 -0
- package/dist/components/MetricSelect/MetricSelect.esm.js +37 -0
- package/dist/components/MetricSelect/MetricSelect.esm.js.map +1 -0
- package/dist/components/PeriodSelect/PeriodSelect.esm.js +72 -0
- package/dist/components/PeriodSelect/PeriodSelect.esm.js.map +1 -0
- package/dist/components/ProductInsights/ProductInsights.esm.js +98 -0
- package/dist/components/ProductInsights/ProductInsights.esm.js.map +1 -0
- package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js +42 -0
- package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js.map +1 -0
- package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js +139 -0
- package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js.map +1 -0
- package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js +83 -0
- package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js.map +1 -0
- package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js +34 -0
- package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js.map +1 -0
- package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js +148 -0
- package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js.map +1 -0
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js +20 -0
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js.map +1 -0
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js +46 -0
- package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js.map +1 -0
- package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js +111 -0
- package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js.map +1 -0
- package/dist/components/ProjectGrowthInstructionsPage/index.esm.js +2 -0
- package/dist/components/ProjectGrowthInstructionsPage/index.esm.js.map +1 -0
- package/dist/components/ProjectSelect/ProjectSelect.esm.js +47 -0
- package/dist/components/ProjectSelect/ProjectSelect.esm.js.map +1 -0
- package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js +41 -0
- package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js.map +1 -0
- package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js +21 -0
- package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js.map +1 -0
- package/dist/example/alerts/KubernetesMigrationAlert.esm.js +86 -0
- package/dist/example/alerts/KubernetesMigrationAlert.esm.js.map +1 -0
- package/dist/example/client.esm.js +194 -0
- package/dist/example/client.esm.js.map +1 -0
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js +33 -0
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js.map +1 -0
- package/dist/{esm/index-BTIHr4n_.esm.js → example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js} +69 -48
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js.map +1 -0
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js +107 -0
- package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js.map +1 -0
- package/dist/example/forms/KubernetesMigrationDismissForm.esm.js +57 -0
- package/dist/example/forms/KubernetesMigrationDismissForm.esm.js.map +1 -0
- package/dist/forms/AlertAcceptForm.esm.js +27 -0
- package/dist/forms/AlertAcceptForm.esm.js.map +1 -0
- package/dist/forms/AlertDismissForm.esm.js +100 -0
- package/dist/forms/AlertDismissForm.esm.js.map +1 -0
- package/dist/forms/AlertSnoozeForm.esm.js +52 -0
- package/dist/forms/AlertSnoozeForm.esm.js.map +1 -0
- package/dist/hooks/useConfig.esm.js +153 -0
- package/dist/hooks/useConfig.esm.js.map +1 -0
- package/dist/hooks/useCurrency.esm.js +26 -0
- package/dist/hooks/useCurrency.esm.js.map +1 -0
- package/dist/hooks/useFilters.esm.js +67 -0
- package/dist/hooks/useFilters.esm.js.map +1 -0
- package/dist/hooks/useGroups.esm.js +55 -0
- package/dist/hooks/useGroups.esm.js.map +1 -0
- package/dist/hooks/useLastCompleteBillingDate.esm.js +65 -0
- package/dist/hooks/useLastCompleteBillingDate.esm.js.map +1 -0
- package/dist/hooks/useLoading.esm.js +54 -0
- package/dist/hooks/useLoading.esm.js.map +1 -0
- package/dist/hooks/useScroll.esm.js +24 -0
- package/dist/hooks/useScroll.esm.js.map +1 -0
- package/dist/index.esm.js +37 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +55 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/testUtils/filters.esm.js +8 -0
- package/dist/testUtils/filters.esm.js.map +1 -0
- package/dist/testUtils/loading.esm.js +14 -0
- package/dist/testUtils/loading.esm.js.map +1 -0
- package/dist/testUtils/mockData.esm.js +485 -0
- package/dist/testUtils/mockData.esm.js.map +1 -0
- package/dist/testUtils/products.esm.js +49 -0
- package/dist/testUtils/products.esm.js.map +1 -0
- package/dist/testUtils/providers.esm.js +41 -0
- package/dist/testUtils/providers.esm.js.map +1 -0
- package/dist/testUtils/testUtils.esm.js +142 -0
- package/dist/testUtils/testUtils.esm.js.map +1 -0
- package/dist/types/Alert.esm.js +66 -0
- package/dist/types/Alert.esm.js.map +1 -0
- package/dist/types/ChangeStatistic.esm.js +15 -0
- package/dist/types/ChangeStatistic.esm.js.map +1 -0
- package/dist/types/CurrencyType.esm.js +10 -0
- package/dist/types/CurrencyType.esm.js.map +1 -0
- package/dist/types/DateFormat.esm.js +4 -0
- package/dist/types/DateFormat.esm.js.map +1 -0
- package/dist/types/Duration.esm.js +10 -0
- package/dist/types/Duration.esm.js.map +1 -0
- package/dist/types/Icon.esm.js +12 -0
- package/dist/types/Icon.esm.js.map +1 -0
- package/dist/utils/alerts.esm.js +72 -0
- package/dist/utils/alerts.esm.js.map +1 -0
- package/dist/utils/assert.esm.js +29 -0
- package/dist/utils/assert.esm.js.map +1 -0
- package/dist/utils/change.esm.js +58 -0
- package/dist/utils/change.esm.js.map +1 -0
- package/dist/utils/charts.esm.js +9 -0
- package/dist/utils/charts.esm.js.map +1 -0
- package/dist/utils/config.esm.js +19 -0
- package/dist/utils/config.esm.js.map +1 -0
- package/dist/utils/currency.esm.js +56 -0
- package/dist/utils/currency.esm.js.map +1 -0
- package/dist/utils/duration.esm.js +55 -0
- package/dist/utils/duration.esm.js.map +1 -0
- package/dist/utils/filters.esm.js +14 -0
- package/dist/utils/filters.esm.js.map +1 -0
- package/dist/utils/formatters.esm.js +103 -0
- package/dist/utils/formatters.esm.js.map +1 -0
- package/dist/utils/grammar.esm.js +14 -0
- package/dist/utils/grammar.esm.js.map +1 -0
- package/dist/utils/graphs.esm.js +48 -0
- package/dist/utils/graphs.esm.js.map +1 -0
- package/dist/utils/history.esm.js +32 -0
- package/dist/utils/history.esm.js.map +1 -0
- package/dist/utils/loading.esm.js +51 -0
- package/dist/utils/loading.esm.js.map +1 -0
- package/dist/utils/navigation.esm.js +56 -0
- package/dist/utils/navigation.esm.js.map +1 -0
- package/dist/utils/scroll.esm.js +38 -0
- package/dist/utils/scroll.esm.js.map +1 -0
- package/dist/utils/sort.esm.js +10 -0
- package/dist/utils/sort.esm.js.map +1 -0
- package/dist/utils/styles.esm.js +562 -0
- package/dist/utils/styles.esm.js.map +1 -0
- package/dist/utils/sum.esm.js +4 -0
- package/dist/utils/sum.esm.js.map +1 -0
- package/package.json +17 -12
- package/dist/esm/index-BA6m_qFS.esm.js.map +0 -1
- package/dist/esm/index-BFM2mP6Z.esm.js +0 -4084
- package/dist/esm/index-BFM2mP6Z.esm.js.map +0 -1
- package/dist/esm/index-BTIHr4n_.esm.js.map +0 -1
- package/dist/esm/index-DaitkcPN.esm.js +0 -1136
- package/dist/esm/index-DaitkcPN.esm.js.map +0 -1
- package/dist/esm/selector-D7iXJwd9.esm.js +0 -594
- package/dist/esm/selector-D7iXJwd9.esm.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const mapFiltersToProps = ({
|
|
2
|
+
pageFilters,
|
|
3
|
+
setPageFilters
|
|
4
|
+
}) => ({
|
|
5
|
+
...pageFilters,
|
|
6
|
+
project: pageFilters.project || "all",
|
|
7
|
+
setDuration: (duration) => setPageFilters({
|
|
8
|
+
...pageFilters,
|
|
9
|
+
duration
|
|
10
|
+
}),
|
|
11
|
+
setProject: (project) => setPageFilters({
|
|
12
|
+
...pageFilters,
|
|
13
|
+
project: project === "all" ? null : project
|
|
14
|
+
}),
|
|
15
|
+
setMetric: (metric) => setPageFilters({
|
|
16
|
+
...pageFilters,
|
|
17
|
+
metric
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export { mapFiltersToProps };
|
|
22
|
+
//# sourceMappingURL=selector.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.esm.js","sources":["../../../src/components/CostOverviewCard/selector.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 { Duration, PageFilters } from '../../types';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\nimport { MapFiltersToProps } from '../../hooks/useFilters';\n\ntype CostOverviewFilterProps = PageFilters & {\n setDuration: (duration: Duration) => void;\n setProject: (project: Maybe<string>) => void;\n setMetric: (metric: Maybe<string>) => void;\n};\n\nexport const mapFiltersToProps: MapFiltersToProps<CostOverviewFilterProps> = ({\n pageFilters,\n setPageFilters,\n}) => ({\n ...pageFilters,\n project: pageFilters.project || 'all',\n setDuration: (duration: Duration) =>\n setPageFilters({\n ...pageFilters,\n duration,\n }),\n setProject: (project: Maybe<string>) =>\n setPageFilters({\n ...pageFilters,\n project: project === 'all' ? null : project,\n }),\n setMetric: (metric: Maybe<string>) =>\n setPageFilters({\n ...pageFilters,\n metric: metric,\n }),\n});\n"],"names":[],"mappings":"AAyBO,MAAM,oBAAgE,CAAC;AAAA,EAC5E,WAAA;AAAA,EACA,cAAA;AACF,CAAO,MAAA;AAAA,EACL,GAAG,WAAA;AAAA,EACH,OAAA,EAAS,YAAY,OAAW,IAAA,KAAA;AAAA,EAChC,WAAA,EAAa,CAAC,QAAA,KACZ,cAAe,CAAA;AAAA,IACb,GAAG,WAAA;AAAA,IACH,QAAA;AAAA,GACD,CAAA;AAAA,EACH,UAAA,EAAY,CAAC,OAAA,KACX,cAAe,CAAA;AAAA,IACb,GAAG,WAAA;AAAA,IACH,OAAA,EAAS,OAAY,KAAA,KAAA,GAAQ,IAAO,GAAA,OAAA;AAAA,GACrC,CAAA;AAAA,EACH,SAAA,EAAW,CAAC,MAAA,KACV,cAAe,CAAA;AAAA,IACb,GAAG,WAAA;AAAA,IACH,MAAA;AAAA,GACD,CAAA;AACL,CAAA;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import InputLabel from '@material-ui/core/InputLabel';
|
|
3
|
+
import Select from '@material-ui/core/Select';
|
|
4
|
+
import FormControl from '@material-ui/core/FormControl';
|
|
5
|
+
import MenuItem from '@material-ui/core/MenuItem';
|
|
6
|
+
import Typography from '@material-ui/core/Typography';
|
|
7
|
+
import { findAlways } from '../../utils/assert.esm.js';
|
|
8
|
+
import { useSelectStyles } from '../../utils/styles.esm.js';
|
|
9
|
+
|
|
10
|
+
const NULL_VALUE = "engineers";
|
|
11
|
+
const CurrencySelect = ({
|
|
12
|
+
currency,
|
|
13
|
+
currencies,
|
|
14
|
+
onSelect
|
|
15
|
+
}) => {
|
|
16
|
+
const classes = useSelectStyles();
|
|
17
|
+
const getOption = (value) => {
|
|
18
|
+
const kind = value === NULL_VALUE ? null : value;
|
|
19
|
+
return findAlways(currencies, (c) => c.kind === kind);
|
|
20
|
+
};
|
|
21
|
+
const handleOnChange = (e) => {
|
|
22
|
+
const option = getOption(e.target.value);
|
|
23
|
+
onSelect(option);
|
|
24
|
+
};
|
|
25
|
+
const renderValue = (value) => {
|
|
26
|
+
const option = getOption(value);
|
|
27
|
+
return /* @__PURE__ */ React.createElement("b", null, option.label);
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ React.createElement(FormControl, { variant: "outlined" }, /* @__PURE__ */ React.createElement(InputLabel, { shrink: true }, "Convert to:"), /* @__PURE__ */ React.createElement(
|
|
30
|
+
Select,
|
|
31
|
+
{
|
|
32
|
+
className: classes.select,
|
|
33
|
+
variant: "outlined",
|
|
34
|
+
labelWidth: 100,
|
|
35
|
+
onChange: handleOnChange,
|
|
36
|
+
value: currency.kind || NULL_VALUE,
|
|
37
|
+
renderValue
|
|
38
|
+
},
|
|
39
|
+
currencies.map((c) => /* @__PURE__ */ React.createElement(
|
|
40
|
+
MenuItem,
|
|
41
|
+
{
|
|
42
|
+
className: classes.menuItem,
|
|
43
|
+
key: c.kind || NULL_VALUE,
|
|
44
|
+
value: c.kind || NULL_VALUE
|
|
45
|
+
},
|
|
46
|
+
/* @__PURE__ */ React.createElement(Typography, { component: "span", role: "img", "aria-label": c.label }, c.label)
|
|
47
|
+
))
|
|
48
|
+
));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { CurrencySelect };
|
|
52
|
+
//# sourceMappingURL=CurrencySelect.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencySelect.esm.js","sources":["../../../src/components/CurrencySelect/CurrencySelect.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 InputLabel from '@material-ui/core/InputLabel';\nimport Select, { SelectProps } from '@material-ui/core/Select';\nimport FormControl from '@material-ui/core/FormControl';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport { Currency, CurrencyType } from '../../types';\nimport { findAlways } from '../../utils/assert';\nimport { useSelectStyles as useStyles } from '../../utils/styles';\n\nconst NULL_VALUE = 'engineers';\n\ntype CurrencySelectProps = {\n currency: Currency;\n currencies: Currency[];\n onSelect: (currency: Currency) => void;\n};\n\nexport const CurrencySelect = ({\n currency,\n currencies,\n onSelect,\n}: CurrencySelectProps) => {\n const classes = useStyles();\n\n const getOption = (value: unknown) => {\n const kind = (value === NULL_VALUE ? null : value) as CurrencyType;\n return findAlways(currencies, c => c.kind === kind);\n };\n\n const handleOnChange: SelectProps['onChange'] = e => {\n const option = getOption(e.target.value);\n onSelect(option);\n };\n\n const renderValue: SelectProps['renderValue'] = value => {\n const option = getOption(value);\n return <b>{option.label}</b>;\n };\n\n return (\n <FormControl variant=\"outlined\">\n <InputLabel shrink>Convert to:</InputLabel>\n <Select\n className={classes.select}\n variant=\"outlined\"\n labelWidth={100}\n onChange={handleOnChange}\n value={currency.kind || NULL_VALUE}\n renderValue={renderValue}\n >\n {currencies.map((c: Currency) => (\n <MenuItem\n className={classes.menuItem}\n key={c.kind || NULL_VALUE}\n value={c.kind || NULL_VALUE}\n >\n <Typography component=\"span\" role=\"img\" aria-label={c.label}>\n {c.label}\n </Typography>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;AA0BA,MAAM,UAAa,GAAA,WAAA,CAAA;AAQZ,MAAM,iBAAiB,CAAC;AAAA,EAC7B,QAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AACF,CAA2B,KAAA;AACzB,EAAA,MAAM,UAAUA,eAAU,EAAA,CAAA;AAE1B,EAAM,MAAA,SAAA,GAAY,CAAC,KAAmB,KAAA;AACpC,IAAM,MAAA,IAAA,GAAQ,KAAU,KAAA,UAAA,GAAa,IAAO,GAAA,KAAA,CAAA;AAC5C,IAAA,OAAO,UAAW,CAAA,UAAA,EAAY,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,IAAI,CAAA,CAAA;AAAA,GACpD,CAAA;AAEA,EAAA,MAAM,iBAA0C,CAAK,CAAA,KAAA;AACnD,IAAA,MAAM,MAAS,GAAA,SAAA,CAAU,CAAE,CAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AACvC,IAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,GACjB,CAAA;AAEA,EAAA,MAAM,cAA0C,CAAS,KAAA,KAAA;AACvD,IAAM,MAAA,MAAA,GAAS,UAAU,KAAK,CAAA,CAAA;AAC9B,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,GAAG,EAAA,IAAA,EAAA,MAAA,CAAO,KAAM,CAAA,CAAA;AAAA,GAC1B,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,OAAQ,EAAA,UAAA,EAAA,sCAClB,UAAW,EAAA,EAAA,MAAA,EAAM,IAAC,EAAA,EAAA,aAAW,CAC9B,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,MAAA;AAAA,MACnB,OAAQ,EAAA,UAAA;AAAA,MACR,UAAY,EAAA,GAAA;AAAA,MACZ,QAAU,EAAA,cAAA;AAAA,MACV,KAAA,EAAO,SAAS,IAAQ,IAAA,UAAA;AAAA,MACxB,WAAA;AAAA,KAAA;AAAA,IAEC,UAAA,CAAW,GAAI,CAAA,CAAC,CACf,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAQ,CAAA,QAAA;AAAA,QACnB,GAAA,EAAK,EAAE,IAAQ,IAAA,UAAA;AAAA,QACf,KAAA,EAAO,EAAE,IAAQ,IAAA,UAAA;AAAA,OAAA;AAAA,sBAEjB,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,IAAA,EAAK,OAAM,YAAY,EAAA,CAAA,CAAE,KACnD,EAAA,EAAA,CAAA,CAAE,KACL,CAAA;AAAA,KAEH,CAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,87 +1,21 @@
|
|
|
1
1
|
import React, { useCallback, useState, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CostOverviewCard } from '../CostOverviewCard/CostOverviewCard.esm.js';
|
|
3
|
+
import { ConfigProvider } from '../../hooks/useConfig.esm.js';
|
|
4
|
+
import { CurrencyProvider } from '../../hooks/useCurrency.esm.js';
|
|
5
|
+
import { FilterProvider, useFilters } from '../../hooks/useFilters.esm.js';
|
|
6
|
+
import { GroupsProvider } from '../../hooks/useGroups.esm.js';
|
|
7
|
+
import { LoadingProvider, useLoading } from '../../hooks/useLoading.esm.js';
|
|
8
|
+
import { ScrollProvider } from '../../hooks/useScroll.esm.js';
|
|
9
|
+
import { BillingDateProvider, useLastCompleteBillingDate } from '../../hooks/useLastCompleteBillingDate.esm.js';
|
|
10
|
+
import { CostInsightsThemeProvider } from '../CostInsightsPage/CostInsightsThemeProvider.esm.js';
|
|
4
11
|
import { WarningPanel, Progress } from '@backstage/core-components';
|
|
5
12
|
import Alert from '@material-ui/lab/Alert';
|
|
13
|
+
import { mapLoadingToProps } from '../CostInsightsPage/selector.esm.js';
|
|
14
|
+
import { intervalsOf } from '../../utils/duration.esm.js';
|
|
15
|
+
import { costInsightsApiRef } from '../../api/CostInsightsApi.esm.js';
|
|
6
16
|
import { useApi } from '@backstage/core-plugin-api';
|
|
7
17
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
8
18
|
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
9
|
-
import '@material-ui/core/Box';
|
|
10
|
-
import '@material-ui/core/utils';
|
|
11
|
-
import '@material-ui/core/Card';
|
|
12
|
-
import '@material-ui/core/CardContent';
|
|
13
|
-
import '@material-ui/core/Divider';
|
|
14
|
-
import '@material-ui/core/Tab';
|
|
15
|
-
import '@material-ui/core/Tabs';
|
|
16
|
-
import '@material-ui/core/styles';
|
|
17
|
-
import 'luxon';
|
|
18
|
-
import 'recharts';
|
|
19
|
-
import '@material-ui/core/Typography';
|
|
20
|
-
import '@material-ui/core/Paper';
|
|
21
|
-
import '@material-ui/core/Slide';
|
|
22
|
-
import '@material-ui/icons/ChevronLeft';
|
|
23
|
-
import '@material-ui/icons/ChevronRight';
|
|
24
|
-
import '@material-ui/core/ButtonBase';
|
|
25
|
-
import 'pluralize';
|
|
26
|
-
import '@material-ui/core/Tooltip';
|
|
27
|
-
import '@material-ui/icons/Lens';
|
|
28
|
-
import '@material-ui/icons/HelpOutlineOutlined';
|
|
29
|
-
import 'classnames';
|
|
30
|
-
import '@material-ui/icons/ArrowDropUp';
|
|
31
|
-
import '@material-ui/icons/ArrowDropDown';
|
|
32
|
-
import '@material-ui/core/styles/colorManipulator';
|
|
33
|
-
import '@material-ui/icons/Fullscreen';
|
|
34
|
-
import '@material-ui/core/InputLabel';
|
|
35
|
-
import '@material-ui/core/FormControl';
|
|
36
|
-
import '@material-ui/core/Select';
|
|
37
|
-
import '@material-ui/core/MenuItem';
|
|
38
|
-
import '@material-ui/core/Avatar';
|
|
39
|
-
import '@material-ui/core/IconButton';
|
|
40
|
-
import '@material-ui/core/Badge';
|
|
41
|
-
import '@material-ui/icons/AccessTime';
|
|
42
|
-
import '@material-ui/icons/Check';
|
|
43
|
-
import '@material-ui/icons/Delete';
|
|
44
|
-
import '@material-ui/core/CardHeader';
|
|
45
|
-
import '@material-ui/icons/MonetizationOn';
|
|
46
|
-
import '@material-ui/icons/Whatshot';
|
|
47
|
-
import '@material-ui/icons/Settings';
|
|
48
|
-
import '@material-ui/icons/AccountTree';
|
|
49
|
-
import '@material-ui/icons/Storage';
|
|
50
|
-
import '@material-ui/icons/Search';
|
|
51
|
-
import '@material-ui/icons/CloudQueue';
|
|
52
|
-
import '@material-ui/icons/School';
|
|
53
|
-
import '@material-ui/icons/ViewHeadline';
|
|
54
|
-
import 'react-router-dom';
|
|
55
|
-
import 'qs';
|
|
56
|
-
import 'yup';
|
|
57
|
-
import '@material-ui/core/Backdrop';
|
|
58
|
-
import '@material-ui/core/CircularProgress';
|
|
59
|
-
import '@material-ui/core/Grid';
|
|
60
|
-
import '@material-ui/core/Snackbar';
|
|
61
|
-
import '@material-ui/core/Button';
|
|
62
|
-
import '@material-ui/core/Dialog';
|
|
63
|
-
import '@material-ui/core/DialogActions';
|
|
64
|
-
import '@material-ui/core/DialogContent';
|
|
65
|
-
import '@material-ui/icons/Close';
|
|
66
|
-
import '@material-ui/core/Checkbox';
|
|
67
|
-
import '@material-ui/core/FormControlLabel';
|
|
68
|
-
import '@material-ui/core/RadioGroup';
|
|
69
|
-
import '@material-ui/core/Radio';
|
|
70
|
-
import '@material-ui/core/Collapse';
|
|
71
|
-
import '@material-ui/core/TextField';
|
|
72
|
-
import '@material-ui/icons/ExpandMore';
|
|
73
|
-
import '@material-ui/core/Container';
|
|
74
|
-
import 'react-use/esm/useCopyToClipboard';
|
|
75
|
-
import '@material-ui/icons/AssignmentOutlined';
|
|
76
|
-
import '@material-ui/icons/AssignmentTurnedInOutlined';
|
|
77
|
-
import '@material-ui/icons/SentimentVeryDissatisfied';
|
|
78
|
-
import 'react-use/esm/useAsync';
|
|
79
|
-
import '@material-ui/core/Menu';
|
|
80
|
-
import '@material-ui/core/MenuList';
|
|
81
|
-
import '@material-ui/core/ListItemIcon';
|
|
82
|
-
import '@material-ui/core/ListItemText';
|
|
83
|
-
import '@material-ui/core/FormGroup';
|
|
84
|
-
import 'regression';
|
|
85
19
|
|
|
86
20
|
const EntityCostsCard = () => {
|
|
87
21
|
const client = useApi(costInsightsApiRef);
|
|
@@ -165,5 +99,5 @@ const EntityCosts = () => {
|
|
|
165
99
|
return /* @__PURE__ */ React.createElement(CostInsightsThemeProvider, null, /* @__PURE__ */ React.createElement(ConfigProvider, null, /* @__PURE__ */ React.createElement(LoadingProvider, null, /* @__PURE__ */ React.createElement(GroupsProvider, null, /* @__PURE__ */ React.createElement(BillingDateProvider, null, /* @__PURE__ */ React.createElement(FilterProvider, null, /* @__PURE__ */ React.createElement(ScrollProvider, null, /* @__PURE__ */ React.createElement(CurrencyProvider, null, /* @__PURE__ */ React.createElement(EntityCostsCard, null)))))))));
|
|
166
100
|
};
|
|
167
101
|
|
|
168
|
-
export { EntityCosts };
|
|
169
|
-
//# sourceMappingURL=
|
|
102
|
+
export { EntityCosts, EntityCostsCard };
|
|
103
|
+
//# sourceMappingURL=EntityCosts.esm.js.map
|
package/dist/{esm/index-BPzWHt3A.esm.js.map → components/EntityCosts/EntityCosts.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"EntityCosts.esm.js","sources":["../../../src/components/EntityCosts/EntityCosts.tsx"],"sourcesContent":["/*\n * Copyright 2022 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, { useCallback, useEffect, useState } from 'react';\nimport { CostOverviewCard } from '../CostOverviewCard';\nimport {\n BillingDateProvider,\n ConfigProvider,\n CurrencyProvider,\n FilterProvider,\n GroupsProvider,\n LoadingProvider,\n ScrollProvider,\n useFilters,\n useLastCompleteBillingDate,\n useLoading,\n} from '../../hooks';\nimport { CostInsightsThemeProvider } from '../CostInsightsPage/CostInsightsThemeProvider';\nimport { Progress, WarningPanel } from '@backstage/core-components';\nimport { default as MaterialAlert } from '@material-ui/lab/Alert';\nimport { mapLoadingToProps } from '../CostInsightsPage/selector';\nimport { intervalsOf } from '../../utils/duration';\nimport { costInsightsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { Cost, Maybe } from '@backstage-community/plugin-cost-insights-common';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\nexport const EntityCostsCard = () => {\n const client = useApi(costInsightsApiRef);\n const { entity } = useEntity();\n\n const {\n loadingActions,\n loadingGroups,\n loadingBillingDate,\n loadingInitial,\n dispatchInitial,\n dispatchInsights,\n dispatchNone,\n } = useLoading(mapLoadingToProps);\n\n /* eslint-disable react-hooks/exhaustive-deps */\n // The dispatchLoading functions are derived from loading state using mapLoadingToProps, to\n // provide nicer props for the component. These are re-derived whenever loading state changes,\n // which causes an infinite loop as product panels load and re-trigger the useEffect below.\n // Since the functions don't change, we can memoize - but we trigger the same loop if we satisfy\n // exhaustive-deps by including the function itself in dependencies.\n\n const dispatchLoadingInitial = useCallback(dispatchInitial, []);\n const dispatchLoadingInsights = useCallback(dispatchInsights, []);\n const dispatchLoadingNone = useCallback(dispatchNone, []);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n const lastCompleteBillingDate = useLastCompleteBillingDate();\n const [dailyCost, setDailyCost] = useState<Maybe<Cost>>(null);\n const [error, setError] = useState<Maybe<Error>>(null);\n const { pageFilters } = useFilters(p => p);\n\n useEffect(() => {\n async function getInsights() {\n setError(null);\n try {\n dispatchLoadingInsights(true);\n const intervals = intervalsOf(\n pageFilters.duration,\n lastCompleteBillingDate,\n );\n\n const fetchedDailyCost = await client.getCatalogEntityDailyCost!(\n stringifyEntityRef(entity),\n intervals,\n );\n setDailyCost(fetchedDailyCost);\n } catch (e) {\n setError(e);\n dispatchLoadingNone(loadingActions);\n } finally {\n dispatchLoadingNone(loadingActions);\n dispatchLoadingInitial(false);\n dispatchLoadingInsights(false);\n }\n }\n\n // Wait for metadata to finish loading\n if (!loadingBillingDate) {\n getInsights();\n }\n }, [\n client,\n entity,\n pageFilters,\n loadingActions,\n loadingGroups,\n loadingBillingDate,\n dispatchLoadingInsights,\n dispatchLoadingInitial,\n dispatchLoadingNone,\n lastCompleteBillingDate,\n ]);\n\n if (loadingInitial) {\n return <Progress />;\n }\n\n if (error) {\n return <MaterialAlert severity=\"error\">{error.message}</MaterialAlert>;\n }\n\n if (!dailyCost || !dailyCost.aggregation.length) {\n return <MaterialAlert severity=\"error\">No daily costs</MaterialAlert>;\n }\n\n return <CostOverviewCard dailyCostData={dailyCost} metricData={null} />;\n};\n\nexport const EntityCosts = () => {\n const client = useApi(costInsightsApiRef);\n\n if (!client.getCatalogEntityDailyCost) {\n return (\n <WarningPanel\n title=\"Could display costs for entity\"\n message=\"The getCatalogEntityDailyCost() method is not implemented by the costInsightsApi.\"\n />\n );\n }\n\n return (\n <CostInsightsThemeProvider>\n <ConfigProvider>\n <LoadingProvider>\n <GroupsProvider>\n <BillingDateProvider>\n <FilterProvider>\n <ScrollProvider>\n <CurrencyProvider>\n <EntityCostsCard />\n </CurrencyProvider>\n </ScrollProvider>\n </FilterProvider>\n </BillingDateProvider>\n </GroupsProvider>\n </LoadingProvider>\n </ConfigProvider>\n </CostInsightsThemeProvider>\n );\n};\n"],"names":["MaterialAlert"],"mappings":";;;;;;;;;;;;;;;;;;;AAyCO,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA,MAAA,GAAS,OAAO,kBAAkB,CAAA,CAAA;AACxC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAM,MAAA;AAAA,IACJ,cAAA;AAAA,IACA,aAAA;AAAA,IACA,kBAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,GACF,GAAI,WAAW,iBAAiB,CAAA,CAAA;AAShC,EAAA,MAAM,sBAAyB,GAAA,WAAA,CAAY,eAAiB,EAAA,EAAE,CAAA,CAAA;AAC9D,EAAA,MAAM,uBAA0B,GAAA,WAAA,CAAY,gBAAkB,EAAA,EAAE,CAAA,CAAA;AAChE,EAAA,MAAM,mBAAsB,GAAA,WAAA,CAAY,YAAc,EAAA,EAAE,CAAA,CAAA;AAGxD,EAAA,MAAM,0BAA0B,0BAA2B,EAAA,CAAA;AAC3D,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAsB,IAAI,CAAA,CAAA;AAC5D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAuB,IAAI,CAAA,CAAA;AACrD,EAAA,MAAM,EAAE,WAAA,EAAgB,GAAA,UAAA,CAAW,OAAK,CAAC,CAAA,CAAA;AAEzC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,eAAe,WAAc,GAAA;AAC3B,MAAA,QAAA,CA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CAAU,YAAY,MAAQ,EAAA;AAC/C,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAAA,KAAA,EAAA,EAAc,QAAS,EAAA,OAAA,EAAA,EAAQ,gBAAc,CAAA,CAAA;AAAA,GACvD;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,aAAe,EAAA,SAAA,EAAW,YAAY,IAAM,EAAA,CAAA,CAAA;AACvE,EAAA;AAEO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,MAAA,GAAS,OAAO,kBAAkB,CAAA,CAAA;AAExC,EAAI,IAAA,CAAC,OAAO,yBAA2B,EAAA;AACrC,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,gCAAA;AAAA,QACN,OAAQ,EAAA,mFAAA;AAAA,OAAA;AAAA,KACV,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,yBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,uCACE,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,sCACE,cACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,IAAA,CACnB,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,85 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Box from '@material-ui/core/Box';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
|
-
import {
|
|
4
|
+
import { AlertInstructionsLayout } from '../AlertInstructionsLayout/AlertInstructionsLayout.esm.js';
|
|
5
5
|
import { Link, CodeSnippet } from '@backstage/core-components';
|
|
6
|
-
import '@backstage/core-plugin-api';
|
|
7
|
-
import 'pluralize';
|
|
8
|
-
import '@material-ui/core/styles';
|
|
9
|
-
import '@material-ui/core/Avatar';
|
|
10
|
-
import '@material-ui/core/Tooltip';
|
|
11
|
-
import '@material-ui/core/IconButton';
|
|
12
|
-
import '@material-ui/core/Badge';
|
|
13
|
-
import '@material-ui/core/Paper';
|
|
14
|
-
import '@material-ui/core/Divider';
|
|
15
|
-
import '@material-ui/icons/AccessTime';
|
|
16
|
-
import '@material-ui/icons/Check';
|
|
17
|
-
import '@material-ui/icons/Delete';
|
|
18
|
-
import 'classnames';
|
|
19
|
-
import '@material-ui/core/Card';
|
|
20
|
-
import '@material-ui/core/CardHeader';
|
|
21
|
-
import '@material-ui/icons/MonetizationOn';
|
|
22
|
-
import '@material-ui/icons/Whatshot';
|
|
23
|
-
import '@material-ui/icons/Settings';
|
|
24
|
-
import '@material-ui/icons/AccountTree';
|
|
25
|
-
import '@material-ui/icons/Storage';
|
|
26
|
-
import '@material-ui/icons/Search';
|
|
27
|
-
import '@material-ui/icons/CloudQueue';
|
|
28
|
-
import '@material-ui/icons/School';
|
|
29
|
-
import '@material-ui/icons/ViewHeadline';
|
|
30
|
-
import '@material-ui/lab/Alert';
|
|
31
|
-
import 'react-router-dom';
|
|
32
|
-
import 'qs';
|
|
33
|
-
import 'yup';
|
|
34
|
-
import '@material-ui/core/Backdrop';
|
|
35
|
-
import '@material-ui/core/CircularProgress';
|
|
36
|
-
import 'luxon';
|
|
37
|
-
import '@material-ui/core/styles/colorManipulator';
|
|
38
|
-
import '@backstage/catalog-model';
|
|
39
|
-
import '@material-ui/core/Grid';
|
|
40
|
-
import '@material-ui/core/Snackbar';
|
|
41
|
-
import '@material-ui/core/utils';
|
|
42
|
-
import '@material-ui/core/Button';
|
|
43
|
-
import '@material-ui/core/Dialog';
|
|
44
|
-
import '@material-ui/core/DialogActions';
|
|
45
|
-
import '@material-ui/core/DialogContent';
|
|
46
|
-
import '@material-ui/icons/Close';
|
|
47
|
-
import '@material-ui/core/Checkbox';
|
|
48
|
-
import '@material-ui/core/FormControl';
|
|
49
|
-
import '@material-ui/core/FormControlLabel';
|
|
50
|
-
import '@material-ui/core/RadioGroup';
|
|
51
|
-
import '@material-ui/core/Radio';
|
|
52
|
-
import '@material-ui/core/Collapse';
|
|
53
|
-
import '@material-ui/core/TextField';
|
|
54
|
-
import '@material-ui/icons/ExpandMore';
|
|
55
|
-
import '@material-ui/core/Container';
|
|
56
|
-
import '@material-ui/icons/ChevronLeft';
|
|
57
|
-
import 'recharts';
|
|
58
|
-
import '@material-ui/core/Slide';
|
|
59
|
-
import '@material-ui/icons/ChevronRight';
|
|
60
|
-
import '@material-ui/core/ButtonBase';
|
|
61
|
-
import '@material-ui/icons/Lens';
|
|
62
|
-
import '@material-ui/icons/HelpOutlineOutlined';
|
|
63
|
-
import 'react-use/esm/useCopyToClipboard';
|
|
64
|
-
import '@material-ui/icons/AssignmentOutlined';
|
|
65
|
-
import '@material-ui/icons/AssignmentTurnedInOutlined';
|
|
66
|
-
import '@material-ui/icons/SentimentVeryDissatisfied';
|
|
67
|
-
import '@material-ui/icons/ArrowDropUp';
|
|
68
|
-
import '@material-ui/icons/ArrowDropDown';
|
|
69
|
-
import 'react-use/esm/useAsync';
|
|
70
|
-
import '@material-ui/core/Menu';
|
|
71
|
-
import '@material-ui/core/MenuItem';
|
|
72
|
-
import '@material-ui/core/Tab';
|
|
73
|
-
import '@material-ui/core/Tabs';
|
|
74
|
-
import '@material-ui/core/MenuList';
|
|
75
|
-
import '@material-ui/core/ListItemIcon';
|
|
76
|
-
import '@material-ui/core/ListItemText';
|
|
77
|
-
import '@material-ui/core/InputLabel';
|
|
78
|
-
import '@material-ui/core/Select';
|
|
79
|
-
import '@material-ui/core/CardContent';
|
|
80
|
-
import '@material-ui/icons/Fullscreen';
|
|
81
|
-
import '@material-ui/core/FormGroup';
|
|
82
|
-
import 'regression';
|
|
83
6
|
|
|
84
7
|
const LabelDataflowInstructionsPage = () => {
|
|
85
8
|
return /* @__PURE__ */ React.createElement(AlertInstructionsLayout, { title: "Investigating Growth" }, /* @__PURE__ */ React.createElement(Typography, { variant: "h1" }, "Labeling Dataflow Jobs"), /* @__PURE__ */ React.createElement(Typography, { paragraph: true }, "Labels in Google Cloud Platform are key-value pairs that can be added to most types of cloud resources. Since these labels are also exported in billing data, adding labels allows a granular breakdown of cloud cost by software entity."), /* @__PURE__ */ React.createElement(Typography, { paragraph: true }, "In Cloud Dataflow, labels can be added to a job either programmatically or via the command-line when launching a job. Note that GCP has", " ", /* @__PURE__ */ React.createElement(Link, { to: "https://cloud.google.com/compute/docs/labeling-resources#restrictions" }, "restrictions"), " ", "on the length and characters that can be used in labels."), /* @__PURE__ */ React.createElement(Typography, { paragraph: true }, "Labels are not retroactive, so cost tracking is only possible from when the labels are first added to a Dataflow job."), /* @__PURE__ */ React.createElement(Box, { mt: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h3" }, "DataflowPipelineOptions"), /* @__PURE__ */ React.createElement(Typography, { paragraph: true }, "Dataflow jobs using Beam's", " ", /* @__PURE__ */ React.createElement(Link, { to: "https://beam.apache.org/releases/javadoc/2.3.0/org/apache/beam/runners/dataflow/options/DataflowPipelineOptions.html" }, "DataflowPipelineOptions"), " ", "directly can use the ", /* @__PURE__ */ React.createElement("b", null, "setLabels"), " function to add one or more labels:", /* @__PURE__ */ React.createElement(
|
|
@@ -106,4 +29,4 @@ sc.optionsAs[DataflowPipelineOptions].setLabels(Map("job-id" -> "my-dataflow-job
|
|
|
106
29
|
};
|
|
107
30
|
|
|
108
31
|
export { LabelDataflowInstructionsPage };
|
|
109
|
-
//# sourceMappingURL=
|
|
32
|
+
//# sourceMappingURL=LabelDataflowInstructionsPage.esm.js.map
|
package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelDataflowInstructionsPage.esm.js","sources":["../../../src/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.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 Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { AlertInstructionsLayout } from '../AlertInstructionsLayout';\nimport { CodeSnippet, Link } from '@backstage/core-components';\n\nexport const LabelDataflowInstructionsPage = () => {\n return (\n <AlertInstructionsLayout title=\"Investigating Growth\">\n <Typography variant=\"h1\">Labeling Dataflow Jobs</Typography>\n <Typography paragraph>\n Labels in Google Cloud Platform are key-value pairs that can be added to\n most types of cloud resources. Since these labels are also exported in\n billing data, adding labels allows a granular breakdown of cloud cost by\n software entity.\n </Typography>\n <Typography paragraph>\n In Cloud Dataflow, labels can be added to a job either programmatically\n or via the command-line when launching a job. Note that GCP has{' '}\n <Link to=\"https://cloud.google.com/compute/docs/labeling-resources#restrictions\">\n restrictions\n </Link>{' '}\n on the length and characters that can be used in labels.\n </Typography>\n <Typography paragraph>\n Labels are not retroactive, so cost tracking is only possible from when\n the labels are first added to a Dataflow job.\n </Typography>\n\n <Box mt={4}>\n <Typography variant=\"h3\">DataflowPipelineOptions</Typography>\n <Typography paragraph>\n Dataflow jobs using Beam's{' '}\n <Link to=\"https://beam.apache.org/releases/javadoc/2.3.0/org/apache/beam/runners/dataflow/options/DataflowPipelineOptions.html\">\n DataflowPipelineOptions\n </Link>{' '}\n directly can use the <b>setLabels</b> function to add one or more\n labels:\n <CodeSnippet\n language=\"java\"\n text={`private DataflowPipelineOptions options = PipelineOptionsFactory.fromArgs(args).as(DataflowPipelineOptionsImpl.class); \noptions.setLabels(ImmutableMap.of(\"job-id\", \"my-dataflow-job\"));`}\n />\n </Typography>\n <Typography paragraph>\n Dataflow jobs using Scio can similarly set options on the ScioContext:\n <CodeSnippet\n language=\"scala\"\n text={`val (sc: ScioContext, args: Args) = ContextAndArgs(cmdLineArgs)\nsc.optionsAs[DataflowPipelineOptions].setLabels(Map(\"job-id\" -> \"my-dataflow-job\").asJava)`}\n />\n </Typography>\n </Box>\n\n <Box mt={4}>\n <Typography variant=\"h3\">Command-line</Typography>\n <Typography paragraph>\n Dataflow jobs launched from the command-line can add labels as an\n argument:\n <CodeSnippet\n language=\"shell\"\n text={`--labels={\"job-id\": \"my-dataflow-job\", \"date-argument\": \"2020-09-16\"}`}\n />\n </Typography>\n <Typography paragraph>\n For more information on specifying options, see the{' '}\n <Link to=\"https://cloud.google.com/dataflow/docs/guides/specifying-exec-params\">\n Dataflow documentation\n </Link>{' '}\n or{' '}\n <Link to=\"https://spotify.github.io/scio/api/com/spotify/scio/ScioContext.html\">\n Scio Scaladoc\n </Link>\n .\n </Typography>\n </Box>\n </AlertInstructionsLayout>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,gCAAgC,MAAM;AACjD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,KAAM,EAAA,sBAAA,EAAA,kBAC5B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAA,EAAK,wBAAsB,CAAA,kBAC9C,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAS,IAAC,EAAA,EAAA,2OAKtB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UA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,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,QAAK,cAAY,CAAA,sCACpC,UAAW,EAAA,EAAA,SAAA,EAAS,QAAC,6EAGpB,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,QAAS,EAAA,OAAA;AAAA,MACT,IAAM,EAAA,CAAA,qEAAA,CAAA;AAAA,KAAA;AAAA,GAEV,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAS,QAAC,qDACgC,EAAA,GAAA,kBACnD,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,EAAG,EAAA,sEAAA,EAAA,EAAuE,wBAEhF,CAAQ,EAAA,GAAA,EAAI,IACT,EAAA,GAAA,kBACF,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,EAAG,EAAA,sEAAA,EAAA,EAAuE,eAEhF,CAAA,EAAO,GAET,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Box from '@material-ui/core/Box';
|
|
3
|
+
import Typography from '@material-ui/core/Typography';
|
|
4
|
+
import Tooltip from '@material-ui/core/Tooltip';
|
|
5
|
+
import LensIcon from '@material-ui/icons/Lens';
|
|
6
|
+
import HelpOutlineOutlinedIcon from '@material-ui/icons/HelpOutlineOutlined';
|
|
7
|
+
import { useCostGrowthLegendStyles } from '../../utils/styles.esm.js';
|
|
8
|
+
|
|
9
|
+
const LegendItem = (props) => {
|
|
10
|
+
const { title, tooltipText, markerColor, children } = props;
|
|
11
|
+
const classes = useCostGrowthLegendStyles();
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Box, { display: "flex", flexDirection: "column" }, /* @__PURE__ */ React.createElement(
|
|
13
|
+
Box,
|
|
14
|
+
{
|
|
15
|
+
minHeight: 25,
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "row",
|
|
18
|
+
alignItems: "center"
|
|
19
|
+
},
|
|
20
|
+
markerColor && /* @__PURE__ */ React.createElement("div", { className: classes.marker }, /* @__PURE__ */ React.createElement(LensIcon, { style: { fontSize: "1em", fill: markerColor } })),
|
|
21
|
+
/* @__PURE__ */ React.createElement(Typography, { className: classes.title, variant: "overline" }, title),
|
|
22
|
+
tooltipText && /* @__PURE__ */ React.createElement(
|
|
23
|
+
Tooltip,
|
|
24
|
+
{
|
|
25
|
+
classes: { tooltip: classes.tooltip },
|
|
26
|
+
title: /* @__PURE__ */ React.createElement(Typography, { className: classes.tooltipText }, tooltipText),
|
|
27
|
+
placement: "top-start"
|
|
28
|
+
},
|
|
29
|
+
/* @__PURE__ */ React.createElement(
|
|
30
|
+
Typography,
|
|
31
|
+
{
|
|
32
|
+
component: "span",
|
|
33
|
+
role: "img",
|
|
34
|
+
"aria-label": "help",
|
|
35
|
+
className: classes.helpIcon
|
|
36
|
+
},
|
|
37
|
+
/* @__PURE__ */ React.createElement(HelpOutlineOutlinedIcon, { fontSize: "small" })
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
), /* @__PURE__ */ React.createElement(Box, { marginLeft: markerColor ? "1.5em" : 0 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.h5, variant: "h5" }, children)));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { LegendItem };
|
|
44
|
+
//# sourceMappingURL=LegendItem.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendItem.esm.js","sources":["../../../src/components/LegendItem/LegendItem.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, { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport LensIcon from '@material-ui/icons/Lens';\nimport HelpOutlineOutlinedIcon from '@material-ui/icons/HelpOutlineOutlined';\nimport { useCostGrowthLegendStyles } from '../../utils/styles';\n\n/** @public */\nexport type LegendItemProps = {\n title: string;\n tooltipText?: string;\n markerColor?: string;\n};\n\n/** @public */\nexport const LegendItem = (props: PropsWithChildren<LegendItemProps>) => {\n const { title, tooltipText, markerColor, children } = props;\n\n const classes = useCostGrowthLegendStyles();\n\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <Box\n minHeight={25}\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n >\n {markerColor && (\n <div className={classes.marker}>\n <LensIcon style={{ fontSize: '1em', fill: markerColor }} />\n </div>\n )}\n <Typography className={classes.title} variant=\"overline\">\n {title}\n </Typography>\n {tooltipText && (\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n title={\n <Typography className={classes.tooltipText}>\n {tooltipText}\n </Typography>\n }\n placement=\"top-start\"\n >\n <Typography\n component=\"span\"\n role=\"img\"\n aria-label=\"help\"\n className={classes.helpIcon}\n >\n <HelpOutlineOutlinedIcon fontSize=\"small\" />\n </Typography>\n </Tooltip>\n )}\n </Box>\n <Box marginLeft={markerColor ? '1.5em' : 0}>\n <Typography className={classes.h5} variant=\"h5\">\n {children}\n </Typography>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAgCa,MAAA,UAAA,GAAa,CAAC,KAA8C,KAAA;AACvE,EAAA,MAAM,EAAE,KAAA,EAAO,WAAa,EAAA,WAAA,EAAa,UAAa,GAAA,KAAA,CAAA;AAEtD,E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A,KACF;AAAA,qBAGH,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,UAAY,EAAA,WAAA,GAAc,UAAU,CACvC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAW,QAAQ,EAAI,EAAA,OAAA,EAAQ,IACxC,EAAA,EAAA,QACH,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import InputLabel from '@material-ui/core/InputLabel';
|
|
3
|
+
import FormControl from '@material-ui/core/FormControl';
|
|
4
|
+
import Select from '@material-ui/core/Select';
|
|
5
|
+
import MenuItem from '@material-ui/core/MenuItem';
|
|
6
|
+
import { useSelectStyles } from '../../utils/styles.esm.js';
|
|
7
|
+
|
|
8
|
+
const MetricSelect = ({
|
|
9
|
+
metric,
|
|
10
|
+
metrics,
|
|
11
|
+
onSelect
|
|
12
|
+
}) => {
|
|
13
|
+
const classes = useSelectStyles();
|
|
14
|
+
function onChange(e) {
|
|
15
|
+
if (e.target.value === "none") {
|
|
16
|
+
onSelect(null);
|
|
17
|
+
} else {
|
|
18
|
+
onSelect(e.target.value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ React.createElement(FormControl, { variant: "outlined" }, /* @__PURE__ */ React.createElement(InputLabel, { shrink: true, id: "metric-select-label" }, "Compare to:"), /* @__PURE__ */ React.createElement(
|
|
22
|
+
Select,
|
|
23
|
+
{
|
|
24
|
+
id: "metric-select",
|
|
25
|
+
labelId: "metric-select-label",
|
|
26
|
+
labelWidth: 100,
|
|
27
|
+
className: classes.select,
|
|
28
|
+
value: metric ?? "none",
|
|
29
|
+
onChange
|
|
30
|
+
},
|
|
31
|
+
/* @__PURE__ */ React.createElement(MenuItem, { className: classes.menuItem, key: "none", value: "none" }, /* @__PURE__ */ React.createElement("em", null, "None")),
|
|
32
|
+
metrics.map((m) => /* @__PURE__ */ React.createElement(MenuItem, { className: classes.menuItem, key: m.kind, value: m.kind }, /* @__PURE__ */ React.createElement("b", null, m.name)))
|
|
33
|
+
));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { MetricSelect };
|
|
37
|
+
//# sourceMappingURL=MetricSelect.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetricSelect.esm.js","sources":["../../../src/components/MetricSelect/MetricSelect.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 InputLabel from '@material-ui/core/InputLabel';\nimport FormControl from '@material-ui/core/FormControl';\nimport Select from '@material-ui/core/Select';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport {\n Maybe,\n Metric,\n} from '@backstage-community/plugin-cost-insights-common';\nimport { useSelectStyles as useStyles } from '../../utils/styles';\n\nexport type MetricSelectProps = {\n metric: Maybe<string>;\n metrics: Array<Metric>;\n onSelect: (metric: Maybe<string>) => void;\n};\n\nexport const MetricSelect = ({\n metric,\n metrics,\n onSelect,\n}: MetricSelectProps) => {\n const classes = useStyles();\n\n function onChange(e: React.ChangeEvent<{ value: unknown }>) {\n if (e.target.value === 'none') {\n onSelect(null);\n } else {\n onSelect(e.target.value as string);\n }\n }\n\n return (\n <FormControl variant=\"outlined\">\n <InputLabel shrink id=\"metric-select-label\">\n Compare to:\n </InputLabel>\n <Select\n id=\"metric-select\"\n labelId=\"metric-select-label\"\n labelWidth={100}\n className={classes.select}\n value={metric ?? 'none'}\n onChange={onChange}\n >\n <MenuItem className={classes.menuItem} key=\"none\" value=\"none\">\n <em>None</em>\n </MenuItem>\n {metrics.map((m: Metric) => (\n <MenuItem className={classes.menuItem} key={m.kind} value={m.kind}>\n <b>{m.name}</b>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;AAiCO,MAAM,eAAe,CAAC;AAAA,EAC3B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AACF,CAAyB,KAAA;AACvB,EAAA,MAAM,UAAUA,eAAU,EAAA,CAAA;AAE1B,EAAA,SAAS,SAAS,CAA0C,EAAA;AAC1D,IAAI,IAAA,CAAA,CAAE,MAAO,CAAA,KAAA,KAAU,MAAQ,EAAA;AAC7B,MAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,KACR,MAAA;AACL,MAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAe,CAAA,CAAA;AAAA,KACnC;AAAA,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,OAAA,EAAQ,UACnB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,MAAA,EAAM,IAAC,EAAA,EAAA,EAAG,qBAAsB,EAAA,EAAA,aAE5C,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,eAAA;AAAA,MACH,OAAQ,EAAA,qBAAA;AAAA,MACR,UAAY,EAAA,GAAA;AAAA,MACZ,WAAW,OAAQ,CAAA,MAAA;AAAA,MACnB,OAAO,MAAU,IAAA,MAAA;AAAA,MACjB,QAAA;AAAA,KAAA;AAAA,oBAEC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,OAAA,CAAQ,QAAU,EAAA,GAAA,EAAI,MAAO,EAAA,KAAA,EAAM,MACtD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAG,EAAA,IAAA,EAAA,MAAI,CACV,CAAA;AAAA,IACC,OAAA,CAAQ,IAAI,CAAC,CAAA,yCACX,QAAS,EAAA,EAAA,SAAA,EAAW,QAAQ,QAAU,EAAA,GAAA,EAAK,EAAE,IAAM,EAAA,KAAA,EAAO,EAAE,IAC3D,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAG,CAAE,CAAA,IAAK,CACb,CACD,CAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MenuItem from '@material-ui/core/MenuItem';
|
|
3
|
+
import Select from '@material-ui/core/Select';
|
|
4
|
+
import '../../types/Alert.esm.js';
|
|
5
|
+
import { Duration } from '../../types/Duration.esm.js';
|
|
6
|
+
import { formatLastTwoLookaheadQuarters } from '../../utils/formatters.esm.js';
|
|
7
|
+
import { findAlways } from '../../utils/assert.esm.js';
|
|
8
|
+
import { useSelectStyles } from '../../utils/styles.esm.js';
|
|
9
|
+
import '../../hooks/useConfig.esm.js';
|
|
10
|
+
import '../../hooks/useCurrency.esm.js';
|
|
11
|
+
import '../../hooks/useFilters.esm.js';
|
|
12
|
+
import '../../hooks/useGroups.esm.js';
|
|
13
|
+
import '../../hooks/useLoading.esm.js';
|
|
14
|
+
import '../../hooks/useScroll.esm.js';
|
|
15
|
+
import { useLastCompleteBillingDate } from '../../hooks/useLastCompleteBillingDate.esm.js';
|
|
16
|
+
|
|
17
|
+
function getDefaultOptions(lastCompleteBillingDate) {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
value: Duration.P90D,
|
|
21
|
+
label: "Past 6 Months"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: Duration.P30D,
|
|
25
|
+
label: "Past 60 Days"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: Duration.P3M,
|
|
29
|
+
label: formatLastTwoLookaheadQuarters(lastCompleteBillingDate)
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
const PeriodSelect = ({
|
|
34
|
+
duration,
|
|
35
|
+
onSelect,
|
|
36
|
+
options
|
|
37
|
+
}) => {
|
|
38
|
+
const classes = useSelectStyles();
|
|
39
|
+
const lastCompleteBillingDate = useLastCompleteBillingDate();
|
|
40
|
+
const optionsOrDefault = options ?? getDefaultOptions(lastCompleteBillingDate);
|
|
41
|
+
const handleOnChange = (e) => {
|
|
42
|
+
onSelect(e.target.value);
|
|
43
|
+
};
|
|
44
|
+
const renderValue = (value) => {
|
|
45
|
+
const option = findAlways(optionsOrDefault, (o) => o.value === value);
|
|
46
|
+
return /* @__PURE__ */ React.createElement("b", null, option.label);
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ React.createElement(
|
|
49
|
+
Select,
|
|
50
|
+
{
|
|
51
|
+
className: classes.select,
|
|
52
|
+
variant: "outlined",
|
|
53
|
+
onChange: handleOnChange,
|
|
54
|
+
value: duration,
|
|
55
|
+
renderValue,
|
|
56
|
+
"data-testid": "period-select"
|
|
57
|
+
},
|
|
58
|
+
optionsOrDefault.map((option) => /* @__PURE__ */ React.createElement(
|
|
59
|
+
MenuItem,
|
|
60
|
+
{
|
|
61
|
+
className: classes.menuItem,
|
|
62
|
+
key: option.value,
|
|
63
|
+
value: option.value,
|
|
64
|
+
"data-testid": `period-select-option-${option.value}`
|
|
65
|
+
},
|
|
66
|
+
option.label
|
|
67
|
+
))
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { PeriodSelect, getDefaultOptions };
|
|
72
|
+
//# sourceMappingURL=PeriodSelect.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeriodSelect.esm.js","sources":["../../../src/components/PeriodSelect/PeriodSelect.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 MenuItem from '@material-ui/core/MenuItem';\nimport Select, { SelectProps } from '@material-ui/core/Select';\nimport { Duration } from '../../types';\nimport { formatLastTwoLookaheadQuarters } from '../../utils/formatters';\nimport { findAlways } from '../../utils/assert';\nimport { useSelectStyles as useStyles } from '../../utils/styles';\nimport { useLastCompleteBillingDate } from '../../hooks';\n\nexport type PeriodOption = {\n value: Duration;\n label: string;\n};\n\nexport function getDefaultOptions(\n lastCompleteBillingDate: string,\n): PeriodOption[] {\n return [\n {\n value: Duration.P90D,\n label: 'Past 6 Months',\n },\n {\n value: Duration.P30D,\n label: 'Past 60 Days',\n },\n {\n value: Duration.P3M,\n label: formatLastTwoLookaheadQuarters(lastCompleteBillingDate),\n },\n ];\n}\n\ntype PeriodSelectProps = {\n duration: Duration;\n onSelect: (duration: Duration) => void;\n options?: PeriodOption[];\n};\n\nexport const PeriodSelect = ({\n duration,\n onSelect,\n options,\n}: PeriodSelectProps) => {\n const classes = useStyles();\n const lastCompleteBillingDate = useLastCompleteBillingDate();\n const optionsOrDefault =\n options ?? getDefaultOptions(lastCompleteBillingDate);\n\n const handleOnChange: SelectProps['onChange'] = e => {\n onSelect(e.target.value as Duration);\n };\n\n const renderValue: SelectProps['renderValue'] = value => {\n const option = findAlways(optionsOrDefault, o => o.value === value);\n return <b>{option.label}</b>;\n };\n\n return (\n <Select\n className={classes.select}\n variant=\"outlined\"\n onChange={handleOnChange}\n value={duration}\n renderValue={renderValue}\n data-testid=\"period-select\"\n >\n {optionsOrDefault.map(option => (\n <MenuItem\n className={classes.menuItem}\n key={option.value}\n value={option.value}\n data-testid={`period-select-option-${option.value}`}\n >\n {option.label}\n </MenuItem>\n ))}\n </Select>\n );\n};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