Skip to content

Commit dd21937

Browse files
gurinder39GurinderRawala
authored andcommitted
changed to cirular progress (#148)
* changed to cirular progress * codeRabbit suggestions
1 parent 32adca5 commit dd21937

File tree

4 files changed

+14
-57
lines changed

4 files changed

+14
-57
lines changed

public/app/features/dashboard/components/DashboardLoading/FnLoader.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import { Box, Typography, type BoxProps } from '@mui/material';
2-
import Lottie, { type LottieComponentProps } from 'lottie-react';
1+
import { Box, CircularProgress, CircularProgressProps, Typography, type BoxProps } from '@mui/material';
32
import React, { type ReactNode, type FC, type HTMLAttributes } from 'react';
43

54
import logoUrl from './fn-logo.svg';
6-
import logoLoader from './fn-lottie-loader.json';
75

86
export type FnLoaderProps = {
97
outerContainerProps?: Omit<BoxProps, 'children'>;
108
innerContainerProps?: Omit<BoxProps, 'children'>;
11-
lottieProps?: LottieComponentProps;
9+
circularProgressProps?: CircularProgressProps;
1210
imageProps?: HTMLAttributes<HTMLImageElement>;
1311
text?: ReactNode;
1412
};
1513

1614
export const FnLoader: FC<FnLoaderProps> = ({
1715
outerContainerProps,
1816
innerContainerProps,
19-
lottieProps,
17+
circularProgressProps,
2018
imageProps,
2119
text,
2220
}) => (
@@ -30,11 +28,12 @@ export const FnLoader: FC<FnLoaderProps> = ({
3028
>
3129
<img src={logoUrl} alt={'FluxNinja logo'} style={{ transform: 'scale(4)' }} {...imageProps} />
3230
<Box marginTop="100px" {...innerContainerProps}>
33-
<Lottie
34-
animationData={logoLoader}
31+
<CircularProgress
32+
role="alert"
33+
aria-busy="true"
3534
aria-label="Loading..."
36-
style={{ maxWidth: '150px', margin: '0 auto' }}
37-
{...lottieProps}
35+
disableShrink
36+
{...circularProgressProps}
3837
/>
3938
</Box>
4039
{typeof text === 'string' ? <Typography>{text}</Typography> : text || null}

public/app/features/dashboard/components/DashboardLoading/fn-lottie-loader.json

-1
This file was deleted.

public/app/fn-app/fn-app-provider.tsx

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import React, { useState, useEffect, FC } from 'react';
1+
import React, { useState, useEffect, FC, PropsWithChildren } from 'react';
22
import { Provider } from 'react-redux';
33
import { BrowserRouter } from 'react-router-dom';
44

55
import { config, navigationLogger } from '@grafana/runtime';
66
import { ErrorBoundaryAlert, GlobalStyles } from '@grafana/ui';
77
import { loadAndInitAngularIfEnabled } from 'app/angular/loadAndInitAngularIfEnabled';
88
import { ThemeProvider } from 'app/core/utils/ConfigProvider';
9+
import { FnLoader } from 'app/features/dashboard/components/DashboardLoading/FnLoader';
910
import { store } from 'app/store/store';
1011

1112
import { GrafanaContext } from '../core/context/GrafanaContext';
@@ -15,33 +16,22 @@ import { FNDashboardProps } from './types';
1516

1617
type FnAppProviderProps = Pick<FNDashboardProps, 'fnError'>;
1718

18-
export const FnAppProvider: FC<FnAppProviderProps> = (props) => {
19-
const { children, fnError = null } = props;
19+
export const FnAppProvider: FC<PropsWithChildren<FnAppProviderProps>> = (props) => {
20+
const { children } = props;
2021

2122
const [ready, setReady] = useState(false);
2223
navigationLogger('AppWrapper', false, 'rendering');
2324
useEffect(() => {
2425
loadAndInitAngularIfEnabled()
2526
.then(() => {
2627
setReady(true);
27-
// $('.preloader').remove();
2828
})
2929
.catch((err) => console.error(err));
3030
return () => {};
3131
}, []);
3232

33-
if (!ready) {
34-
/**
35-
* TODO: I think loader would be better
36-
*/
37-
return <>{fnError}</>;
38-
}
39-
40-
if (!store) {
41-
/**
42-
* TODO: I think loader would be better
43-
*/
44-
return <>{fnError}</>;
33+
if (!store || !ready) {
34+
return <FnLoader />;
4535
}
4636

4737
return (

yarn.lock

-31
Original file line numberDiff line numberDiff line change
@@ -22818,41 +22818,10 @@ __metadata:
2281822818

2281922819
"merge2@npm:^1.2.3, merge2@npm:^1.3.0, merge2@npm:^1.4.1":
2282022820
version: 1.4.1
22821-
resolution: "merge2@npm:1.4.1"
2282222821
checksum: 10/7268db63ed5169466540b6fb947aec313200bcf6d40c5ab722c22e242f651994619bcd85601602972d3c85bd2cc45a358a4c61937e9f11a061919a1da569b0c2
2282322822
languageName: node
2282422823
linkType: hard
2282522824

22826-
"methods@npm:~1.1.2":
22827-
version: 1.1.2
22828-
resolution: "methods@npm:1.1.2"
22829-
checksum: 10/a385dd974faa34b5dd021b2bbf78c722881bf6f003bfe6d391d7da3ea1ed625d1ff10ddd13c57531f628b3e785be38d3eed10ad03cebd90b76932413df9a1820
22830-
languageName: node
22831-
linkType: hard
22832-
22833-
"micro-memoize@npm:^4.1.2":
22834-
version: 4.1.2
22835-
resolution: "micro-memoize@npm:4.1.2"
22836-
checksum: 10/027e90c3147c97c07224440ea50ede27eb7d888149e4925820397b466d16efc525f5ec3981e4cadec3258a8d36dfd5e7e7c8e660879fbe2e47106785be9bc570
22837-
languageName: node
22838-
linkType: hard
22839-
22840-
"micromark-core-commonmark@npm:^2.0.0":
22841-
version: 2.0.1
22842-
resolution: "micromark-core-commonmark@npm:2.0.1"
22843-
dependencies:
22844-
decode-named-character-reference: "npm:^1.0.0"
22845-
devlop: "npm:^1.0.0"
22846-
micromark-factory-destination: "npm:^2.0.0"
22847-
micromark-factory-label: "npm:^2.0.0"
22848-
micromark-factory-space: "npm:^2.0.0"
22849-
micromark-factory-title: "npm:^2.0.0"
22850-
micromark-factory-whitespace: "npm:^2.0.0"
22851-
micromark-util-character: "npm:^2.0.0"
22852-
micromark-util-chunked: "npm:^2.0.0"
22853-
micromark-util-classify-character: "npm:^2.0.0"
22854-
micromark-util-html-tag-name: "npm:^2.0.0"
22855-
micromark-util-normalize-identifier: "npm:^2.0.0"
2285622825
micromark-util-resolve-all: "npm:^2.0.0"
2285722826
micromark-util-subtokenize: "npm:^2.0.0"
2285822827
micromark-util-symbol: "npm:^2.0.0"

0 commit comments

Comments
 (0)