ran prettier, added changeset

Signed-off-by: Simon <simme.jakobsson@gmail.com>
This commit is contained in:
Simon
2022-12-05 12:03:57 +01:00
parent e23c811ec7
commit 5960d0902e
28 changed files with 60 additions and 35 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---
Internal refactor to avoid usage of deprecated symbols
@@ -24,9 +24,11 @@ import {
AlertOptions,
AlertStatus,
AlertSnoozeFormData,
} from '../../types';
import {
ChangeStatistic,
Entity,
} from '../../types';
} from '@backstage/plugin-cost-insights-common';
import {
KubernetesMigrationDismissForm,
KubernetesMigrationDismissFormData,
+6 -4
View File
@@ -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 {
@@ -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 = {
@@ -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 = {
@@ -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';
@@ -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<Alert, AlertDismissFormData>;
@@ -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';
@@ -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';
@@ -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,
@@ -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';
@@ -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 = {
@@ -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<string>;
@@ -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[] = [
{
@@ -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<T> = (entity: T) => T;
@@ -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,
+2 -1
View File
@@ -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) =>
@@ -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 = {
+2 -4
View File
@@ -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';
+5 -1
View File
@@ -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;
+2 -1
View File
@@ -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);
+2 -1
View File
@@ -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 {
@@ -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';
+2 -1
View File
@@ -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,
+2 -1
View File
@@ -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';
+2 -1
View File
@@ -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 = {
+2 -1
View File
@@ -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 = (
+1 -1
View File
@@ -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);