migrate loading utils

This commit is contained in:
Ryan Vazquez
2020-10-28 10:51:05 -04:00
parent 474345a484
commit d20428775c
6 changed files with 14 additions and 11 deletions
@@ -18,7 +18,7 @@ import {
getResetState,
DefaultLoadingAction,
getResetStateWithoutInitial,
} from '../../types';
} from '../../utils/loading';
type CostInsightsPageLoadingProps = {
loadingActions: Array<string>;
@@ -16,7 +16,8 @@
import { MapFiltersToProps } from '../../hooks/useFilters';
import { MapLoadingToProps } from '../../hooks/useLoading';
import { Group, PageFilters, getResetStateWithoutInitial } from '../../types';
import { Group, PageFilters } from '../../types';
import { getResetStateWithoutInitial } from '../../utils/loading';
type CostInsightsTabsFilterProps = PageFilters & {
setGroup: (group: Group) => void;
@@ -24,9 +24,8 @@ import { Alert } from '@material-ui/lab';
import { useApi, identityApiRef } from '@backstage/core';
import { costInsightsApiRef } from '../api';
import { MapLoadingToProps, useLoading } from './useLoading';
import { DefaultLoadingAction, Group, Maybe } from '../types';
console.log(DefaultLoadingAction)
import { Group, Maybe } from '../types';
import { DefaultLoadingAction } from '../utils/loading';
type GroupsProviderLoadingProps = {
dispatchLoadingGroups: (isLoading: boolean) => void;
@@ -25,7 +25,8 @@ import { Alert } from '@material-ui/lab';
import { useApi } from '@backstage/core';
import { costInsightsApiRef } from '../api';
import { MapLoadingToProps, useLoading } from './useLoading';
import { DefaultLoadingAction, Maybe } from '../types';
import { DefaultLoadingAction } from '../utils/loading';
import { Maybe } from '../types';
type BillingDateProviderLoadingProps = {
dispatchLoadingBillingDate: (isLoading: boolean) => void;
@@ -26,12 +26,12 @@ import React, {
useState,
} from 'react';
import { Backdrop, CircularProgress } from '@material-ui/core';
import { Loading } from '../types';
import {
DefaultLoadingAction,
getDefaultState,
getLoadingActions,
Loading,
} from '../types';
} from '../utils/loading';
import { useBackdropStyles as useStyles } from '../utils/styles';
import { useConfig } from './useConfig';
@@ -68,7 +68,7 @@ export const LoadingProvider = ({ children }: PropsWithChildren<{}>) => {
// Initial page loading is handled by progress bar
setBackdropVisible(
!state[DefaultLoadingAction.CostInsightsInitial] &&
Object.values(state).some(l => l),
Object.values(state).some(l => l),
);
}
displayLoadingBackdrop();
+4 -2
View File
@@ -15,11 +15,9 @@
*/
import {
DefaultLoadingAction,
Duration,
Entity,
findAlways,
getDefaultState as getDefaultLoadingState,
Product,
ProductCost,
ProductFilters,
@@ -27,6 +25,10 @@ import {
UnlabeledDataflowAlertProject,
UnlabeledDataflowData,
} from '../types';
import {
DefaultLoadingAction,
getDefaultState as getDefaultLoadingState,
} from '../utils/loading';
import { Config } from '@backstage/config';
import { ConfigApi } from '@backstage/core';