diff --git a/src/fireedge/src/client/components/Cards/DatastoreCard.js b/src/fireedge/src/client/components/Cards/DatastoreCard.js
index 2bd4aaa1d8..b912490b11 100644
--- a/src/fireedge/src/client/components/Cards/DatastoreCard.js
+++ b/src/fireedge/src/client/components/Cards/DatastoreCard.js
@@ -4,25 +4,43 @@ import PropTypes from 'prop-types'
import { makeStyles, Typography } from '@material-ui/core'
import DatastoreIcon from '@material-ui/icons/FolderOpen'
-import SelectCard from 'client/components/Cards/SelectCard'
-import { StatusBadge, StatusChip } from 'client/components/Status'
+import SelectCard, { Action } from 'client/components/Cards/SelectCard'
+import { StatusBadge, StatusChip, LinearProgressWithLabel } from 'client/components/Status'
+
+import { prettyBytes } from 'client/utils'
import Datastore from 'client/constants/datastore'
-const useStyles = makeStyles(() => ({
- title: { display: 'flex', gap: '0.5rem' }
+const useStyles = makeStyles(({
+ title: {
+ display: 'flex',
+ gap: '0.5rem'
+ },
+ content: {
+ padding: '2em',
+ display: 'flex',
+ flexFlow: 'column',
+ gap: '1em'
+ }
}))
const DatastoreCard = memo(
({ value, isSelected, handleClick, actions }) => {
const classes = useStyles()
- const { ID, NAME, TYPE, STATE } = value
+ const { ID, NAME, TYPE, STATE, TOTAL_MB, USED_MB } = value
const type = Datastore.TYPES[TYPE]
const state = Datastore.STATES[STATE]
+ const percentOfUsed = +USED_MB * 100 / +TOTAL_MB || 0
+ const usedBytes = prettyBytes(+USED_MB, 'MB')
+ const totalBytes = prettyBytes(+TOTAL_MB, 'MB')
+ const percentLabel = `${usedBytes} / ${totalBytes} (${Math.round(percentOfUsed)}%)`
+
return (
+
+ )}
icon={
@@ -39,8 +57,11 @@ const DatastoreCard = memo(
subheader={`#${ID}`}
isSelected={isSelected}
handleClick={handleClick}
- actions={actions}
- />
+ >
+
+
+
+
)
},
(prev, next) => (
@@ -54,7 +75,10 @@ DatastoreCard.propTypes = {
ID: PropTypes.string.isRequired,
NAME: PropTypes.string.isRequired,
TYPE: PropTypes.string,
- STATE: PropTypes.string
+ STATE: PropTypes.string,
+ TOTAL_MB: PropTypes.string,
+ FREE_MB: PropTypes.string,
+ USED_MB: PropTypes.string
}),
isSelected: PropTypes.bool,
handleClick: PropTypes.func,
diff --git a/src/fireedge/src/client/components/Cards/HostCard.js b/src/fireedge/src/client/components/Cards/HostCard.js
index 60a1ce702e..12d5078d13 100644
--- a/src/fireedge/src/client/components/Cards/HostCard.js
+++ b/src/fireedge/src/client/components/Cards/HostCard.js
@@ -4,31 +4,53 @@ import PropTypes from 'prop-types'
import { makeStyles, Typography } from '@material-ui/core'
import { Computer as HostIcon } from '@material-ui/icons'
-import SelectCard from 'client/components/Cards/SelectCard'
-import { StatusBadge, StatusChip } from 'client/components/Status'
+import SelectCard, { Action } from 'client/components/Cards/SelectCard'
+import { StatusBadge, StatusChip, LinearProgressWithLabel } from 'client/components/Status'
+
+import { prettyBytes } from 'client/utils'
import Host from 'client/constants/host'
-const useStyles = makeStyles(() => ({
- title: { display: 'flex', gap: '0.5rem' }
-}))
+const useStyles = makeStyles({
+ title: {
+ display: 'flex',
+ gap: '0.5rem'
+ },
+ content: {
+ padding: '2em',
+ display: 'flex',
+ flexFlow: 'column',
+ gap: '1em'
+ }
+})
const HostCard = memo(
({ value, isSelected, handleClick, actions }) => {
const classes = useStyles()
- const { ID, NAME, STATE, IM_MAD: imMad, VM_MAD: vmMad } = value
+ const { ID, NAME, STATE, IM_MAD, VM_MAD, HOST_SHARE } = value
+ const { CPU_USAGE, TOTAL_CPU, MEM_USAGE, TOTAL_MEM } = HOST_SHARE
+
+ const percentCpuUsed = +CPU_USAGE * 100 / +TOTAL_CPU || 0
+ const percentCpuLabel = `${CPU_USAGE} / ${TOTAL_CPU} (${Math.round(percentCpuUsed)}%)`
+
+ const percentMemUsed = +MEM_USAGE * 100 / +TOTAL_MEM || 0
+ const usedMemBytes = prettyBytes(+MEM_USAGE)
+ const totalMemBytes = prettyBytes(+TOTAL_MEM)
+ const percentMemLabel = `${usedMemBytes} / ${totalMemBytes} (${Math.round(percentMemUsed)}%)`
+
const state = Host.STATES[STATE]
- const mad = imMad === vmMad ? imMad : `${imMad}/${vmMad}`
+ const mad = IM_MAD === VM_MAD ? IM_MAD : `${IM_MAD}/${VM_MAD}`
return (
+
+ )}
icon={
}
-
title={
@@ -40,8 +62,12 @@ const HostCard = memo(
subheader={`#${ID}`}
isSelected={isSelected}
handleClick={handleClick}
- actions={actions}
- />
+ >
+
+
+
+
+
)
},
(prev, next) => (
@@ -57,7 +83,13 @@ HostCard.propTypes = {
TYPE: PropTypes.string,
STATE: PropTypes.string,
IM_MAD: PropTypes.string,
- VM_MAD: PropTypes.string
+ VM_MAD: PropTypes.string,
+ HOST_SHARE: PropTypes.shape({
+ CPU_USAGE: PropTypes.string,
+ TOTAL_CPU: PropTypes.string,
+ MEM_USAGE: PropTypes.string,
+ TOTAL_MEM: PropTypes.string
+ })
}),
isSelected: PropTypes.bool,
handleClick: PropTypes.func,
diff --git a/src/fireedge/src/client/components/Cards/NetworkCard.js b/src/fireedge/src/client/components/Cards/NetworkCard.js
index 30e0aee192..9c55fc506d 100644
--- a/src/fireedge/src/client/components/Cards/NetworkCard.js
+++ b/src/fireedge/src/client/components/Cards/NetworkCard.js
@@ -2,22 +2,35 @@ import React, { memo } from 'react'
import PropTypes from 'prop-types'
import NetworkIcon from '@material-ui/icons/AccountTree'
-import SelectCard from 'client/components/Cards/SelectCard'
+
+import SelectCard, { Action } from 'client/components/Cards/SelectCard'
+import { LinearProgressWithLabel } from 'client/components/Status'
const NetworkCard = memo(
({ value, isSelected, handleClick, actions }) => {
- const { ID, NAME } = value
+ const { ID, NAME, USED_LEASES = '', AR_POOL } = value
+
+ const addresses = [AR_POOL?.AR ?? []].flat()
+ const totalLeases = addresses.reduce((res, ar) => +ar.SIZE + res, 0)
+
+ const percentOfUsed = +USED_LEASES * 100 / +totalLeases || 0
+ const percentLabel = `${USED_LEASES} / ${totalLeases} (${Math.round(percentOfUsed)}%)`
return (
+
+ )}
icon={}
title={NAME}
subheader={`#${ID}`}
isSelected={isSelected}
handleClick={handleClick}
- actions={actions}
- />
+ >
+
+
+
+
)
},
(prev, next) => prev.isSelected === next.isSelected
@@ -28,7 +41,11 @@ NetworkCard.propTypes = {
ID: PropTypes.string.isRequired,
NAME: PropTypes.string.isRequired,
TYPE: PropTypes.string,
- STATE: PropTypes.string
+ STATE: PropTypes.string,
+ USED_LEASES: PropTypes.string,
+ AR_POOL: PropTypes.shape({
+ AR: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
+ })
}),
isSelected: PropTypes.bool,
handleClick: PropTypes.func,
diff --git a/src/fireedge/src/client/components/Cards/ProvisionCard.js b/src/fireedge/src/client/components/Cards/ProvisionCard.js
index ed517c5cd7..84753ec975 100644
--- a/src/fireedge/src/client/components/Cards/ProvisionCard.js
+++ b/src/fireedge/src/client/components/Cards/ProvisionCard.js
@@ -4,8 +4,7 @@ import PropTypes from 'prop-types'
import ProviderIcon from '@material-ui/icons/Public'
import ProvisionIcon from '@material-ui/icons/Cloud'
-import SelectCard from 'client/components/Cards/SelectCard'
-import Action from 'client/components/Cards/SelectCard/Action'
+import SelectCard, { Action } from 'client/components/Cards/SelectCard'
import { StatusBadge } from 'client/components/Status'
import Image from 'client/components/Image'
import { isExternalURL } from 'client/utils'
diff --git a/src/fireedge/src/client/components/Cards/SelectCard/SelectCard.js b/src/fireedge/src/client/components/Cards/SelectCard/SelectCard.js
new file mode 100644
index 0000000000..65236898e6
--- /dev/null
+++ b/src/fireedge/src/client/components/Cards/SelectCard/SelectCard.js
@@ -0,0 +1,210 @@
+import React, { memo } from 'react'
+import PropTypes from 'prop-types'
+import clsx from 'clsx'
+
+import {
+ Card, CardActionArea, CardHeader, CardActions, CardMedia
+} from '@material-ui/core'
+import { Skeleton } from '@material-ui/lab'
+
+import useNearScreen from 'client/hooks/useNearScreen'
+import ConditionalWrap from 'client/components/HOC/ConditionalWrap'
+
+import { Action } from 'client/components/Cards/SelectCard'
+import selectCardStyles from 'client/components/Cards/SelectCard/styles'
+
+const SelectCard = memo(({
+ action,
+ actions,
+ cardActionsProps,
+ cardHeaderProps,
+ cardProps,
+ cardActionAreaProps,
+ children,
+ dataCy,
+ disableFilterImage,
+ handleClick,
+ icon,
+ isSelected,
+ mediaProps,
+ observerOff,
+ stylesProps,
+ subheader,
+ title
+}) => {
+ const classes = selectCardStyles({ ...stylesProps, isSelected, disableFilterImage })
+ const { isNearScreen, fromRef } = useNearScreen({
+ distance: '100px'
+ })
+
+ return (
+ {children}}>
+ {observerOff || isNearScreen ? (
+
+
+ {/* CARD ACTION AREA */}
+
+
+ {children}
+
+ }
+ >
+ {/* CARD HEADER */}
+ {(title || subheader || icon || action) && (
+
+ )}
+
+ {/* CARD CONTENT */}
+ {children}
+
+ {/* CARD MEDIA */}
+ {mediaProps && (
+
+
+ {children}
+
+ }
+ >
+
+
+ )}
+
+ {/* CARD ACTIONS */}
+ {actions?.length > 0 && (
+
+ {actions?.map(action => (
+
+ ))}
+
+ )}
+
+
+ ) : (
+
+ )}
+
+ )
+})
+
+SelectCard.propTypes = {
+ stylesProps: PropTypes.object,
+ action: PropTypes.node,
+ actions: PropTypes.arrayOf(
+ PropTypes.shape({
+ handleClick: PropTypes.func.isRequired,
+ icon: PropTypes.node.isRequired,
+ cy: PropTypes.string
+ })
+ ),
+ cardActionsProps: PropTypes.shape({
+ className: PropTypes.string,
+ style: PropTypes.object
+ }),
+ icon: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.object
+ ]),
+ title: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.object
+ ]),
+ subheader: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.object
+ ]),
+ cardHeaderProps: PropTypes.object,
+ mediaProps: PropTypes.shape({
+ classes: PropTypes.object,
+ className: PropTypes.string,
+ component: PropTypes.elementType,
+ image: PropTypes.string,
+ src: PropTypes.string,
+ style: PropTypes.object
+ }),
+ isSelected: PropTypes.bool,
+ handleClick: PropTypes.func,
+ cardProps: PropTypes.object,
+ cardActionAreaProps: PropTypes.object,
+ observerOff: PropTypes.bool,
+ children: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.node),
+ PropTypes.node,
+ PropTypes.string
+ ]),
+ dataCy: PropTypes.string,
+ disableFilterImage: PropTypes.bool
+}
+
+SelectCard.defaultProps = {
+ action: undefined,
+ actions: undefined,
+ cardActionsProps: undefined,
+ cardHeaderProps: undefined,
+ cardProps: {},
+ cardActionAreaProps: {},
+ children: undefined,
+ dataCy: undefined,
+ disableFilterImage: false,
+ handleClick: undefined,
+ icon: undefined,
+ isSelected: false,
+ mediaProps: undefined,
+ observerOff: false,
+ stylesProps: undefined,
+ subheader: undefined,
+ title: undefined
+}
+
+SelectCard.displayName = 'SelectCard'
+
+export default SelectCard
diff --git a/src/fireedge/src/client/components/Cards/SelectCard/index.js b/src/fireedge/src/client/components/Cards/SelectCard/index.js
index 82f851103f..0ebe5b3abd 100644
--- a/src/fireedge/src/client/components/Cards/SelectCard/index.js
+++ b/src/fireedge/src/client/components/Cards/SelectCard/index.js
@@ -1,209 +1,6 @@
-import React, { memo } from 'react'
-import PropTypes from 'prop-types'
-import clsx from 'clsx'
-
-import {
- Card, CardActionArea, CardHeader, CardActions, CardMedia
-} from '@material-ui/core'
-import { Skeleton } from '@material-ui/lab'
-
-import useNearScreen from 'client/hooks/useNearScreen'
-import ConditionalWrap from 'client/components/HOC/ConditionalWrap'
+import SelectCard from 'client/components/Cards/SelectCard/SelectCard'
import Action from 'client/components/Cards/SelectCard/Action'
-import selectCardStyles from 'client/components/Cards/SelectCard/styles'
-const SelectCard = memo(({
- action,
- actions,
- cardActionsProps,
- cardHeaderProps,
- cardProps,
- cardActionAreaProps,
- children,
- dataCy,
- disableFilterImage,
- handleClick,
- icon,
- isSelected,
- mediaProps,
- observerOff,
- stylesProps,
- subheader,
- title
-}) => {
- const classes = selectCardStyles({ ...stylesProps, isSelected, disableFilterImage })
- const { isNearScreen, fromRef } = useNearScreen({
- distance: '100px'
- })
-
- return (
- {children}}>
- {observerOff || isNearScreen ? (
-
-
- {/* CARD ACTION AREA */}
-
-
- {children}
-
- }
- >
- {/* CARD HEADER */}
- {(title || subheader || icon || action) && (
-
- )}
-
- {/* CARD CONTENT */}
- {children}
-
- {/* CARD MEDIA */}
- {mediaProps && (
-
-
- {children}
-
- }
- >
-
-
- )}
-
- {/* CARD ACTIONS */}
- {actions?.length > 0 && (
-
- {actions?.map(action => (
-
- ))}
-
- )}
-
-
- ) : (
-
- )}
-
- )
-})
-
-SelectCard.propTypes = {
- stylesProps: PropTypes.object,
- action: PropTypes.node,
- actions: PropTypes.arrayOf(
- PropTypes.shape({
- handleClick: PropTypes.func.isRequired,
- icon: PropTypes.node.isRequired,
- cy: PropTypes.string
- })
- ),
- cardActionsProps: PropTypes.shape({
- className: PropTypes.string,
- style: PropTypes.object
- }),
- icon: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.object
- ]),
- title: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.object
- ]),
- subheader: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.object
- ]),
- cardHeaderProps: PropTypes.object,
- mediaProps: PropTypes.shape({
- classes: PropTypes.object,
- className: PropTypes.string,
- component: PropTypes.elementType,
- image: PropTypes.string,
- src: PropTypes.string,
- style: PropTypes.object
- }),
- isSelected: PropTypes.bool,
- handleClick: PropTypes.func,
- cardProps: PropTypes.object,
- cardActionAreaProps: PropTypes.object,
- observerOff: PropTypes.bool,
- children: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.node),
- PropTypes.node,
- PropTypes.string
- ]),
- dataCy: PropTypes.string,
- disableFilterImage: PropTypes.bool
-}
-
-SelectCard.defaultProps = {
- action: undefined,
- actions: undefined,
- cardActionsProps: undefined,
- cardHeaderProps: undefined,
- cardProps: {},
- cardActionAreaProps: {},
- children: undefined,
- dataCy: undefined,
- disableFilterImage: false,
- handleClick: undefined,
- icon: undefined,
- isSelected: false,
- mediaProps: undefined,
- observerOff: false,
- stylesProps: undefined,
- subheader: undefined,
- title: undefined
-}
-
-SelectCard.displayName = 'SelectCard'
+export { Action }
export default SelectCard
diff --git a/src/fireedge/src/client/components/Status/LinearProgressWithLabel.js b/src/fireedge/src/client/components/Status/LinearProgressWithLabel.js
new file mode 100644
index 0000000000..57eb5e374e
--- /dev/null
+++ b/src/fireedge/src/client/components/Status/LinearProgressWithLabel.js
@@ -0,0 +1,35 @@
+import React, { memo } from 'react'
+import PropTypes from 'prop-types'
+
+import { withStyles } from '@material-ui/core/styles'
+import { Typography, LinearProgress } from '@material-ui/core'
+
+const BorderLinearProgress = withStyles(({ palette }) => ({
+ root: {
+ height: 15,
+ borderRadius: 5
+ },
+ colorPrimary: {
+ backgroundColor: palette.grey[palette.type === 'light' ? 200 : 700]
+ },
+ bar: {
+ borderRadius: 5,
+ backgroundColor: palette.primary.main
+ }
+}))(LinearProgress)
+
+const LinearProgressWithLabel = memo(({ value, label }) => (
+
+ {label}
+
+
+), (prev, next) => prev.value === next.value && prev.label === next.label)
+
+LinearProgressWithLabel.propTypes = {
+ value: PropTypes.number.isRequired,
+ label: PropTypes.string.isRequired
+}
+
+LinearProgressWithLabel.displayName = 'LinearProgressWithLabel'
+
+export default LinearProgressWithLabel
diff --git a/src/fireedge/src/client/components/Status/index.js b/src/fireedge/src/client/components/Status/index.js
index 7a14d44044..3ac225cdd1 100644
--- a/src/fireedge/src/client/components/Status/index.js
+++ b/src/fireedge/src/client/components/Status/index.js
@@ -1,7 +1,9 @@
import StatusBadge from 'client/components/Status/Badge'
import StatusChip from 'client/components/Status/Chip'
+import LinearProgressWithLabel from 'client/components/Status/LinearProgressWithLabel'
export {
StatusBadge,
- StatusChip
+ StatusChip,
+ LinearProgressWithLabel
}
diff --git a/src/fireedge/src/client/containers/Webconsole/index.js b/src/fireedge/src/client/containers/Webconsole/index.js
index 196d99e160..149b828958 100644
--- a/src/fireedge/src/client/containers/Webconsole/index.js
+++ b/src/fireedge/src/client/containers/Webconsole/index.js
@@ -18,8 +18,13 @@ import React, { useState, useEffect, memo } from 'react'
import { Button, makeStyles } from '@material-ui/core'
import { useSocket } from 'client/hooks'
-const useStyles = makeStyles(() => ({
- sticky: { position: 'sticky', top: 0, backgroundColor: '#fafafa' },
+const useStyles = makeStyles(theme => ({
+ sticky: {
+ position: 'sticky',
+ top: 0,
+ padding: '1em',
+ backgroundColor: theme.palette.background.paper
+ },
loading: {
'&::after': {
overflow: 'hidden',
diff --git a/src/fireedge/src/client/router/flow.js b/src/fireedge/src/client/router/flow.js
index 4c5a84a4c4..e8cd604f31 100644
--- a/src/fireedge/src/client/router/flow.js
+++ b/src/fireedge/src/client/router/flow.js
@@ -3,8 +3,21 @@ import {
FormatListBulleted as TemplatesIcons,
Apps as InstancesIcons
} from '@material-ui/icons'
+
import loadable from '@loadable/component'
+const Login = loadable(() => import('client/containers/Login'), { ssr: false })
+
+const Dashboard = loadable(() => import('client/containers/Dashboard'), { ssr: false })
+const Settings = loadable(() => import('client/containers/Settings'), { ssr: false })
+const ApplicationsTemplates = loadable(() => import('client/containers/ApplicationsTemplates'), { ssr: false })
+const ApplicationsInstances = loadable(() => import('client/containers/ApplicationsInstances'), { ssr: false })
+
+const ApplicationsTemplatesFormCreate = loadable(
+ () => import('client/containers/ApplicationsTemplates/Form/Create'),
+ { ssr: false }
+)
+
export const PATH = {
LOGIN: '/',
DASHBOARD: '/dashboard',
@@ -24,7 +37,7 @@ export const ENDPOINTS = [
label: 'Login',
path: PATH.LOGIN,
authenticated: false,
- Component: loadable(() => import('client/containers/Login'))
+ Component: Login
},
{
label: 'Dashboard',
@@ -32,14 +45,14 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: DashboardIcon,
- Component: loadable(() => import('client/containers/Dashboard'))
+ Component: Dashboard
},
{
label: 'Settings',
path: PATH.SETTINGS,
authenticated: true,
header: true,
- Component: loadable(() => import('client/containers/Settings'), { ssr: false })
+ Component: Settings
},
{
label: 'Templates',
@@ -47,19 +60,19 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: TemplatesIcons,
- Component: loadable(() => import('client/containers/ApplicationsTemplates'), { ssr: false })
+ Component: ApplicationsTemplates
},
{
label: 'Create Application template',
path: PATH.APPLICATIONS_TEMPLATES.CREATE,
authenticated: true,
- Component: loadable(() => import('client/containers/ApplicationsTemplates/Form/Create'), { ssr: false })
+ Component: ApplicationsTemplatesFormCreate
},
{
label: 'Edit Application template',
path: PATH.APPLICATIONS_TEMPLATES.EDIT,
authenticated: true,
- Component: loadable(() => import('client/containers/ApplicationsTemplates/Form/Create'), { ssr: false })
+ Component: ApplicationsTemplatesFormCreate
},
{
label: 'Instances',
@@ -67,7 +80,7 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: InstancesIcons,
- Component: loadable(() => import('client/containers/ApplicationsInstances'), { ssr: false })
+ Component: ApplicationsInstances
}
]
diff --git a/src/fireedge/src/client/router/index.js b/src/fireedge/src/client/router/index.js
index b470cd4f57..a50ca1c7d6 100644
--- a/src/fireedge/src/client/router/index.js
+++ b/src/fireedge/src/client/router/index.js
@@ -71,7 +71,10 @@ Router.propTypes = {
authenticated: PropTypes.bool.isRequired,
sidebar: PropTypes.bool,
icon: PropTypes.object,
- Component: PropTypes.func.isRequired
+ Component: PropTypes.oneOfType([
+ PropTypes.func,
+ PropTypes.object
+ ]).isRequired
})
)
})
diff --git a/src/fireedge/src/client/router/provision.js b/src/fireedge/src/client/router/provision.js
index a190142e9a..686fa8d1b6 100644
--- a/src/fireedge/src/client/router/provision.js
+++ b/src/fireedge/src/client/router/provision.js
@@ -4,8 +4,20 @@ import {
SettingsSystemDaydream as ProvisionsIcon,
Settings as SettingsIcon
} from '@material-ui/icons'
+
import loadable from '@loadable/component'
+const Login = loadable(() => import('client/containers/Login'), { ssr: false })
+const Dashboard = loadable(() => import('client/containers/Dashboard/Provision'), { ssr: false })
+
+const Providers = loadable(() => import('client/containers/Providers'), { ssr: false })
+const ProvidersFormCreate = loadable(() => import('client/containers/Providers/Form/Create'), { ssr: false })
+
+const Provisions = loadable(() => import('client/containers/Provisions'), { ssr: false })
+const ProvisionsFormCreate = loadable(() => import('client/containers/Provisions/Form/Create'), { ssr: false })
+
+const Settings = loadable(() => import('client/containers/Settings'), { ssr: false })
+
export const PATH = {
LOGIN: '/',
DASHBOARD: '/dashboard',
@@ -28,7 +40,7 @@ export const ENDPOINTS = [
label: 'Login',
path: PATH.LOGIN,
authenticated: false,
- Component: loadable(() => import('client/containers/Login'))
+ Component: Login
},
{
label: 'Dashboard',
@@ -36,7 +48,7 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: DashboardIcon,
- Component: loadable(() => import('client/containers/Dashboard/Provision'))
+ Component: Dashboard
},
{
label: 'Providers',
@@ -44,19 +56,19 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: ProvidersIcon,
- Component: loadable(() => import('client/containers/Providers'), { ssr: false })
+ Component: Providers
},
{
label: 'Create Provider',
path: PATH.PROVIDERS.CREATE,
authenticated: true,
- Component: loadable(() => import('client/containers/Providers/Form/Create'), { ssr: false })
+ Component: ProvidersFormCreate
},
{
label: 'Edit Provider template',
path: PATH.PROVIDERS.EDIT,
authenticated: true,
- Component: loadable(() => import('client/containers/Providers/Form/Create'), { ssr: false })
+ Component: ProvidersFormCreate
},
{
label: 'Provisions',
@@ -64,19 +76,19 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: ProvisionsIcon,
- Component: loadable(() => import('client/containers/Provisions'), { ssr: false })
+ Component: Provisions
},
{
label: 'Create Provision',
path: PATH.PROVISIONS.CREATE,
authenticated: true,
- Component: loadable(() => import('client/containers/Provisions/Form/Create'), { ssr: false })
+ Component: ProvisionsFormCreate
},
{
label: 'Edit Provision template',
path: PATH.PROVISIONS.EDIT,
authenticated: true,
- Component: loadable(() => import('client/containers/Provisions/Form/Create'), { ssr: false })
+ Component: ProvisionsFormCreate
},
{
label: 'Settings',
@@ -84,7 +96,7 @@ export const ENDPOINTS = [
authenticated: true,
sidebar: true,
icon: SettingsIcon,
- Component: loadable(() => import('client/containers/Settings'), { ssr: false })
+ Component: Settings
}
]
diff --git a/src/fireedge/src/client/utils/helpers.js b/src/fireedge/src/client/utils/helpers.js
index 2dba4c2a88..f1427e2686 100644
--- a/src/fireedge/src/client/utils/helpers.js
+++ b/src/fireedge/src/client/utils/helpers.js
@@ -11,6 +11,28 @@ export function sanitize (strings, ...values) {
return DOMPurify.sanitize(dirty)
}
+/**
+ * Converts a long string of units into a readable format e.g KB, MB, GB, TB, YB
+ *
+ * @param {Int} value The quantity of units.
+ * @param {String} unit The unit of value.
+ * @param {Int} fractionDigits — Number of digits after the decimal point. Must be in the range 0 - 20, inclusive
+ */
+export const prettyBytes = (value, unit = 'KB', fractionDigits = 0) => {
+ const UNITS = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
+
+ if (Math.abs(value) === 0) return `${value} ${UNITS[0]}`
+
+ let idxUnit = UNITS.indexOf(unit)
+
+ while (value > 1024) {
+ value /= 1024
+ idxUnit += 1
+ }
+
+ return `${value.toFixed(fractionDigits)} ${UNITS[idxUnit]}`
+}
+
export const addOpacityToColor = (color, opacity) => {
const opacityHex = Math.round(opacity * 255).toString(16)
return `${color}${opacityHex}`
diff --git a/src/fireedge/src/server/routes/entrypoints/App.js b/src/fireedge/src/server/routes/entrypoints/App.js
index 7994cb9507..bc2b2e8070 100644
--- a/src/fireedge/src/server/routes/entrypoints/App.js
+++ b/src/fireedge/src/server/routes/entrypoints/App.js
@@ -32,7 +32,7 @@ const router = Router()
router.get('*', (req, res) => {
let app = 'dev'
- let title = 'fireedge'
+ let title = 'FireEdge'
const context = {}
let store = ''
let component = ''