diff --git a/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js b/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js index c2378e26e9..e045c7f956 100644 --- a/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js +++ b/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js @@ -49,17 +49,15 @@ function SunstoneDashboard() { const imageAccess = useMemo(() => hasAccessToResource(IMAGE), [view]) const vnetAccess = useMemo(() => hasAccessToResource(VNET), [view]) + const styles = useMemo(() => { + if (stringToBoolean(DISABLE_ANIMATIONS)) + return { + '& *, & *::before, & *::after': { animation: 'none !important' }, + } + }, [DISABLE_ANIMATIONS]) + return ( - + { +const ResourceWidget = memo((props) => { + const { settings: { DISABLE_ANIMATIONS } = {} } = useAuth() + const { query, onClick, text, bgColor, icon } = props const { data = [], isFetching } = query() + const NumberElement = useMemo(() => { + if (stringToBoolean(DISABLE_ANIMATIONS)) return data?.length + + return + }, [DISABLE_ANIMATIONS, data?.length]) + return ( - ) : ( - - ) - } - {...props} + bgColor={bgColor} + icon={icon} + text={text} + value={isFetching ? : NumberElement} + onClick={onClick || undefined} /> ) @@ -124,6 +127,7 @@ ResourceWidget.propTypes = { text: PropTypes.string, bgColor: PropTypes.string, icon: PropTypes.any, + onClick: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]), } export default SunstoneDashboard