From e905e8e3ddfcd85272bb79988537d7baec34cd45 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 21 Nov 2022 15:33:20 +0100 Subject: [PATCH 1/3] started fixing cost insight deprecations' ' Signed-off-by: Simon --- plugins/cost-insights/src/api/CostInsightsApi.ts | 5 +++-- .../src/components/AlertInsights/AlertDialog.tsx | 3 ++- .../src/components/CostGrowth/CostGrowthIndicator.tsx | 3 ++- .../components/CostInsightsHeader/CostInsightsHeader.tsx | 2 +- .../CostInsightsNavigation/CostInsightsNavigation.tsx | 2 +- .../src/components/CostInsightsPage/CostInsightsPage.tsx | 9 ++++++++- .../CostInsightsTabs/CostInsightsTabs.test.tsx | 2 +- .../src/components/CostInsightsTabs/CostInsightsTabs.tsx | 2 +- .../src/components/CostInsightsTabs/selector.ts | 3 ++- .../CostOverviewCard/CostOverviewBreakdownChart.tsx | 3 ++- .../CostOverviewCard/CostOverviewCard.test.tsx | 2 +- .../src/components/CostOverviewCard/CostOverviewCard.tsx | 7 ++++++- .../components/CostOverviewCard/CostOverviewChart.tsx | 6 ++---- .../components/CostOverviewCard/CostOverviewLegend.tsx | 4 ++-- .../src/components/CostOverviewCard/selector.tsx | 3 ++- .../src/components/MetricSelect/MetricSelect.tsx | 2 +- 16 files changed, 37 insertions(+), 21 deletions(-) diff --git a/plugins/cost-insights/src/api/CostInsightsApi.ts b/plugins/cost-insights/src/api/CostInsightsApi.ts index a7065a04aa..959b40e584 100644 --- a/plugins/cost-insights/src/api/CostInsightsApi.ts +++ b/plugins/cost-insights/src/api/CostInsightsApi.ts @@ -15,14 +15,15 @@ */ import { - Alert, Cost, Entity, Group, Project, Maybe, MetricData, -} from '../types'; +} from '@backstage/plugin-cost-insights-common'; + +import { Alert } from '../types'; import { createApiRef } from '@backstage/core-plugin-api'; /** @public */ diff --git a/plugins/cost-insights/src/components/AlertInsights/AlertDialog.tsx b/plugins/cost-insights/src/components/AlertInsights/AlertDialog.tsx index af976c6d3f..385116e188 100644 --- a/plugins/cost-insights/src/components/AlertInsights/AlertDialog.tsx +++ b/plugins/cost-insights/src/components/AlertInsights/AlertDialog.tsx @@ -28,7 +28,8 @@ import { } from '@material-ui/core'; import { default as CloseIcon } from '@material-ui/icons/Close'; import { useAlertDialogStyles as useStyles } from '../../utils/styles'; -import { Alert, AlertStatus, Maybe } from '../../types'; +import { Alert, AlertStatus } from '../../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { choose, formOf } from '../../utils/alerts'; const DEFAULT_FORM_ID = 'alert-form'; diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx index 8993504c84..2591fd5a47 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx @@ -20,8 +20,9 @@ import { Typography, TypographyProps } from '@material-ui/core'; import { default as ArrowDropUp } from '@material-ui/icons/ArrowDropUp'; import { default as ArrowDropDown } from '@material-ui/icons/ArrowDropDown'; import { growthOf } from '../../utils/change'; -import { ChangeStatistic, GrowthType, Maybe } from '../../types'; +import { GrowthType } from '../../types'; import { useCostGrowthStyles as useStyles } from '../../utils/styles'; +import { ChangeStatistic, Maybe } from '@backstage/plugin-cost-insights-common'; /** @public */ export type CostGrowthIndicatorProps = TypographyProps & { diff --git a/plugins/cost-insights/src/components/CostInsightsHeader/CostInsightsHeader.tsx b/plugins/cost-insights/src/components/CostInsightsHeader/CostInsightsHeader.tsx index 540165d1d9..8e12b7f5dd 100644 --- a/plugins/cost-insights/src/components/CostInsightsHeader/CostInsightsHeader.tsx +++ b/plugins/cost-insights/src/components/CostInsightsHeader/CostInsightsHeader.tsx @@ -18,7 +18,7 @@ import React from 'react'; import { Typography } from '@material-ui/core'; import useAsync from 'react-use/lib/useAsync'; import { useCostInsightsStyles } from '../../utils/styles'; -import { Group } from '../../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; import { identityApiRef, useApi } from '@backstage/core-plugin-api'; function useDisplayName(): string { diff --git a/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.tsx b/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.tsx index ad7dea55fd..507016f391 100644 --- a/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.tsx +++ b/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.tsx @@ -32,7 +32,7 @@ import { NavigationItem, getDefaultNavigationItems, } from '../../utils/navigation'; -import { Maybe, Product } from '../../types'; +import { Maybe, Product } from '@backstage/plugin-cost-insights-common'; type CostInsightsNavigationProps = { alerts: number; diff --git a/plugins/cost-insights/src/components/CostInsightsPage/CostInsightsPage.tsx b/plugins/cost-insights/src/components/CostInsightsPage/CostInsightsPage.tsx index 00d92f945d..d113f1b8f3 100644 --- a/plugins/cost-insights/src/components/CostInsightsPage/CostInsightsPage.tsx +++ b/plugins/cost-insights/src/components/CostInsightsPage/CostInsightsPage.tsx @@ -48,7 +48,14 @@ import { useLastCompleteBillingDate, useLoading, } from '../../hooks'; -import { Alert, Cost, Maybe, MetricData, Product, Project } from '../../types'; +import { Alert } from '../../types'; +import { + Cost, + Maybe, + MetricData, + Product, + Project, +} from '@backstage/plugin-cost-insights-common'; import { mapLoadingToProps } from './selector'; import { ProjectSelect } from '../ProjectSelect'; import { intervalsOf } from '../../utils/duration'; diff --git a/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.test.tsx b/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.test.tsx index 2e2131daff..b04f314e73 100644 --- a/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.test.tsx +++ b/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.test.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { CostInsightsTabs } from './CostInsightsTabs'; import userEvent from '@testing-library/user-event'; -import { Group } from '../../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; import { MockFilterProvider, MockLoadingProvider } from '../../testUtils'; import { renderInTestApp } from '@backstage/test-utils'; diff --git a/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.tsx b/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.tsx index 935184ee55..152ce56902 100644 --- a/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.tsx +++ b/plugins/cost-insights/src/components/CostInsightsTabs/CostInsightsTabs.tsx @@ -18,7 +18,7 @@ import React, { useState } from 'react'; import { Menu, MenuItem, Tab, Tabs, Typography } from '@material-ui/core'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { mapLoadingToProps, mapFiltersToProps } from './selector'; -import { Group } from '../../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; import { useFilters, useLoading } from '../../hooks'; import { useCostInsightsTabsStyles as useStyles } from '../../utils/styles'; diff --git a/plugins/cost-insights/src/components/CostInsightsTabs/selector.ts b/plugins/cost-insights/src/components/CostInsightsTabs/selector.ts index 6309016c85..7e19deb301 100644 --- a/plugins/cost-insights/src/components/CostInsightsTabs/selector.ts +++ b/plugins/cost-insights/src/components/CostInsightsTabs/selector.ts @@ -16,7 +16,8 @@ import { MapFiltersToProps } from '../../hooks/useFilters'; import { MapLoadingToProps } from '../../hooks/useLoading'; -import { Group, PageFilters } from '../../types'; +import { PageFilters } from '../../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; import { getResetStateWithoutInitial } from '../../utils/loading'; type CostInsightsTabsFilterProps = PageFilters & { diff --git a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewBreakdownChart.tsx b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewBreakdownChart.tsx index 962dc6b332..6433ab472c 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewBreakdownChart.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewBreakdownChart.tsx @@ -32,7 +32,8 @@ import { ResponsiveContainer, CartesianGrid, } from 'recharts'; -import { Cost, DEFAULT_DATE_FORMAT, CostInsightsTheme } from '../../types'; +import { DEFAULT_DATE_FORMAT, CostInsightsTheme } from '../../types'; +import { Cost } from '@backstage/plugin-cost-insights-common'; import { BarChartTooltip as Tooltip, BarChartTooltipItem as TooltipItem, diff --git a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx index e3de9593d9..91c599e407 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { fireEvent } from '@testing-library/react'; import { renderInTestApp } from '@backstage/test-utils'; import { CostOverviewCard } from './CostOverviewCard'; -import { Cost } from '../../types'; +import { Cost } from '@backstage/plugin-cost-insights-common'; import { changeOf, getGroupedProducts, diff --git a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.tsx b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.tsx index 9eb5f1e190..c816da97ed 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.tsx @@ -34,7 +34,12 @@ import { useConfig, useFilters } from '../../hooks'; import { mapFiltersToProps } from './selector'; import { DefaultNavigation } from '../../utils/navigation'; import { findAlways } from '../../utils/assert'; -import { Cost, CostInsightsTheme, Maybe, MetricData } from '../../types'; +import { CostInsightsTheme } from '../../types'; +import { + Cost, + Maybe, + MetricData, +} from '@backstage/plugin-cost-insights-common'; import { useOverviewTabsStyles } from '../../utils/styles'; import { ScrollAnchor } from '../../utils/scroll'; diff --git a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewChart.tsx b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewChart.tsx index 1c58bf58e6..e5b0c59684 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewChart.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewChart.tsx @@ -26,15 +26,13 @@ import { Line, ResponsiveContainer, } from 'recharts'; +import { ChartData, DEFAULT_DATE_FORMAT, CostInsightsTheme } from '../../types'; import { - ChartData, Cost, - DEFAULT_DATE_FORMAT, Maybe, Metric, MetricData, - CostInsightsTheme, -} from '../../types'; +} from '@backstage/plugin-cost-insights-common'; import { BarChartTooltip as Tooltip, BarChartTooltipItem as TooltipItem, diff --git a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewLegend.tsx b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewLegend.tsx index 2df80f4780..d823c54691 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewLegend.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewLegend.tsx @@ -17,13 +17,13 @@ import React, { PropsWithChildren } from 'react'; import { Box, useTheme } from '@material-ui/core'; import { LegendItem } from '../LegendItem'; +import { CostInsightsTheme } from '../../types'; import { - CostInsightsTheme, MetricData, Maybe, Cost, Metric, -} from '../../types'; +} from '@backstage/plugin-cost-insights-common'; import { useLastCompleteBillingDate, useFilters } from '../../hooks'; import { getComparedChange, choose } from '../../utils/change'; import { mapFiltersToProps } from './selector'; diff --git a/plugins/cost-insights/src/components/CostOverviewCard/selector.tsx b/plugins/cost-insights/src/components/CostOverviewCard/selector.tsx index d0f7cb76d9..55ad6df69e 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/selector.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/selector.tsx @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Duration, Maybe, PageFilters } from '../../types'; +import { Duration, PageFilters } from '../../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { MapFiltersToProps } from '../../hooks/useFilters'; type CostOverviewFilterProps = PageFilters & { diff --git a/plugins/cost-insights/src/components/MetricSelect/MetricSelect.tsx b/plugins/cost-insights/src/components/MetricSelect/MetricSelect.tsx index 090444f025..fd534eb8f0 100644 --- a/plugins/cost-insights/src/components/MetricSelect/MetricSelect.tsx +++ b/plugins/cost-insights/src/components/MetricSelect/MetricSelect.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { InputLabel, FormControl, Select, MenuItem } from '@material-ui/core'; -import { Maybe, Metric } from '../../types'; +import { Maybe, Metric } from '@backstage/plugin-cost-insights-common'; import { useSelectStyles as useStyles } from '../../utils/styles'; export type MetricSelectProps = { From f68a7059b594c1946d3641fdbaf6b45f640af0b1 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 22 Nov 2022 10:11:52 +0100 Subject: [PATCH 2/3] fixed last of const-insigts components deprecations' Signed-off-by: Simon --- .../src/components/AlertInsights/AlertInsights.tsx | 3 ++- .../cost-insights/src/components/CostGrowth/CostGrowth.tsx | 2 +- .../components/CostInsightsLayout/CostInsightsLayout.tsx | 2 +- .../CostInsightsNavigation/CostInsightsNavigation.test.tsx | 3 ++- .../src/components/PeriodSelect/PeriodSelect.test.tsx | 3 ++- .../src/components/ProductInsights/ProductInsights.test.tsx | 2 +- .../src/components/ProductInsights/ProductInsights.tsx | 3 ++- .../ProductInsightsCard/ProductEntityDialog.test.tsx | 2 +- .../components/ProductInsightsCard/ProductEntityDialog.tsx | 2 +- .../components/ProductInsightsCard/ProductEntityTable.tsx | 6 +++++- .../ProductInsightsCard/ProductInsightsCard.test.tsx | 3 ++- .../components/ProductInsightsCard/ProductInsightsCard.tsx | 3 ++- .../ProductInsightsCard/ProductInsightsCardList.tsx | 3 ++- .../components/ProductInsightsCard/ProductInsightsChart.tsx | 3 ++- .../ProjectGrowthInstructionsPage.tsx | 3 +-- .../src/components/ProjectSelect/ProjectSelect.tsx | 2 +- 16 files changed, 28 insertions(+), 17 deletions(-) diff --git a/plugins/cost-insights/src/components/AlertInsights/AlertInsights.tsx b/plugins/cost-insights/src/components/AlertInsights/AlertInsights.tsx index 2daacda85e..e48ae2789d 100644 --- a/plugins/cost-insights/src/components/AlertInsights/AlertInsights.tsx +++ b/plugins/cost-insights/src/components/AlertInsights/AlertInsights.tsx @@ -30,7 +30,8 @@ import { MapLoadingToProps, } from '../../hooks'; import { DefaultLoadingAction } from '../../utils/loading'; -import { Alert, AlertOptions, AlertStatus, Maybe } from '../../types'; +import { Alert, AlertOptions, AlertStatus } from '../../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { isStatusSnoozed, isStatusAccepted, diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx index ffc548c7ad..d0a4e7901a 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx @@ -17,12 +17,12 @@ import React from 'react'; import classnames from 'classnames'; import { - ChangeStatistic, CurrencyType, Duration, EngineerThreshold, GrowthType, } from '../../types'; +import { ChangeStatistic } from '@backstage/plugin-cost-insights-common'; import { rateOf } from '../../utils/currency'; import { growthOf } from '../../utils/change'; import { useCostGrowthStyles as useStyles } from '../../utils/styles'; diff --git a/plugins/cost-insights/src/components/CostInsightsLayout/CostInsightsLayout.tsx b/plugins/cost-insights/src/components/CostInsightsLayout/CostInsightsLayout.tsx index 93614bd64f..0a583aae0d 100644 --- a/plugins/cost-insights/src/components/CostInsightsLayout/CostInsightsLayout.tsx +++ b/plugins/cost-insights/src/components/CostInsightsLayout/CostInsightsLayout.tsx @@ -15,7 +15,7 @@ */ import React, { PropsWithChildren } from 'react'; import { makeStyles } from '@material-ui/core'; -import { Group } from '../../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; import { CostInsightsTabs } from '../CostInsightsTabs'; import { Header, Page } from '@backstage/core-components'; diff --git a/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.test.tsx b/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.test.tsx index 8ccca96e0f..4cfabc119c 100644 --- a/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.test.tsx +++ b/plugins/cost-insights/src/components/CostInsightsNavigation/CostInsightsNavigation.test.tsx @@ -18,7 +18,8 @@ import React from 'react'; import { default as HappyFace } from '@material-ui/icons/SentimentSatisfiedAlt'; import { renderInTestApp } from '@backstage/test-utils'; import { CostInsightsNavigation } from './CostInsightsNavigation'; -import { Product, Icon } from '../../types'; +import { Icon } from '../../types'; +import { Product } from '@backstage/plugin-cost-insights-common'; import { MockConfigProvider, MockScrollProvider } from '../../testUtils'; import { getDefaultNavigationItems } from '../../utils/navigation'; diff --git a/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx b/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx index dfac13dd42..b7a1e034da 100644 --- a/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx +++ b/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx @@ -21,7 +21,8 @@ import userEvent from '@testing-library/user-event'; import { PeriodSelect, getDefaultOptions } from './PeriodSelect'; import { getDefaultPageFilters } from '../../utils/filters'; import { MockBillingDateProvider } from '../../testUtils'; -import { Group, Duration } from '../../types'; +import { Duration } from '../../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; const DefaultPageFilters = getDefaultPageFilters([{ id: 'tools' }] as Group[]); const lastCompleteBillingDate = '2020-05-01'; diff --git a/plugins/cost-insights/src/components/ProductInsights/ProductInsights.test.tsx b/plugins/cost-insights/src/components/ProductInsights/ProductInsights.test.tsx index 128c9d50b9..3c6b731ce8 100644 --- a/plugins/cost-insights/src/components/ProductInsights/ProductInsights.test.tsx +++ b/plugins/cost-insights/src/components/ProductInsights/ProductInsights.test.tsx @@ -27,7 +27,7 @@ import { MockScrollProvider, MockLoadingProvider, } from '../../testUtils'; -import { Entity, Product } from '../../types'; +import { Entity, Product } from '@backstage/plugin-cost-insights-common'; // suppress recharts componentDidUpdate warnings jest.spyOn(console, 'warn').mockImplementation(() => {}); diff --git a/plugins/cost-insights/src/components/ProductInsights/ProductInsights.tsx b/plugins/cost-insights/src/components/ProductInsights/ProductInsights.tsx index 3eba868843..9df763a5d4 100644 --- a/plugins/cost-insights/src/components/ProductInsights/ProductInsights.tsx +++ b/plugins/cost-insights/src/components/ProductInsights/ProductInsights.tsx @@ -19,7 +19,8 @@ import { Box, Typography } from '@material-ui/core'; import { default as Alert } from '@material-ui/lab/Alert'; import { costInsightsApiRef } from '../../api'; import { ProductInsightsCardList } from '../ProductInsightsCard/ProductInsightsCardList'; -import { Duration, Entity, Maybe, Product } from '../../types'; +import { Duration } from '../../types'; +import { Entity, Maybe, Product } from '@backstage/plugin-cost-insights-common'; import { intervalsOf, DEFAULT_DURATION } from '../../utils/duration'; import { DefaultLoadingAction, diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.test.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.test.tsx index d3d12abe74..b0c35da493 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.test.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.test.tsx @@ -18,7 +18,7 @@ import React from 'react'; import { wrapInTestApp } from '@backstage/test-utils'; import { ProductEntityDialog } from './ProductEntityDialog'; import { render } from '@testing-library/react'; -import { Entity } from '../../types'; +import { Entity } from '@backstage/plugin-cost-insights-common'; const atomicEntity: Entity = { id: null, diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.tsx index 50b2ff993c..55fa795728 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityDialog.tsx @@ -18,7 +18,7 @@ import React, { useState } from 'react'; import { Dialog, IconButton } from '@material-ui/core'; import { default as CloseButton } from '@material-ui/icons/Close'; import { useEntityDialogStyles as useStyles } from '../../utils/styles'; -import { Entity } from '../../types'; +import { Entity } from '@backstage/plugin-cost-insights-common'; import { ProductEntityTable, ProductEntityTableOptions, diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityTable.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityTable.tsx index 95ba4f2f2d..24115e830a 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityTable.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductEntityTable.tsx @@ -20,7 +20,11 @@ import { Typography } from '@material-ui/core'; import { costFormatter, formatChange } from '../../utils/formatters'; import { useEntityDialogStyles as useStyles } from '../../utils/styles'; import { CostGrowthIndicator } from '../CostGrowth'; -import { BarChartOptions, ChangeStatistic, Entity } from '../../types'; +import { BarChartOptions } from '../../types'; +import { + ChangeStatistic, + Entity, +} from '@backstage/plugin-cost-insights-common'; import { Table, TableColumn } from '@backstage/core-components'; export type ProductEntityTableOptions = Partial< diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.test.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.test.tsx index 737019e77a..b24b3bd366 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.test.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.test.tsx @@ -28,7 +28,8 @@ import { MockScrollProvider, MockLoadingProvider, } from '../../testUtils'; -import { Duration, Entity, Product } from '../../types'; +import { Duration } from '../../types'; +import { Entity, Product } from '@backstage/plugin-cost-insights-common'; // suppress recharts componentDidUpdate warnings jest.spyOn(console, 'warn').mockImplementation(() => {}); diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx index 2b4ee4b0db..a587bfb26e 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx @@ -28,7 +28,8 @@ import { PeriodSelect } from '../PeriodSelect'; import { ProductInsightsChart } from './ProductInsightsChart'; import { useProductInsightsCardStyles as useStyles } from '../../utils/styles'; import { DefaultLoadingAction } from '../../utils/loading'; -import { Duration, Entity, Maybe, Product } from '../../types'; +import { Duration } from '../../types'; +import { Entity, Maybe, Product } from '@backstage/plugin-cost-insights-common'; import { MapLoadingToProps, useLastCompleteBillingDate, diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCardList.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCardList.tsx index ecf60b4bef..3ae97daecb 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCardList.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCardList.tsx @@ -17,7 +17,8 @@ import React from 'react'; import { Box, CircularProgress, Collapse } from '@material-ui/core'; import { ProductInsightsCard } from './ProductInsightsCard'; -import { Duration, Entity, Product } from '../../types'; +import { Duration } from '../../types'; +import { Entity, Product } from '@backstage/plugin-cost-insights-common'; import { ProductState } from '../../utils/loading'; type ProductInsightsCardListProps = { diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsChart.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsChart.tsx index b77b415e1e..751a37f67e 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsChart.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsChart.tsx @@ -48,7 +48,8 @@ import { useProductInsightsChartStyles as useStyles, useBarChartLayoutStyles as useLayoutStyles, } from '../../utils/styles'; -import { Duration, Entity, Maybe } from '../../types'; +import { Duration } from '../../types'; +import { Entity, Maybe } from '@backstage/plugin-cost-insights-common'; import { choose } from '../../utils/change'; import { TooltipRenderer } from '../../types/Tooltip'; diff --git a/plugins/cost-insights/src/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.tsx b/plugins/cost-insights/src/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.tsx index 35b00ce6f6..0435210a98 100644 --- a/plugins/cost-insights/src/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.tsx +++ b/plugins/cost-insights/src/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.tsx @@ -23,10 +23,9 @@ import { Alert, DEFAULT_DATE_FORMAT, Duration, - Entity, - Product, ProjectGrowthData, } from '../../types'; +import { Entity, Product } from '@backstage/plugin-cost-insights-common'; import { ProjectGrowthAlert } from '../../alerts'; import { InfoCard } from '@backstage/core-components'; diff --git a/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx b/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx index d46123b001..c83fa67d94 100644 --- a/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx +++ b/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx @@ -15,7 +15,7 @@ */ import React from 'react'; import { MenuItem, Select } from '@material-ui/core'; -import { Maybe, Project } from '../../types'; +import { Maybe, Project } from '@backstage/plugin-cost-insights-common'; import { useSelectStyles as useStyles } from '../../utils/styles'; type ProjectSelectProps = { From d379b6f070a104f454d0ca9d78a1029345d68cd8 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 22 Nov 2022 10:54:25 +0100 Subject: [PATCH 3/3] added changeset and api report Signed-off-by: Simon --- .changeset/hip-chairs-tap.md | 5 +++++ plugins/cost-insights/api-report.md | 29 +++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .changeset/hip-chairs-tap.md diff --git a/.changeset/hip-chairs-tap.md b/.changeset/hip-chairs-tap.md new file mode 100644 index 0000000000..8eca0a9292 --- /dev/null +++ b/.changeset/hip-chairs-tap.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-cost-insights': patch +--- + +Internal refactor to avoid usage of deprecated symbols diff --git a/plugins/cost-insights/api-report.md b/plugins/cost-insights/api-report.md index dd4e404450..ba93878aea 100644 --- a/plugins/cost-insights/api-report.md +++ b/plugins/cost-insights/api-report.md @@ -11,10 +11,15 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { BackstageTheme } from '@backstage/theme'; import { ChangeStatistic as ChangeStatistic_2 } from '@backstage/plugin-cost-insights-common'; import * as common from '@backstage/plugin-cost-insights-common'; +import { Cost as Cost_2 } from '@backstage/plugin-cost-insights-common'; import { Dispatch } from 'react'; +import { Entity as Entity_2 } from '@backstage/plugin-cost-insights-common'; import { ForwardRefExoticComponent } from 'react'; +import { Group as Group_2 } from '@backstage/plugin-cost-insights-common'; import { Maybe as Maybe_2 } from '@backstage/plugin-cost-insights-common'; +import { MetricData as MetricData_2 } from '@backstage/plugin-cost-insights-common'; import { PaletteOptions } from '@material-ui/core/styles/createPalette'; +import { Project as Project_2 } from '@backstage/plugin-cost-insights-common'; import { PropsWithChildren } from 'react'; import { ReactNode } from 'react'; import { RefAttributes } from 'react'; @@ -247,34 +252,34 @@ export const CostGrowthIndicator: ( // @public (undocumented) export type CostGrowthIndicatorProps = TypographyProps & { - change: ChangeStatistic; + change: ChangeStatistic_2; formatter?: ( - change: ChangeStatistic, + change: ChangeStatistic_2, options?: { absolute: boolean; }, - ) => Maybe; + ) => Maybe_2; }; // @public (undocumented) export type CostGrowthProps = { - change: ChangeStatistic; + change: ChangeStatistic_2; duration: Duration; }; // @public (undocumented) export type CostInsightsApi = { getLastCompleteBillingDate(): Promise; - getUserGroups(userId: string): Promise; - getGroupProjects(group: string): Promise; + getUserGroups(userId: string): Promise; + getGroupProjects(group: string): Promise; getCatalogEntityDailyCost?( catalogEntityRef: string, intervals: string, - ): Promise; - getGroupDailyCost(group: string, intervals: string): Promise; - getProjectDailyCost(project: string, intervals: string): Promise; - getDailyMetricData(metric: string, intervals: string): Promise; - getProductInsights(options: ProductInsightsOptions): Promise; + ): Promise; + getGroupDailyCost(group: string, intervals: string): Promise; + getProjectDailyCost(project: string, intervals: string): Promise; + getDailyMetricData(metric: string, intervals: string): Promise; + getProductInsights(options: ProductInsightsOptions): Promise; getAlerts(group: string): Promise; }; @@ -538,7 +543,7 @@ export type ProductInsightsOptions = { product: string; group: string; intervals: string; - project: Maybe; + project: Maybe_2; }; // @public (undocumented)