diff --git a/src/fireedge/src/client/components/Widgets/TotalSunstoneResources.js b/src/fireedge/src/client/components/Widgets/TotalSunstoneResources.js
index 347d54eeb4..5a43f32177 100644
--- a/src/fireedge/src/client/components/Widgets/TotalSunstoneResources.js
+++ b/src/fireedge/src/client/components/Widgets/TotalSunstoneResources.js
@@ -7,8 +7,9 @@ import {
NetworkAlt as NetworkIcon
} from 'iconoir-react'
import { makeStyles } from '@material-ui/core'
+import { Skeleton } from '@material-ui/lab'
-import { useUser, useGroup, useImage, useVNetwork } from 'client/features/One'
+import { RESOURCES, useOne } from 'client/features/One'
import Count from 'client/components/Count'
import { WavesCard } from 'client/components/Cards'
import { T } from 'client/constants'
@@ -21,44 +22,57 @@ const useStyles = makeStyles({
}
})
-const TotalProvisionInfrastructures = () => {
+const TotalProvisionInfrastructures = ({ isLoading }) => {
const classes = useStyles()
- const users = useUser()
- const groups = useGroup()
- const images = useImage()
- const vnetworks = useVNetwork()
+ const {
+ [RESOURCES.user]: users = [],
+ [RESOURCES.group]: groups = [],
+ [RESOURCES.image]: images = [],
+ [RESOURCES.vn]: vNetworks = []
+ } = useOne()
return React.useMemo(() => (
- }
- bgColor='#fa7892'
- icon={UserIcon}
- />
- }
- bgColor='#b25aff'
- icon={GroupIcon}
- />
- }
- bgColor='#1fbbc6'
- icon={ImageIcon}
- />
- }
- bgColor='#f09d42'
- icon={NetworkIcon}
- />
+ {!users?.length && isLoading ? (
+ <>
+
+
+
+
+ >
+ ) : (
+ <>
+ }
+ bgColor='#fa7892'
+ icon={UserIcon}
+ />
+ }
+ bgColor='#b25aff'
+ icon={GroupIcon}
+ />
+ }
+ bgColor='#1fbbc6'
+ icon={ImageIcon}
+ />
+ }
+ bgColor='#f09d42'
+ icon={NetworkIcon}
+ />
+ >
+ )}
- ), [users.length, groups.length, images.length, vnetworks.length])
+ ), [users?.length, isLoading])
}
TotalProvisionInfrastructures.displayName = 'TotalProvisionInfrastructures'
diff --git a/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js b/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js
index e8b7c8e11f..4000f4bb30 100644
--- a/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js
+++ b/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js
@@ -4,28 +4,35 @@ import clsx from 'clsx'
import { Container, Box, Grid } from '@material-ui/core'
import { useAuth } from 'client/features/Auth'
-import { useUserApi, useGroupApi, useImageApi, useVNetworkApi } from 'client/features/One'
+import { useFetchAll } from 'client/hooks'
+import { useVmApi, useUserApi, useImageApi, useVNetworkApi } from 'client/features/One'
+
import * as Widgets from 'client/components/Widgets'
import dashboardStyles from 'client/containers/Dashboard/Provision/styles'
function Dashboard () {
+ const { status, fetchRequestAll, STATUS } = useFetchAll()
+ const { INIT, PENDING } = STATUS
+
+ const { getVms } = useVmApi()
const { getUsers } = useUserApi()
- const { getGroups } = useGroupApi()
const { getImages } = useImageApi()
const { getVNetworks } = useVNetworkApi()
const { settings: { disableanimations } = {} } = useAuth()
const classes = dashboardStyles({ disableanimations })
- React.useEffect(() => {
- getUsers()
- getGroups()
- getImages()
- getVNetworks()
- }, [])
-
const withoutAnimations = String(disableanimations).toUpperCase() === 'YES'
+ React.useEffect(() => {
+ fetchRequestAll([
+ getVms(),
+ getUsers(),
+ getImages(),
+ getVNetworks()
+ ])
+ }, [])
+
return (
-
+