@backstage-community/plugin-cost-insights 0.15.2 → 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 +11 -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
|
@@ -1,31 +1,76 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Box from '@material-ui/core/Box';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import { AlertInstructionsLayout } from '../AlertInstructionsLayout/AlertInstructionsLayout.esm.js';
|
|
5
5
|
import { Link, CodeSnippet } from '@backstage/core-components';
|
|
6
6
|
|
|
7
7
|
const LabelDataflowInstructionsPage = () => {
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
return /* @__PURE__ */ jsxs(AlertInstructionsLayout, { title: "Investigating Growth", children: [
|
|
9
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h1", children: "Labeling Dataflow Jobs" }),
|
|
10
|
+
/* @__PURE__ */ jsx(Typography, { paragraph: true, children: "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." }),
|
|
11
|
+
/* @__PURE__ */ jsxs(Typography, { paragraph: true, children: [
|
|
12
|
+
"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",
|
|
13
|
+
" ",
|
|
14
|
+
/* @__PURE__ */ jsx(Link, { to: "https://cloud.google.com/compute/docs/labeling-resources#restrictions", children: "restrictions" }),
|
|
15
|
+
" ",
|
|
16
|
+
"on the length and characters that can be used in labels."
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsx(Typography, { paragraph: true, children: "Labels are not retroactive, so cost tracking is only possible from when the labels are first added to a Dataflow job." }),
|
|
19
|
+
/* @__PURE__ */ jsxs(Box, { mt: 4, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", children: "DataflowPipelineOptions" }),
|
|
21
|
+
/* @__PURE__ */ jsxs(Typography, { paragraph: true, children: [
|
|
22
|
+
"Dataflow jobs using Beam's",
|
|
23
|
+
" ",
|
|
24
|
+
/* @__PURE__ */ jsx(Link, { to: "https://beam.apache.org/releases/javadoc/2.3.0/org/apache/beam/runners/dataflow/options/DataflowPipelineOptions.html", children: "DataflowPipelineOptions" }),
|
|
25
|
+
" ",
|
|
26
|
+
"directly can use the ",
|
|
27
|
+
/* @__PURE__ */ jsx("b", { children: "setLabels" }),
|
|
28
|
+
" function to add one or more labels:",
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
CodeSnippet,
|
|
31
|
+
{
|
|
32
|
+
language: "java",
|
|
33
|
+
text: `private DataflowPipelineOptions options = PipelineOptionsFactory.fromArgs(args).as(DataflowPipelineOptionsImpl.class);
|
|
13
34
|
options.setLabels(ImmutableMap.of("job-id", "my-dataflow-job"));`
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ jsxs(Typography, { paragraph: true, children: [
|
|
39
|
+
"Dataflow jobs using Scio can similarly set options on the ScioContext:",
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
CodeSnippet,
|
|
42
|
+
{
|
|
43
|
+
language: "scala",
|
|
44
|
+
text: `val (sc: ScioContext, args: Args) = ContextAndArgs(cmdLineArgs)
|
|
20
45
|
sc.optionsAs[DataflowPipelineOptions].setLabels(Map("job-id" -> "my-dataflow-job").asJava)`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsxs(Box, { mt: 4, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", children: "Command-line" }),
|
|
52
|
+
/* @__PURE__ */ jsxs(Typography, { paragraph: true, children: [
|
|
53
|
+
"Dataflow jobs launched from the command-line can add labels as an argument:",
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
CodeSnippet,
|
|
56
|
+
{
|
|
57
|
+
language: "shell",
|
|
58
|
+
text: `--labels={"job-id": "my-dataflow-job", "date-argument": "2020-09-16"}`
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ jsxs(Typography, { paragraph: true, children: [
|
|
63
|
+
"For more information on specifying options, see the",
|
|
64
|
+
" ",
|
|
65
|
+
/* @__PURE__ */ jsx(Link, { to: "https://cloud.google.com/dataflow/docs/guides/specifying-exec-params", children: "Dataflow documentation" }),
|
|
66
|
+
" ",
|
|
67
|
+
"or",
|
|
68
|
+
" ",
|
|
69
|
+
/* @__PURE__ */ jsx(Link, { to: "https://spotify.github.io/scio/api/com/spotify/scio/ScioContext.html", children: "Scio Scaladoc" }),
|
|
70
|
+
"."
|
|
71
|
+
] })
|
|
72
|
+
] })
|
|
73
|
+
] });
|
|
29
74
|
};
|
|
30
75
|
|
|
31
76
|
export { LabelDataflowInstructionsPage };
|
package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map
CHANGED
|
@@ -1 +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
|
|
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 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":";;;;;;AAqBO,MAAM,gCAAgC,MAAM;AACjD,EACE,uBAAA,IAAA,CAAC,uBAAwB,EAAA,EAAA,KAAA,EAAM,sBAC7B,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,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';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
@@ -9,35 +9,40 @@ import { useCostGrowthLegendStyles } from '../../utils/styles.esm.js';
|
|
|
9
9
|
const LegendItem = (props) => {
|
|
10
10
|
const { title, tooltipText, markerColor, children } = props;
|
|
11
11
|
const classes = useCostGrowthLegendStyles();
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
|
|
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,
|
|
12
|
+
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", children: [
|
|
13
|
+
/* @__PURE__ */ jsxs(
|
|
14
|
+
Box,
|
|
24
15
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
16
|
+
minHeight: 25,
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "row",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
children: [
|
|
21
|
+
markerColor && /* @__PURE__ */ jsx("div", { className: classes.marker, children: /* @__PURE__ */ jsx(LensIcon, { style: { fontSize: "1em", fill: markerColor } }) }),
|
|
22
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.title, variant: "overline", children: title }),
|
|
23
|
+
tooltipText && /* @__PURE__ */ jsx(
|
|
24
|
+
Tooltip,
|
|
25
|
+
{
|
|
26
|
+
classes: { tooltip: classes.tooltip },
|
|
27
|
+
title: /* @__PURE__ */ jsx(Typography, { className: classes.tooltipText, children: tooltipText }),
|
|
28
|
+
placement: "top-start",
|
|
29
|
+
children: /* @__PURE__ */ jsx(
|
|
30
|
+
Typography,
|
|
31
|
+
{
|
|
32
|
+
component: "span",
|
|
33
|
+
role: "img",
|
|
34
|
+
"aria-label": "help",
|
|
35
|
+
className: classes.helpIcon,
|
|
36
|
+
children: /* @__PURE__ */ jsx(HelpOutlineOutlinedIcon, { fontSize: "small" })
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(Box, { marginLeft: markerColor ? "1.5em" : 0, children: /* @__PURE__ */ jsx(Typography, { className: classes.h5, variant: "h5", children }) })
|
|
45
|
+
] });
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
export { LegendItem };
|
|
@@ -1 +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
|
|
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 { 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,EAA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,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA;AAAA;AAAA;AAC5C;AAAA;AACF;AAAA;AAAA,KAEJ;AAAA,oBACC,GAAA,CAAA,GAAA,EAAA,EAAI,UAAY,EAAA,WAAA,GAAc,UAAU,CACvC,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,EAAA,EAAI,OAAQ,EAAA,IAAA,EACxC,UACH,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import InputLabel from '@material-ui/core/InputLabel';
|
|
3
3
|
import FormControl from '@material-ui/core/FormControl';
|
|
4
4
|
import Select from '@material-ui/core/Select';
|
|
@@ -18,19 +18,24 @@ const MetricSelect = ({
|
|
|
18
18
|
onSelect(e.target.value);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
return /* @__PURE__ */ jsxs(FormControl, { variant: "outlined", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(InputLabel, { shrink: true, id: "metric-select-label", children: "Compare to:" }),
|
|
23
|
+
/* @__PURE__ */ jsxs(
|
|
24
|
+
Select,
|
|
25
|
+
{
|
|
26
|
+
id: "metric-select",
|
|
27
|
+
labelId: "metric-select-label",
|
|
28
|
+
labelWidth: 100,
|
|
29
|
+
className: classes.select,
|
|
30
|
+
value: metric ?? "none",
|
|
31
|
+
onChange,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(MenuItem, { className: classes.menuItem, value: "none", children: /* @__PURE__ */ jsx("em", { children: "None" }) }, "none"),
|
|
34
|
+
metrics.map((m) => /* @__PURE__ */ jsx(MenuItem, { className: classes.menuItem, value: m.kind, children: /* @__PURE__ */ jsx("b", { children: m.name }) }, m.kind))
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] });
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
export { MetricSelect };
|
|
@@ -1 +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
|
|
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 type { ChangeEvent } 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: 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;AACF,CAAyB,KAAA;AACvB,EAAA,MAAM,UAAUA,eAAU,EAAA;AAE1B,EAAA,SAAS,SAAS,CAAoC,EAAA;AACpD,IAAI,IAAA,CAAA,CAAE,MAAO,CAAA,KAAA,KAAU,MAAQ,EAAA;AAC7B,MAAA,QAAA,CAAS,IAAI,CAAA;AAAA,KACR,MAAA;AACL,MAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAe,CAAA;AAAA;AACnC;AAGF,EACE,uBAAA,IAAA,CAAC,WAAY,EAAA,EAAA,OAAA,EAAQ,UACnB,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,MAAA,EAAM,IAAC,EAAA,EAAA,EAAG,uBAAsB,QAE5C,EAAA,aAAA,EAAA,CAAA;AAAA,oBACA,IAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,eAAA;AAAA,QACH,OAAQ,EAAA,qBAAA;AAAA,QACR,UAAY,EAAA,GAAA;AAAA,QACZ,WAAW,OAAQ,CAAA,MAAA;AAAA,QACnB,OAAO,MAAU,IAAA,MAAA;AAAA,QACjB,QAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAC,GAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,OAAA,CAAQ,QAAqB,EAAA,KAAA,EAAM,QACtD,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAG,QAAI,EAAA,MAAA,EAAA,CAAA,EAAA,EADiC,MAE3C,CAAA;AAAA,UACC,QAAQ,GAAI,CAAA,CAAC,sBACX,GAAA,CAAA,QAAA,EAAA,EAAS,WAAW,OAAQ,CAAA,QAAA,EAAuB,OAAO,CAAE,CAAA,IAAA,EAC3D,8BAAC,GAAG,EAAA,EAAA,QAAA,EAAA,CAAA,CAAE,MAAK,CAD+B,EAAA,EAAA,CAAA,CAAE,IAE9C,CACD;AAAA;AAAA;AAAA;AACH,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
3
3
|
import Select from '@material-ui/core/Select';
|
|
4
4
|
import '../../types/Alert.esm.js';
|
|
@@ -43,9 +43,9 @@ const PeriodSelect = ({
|
|
|
43
43
|
};
|
|
44
44
|
const renderValue = (value) => {
|
|
45
45
|
const option = findAlways(optionsOrDefault, (o) => o.value === value);
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx("b", { children: option.label });
|
|
47
47
|
};
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
49
|
Select,
|
|
50
50
|
{
|
|
51
51
|
className: classes.select,
|
|
@@ -53,18 +53,18 @@ const PeriodSelect = ({
|
|
|
53
53
|
onChange: handleOnChange,
|
|
54
54
|
value: duration,
|
|
55
55
|
renderValue,
|
|
56
|
-
"data-testid": "period-select"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
"data-testid": "period-select",
|
|
57
|
+
children: optionsOrDefault.map((option) => /* @__PURE__ */ jsx(
|
|
58
|
+
MenuItem,
|
|
59
|
+
{
|
|
60
|
+
className: classes.menuItem,
|
|
61
|
+
value: option.value,
|
|
62
|
+
"data-testid": `period-select-option-${option.value}`,
|
|
63
|
+
children: option.label
|
|
64
|
+
},
|
|
65
|
+
option.value
|
|
66
|
+
))
|
|
67
|
+
}
|
|
68
68
|
);
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -1 +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
|
|
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 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};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;AA6BO,SAAS,kBACd,uBACgB,EAAA;AAChB,EAAO,OAAA;AAAA,IACL;AAAA,M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O,MAAO,CAAA,KAAA;AAAA,UACd,aAAA,EAAa,CAAwB,qBAAA,EAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAAA,UAEhD,QAAO,EAAA,MAAA,CAAA;AAAA,SAAA;AAAA,QAJH,MAAO,CAAA;AAAA,OAMf;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
3
|
import Box from '@material-ui/core/Box';
|
|
3
4
|
import Typography from '@material-ui/core/Typography';
|
|
4
5
|
import Alert from '@material-ui/lab/Alert';
|
|
@@ -85,13 +86,16 @@ const ProductInsights = ({
|
|
|
85
86
|
},
|
|
86
87
|
[initialStates, onLoaded]
|
|
87
88
|
);
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
return /* @__PURE__ */ jsxs(Box, { px: 3, py: 6, children: [
|
|
90
|
+
/* @__PURE__ */ jsx(Box, { mt: 0, mb: 5, textAlign: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, children: "Your team's product usage" }) }),
|
|
91
|
+
error ? /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.message }) : /* @__PURE__ */ jsx(
|
|
92
|
+
ProductInsightsCardList,
|
|
93
|
+
{
|
|
94
|
+
initialStates,
|
|
95
|
+
onSelectAsync: onSelectAsyncMemo
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] });
|
|
95
99
|
};
|
|
96
100
|
|
|
97
101
|
export { ProductInsights };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductInsights.esm.js","sources":["../../../src/components/ProductInsights/ProductInsights.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":"ProductInsights.esm.js","sources":["../../../src/components/ProductInsights/ProductInsights.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 { useCallback, useEffect, useRef, useState } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { default as Alert } from '@material-ui/lab/Alert';\nimport { costInsightsApiRef } from '../../api';\nimport { ProductInsightsCardList } from '../ProductInsightsCard/ProductInsightsCardList';\nimport { Duration } from '../../types';\nimport {\n Entity,\n Maybe,\n Product,\n} from '@backstage-community/plugin-cost-insights-common';\nimport { intervalsOf, DEFAULT_DURATION } from '../../utils/duration';\nimport {\n DefaultLoadingAction,\n initialStatesOf,\n settledResponseOf,\n ProductState,\n} from '../../utils/loading';\nimport { totalAggregationSort } from '../../utils/sort';\nimport {\n useLoading,\n useLastCompleteBillingDate,\n MapLoadingToProps,\n} from '../../hooks';\nimport { useApi } from '@backstage/core-plugin-api';\n\ntype LoadingProps = (isLoading: boolean) => void;\n\nconst mapLoadingToProps: MapLoadingToProps<LoadingProps> =\n ({ dispatch }) =>\n (isLoading: boolean) =>\n dispatch({ [DefaultLoadingAction.CostInsightsProducts]: isLoading });\n\ntype ProductInsightsProps = {\n group: string;\n project: Maybe<string>;\n products: Product[];\n onLoaded: (entities: Product[]) => void;\n};\n\nexport const ProductInsights = ({\n group,\n project,\n products,\n onLoaded,\n}: ProductInsightsProps) => {\n const client = useApi(costInsightsApiRef);\n const onceRef = useRef(false);\n const [initialStates, setStates] = useState<ProductState[]>([]);\n const [error, setError] = useState<Maybe<Error>>(null);\n const lastCompleteBillingDate = useLastCompleteBillingDate();\n const dispatchLoading = useLoading(mapLoadingToProps);\n\n /* eslint-disable react-hooks/exhaustive-deps */\n // See @CostInsightsPage\n const dispatchLoadingProducts = useCallback(dispatchLoading, []);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n const onSelectAsyncMemo = useCallback(\n async function onSelectAsync(\n product: Product,\n duration: Duration,\n ): Promise<Entity> {\n return client.getProductInsights({\n group: group,\n project: project,\n product: product.kind,\n intervals: intervalsOf(duration, lastCompleteBillingDate),\n });\n },\n [client, group, project, lastCompleteBillingDate],\n );\n\n useEffect(() => {\n async function getAllProductInsights() {\n try {\n dispatchLoadingProducts(true);\n const responses = await Promise.allSettled(\n products.map(product =>\n client.getProductInsights({\n group: group,\n project: project,\n product: product.kind,\n intervals: intervalsOf(DEFAULT_DURATION, lastCompleteBillingDate),\n }),\n ),\n ).then(settledResponseOf);\n\n const updatedInitialStates = initialStatesOf(products, responses).sort(\n totalAggregationSort,\n );\n setStates(updatedInitialStates);\n } catch (e) {\n setError(e);\n } finally {\n dispatchLoadingProducts(false);\n }\n }\n\n getAllProductInsights();\n }, [\n client,\n group,\n project,\n products,\n lastCompleteBillingDate,\n dispatchLoadingProducts,\n ]);\n\n useEffect(\n function handleOnLoaded() {\n if (onceRef.current) {\n const initialProducts = initialStates.map(state => state.product);\n onLoaded(initialProducts);\n } else {\n onceRef.current = true;\n }\n },\n [initialStates, onLoaded],\n );\n\n return (\n <Box px={3} py={6}>\n <Box mt={0} mb={5} textAlign=\"center\">\n <Typography variant=\"h4\" gutterBottom>\n Your team's product usage\n </Typography>\n </Box>\n {error ? (\n <Alert severity=\"error\">{error.message}</Alert>\n ) : (\n <ProductInsightsCardList\n initialStates={initialStates}\n onSelectAsync={onSelectAsyncMemo}\n />\n )}\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA6CA,MAAM,iBACJ,GAAA,CAAC,EAAE,QAAA,OACH,CAAC,SAAA,KACC,QAAS,CAAA,EAAE,CAAC,oBAAA,CAAqB,oBAAoB,GAAG,WAAW,CAAA;AAShE,MAAM,kBAAkB,CAAC;AAAA,EAC9B,KAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAA4B,KAAA;AAC1B,EAAM,MAAA,MAAA,GAAS,OAAO,kBAAkB,CAAA;AACxC,EAAM,MAAA,OAAA,GAAU,OAAO,KAAK,CAAA;AAC5B,EAAA,MAAM,CAAC,aAAe,EAAA,SAAS,CAAI,GAAA,QAAA,CAAyB,EAAE,CAAA;AAC9D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAuB,IAAI,CAAA;AACrD,EAAA,MAAM,0BAA0B,0BAA2B,EAAA;AAC3D,EAAM,MAAA,eAAA,GAAkB,WAAW,iBAAiB,CAAA;AAIpD,EAAA,MAAM,uBAA0B,GAAA,WAAA,CAAY,eAAiB,EAAA,EAAE,CAAA;AAG/D,EAAA,MAAM,iBAAoB,GAAA,WAAA;AAAA,IACxB,eAAe,aACb,CAAA,OAAA,EACA,QACiB,EAAA;AACjB,MAAA,OAAO,OAAO,kBAAmB,CAAA;AAAA,QAC/B,KAAA;AAAA,QACA,OAAA;AAAA,QACA,SAAS,OAAQ,CAAA,IAAA;AAAA,QACjB,SAAA,EAAW,WAAY,CAAA,QAAA,EAAU,uBAAuB;AAAA,OACzD,CAAA;AAAA,KACH;AAAA,IACA,CAAC,MAAA,EAAQ,KAAO,EAAA,OAAA,EAAS,uBAAuB;AAAA,GAClD;AAEA,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EAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CACd,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,CAAG,EAAA,EAAA,EAAI,GAAG,SAAU,EAAA,QAAA,EAC3B,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,YAAY,EAAA,IAAA,EAAC,uCAEtC,CACF,EAAA,CAAA;AAAA,IACC,wBACE,GAAA,CAAA,KAAA,EAAA,EAAM,UAAS,OAAS,EAAA,QAAA,EAAA,KAAA,CAAM,SAAQ,CAEvC,mBAAA,GAAA;AAAA,MAAC,uBAAA;AAAA,MAAA;AAAA,QACC,aAAA;AAAA,QACA,aAAe,EAAA;AAAA;AAAA;AACjB,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import Dialog from '@material-ui/core/Dialog';
|
|
3
4
|
import IconButton from '@material-ui/core/IconButton';
|
|
4
5
|
import CloseIcon from '@material-ui/icons/Close';
|
|
@@ -22,20 +23,24 @@ const ProductEntityDialog = ({
|
|
|
22
23
|
id: index.toString(),
|
|
23
24
|
label: `Breakdown by ${label}`
|
|
24
25
|
}));
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onClose, scroll: "body", fullWidth: true, maxWidth: "lg", children: [
|
|
27
|
+
/* @__PURE__ */ jsx(IconButton, { className: classes.closeButton, onClick: onClose, children: /* @__PURE__ */ jsx(CloseIcon, {}) }),
|
|
28
|
+
/* @__PURE__ */ jsx(
|
|
29
|
+
HeaderTabs,
|
|
30
|
+
{
|
|
31
|
+
tabs,
|
|
32
|
+
onChange: (index) => setSelectedLabel(labels[index])
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
ProductEntityTable,
|
|
37
|
+
{
|
|
38
|
+
entityLabel: selectedLabel,
|
|
39
|
+
entity,
|
|
40
|
+
options
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
] });
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
export { ProductEntityDialog };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductEntityDialog.esm.js","sources":["../../../src/components/ProductInsightsCard/ProductEntityDialog.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":"ProductEntityDialog.esm.js","sources":["../../../src/components/ProductInsightsCard/ProductEntityDialog.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 { useState } from 'react';\nimport Dialog from '@material-ui/core/Dialog';\nimport IconButton from '@material-ui/core/IconButton';\nimport { default as CloseButton } from '@material-ui/icons/Close';\nimport { useEntityDialogStyles as useStyles } from '../../utils/styles';\nimport { Entity } from '@backstage-community/plugin-cost-insights-common';\nimport {\n ProductEntityTable,\n ProductEntityTableOptions,\n} from './ProductEntityTable';\nimport { findAlways } from '../../utils/assert';\nimport { HeaderTabs } from '@backstage/core-components';\n\ntype ProductEntityDialogProps = {\n open: boolean;\n entity: Entity;\n options?: ProductEntityTableOptions;\n onClose: () => void;\n};\n\nexport const ProductEntityDialog = ({\n open,\n entity,\n options = {},\n onClose,\n}: ProductEntityDialogProps) => {\n const classes = useStyles();\n const labels = Object.keys(entity.entities);\n const [selectedLabel, setSelectedLabel] = useState(\n findAlways(labels, _ => true),\n );\n\n const tabs = labels.map((label, index) => ({\n id: index.toString(),\n label: `Breakdown by ${label}`,\n }));\n\n return (\n <Dialog open={open} onClose={onClose} scroll=\"body\" fullWidth maxWidth=\"lg\">\n <IconButton className={classes.closeButton} onClick={onClose}>\n <CloseButton />\n </IconButton>\n <HeaderTabs\n tabs={tabs}\n onChange={index => setSelectedLabel(labels[index])}\n />\n <ProductEntityTable\n entityLabel={selectedLabel}\n entity={entity}\n options={options}\n />\n </Dialog>\n );\n};\n"],"names":["useStyles","CloseButton"],"mappings":";;;;;;;;;;AAoCO,MAAM,sBAAsB,CAAC;AAAA,EAClC,IAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAU,EAAC;AAAA,EACX;AACF,CAAgC,KAAA;AAC9B,EAAA,MAAM,UAAUA,qBAAU,EAAA;AAC1B,EAAA,MAAM,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,MAAA,CAAO,QAAQ,CAAA;AAC1C,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA;AAAA,IACxC,UAAA,CAAW,MAAQ,EAAA,CAAA,CAAA,KAAK,IAAI;AAAA,GAC9B;AAEA,EAAA,MAAM,IAAO,GAAA,MAAA,CAAO,GAAI,CAAA,CAAC,OAAO,KAAW,MAAA;AAAA,IACzC,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,IACnB,KAAA,EAAO,gBAAgB,KAAK,CAAA;AAAA,GAC5B,CAAA,CAAA;AAEF,EACE,uBAAA,IAAA,CAAC,UAAO,IAAY,EAAA,OAAA,EAAkB,QAAO,MAAO,EAAA,SAAA,EAAS,IAAC,EAAA,QAAA,EAAS,IACrE,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,WAAW,OAAQ,CAAA,WAAA,EAAa,SAAS,OACnD,EAAA,QAAA,kBAAA,GAAA,CAACC,aAAY,CACf,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,QAAU,EAAA,CAAA,KAAA,KAAS,gBAAiB,CAAA,MAAA,CAAO,KAAK,CAAC;AAAA;AAAA,KACnD;AAAA,oBACA,GAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,WAAa,EAAA,aAAA;AAAA,QACb,MAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import { formatChange } from '../../utils/formatters.esm.js';
|
|
@@ -28,9 +28,9 @@ const createRenderer = (baseCurrency) => (col, classes) => {
|
|
|
28
28
|
switch (col) {
|
|
29
29
|
case "previous":
|
|
30
30
|
case "current":
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(Typography, { className: rowStyles, children: baseCurrency.format(row[col]) });
|
|
32
32
|
case "change":
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
34
|
CostGrowthIndicator,
|
|
35
35
|
{
|
|
36
36
|
className: rowStyles,
|
|
@@ -39,7 +39,7 @@ const createRenderer = (baseCurrency) => (col, classes) => {
|
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
default:
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(Typography, { className: rowStyles, children: row.label });
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
};
|
|
@@ -80,28 +80,28 @@ const ProductEntityTable = ({
|
|
|
80
80
|
const columns = [
|
|
81
81
|
{
|
|
82
82
|
field: "label",
|
|
83
|
-
title: /* @__PURE__ */
|
|
83
|
+
title: /* @__PURE__ */ jsx(Typography, { className: firstColClasses, children: entityLabel }),
|
|
84
84
|
render: createRenderer(baseCurrency)("label", classes),
|
|
85
85
|
customSort: createSorter("label"),
|
|
86
86
|
width: "33.33%"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
field: "previous",
|
|
90
|
-
title: /* @__PURE__ */
|
|
90
|
+
title: /* @__PURE__ */ jsx(Typography, { className: classes.column, children: data.previousName }),
|
|
91
91
|
align: "right",
|
|
92
92
|
render: createRenderer(baseCurrency)("previous", classes),
|
|
93
93
|
customSort: createSorter("previous")
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
field: "current",
|
|
97
|
-
title: /* @__PURE__ */
|
|
97
|
+
title: /* @__PURE__ */ jsx(Typography, { className: classes.column, children: data.currentName }),
|
|
98
98
|
align: "right",
|
|
99
99
|
render: createRenderer(baseCurrency)("current", classes),
|
|
100
100
|
customSort: createSorter("current")
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
field: "change",
|
|
104
|
-
title: /* @__PURE__ */
|
|
104
|
+
title: /* @__PURE__ */ jsx(Typography, { className: lastColClasses, children: "Change" }),
|
|
105
105
|
align: "right",
|
|
106
106
|
render: createRenderer(baseCurrency)("change", classes),
|
|
107
107
|
customSort: createSorter("change")
|
|
@@ -120,7 +120,7 @@ const ProductEntityTable = ({
|
|
|
120
120
|
current: entity.aggregation[1],
|
|
121
121
|
change: entity.change
|
|
122
122
|
}).sort(createSorter());
|
|
123
|
-
return /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
124
|
Table,
|
|
125
125
|
{
|
|
126
126
|
columns,
|