Skip to content

Commit

Permalink
F #5422: Fix bar styles on hover (#1996)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Betanzos authored and rsmontero committed Jul 27, 2022
1 parent 90ff146 commit ffead05
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/fireedge/src/client/components/Cards/HostCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const HostCard = memo(
*/
({ host, rootProps, actions }) => {
const classes = rowStyles()
const { ID, NAME, IM_MAD, VM_MAD, HOST_SHARE, CLUSTER, TEMPLATE } = host
const { ID, NAME, IM_MAD, VM_MAD, HOST_SHARE, CLUSTER } = host

const { percentCpuUsed, percentCpuLabel, percentMemUsed, percentMemLabel } =
getAllocatedInfo(host)
Expand All @@ -57,7 +57,7 @@ const HostCard = memo(
<div className={classes.title}>
<StatusCircle color={stateColor} tooltip={stateName} />
<Typography noWrap component="span">
{TEMPLATE?.NAME ?? NAME}
{NAME}
</Typography>
<span className={classes.labels}>
{labels.map((label) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
linearProgressClasses,
} from '@mui/material'

import { SCHEMES } from 'client/constants'

const getRangeColor = ({ value, high, low, palette }) => {
if (low > value) return palette.success.main
if (low < value && value < high) return palette.warning.main
Expand All @@ -34,7 +36,7 @@ const BorderLinearProgress = styled(LinearProgress)(
height: 8,
borderRadius: 5,
[`&.${linearProgressClasses.colorPrimary}`]: {
backgroundColor: palette.grey[palette.mode === 'light' ? 200 : 800],
backgroundColor: palette.grey[palette.mode === SCHEMES.LIGHT ? 400 : 800],
},
[`& .${linearProgressClasses.bar}`]: {
borderRadius: 5,
Expand Down
13 changes: 8 additions & 5 deletions src/fireedge/src/client/components/Tables/Hosts/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@
* See the License for the specific language governing permissions and *
* limitations under the License. *
* ------------------------------------------------------------------------- */
import { memo } from 'react'
import { memo, useMemo } from 'react'
import PropTypes from 'prop-types'
import hostApi from 'client/features/OneApi/host'
import { HostCard } from 'client/components/Cards'

const Row = memo(
({ original, value, ...props }) => {
const detail = hostApi.endpoints.getHosts.useQueryState(undefined, {
selectFromResult: ({ data }) =>
[data ?? []].flat().find((host) => +host?.ID === +original.ID),
const state = hostApi.endpoints.getHosts.useQueryState(undefined, {
selectFromResult: ({ data = [] }) =>
data.find((host) => +host?.ID === +original.ID),
})

return <HostCard host={detail ?? original} rootProps={props} />
const memoHost = useMemo(() => state ?? original, [state, original])

return <HostCard host={memoHost} rootProps={props} />
},
(prev, next) => prev.className === next.className
)
Expand All @@ -34,6 +36,7 @@ Row.propTypes = {
original: PropTypes.object,
value: PropTypes.object,
isSelected: PropTypes.bool,
className: PropTypes.string,
handleClick: PropTypes.func,
}

Expand Down
10 changes: 2 additions & 8 deletions src/fireedge/src/client/components/Tabs/Common/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ import { Fragment, isValidElement } from 'react'
import PropTypes from 'prop-types'

import clsx from 'clsx'
import {
List as MList,
ListItem,
Typography,
Paper,
alpha,
} from '@mui/material'
import { List as MList, ListItem, Typography, Paper } from '@mui/material'
import makeStyles from '@mui/styles/makeStyles'

import {
Expand All @@ -48,7 +42,7 @@ const useStyles = makeStyles((theme) => ({
minHeight: '100%',
},
'&:hover': {
backgroundColor: alpha(theme.palette.text.primary, 0.05),
backgroundColor: theme.palette.action.hover,
},
},
typo: theme.typography.body2,
Expand Down

0 comments on commit ffead05

Please sign in to comment.