diff --git a/.changeset/old-sloths-warn.md b/.changeset/old-sloths-warn.md new file mode 100644 index 0000000000..8eca0a9292 --- /dev/null +++ b/.changeset/old-sloths-warn.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-cost-insights': patch +--- + +Internal refactor to avoid usage of deprecated symbols diff --git a/plugins/cost-insights/src/example/alerts/KubernetesMigrationAlert.tsx b/plugins/cost-insights/src/example/alerts/KubernetesMigrationAlert.tsx index e9d5877bf0..eb5423148d 100644 --- a/plugins/cost-insights/src/example/alerts/KubernetesMigrationAlert.tsx +++ b/plugins/cost-insights/src/example/alerts/KubernetesMigrationAlert.tsx @@ -24,9 +24,11 @@ import { AlertOptions, AlertStatus, AlertSnoozeFormData, +} from '../../types'; +import { ChangeStatistic, Entity, -} from '../../types'; +} from '@backstage/plugin-cost-insights-common'; import { KubernetesMigrationDismissForm, KubernetesMigrationDismissFormData, diff --git a/plugins/cost-insights/src/example/client.ts b/plugins/cost-insights/src/example/client.ts index e2a183b682..160c0a691b 100644 --- a/plugins/cost-insights/src/example/client.ts +++ b/plugins/cost-insights/src/example/client.ts @@ -19,15 +19,17 @@ import { DateTime } from 'luxon'; import { CostInsightsApi, ProductInsightsOptions } from '../api'; import { Alert, - Cost, DEFAULT_DATE_FORMAT, + ProjectGrowthData, + UnlabeledDataflowData, +} from '../types'; +import { Entity, Group, MetricData, Project, - ProjectGrowthData, - UnlabeledDataflowData, -} from '../types'; + Cost, +} from '@backstage/plugin-cost-insights-common'; import { KubernetesMigrationAlert } from './alerts'; import { ProjectGrowthAlert, UnlabeledDataflowAlert } from '../alerts'; import { diff --git a/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.tsx b/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.tsx index 68a92aa877..bdc7af551a 100644 --- a/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.tsx +++ b/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.tsx @@ -19,9 +19,9 @@ import { BarChart } from '../../../components'; import { BarChartOptions, CostInsightsTheme, - Entity, ResourceData, } from '../../../types'; +import { Entity } from '@backstage/plugin-cost-insights-common'; import { useTheme } from '@material-ui/core'; type MigrationBarChartProps = { diff --git a/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.tsx b/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.tsx index 5b62b4b7bc..1b46b15a10 100644 --- a/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.tsx +++ b/plugins/cost-insights/src/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.tsx @@ -17,7 +17,8 @@ import React from 'react'; import { Box, useTheme } from '@material-ui/core'; import { CostGrowth, LegendItem } from '../../../components'; -import { ChangeStatistic, CostInsightsTheme, Duration } from '../../../types'; +import { CostInsightsTheme, Duration } from '../../../types'; +import { ChangeStatistic } from '@backstage/plugin-cost-insights-common'; import { monthOf } from '../../../utils/formatters'; export type MigrationBarChartLegendProps = { diff --git a/plugins/cost-insights/src/example/forms/KubernetesMigrationDismissForm.tsx b/plugins/cost-insights/src/example/forms/KubernetesMigrationDismissForm.tsx index 285cc15f94..7efd32616c 100644 --- a/plugins/cost-insights/src/example/forms/KubernetesMigrationDismissForm.tsx +++ b/plugins/cost-insights/src/example/forms/KubernetesMigrationDismissForm.tsx @@ -28,7 +28,8 @@ import { FormGroup, Typography, } from '@material-ui/core'; -import { AlertFormProps, Entity } from '../../types'; +import { AlertFormProps } from '../../types'; +import { Entity } from '@backstage/plugin-cost-insights-common'; import { KubernetesMigrationAlert } from '../alerts'; import { findAlways } from '../../utils/assert'; diff --git a/plugins/cost-insights/src/forms/AlertDismissForm.tsx b/plugins/cost-insights/src/forms/AlertDismissForm.tsx index 9697672789..7506fe8ee1 100644 --- a/plugins/cost-insights/src/forms/AlertDismissForm.tsx +++ b/plugins/cost-insights/src/forms/AlertDismissForm.tsx @@ -37,8 +37,8 @@ import { AlertDismissReason, AlertDismissOptions, AlertDismissFormData, - Maybe, } from '../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { useAlertDialogStyles as useStyles } from '../utils/styles'; export type AlertDismissFormProps = AlertFormProps; diff --git a/plugins/cost-insights/src/forms/AlertSnoozeForm.tsx b/plugins/cost-insights/src/forms/AlertSnoozeForm.tsx index 0dcc0a949e..3f87c87771 100644 --- a/plugins/cost-insights/src/forms/AlertSnoozeForm.tsx +++ b/plugins/cost-insights/src/forms/AlertSnoozeForm.tsx @@ -35,10 +35,10 @@ import { AlertFormProps, Duration, DEFAULT_DATE_FORMAT, - Maybe, AlertSnoozeFormData, AlertSnoozeOptions, } from '../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { useAlertDialogStyles as useStyles } from '../utils/styles'; import { intervalsOf } from '../utils/duration'; diff --git a/plugins/cost-insights/src/hooks/useConfig.tsx b/plugins/cost-insights/src/hooks/useConfig.tsx index d1b3a4788e..f42cea38c3 100644 --- a/plugins/cost-insights/src/hooks/useConfig.tsx +++ b/plugins/cost-insights/src/hooks/useConfig.tsx @@ -22,7 +22,8 @@ import React, { useState, } from 'react'; import { Config as BackstageConfig } from '@backstage/config'; -import { Currency, EngineerThreshold, Icon, Metric, Product } from '../types'; +import { Currency, EngineerThreshold, Icon } from '../types'; +import { Metric, Product } from '@backstage/plugin-cost-insights-common'; import { getIcon } from '../utils/navigation'; import { validateCurrencies, validateMetrics } from '../utils/config'; import { createCurrencyFormat, defaultCurrencies } from '../utils/currency'; diff --git a/plugins/cost-insights/src/hooks/useFilters.tsx b/plugins/cost-insights/src/hooks/useFilters.tsx index abe7a132cc..e888da369e 100644 --- a/plugins/cost-insights/src/hooks/useFilters.tsx +++ b/plugins/cost-insights/src/hooks/useFilters.tsx @@ -23,7 +23,8 @@ import React, { useState, } from 'react'; import { Alert } from '@material-ui/lab'; -import { Maybe, PageFilters, ProductFilters } from '../types'; +import { PageFilters, ProductFilters } from '../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { useLocation, useNavigate } from 'react-router-dom'; import { stringify, diff --git a/plugins/cost-insights/src/hooks/useGroups.tsx b/plugins/cost-insights/src/hooks/useGroups.tsx index de0e253763..ec10faa7de 100644 --- a/plugins/cost-insights/src/hooks/useGroups.tsx +++ b/plugins/cost-insights/src/hooks/useGroups.tsx @@ -23,7 +23,7 @@ import React, { import { Alert } from '@material-ui/lab'; import { costInsightsApiRef } from '../api'; import { MapLoadingToProps, useLoading } from './useLoading'; -import { Group, Maybe } from '../types'; +import { Group, Maybe } from '@backstage/plugin-cost-insights-common'; import { DefaultLoadingAction } from '../utils/loading'; import { useApi, identityApiRef } from '@backstage/core-plugin-api'; import { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model'; diff --git a/plugins/cost-insights/src/hooks/useLastCompleteBillingDate.tsx b/plugins/cost-insights/src/hooks/useLastCompleteBillingDate.tsx index d8236ed61a..24c5716442 100644 --- a/plugins/cost-insights/src/hooks/useLastCompleteBillingDate.tsx +++ b/plugins/cost-insights/src/hooks/useLastCompleteBillingDate.tsx @@ -25,7 +25,7 @@ import { Alert } from '@material-ui/lab'; import { costInsightsApiRef } from '../api'; import { MapLoadingToProps, useLoading } from './useLoading'; import { DefaultLoadingAction } from '../utils/loading'; -import { Maybe } from '../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { useApi } from '@backstage/core-plugin-api'; type BillingDateProviderLoadingProps = { diff --git a/plugins/cost-insights/src/hooks/useScroll.tsx b/plugins/cost-insights/src/hooks/useScroll.tsx index 5ddc60b8ff..3e2bbc6c24 100644 --- a/plugins/cost-insights/src/hooks/useScroll.tsx +++ b/plugins/cost-insights/src/hooks/useScroll.tsx @@ -20,7 +20,7 @@ import React, { useContext, PropsWithChildren, } from 'react'; -import { Maybe } from '../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; export type ScrollTo = Maybe; diff --git a/plugins/cost-insights/src/testUtils/mockData.ts b/plugins/cost-insights/src/testUtils/mockData.ts index 45a514ff8f..67cb4d9035 100644 --- a/plugins/cost-insights/src/testUtils/mockData.ts +++ b/plugins/cost-insights/src/testUtils/mockData.ts @@ -14,7 +14,10 @@ * limitations under the License. */ -import { DateAggregation, Entity } from '../types'; +import { + DateAggregation, + Entity, +} from '@backstage/plugin-cost-insights-common'; export const MockAggregatedDailyCosts: DateAggregation[] = [ { diff --git a/plugins/cost-insights/src/testUtils/products.ts b/plugins/cost-insights/src/testUtils/products.ts index 1daab969de..200c1014b0 100644 --- a/plugins/cost-insights/src/testUtils/products.ts +++ b/plugins/cost-insights/src/testUtils/products.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Entity, Product } from '../types'; +import { Entity, Product } from '@backstage/plugin-cost-insights-common'; import { findAlways } from '../utils/assert'; type mockEntityRenderer = (entity: T) => T; diff --git a/plugins/cost-insights/src/testUtils/testUtils.ts b/plugins/cost-insights/src/testUtils/testUtils.ts index e0ed1aa933..4e1bea347d 100644 --- a/plugins/cost-insights/src/testUtils/testUtils.ts +++ b/plugins/cost-insights/src/testUtils/testUtils.ts @@ -16,14 +16,13 @@ import { DateTime } from 'luxon'; import regression, { DataPoint } from 'regression'; +import { Duration, DEFAULT_DATE_FORMAT } from '../types'; import { ChangeStatistic, - Duration, Entity, Trendline, DateAggregation, - DEFAULT_DATE_FORMAT, -} from '../types'; +} from '@backstage/plugin-cost-insights-common'; import { inclusiveEndDateOf, inclusiveStartDateOf } from '../utils/duration'; import { MockComputeEngineInsights, diff --git a/plugins/cost-insights/src/utils/alerts.tsx b/plugins/cost-insights/src/utils/alerts.tsx index 2039a5b617..9efc8a4f3b 100644 --- a/plugins/cost-insights/src/utils/alerts.tsx +++ b/plugins/cost-insights/src/utils/alerts.tsx @@ -14,7 +14,8 @@ * limitations under the License. */ -import { Alert, AlertForm, AlertStatus, Maybe } from '../types'; +import { Alert, AlertForm, AlertStatus } from '../types'; +import { Maybe } from '@backstage/plugin-cost-insights-common'; import { AlertAcceptForm, AlertDismissForm, AlertSnoozeForm } from '../forms'; const createAlertHandler = (status?: AlertStatus) => (alert: Alert) => diff --git a/plugins/cost-insights/src/utils/change.test.ts b/plugins/cost-insights/src/utils/change.test.ts index 1a0b9947f5..79f68db716 100644 --- a/plugins/cost-insights/src/utils/change.test.ts +++ b/plugins/cost-insights/src/utils/change.test.ts @@ -20,8 +20,8 @@ import { ChangeThreshold, EngineerThreshold, Duration, - Cost, } from '../types'; +import { Cost } from '@backstage/plugin-cost-insights-common'; import { MockAggregatedDailyCosts, trendlineOf, changeOf } from '../testUtils'; const GrowthMap = { diff --git a/plugins/cost-insights/src/utils/change.ts b/plugins/cost-insights/src/utils/change.ts index 43d58a021b..33a5eb4a9b 100644 --- a/plugins/cost-insights/src/utils/change.ts +++ b/plugins/cost-insights/src/utils/change.ts @@ -14,15 +14,13 @@ * limitations under the License. */ +import { ChangeThreshold, GrowthType, Duration } from '../types'; import { Cost, ChangeStatistic, - ChangeThreshold, - GrowthType, MetricData, - Duration, DateAggregation, -} from '../types'; +} from '@backstage/plugin-cost-insights-common'; import { DateTime, Duration as LuxonDuration } from 'luxon'; import { inclusiveStartDateOf } from './duration'; import { notEmpty } from './assert'; diff --git a/plugins/cost-insights/src/utils/charts.ts b/plugins/cost-insights/src/utils/charts.ts index 2a6d0b2ad6..e7bcd7bd33 100644 --- a/plugins/cost-insights/src/utils/charts.ts +++ b/plugins/cost-insights/src/utils/charts.ts @@ -14,7 +14,11 @@ * limitations under the License. */ -import { DateAggregation, Trendline, ChartData } from '../types'; +import { + DateAggregation, + Trendline, +} from '@backstage/plugin-cost-insights-common'; +import { ChartData } from '../types'; export function trendFrom(trendline: Trendline, date: number): number { return trendline.slope * (date / 1000) + trendline.intercept; diff --git a/plugins/cost-insights/src/utils/config.ts b/plugins/cost-insights/src/utils/config.ts index 496021d70e..3a2e858de3 100644 --- a/plugins/cost-insights/src/utils/config.ts +++ b/plugins/cost-insights/src/utils/config.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { Metric, Currency } from '../types'; +import { Currency } from '../types'; +import { Metric } from '@backstage/plugin-cost-insights-common'; export function validateMetrics(metrics: Metric[]) { const defaults = metrics.filter(metric => metric.default); diff --git a/plugins/cost-insights/src/utils/filters.ts b/plugins/cost-insights/src/utils/filters.ts index f0252edd45..d44042d358 100644 --- a/plugins/cost-insights/src/utils/filters.ts +++ b/plugins/cost-insights/src/utils/filters.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { Duration, Group, PageFilters } from '../types'; +import { Duration, PageFilters } from '../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; export function getDefaultPageFilters(groups: Group[]): PageFilters { return { diff --git a/plugins/cost-insights/src/utils/formatters.ts b/plugins/cost-insights/src/utils/formatters.ts index fd3fb4c0ef..e715aebbd7 100644 --- a/plugins/cost-insights/src/utils/formatters.ts +++ b/plugins/cost-insights/src/utils/formatters.ts @@ -16,7 +16,8 @@ import { DateTime, Duration as LuxonDuration } from 'luxon'; import pluralize from 'pluralize'; -import { ChangeStatistic, Duration } from '../types'; +import { Duration } from '../types'; +import { ChangeStatistic } from '@backstage/plugin-cost-insights-common'; import { inclusiveEndDateOf, inclusiveStartDateOf } from './duration'; import { notEmpty } from './assert'; diff --git a/plugins/cost-insights/src/utils/graphs.ts b/plugins/cost-insights/src/utils/graphs.ts index 896d09f865..7512ec0c51 100644 --- a/plugins/cost-insights/src/utils/graphs.ts +++ b/plugins/cost-insights/src/utils/graphs.ts @@ -16,7 +16,8 @@ import { TooltipProps } from 'recharts'; import { Payload } from 'recharts/types/component/DefaultTooltipContent'; -import { AlertCost, DataKey, Entity, ResourceData } from '../types'; +import { AlertCost, DataKey, ResourceData } from '../types'; +import { Entity } from '@backstage/plugin-cost-insights-common'; import { currencyFormatter, dateFormatter, diff --git a/plugins/cost-insights/src/utils/history.ts b/plugins/cost-insights/src/utils/history.ts index 466f506479..ccdce9c3e4 100644 --- a/plugins/cost-insights/src/utils/history.ts +++ b/plugins/cost-insights/src/utils/history.ts @@ -16,7 +16,8 @@ import qs from 'qs'; import * as yup from 'yup'; -import { Duration, Group, PageFilters } from '../types'; +import { Duration, PageFilters } from '../types'; +import { Group } from '@backstage/plugin-cost-insights-common'; import { getDefaultPageFilters } from '../utils/filters'; import { ConfigContextProps } from '../hooks/useConfig'; diff --git a/plugins/cost-insights/src/utils/loading.ts b/plugins/cost-insights/src/utils/loading.ts index 2a453a58f1..7fe95a39db 100644 --- a/plugins/cost-insights/src/utils/loading.ts +++ b/plugins/cost-insights/src/utils/loading.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { Duration, Entity, Loading, Maybe, Product } from '../types'; +import { Duration, Loading } from '../types'; +import { Entity, Maybe, Product } from '@backstage/plugin-cost-insights-common'; import { DEFAULT_DURATION } from './duration'; export type ProductState = { diff --git a/plugins/cost-insights/src/utils/sort.ts b/plugins/cost-insights/src/utils/sort.ts index 817e4b9012..0bdcc388b5 100644 --- a/plugins/cost-insights/src/utils/sort.ts +++ b/plugins/cost-insights/src/utils/sort.ts @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { DateAggregation, ResourceData } from '../types'; +import { ResourceData } from '../types'; +import { DateAggregation } from '@backstage/plugin-cost-insights-common'; import { ProductState } from './loading'; export const aggregationSort = ( diff --git a/plugins/cost-insights/src/utils/sum.ts b/plugins/cost-insights/src/utils/sum.ts index 1ab6bdef71..2aba59891a 100644 --- a/plugins/cost-insights/src/utils/sum.ts +++ b/plugins/cost-insights/src/utils/sum.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { DateAggregation } from '../types'; +import { DateAggregation } from '@backstage/plugin-cost-insights-common'; export const aggregationSum = (aggregation: DateAggregation[]) => aggregation.reduce((total, curAgg) => total + curAgg.amount, 0);