diff --git a/src/fireedge/src/client/components/Tables/Clusters/row.js b/src/fireedge/src/client/components/Tables/Clusters/row.js index e046b06c5c..db11f9264d 100644 --- a/src/fireedge/src/client/components/Tables/Clusters/row.js +++ b/src/fireedge/src/client/components/Tables/Clusters/row.js @@ -6,16 +6,18 @@ import { Typography } from '@material-ui/core' import { rowStyles } from 'client/components/Tables/styles' -const Row = ({ value, ...props }) => { +const Row = ({ original, value, ...props }) => { const classes = rowStyles() const { ID, NAME, HOSTS, DATASTORES, VNETS, PROVIDER_NAME } = value return (
diff --git a/src/fireedge/src/client/components/Tables/Enhanced/styles.js b/src/fireedge/src/client/components/Tables/Enhanced/styles.js
new file mode 100644
index 0000000000..9e7f490ca7
--- /dev/null
+++ b/src/fireedge/src/client/components/Tables/Enhanced/styles.js
@@ -0,0 +1,73 @@
+import { makeStyles } from '@material-ui/core'
+
+import { addOpacityToColor } from 'client/utils'
+
+export default makeStyles(({ palette, typography, breakpoints }) => ({
+ root: {
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column'
+ },
+ toolbar: {
+ ...typography.body1,
+ marginBottom: 16,
+ display: 'flex',
+ gap: '1em',
+ alignItems: 'start',
+ justifyContent: 'space-between',
+ '& > div:first-child': {
+ flexGrow: 1
+ }
+ },
+ pagination: {
+ flexShrink: 0,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '1em'
+ },
+ loading: {
+ transition: '200ms'
+ },
+ table: {
+ display: 'grid',
+ gridTemplateColumns: 'minmax(auto, 300px) 1fr',
+ gap: 8,
+ overflow: 'auto',
+ [breakpoints.down('sm')]: {
+ gridTemplateColumns: 'minmax(0, 1fr)'
+ }
+ },
+ body: {
+ overflow: 'auto',
+ display: 'grid',
+ gap: '1em',
+ gridTemplateColumns: 'minmax(0, 1fr)',
+ gridAutoRows: 'max-content',
+ '& > [role=row]': {
+ padding: '0.8em',
+ cursor: 'pointer',
+ color: palette.text.primary,
+ backgroundColor: palette.background.paper,
+ fontWeight: typography.fontWeightMedium,
+ fontSize: '1em',
+ borderRadius: 6,
+ display: 'flex',
+ gap: 8,
+ '&:hover': {
+ backgroundColor: palette.action.hover
+ },
+ '&.selected': {
+ backgroundColor: addOpacityToColor(palette.secondary.main, 0.2),
+ border: `1px solid ${palette.secondary.main}`
+ }
+ }
+ },
+ noDataMessage: {
+ ...typography.h6,
+ color: palette.text.hint,
+ display: 'inline-flex',
+ alignItems: 'center',
+ gap: 6,
+ padding: '1em'
+ }
+}))
diff --git a/src/fireedge/src/client/components/Tables/Enhanced/toolbar.js b/src/fireedge/src/client/components/Tables/Enhanced/toolbar.js
index 6d18efb1cf..de79684ba1 100644
--- a/src/fireedge/src/client/components/Tables/Enhanced/toolbar.js
+++ b/src/fireedge/src/client/components/Tables/Enhanced/toolbar.js
@@ -1,77 +1,26 @@
import * as React from 'react'
import PropTypes from 'prop-types'
-import { makeStyles, Button } from '@material-ui/core'
-import { Filter as FilterIcon } from 'iconoir-react'
+import { makeStyles, useMediaQuery } from '@material-ui/core'
-import GlobalFilter from 'client/components/Tables/Enhanced/Utils/GlobalFilter'
import GlobalSort from 'client/components/Tables/Enhanced/Utils/GlobalSort'
-import { Tr } from 'client/components/HOC'
-import { T } from 'client/constants'
-
-const useToolbarStyles = makeStyles(() => ({
+const useToolbarStyles = makeStyles({
root: {
display: 'flex',
flexDirection: 'column',
alignItems: 'start',
gap: '1em'
- },
- filterWrapper: {
- flexGrow: 1,
- display: 'flex',
- gap: '1em'
- },
- filterButton: {
- minWidth: 123,
- textAlign: 'left'
}
-}))
+})
const Toolbar = ({ useTableProps }) => {
const classes = useToolbarStyles()
-
- /**
- * @type {import('react-table').UseGlobalFiltersInstanceProps &
- * import('react-table').UseSortByInstanceProps &
- * import('react-table').TableInstance &
- * { state: import('react-table').UseGlobalFiltersState &
- * import('react-table').TableState
- * import('react-table').UseSortByState }}
- */
- const {
- headers,
- preGlobalFilteredRows,
- setGlobalFilter,
- preSortedRows,
- setSortBy,
- state: { globalFilter, sortBy }
- } = useTableProps
-
- // const numSelected = Object.keys(selectedRowIds).length
+ const isMobile = useMediaQuery(theme => theme.breakpoints.down('sm'))
return (
-
- }
- className={classes.filterButton}
- >
- {Tr(T.Filter)}
-
-
-
-
+ {!isMobile && }
)
}
diff --git a/src/fireedge/src/client/components/Tables/Hosts/columns.js b/src/fireedge/src/client/components/Tables/Hosts/columns.js
index f52478908a..213c71cad6 100644
--- a/src/fireedge/src/client/components/Tables/Hosts/columns.js
+++ b/src/fireedge/src/client/components/Tables/Hosts/columns.js
@@ -1,3 +1,4 @@
+import CategoryFilter from 'client/components/Tables/Enhanced/Utils/CategoryFilter'
import * as HostModel from 'client/models/Host'
const getTotalOfResources = resources => [resources?.ID ?? []].flat().length || 0
@@ -12,7 +13,14 @@ export default [
{
Header: 'State',
id: 'STATE',
- accessor: row => HostModel.getState(row)
+ accessor: row => HostModel.getState(row)?.name,
+ disableFilters: false,
+ Filter: ({ column }) => CategoryFilter({
+ column,
+ multiple: true,
+ title: 'State'
+ }),
+ filter: 'includesValue'
},
{ Header: 'Cluster', accessor: 'CLUSTER' },
{ Header: 'IM MAD', accessor: 'IM_MAD' },
diff --git a/src/fireedge/src/client/components/Tables/Hosts/row.js b/src/fireedge/src/client/components/Tables/Hosts/row.js
index e8032c105d..587f55cc4a 100644
--- a/src/fireedge/src/client/components/Tables/Hosts/row.js
+++ b/src/fireedge/src/client/components/Tables/Hosts/row.js
@@ -9,11 +9,11 @@ import { rowStyles } from 'client/components/Tables/styles'
import * as HostModel from 'client/models/Host'
-const Row = ({ value, ...props }) => {
+const Row = ({ original, value, ...props }) => {
const classes = rowStyles()
const {
- ID, NAME, IM_MAD, VM_MAD, STATE,
- RUNNING_VMS, TOTAL_VMS, CLUSTER, TEMPLATE
+ ID, NAME, IM_MAD, VM_MAD, RUNNING_VMS,
+ TOTAL_VMS, CLUSTER, TEMPLATE
} = value
const {
@@ -23,22 +23,26 @@ const Row = ({ value, ...props }) => {
percentMemLabel
} = HostModel.getAllocatedInfo(value)
+ const { color: stateColor, name: stateName } = HostModel.getState(original)
+
const labels = [...new Set([IM_MAD, VM_MAD])]
return (
-
+
-
- {TEMPLATE?.NAME ?? NAME}
+
+
+ {TEMPLATE?.NAME ?? NAME}
+
{labels.map(label => (
))}
-
+
{`#${ID}`}
@@ -60,6 +64,7 @@ const Row = ({ value, ...props }) => {
}
Row.propTypes = {
+ original: PropTypes.object,
value: PropTypes.object,
isSelected: PropTypes.bool,
handleClick: PropTypes.func
diff --git a/src/fireedge/src/client/components/Tables/Images/columns.js b/src/fireedge/src/client/components/Tables/Images/columns.js
index 5efade194c..5df5c6fda5 100644
--- a/src/fireedge/src/client/components/Tables/Images/columns.js
+++ b/src/fireedge/src/client/components/Tables/Images/columns.js
@@ -1,3 +1,4 @@
+import CategoryFilter from 'client/components/Tables/Enhanced/Utils/CategoryFilter'
import * as ImageModel from 'client/models/Image'
const getTotalOfResources = resources => [resources?.ID ?? []].flat().length || 0
@@ -10,7 +11,14 @@ export default [
{
Header: 'State',
id: 'STATE',
- accessor: row => ImageModel.getState(row)
+ accessor: row => ImageModel.getState(row)?.name,
+ disableFilters: false,
+ Filter: ({ column }) => CategoryFilter({
+ column,
+ multiple: true,
+ title: 'State'
+ }),
+ filter: 'includesValue'
},
{
Header: 'Type',
diff --git a/src/fireedge/src/client/components/Tables/Images/row.js b/src/fireedge/src/client/components/Tables/Images/row.js
index eda3ee7a71..e81e8695bf 100644
--- a/src/fireedge/src/client/components/Tables/Images/row.js
+++ b/src/fireedge/src/client/components/Tables/Images/row.js
@@ -7,14 +7,15 @@ import { Typography } from '@material-ui/core'
import { StatusCircle, StatusChip } from 'client/components/Status'
import { rowStyles } from 'client/components/Tables/styles'
+import * as ImageModel from 'client/models/Image'
import * as Helper from 'client/models/Helper'
-const Row = ({ value, ...props }) => {
+const Row = ({ original, value, ...props }) => {
const classes = rowStyles()
const {
- ID, NAME, UNAME, GNAME, REGTIME,
- STATE, TYPE, DISK_TYPE, PERSISTENT,
- LOCK, DATASTORE, VMS, RUNNING_VMS
+ ID, NAME, UNAME, GNAME, REGTIME, TYPE,
+ DISK_TYPE, PERSISTENT, LOCK, DATASTORE,
+ VMS, RUNNING_VMS
} = value
const usedByVms = [VMS?.ID ?? []].flat().length || 0
@@ -22,24 +23,28 @@ const Row = ({ value, ...props }) => {
const labels = [...new Set([
PERSISTENT && 'PERSISTENT', TYPE, DISK_TYPE])].filter(Boolean)
+ const { color: stateColor, name: stateName } = ImageModel.getState(original)
+
const time = Helper.timeFromMilliseconds(+REGTIME)
const timeAgo = `registered ${time.toRelative()}`
return (
-
+
-
- {NAME}
+
+
+ {NAME}
+
{LOCK && }
{labels.map(label => (
))}
-
+
{`#${ID} ${timeAgo}`}
@@ -68,6 +73,7 @@ const Row = ({ value, ...props }) => {
}
Row.propTypes = {
+ original: PropTypes.object,
value: PropTypes.object,
isSelected: PropTypes.bool,
handleClick: PropTypes.func
diff --git a/src/fireedge/src/client/components/Tables/MarketplaceApps/columns.js b/src/fireedge/src/client/components/Tables/MarketplaceApps/columns.js
index 53e1338c23..3019b50a3e 100644
--- a/src/fireedge/src/client/components/Tables/MarketplaceApps/columns.js
+++ b/src/fireedge/src/client/components/Tables/MarketplaceApps/columns.js
@@ -1,3 +1,4 @@
+import CategoryFilter from 'client/components/Tables/Enhanced/Utils/CategoryFilter'
import * as MarketplaceAppModel from 'client/models/MarketplaceApp'
export default [
@@ -8,7 +9,14 @@ export default [
{
Header: 'State',
id: 'STATE',
- accessor: row => MarketplaceAppModel.getState(row)
+ accessor: row => MarketplaceAppModel.getState(row)?.name,
+ disableFilters: false,
+ Filter: ({ column }) => CategoryFilter({
+ column,
+ multiple: true,
+ title: 'State'
+ }),
+ filter: 'includesValue'
},
{
Header: 'Type',
@@ -17,6 +25,16 @@ export default [
},
{ Header: 'Size', accessor: 'SIZE' },
{ Header: 'Registration Time', accessor: 'REGTIME' },
- { Header: 'Marketplace', accessor: 'MARKETPLACE' },
+ {
+ Header: 'Marketplace',
+ accessor: 'MARKETPLACE',
+ disableFilters: false,
+ Filter: ({ column }) => CategoryFilter({
+ column,
+ multiple: true,
+ title: 'Marketplace'
+ }),
+ filter: 'includesValue'
+ },
{ Header: 'Zone ID', accessor: 'ZONE_ID' }
]
diff --git a/src/fireedge/src/client/components/Tables/MarketplaceApps/row.js b/src/fireedge/src/client/components/Tables/MarketplaceApps/row.js
index 81904c9ec2..97045d8824 100644
--- a/src/fireedge/src/client/components/Tables/MarketplaceApps/row.js
+++ b/src/fireedge/src/client/components/Tables/MarketplaceApps/row.js
@@ -7,32 +7,37 @@ import { Typography } from '@material-ui/core'
import { StatusCircle, StatusChip } from 'client/components/Status'
import { rowStyles } from 'client/components/Tables/styles'
+import * as MarketplaceAppModel from 'client/models/MarketplaceApp'
import * as Helper from 'client/models/Helper'
import { prettyBytes } from 'client/utils'
-const Row = ({ value, ...props }) => {
+const Row = ({ original, value, ...props }) => {
const classes = rowStyles()
const {
- ID, NAME, UNAME, GNAME, LOCK, TYPE, STATE,
+ ID, NAME, UNAME, GNAME, LOCK, TYPE,
REGTIME, MARKETPLACE, ZONE_ID, SIZE
} = value
+ const { color: stateColor, name: stateName } = MarketplaceAppModel.getState(original)
+
const time = Helper.timeFromMilliseconds(+REGTIME)
const timeAgo = `registered ${time.toRelative()}`
return (
-
+
-
- {NAME}
+
+
+ {NAME}
+
{LOCK && }
-
+
{`#${ID} ${timeAgo}`}
@@ -62,6 +67,7 @@ const Row = ({ value, ...props }) => {
}
Row.propTypes = {
+ original: PropTypes.object,
value: PropTypes.object,
isSelected: PropTypes.bool,
handleClick: PropTypes.func
diff --git a/src/fireedge/src/client/components/Tables/Marketplaces/columns.js b/src/fireedge/src/client/components/Tables/Marketplaces/columns.js
index a9d8060bfa..74ed17e8e4 100644
--- a/src/fireedge/src/client/components/Tables/Marketplaces/columns.js
+++ b/src/fireedge/src/client/components/Tables/Marketplaces/columns.js
@@ -1,3 +1,4 @@
+import CategoryFilter from 'client/components/Tables/Enhanced/Utils/CategoryFilter'
import * as MarketplaceModel from 'client/models/Datastore'
const getTotalOfResources = resources => [resources?.ID ?? []].flat().length || 0
@@ -10,7 +11,14 @@ export default [
{
Header: 'State',
id: 'STATE',
- accessor: row => MarketplaceModel.getState(row)
+ accessor: row => MarketplaceModel.getState(row)?.name,
+ disableFilters: false,
+ Filter: ({ column }) => CategoryFilter({
+ column,
+ multiple: true,
+ title: 'State'
+ }),
+ filter: 'includesValue'
},
{ Header: 'Market', accessor: 'MARKET_MAD' },
{ Header: 'Total Capacity', accessor: 'TOTAL_MB' },
diff --git a/src/fireedge/src/client/components/Tables/Marketplaces/row.js b/src/fireedge/src/client/components/Tables/Marketplaces/row.js
index 9a86010765..a54f66c3bc 100644
--- a/src/fireedge/src/client/components/Tables/Marketplaces/row.js
+++ b/src/fireedge/src/client/components/Tables/Marketplaces/row.js
@@ -9,24 +9,28 @@ import { rowStyles } from 'client/components/Tables/styles'
import * as MarketplaceModel from 'client/models/Datastore'
-const Row = ({ value, ...props }) => {
+const Row = ({ original, value, ...props }) => {
const classes = rowStyles()
- const { ID, NAME, UNAME, GNAME, STATE, MARKET_MAD, TOTAL_APPS } = value
+ const { ID, NAME, UNAME, GNAME, MARKET_MAD, TOTAL_APPS } = value
+
+ const { name: stateName, color: stateColor } = MarketplaceModel.getState(original)
const { percentOfUsed, percentLabel } = MarketplaceModel.getCapacityInfo(value)
return (
-
+
-
- {NAME}
+
+
+ {NAME}
+
-
+
{`#${ID}`}
@@ -52,6 +56,7 @@ const Row = ({ value, ...props }) => {
Row.propTypes = {
value: PropTypes.object,
+ original: PropTypes.object,
isSelected: PropTypes.bool,
handleClick: PropTypes.func
}
diff --git a/src/fireedge/src/client/components/Tables/Vms/columns.js b/src/fireedge/src/client/components/Tables/Vms/columns.js
index 4b085714b8..b24ee0d20d 100644
--- a/src/fireedge/src/client/components/Tables/Vms/columns.js
+++ b/src/fireedge/src/client/components/Tables/Vms/columns.js
@@ -1,3 +1,4 @@
+import CategoryFilter from 'client/components/Tables/Enhanced/Utils/CategoryFilter'
import * as VirtualMachineModel from 'client/models/VirtualMachine'
export default [
@@ -6,7 +7,14 @@ export default [
{
Header: 'State',
id: 'STATE',
- accessor: row => VirtualMachineModel.getState(row)
+ accessor: row => VirtualMachineModel.getState(row)?.name,
+ disableFilters: false,
+ Filter: ({ column }) => CategoryFilter({
+ column,
+ multiple: true,
+ title: 'State'
+ }),
+ filter: 'includesValue'
},
{ Header: 'Owner', accessor: 'UNAME' },
{ Header: 'Group', accessor: 'GNAME' },
@@ -22,6 +30,6 @@ export default [
{
Header: 'Hostname',
id: 'HOSTNAME',
- accessor: row => VirtualMachineModel.getLastHistory(row)?.HOSTNAME ?? '--'
+ accessor: row => VirtualMachineModel.getLastHistory(row)?.HOSTNAME
}
]
diff --git a/src/fireedge/src/client/components/Tables/Vms/multiple.js b/src/fireedge/src/client/components/Tables/Vms/multiple.js
index 369d26ab67..c5b45efe2a 100644
--- a/src/fireedge/src/client/components/Tables/Vms/multiple.js
+++ b/src/fireedge/src/client/components/Tables/Vms/multiple.js
@@ -16,20 +16,22 @@ const Multiple = ({ tags, limitTags = 1 }) => {
))
- return [
- ...Tags,
- (more > 0 && (
- (
- {tag}
- ))}
- >
-
- {`+${more} more`}
-
-
- ))
- ]
+ return (
+
+ {Tags}
+ {more > 0 && (
+ (
+ {tag}
+ ))}
+ >
+
+ {`+${more} more`}
+
+
+ )}
+
+ )
}
Multiple.propTypes = {
diff --git a/src/fireedge/src/client/components/Tables/Vms/row.js b/src/fireedge/src/client/components/Tables/Vms/row.js
index 7e2318667b..c3ec3f915c 100644
--- a/src/fireedge/src/client/components/Tables/Vms/row.js
+++ b/src/fireedge/src/client/components/Tables/Vms/row.js
@@ -8,28 +8,32 @@ import { StatusCircle } from 'client/components/Status'
import Multiple from 'client/components/Tables/Vms/multiple'
import { rowStyles } from 'client/components/Tables/styles'
+import * as VirtualMachineModel from 'client/models/VirtualMachine'
import * as Helper from 'client/models/Helper'
-const Row = ({ value, ...props }) => {
+const Row = ({ original, value, ...props }) => {
const classes = rowStyles()
- const {
- ID, NAME, UNAME, GNAME, STATE,
- IPS, STIME, ETIME, HOSTNAME, LOCK
- } = value
+ const { ID, NAME, UNAME, GNAME, IPS, STIME, ETIME, HOSTNAME = '--', LOCK } = value
const time = Helper.timeFromMilliseconds(+ETIME || +STIME)
const timeAgo = `${+ETIME ? 'done' : 'started'} ${time.toRelative()}`
+ const { color: stateColor, name: stateName } = VirtualMachineModel.getState(original)
+
return (
-
+
-
- {NAME}
- {LOCK && }
-
+
+
+ {NAME}
+
+
+ {LOCK && }
+
+
{`#${ID} ${timeAgo}`}
@@ -56,6 +60,7 @@ const Row = ({ value, ...props }) => {
}
Row.propTypes = {
+ original: PropTypes.object,
value: PropTypes.object,
isSelected: PropTypes.bool,
handleClick: PropTypes.func
diff --git a/src/fireedge/src/client/components/Tables/styles.js b/src/fireedge/src/client/components/Tables/styles.js
index a23634c8d8..2f9658ab38 100644
--- a/src/fireedge/src/client/components/Tables/styles.js
+++ b/src/fireedge/src/client/components/Tables/styles.js
@@ -3,17 +3,20 @@ import { makeStyles } from '@material-ui/core'
export const rowStyles = makeStyles(
({ palette, typography, breakpoints }) => ({
main: {
- flex: 'auto'
+ flex: 'auto',
+ overflow: 'hidden'
},
title: {
color: palette.text.primary,
display: 'flex',
- alignItems: 'center'
+ gap: 6,
+ alignItems: 'center',
+ flexWrap: 'wrap',
+ marginBottom: 8
},
labels: {
display: 'inline-flex',
- gap: 6,
- marginLeft: 6
+ gap: 6
},
caption: {
...typography.caption,
diff --git a/src/fireedge/src/client/constants/translates.js b/src/fireedge/src/client/constants/translates.js
index 16775a9af1..fd6c50f3d4 100644
--- a/src/fireedge/src/client/constants/translates.js
+++ b/src/fireedge/src/client/constants/translates.js
@@ -49,6 +49,7 @@ module.exports = {
NotFound: 'Not found',
None: 'None',
Empty: 'Empty',
+ NoDataAvailable: 'There is no data available',
/* steps form */
/* steps form - flow */