Merge pull request #14767 from Znarvl/continue_dependencies_deprecations

Fixed dependencies deprecation plugin/cost-insights
This commit is contained in:
Patrik Oldsberg
2022-11-23 12:02:43 +01:00
committed by GitHub
34 changed files with 87 additions and 50 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---
Internal refactor to avoid usage of deprecated symbols
+17 -12
View File
@@ -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';
@@ -248,34 +253,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<string>;
) => Maybe_2<string>;
};
// @public (undocumented)
export type CostGrowthProps = {
change: ChangeStatistic;
change: ChangeStatistic_2;
duration: Duration;
};
// @public (undocumented)
export type CostInsightsApi = {
getLastCompleteBillingDate(): Promise<string>;
getUserGroups(userId: string): Promise<Group[]>;
getGroupProjects(group: string): Promise<Project[]>;
getUserGroups(userId: string): Promise<Group_2[]>;
getGroupProjects(group: string): Promise<Project_2[]>;
getCatalogEntityDailyCost?(
catalogEntityRef: string,
intervals: string,
): Promise<Cost>;
getGroupDailyCost(group: string, intervals: string): Promise<Cost>;
getProjectDailyCost(project: string, intervals: string): Promise<Cost>;
getDailyMetricData(metric: string, intervals: string): Promise<MetricData>;
getProductInsights(options: ProductInsightsOptions): Promise<Entity>;
): Promise<Cost_2>;
getGroupDailyCost(group: string, intervals: string): Promise<Cost_2>;
getProjectDailyCost(project: string, intervals: string): Promise<Cost_2>;
getDailyMetricData(metric: string, intervals: string): Promise<MetricData_2>;
getProductInsights(options: ProductInsightsOptions): Promise<Entity_2>;
getAlerts(group: string): Promise<Alert[]>;
};
@@ -539,7 +544,7 @@ export type ProductInsightsOptions = {
product: string;
group: string;
intervals: string;
project: Maybe<string>;
project: Maybe_2<string>;
};
// @public (undocumented)
@@ -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 */
@@ -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';
@@ -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,
@@ -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';
@@ -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 & {
@@ -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 {
@@ -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';
@@ -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';
@@ -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;
@@ -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';
@@ -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';
@@ -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';
@@ -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 & {
@@ -32,7 +32,8 @@ import {
XAxis,
YAxis,
} from 'recharts';
import { Cost, CostInsightsTheme, DEFAULT_DATE_FORMAT } from '../../types';
import { DEFAULT_DATE_FORMAT, CostInsightsTheme } from '../../types';
import { Cost } from '@backstage/plugin-cost-insights-common';
import {
BarChartLegend,
BarChartTooltip as Tooltip,
@@ -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,
@@ -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';
@@ -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,
@@ -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';
@@ -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 & {
@@ -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 = {
@@ -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';
@@ -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(() => {});
@@ -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,
@@ -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';
import { MockConfigProvider } from '../../testUtils';
const atomicEntity: Entity = {
@@ -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,
@@ -20,7 +20,11 @@ import { Typography } from '@material-ui/core';
import { 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';
import { useConfig } from '../../hooks';
@@ -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(() => {});
@@ -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,
@@ -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 = {
@@ -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';
import { useConfig } from '../../hooks';
@@ -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';
@@ -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 = {