diff --git a/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx b/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx index 628046f921..67f40550f2 100644 --- a/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx +++ b/plugins/cost-insights/src/components/PeriodSelect/PeriodSelect.test.tsx @@ -19,9 +19,10 @@ import { getByRole, waitFor } from '@testing-library/react'; import { renderInTestApp } from '@backstage/test-utils'; import UserEvent from '@testing-library/user-event'; import { PeriodSelect, getDefaultOptions } from './PeriodSelect'; -import { getDefaultPageFilters, Group } from '../../types'; +import { getDefaultPageFilters } from '../../utils/filters'; import { Duration } from '../../utils/duration'; import { MockBillingDateProvider } from '../../utils/tests'; +import { Group } from '../../types'; const DefaultPageFilters = getDefaultPageFilters([{ id: 'tools' }] as Group[]); const lastCompleteBillingDate = '2020-05-01'; diff --git a/plugins/cost-insights/src/types/Filters.ts b/plugins/cost-insights/src/types/Filters.ts index e72e850c61..da71471f50 100644 --- a/plugins/cost-insights/src/types/Filters.ts +++ b/plugins/cost-insights/src/types/Filters.ts @@ -15,7 +15,6 @@ */ import { Maybe } from './Maybe'; -import { Group } from './Group'; import { Duration } from '../utils/duration'; export interface PageFilters { @@ -31,12 +30,3 @@ export interface ProductPeriod { duration: Duration; productType: string; } - -export function getDefaultPageFilters(groups: Group[]): PageFilters { - return { - group: groups.length ? groups[0].id : null, - project: null, - duration: Duration.P90D, - metric: null, - }; -} diff --git a/plugins/cost-insights/src/types/Icon.ts b/plugins/cost-insights/src/types/Icon.ts index 70f43a6813..db5520ca15 100644 --- a/plugins/cost-insights/src/types/Icon.ts +++ b/plugins/cost-insights/src/types/Icon.ts @@ -18,12 +18,3 @@ export type Icon = { kind: string; component: JSX.Element; }; - -export enum IconType { - Compute = 'compute', - Data = 'data', - Database = 'database', - Storage = 'storage', - Search = 'search', - ML = 'ml', -} diff --git a/plugins/cost-insights/src/utils/filters.ts b/plugins/cost-insights/src/utils/filters.ts new file mode 100644 index 0000000000..26d2bc6cf3 --- /dev/null +++ b/plugins/cost-insights/src/utils/filters.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Group, PageFilters } from '../types'; +import { Duration } from './duration'; + +export function getDefaultPageFilters(groups: Group[]): PageFilters { + return { + group: groups.length ? groups[0].id : null, + project: null, + duration: Duration.P90D, + metric: null, + }; +} diff --git a/plugins/cost-insights/src/utils/history.ts b/plugins/cost-insights/src/utils/history.ts index 3b55aeebce..36f4e9a5b0 100644 --- a/plugins/cost-insights/src/utils/history.ts +++ b/plugins/cost-insights/src/utils/history.ts @@ -16,8 +16,9 @@ import qs from 'qs'; import * as yup from 'yup'; -import { Group, PageFilters, getDefaultPageFilters } from '../types'; +import { Group, PageFilters } from '../types'; import { Duration } from '../utils/duration'; +import { getDefaultPageFilters } from '../utils/filters'; import { ConfigContextProps } from '../hooks/useConfig'; const schema = yup diff --git a/plugins/cost-insights/src/utils/icon.ts b/plugins/cost-insights/src/utils/icon.ts new file mode 100644 index 0000000000..de957743ba --- /dev/null +++ b/plugins/cost-insights/src/utils/icon.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum IconType { + Compute = 'compute', + Data = 'data', + Database = 'database', + Storage = 'storage', + Search = 'search', + ML = 'ml', +} diff --git a/plugins/cost-insights/src/utils/navigation.tsx b/plugins/cost-insights/src/utils/navigation.tsx index d2cb1d20bb..39016f6092 100644 --- a/plugins/cost-insights/src/utils/navigation.tsx +++ b/plugins/cost-insights/src/utils/navigation.tsx @@ -23,7 +23,7 @@ import Search from '@material-ui/icons/Search'; import CloudQueue from '@material-ui/icons/CloudQueue'; import School from '@material-ui/icons/School'; import ViewHeadline from '@material-ui/icons/ViewHeadline'; -import { IconType } from '../types'; +import { IconType } from '../utils/icon'; export enum DefaultNavigation { CostOverviewCard = 'cost-overview-card',