migrate filters and icon utils

This commit is contained in:
Ryan Vazquez
2020-10-28 11:41:29 -04:00
parent cb4568f665
commit dbaefe6e57
7 changed files with 56 additions and 22 deletions
@@ -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';
@@ -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,
};
}
-9
View File
@@ -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',
}
@@ -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,
};
}
+2 -1
View File
@@ -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
+24
View File
@@ -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',
}
@@ -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',