B OpenNebula/one#7152: Fix the resize option in details (#3742)

Signed-off-by: dcarracedo <dcarracedo@opennebula.io>
This commit is contained in:
David authored and GitHub committed 2025-07-28 14:40:19 +02:00
1 parent d8db8c0404
commit e4f38464ff
2 files changed
+15 -19

No files matched your search

@@ -23,10 +23,9 @@ import { Box, useMediaQuery, useTheme } from '@mui/material'
import PropTypes from 'prop-types'
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
const heightWindowRow = 30
const heightGutterRow = 40
const defaultPropsResize = `1fr ${heightGutterRow}px 1fr`
const defaultPropsResize = `1fr ${heightGutterRow}px 0fr`
const Switch = memo(({ valid, invalid, condition }) =>
condition ? valid : invalid
@@ -111,12 +110,12 @@ const ResourcesBackButton = memo(
}, [])
useEffect(() => {
isFullMode
? setPropsResize(`${heightWindowRow}px 100% ${heightGutterRow}px 1fr`)
showInfo && hasSelectedRows
? setPropsResize(`1fr ${heightGutterRow}px 1fr`)
: setPropsResize(defaultPropsResize)
!isFullMode && setPageIndex(0)
}, [isFullMode])
}, [showInfo, hasSelectedRows])
useEffect(() => {
!hasSelectedRows && setShowInfo(false)
@@ -235,10 +234,13 @@ const ResourcesBackButton = memo(
id="boxWithProps"
height={1}
sx={{
display: 'flex',
flexDirection: 'column',
display: 'grid',
gridTemplateRows:
hasSelectedRows && showInfo
? propsResize
: defaultPropsResize + ' !important',
paddingBottom: '0rem',
overflow: 'hidden', // Prevents the entire Box from scrolling
overflow: 'hidden',
}}
{...(hasSelectedRows && showInfo && getGridProps())}
>
@@ -280,17 +282,7 @@ const ResourcesBackButton = memo(
invalid={
<Box
sx={{
height: upExtraLarge
? '700px'
: upLarge
? '500px'
: upMedium
? '400px'
: upSmall
? '250px'
: upTiny
? '200px'
: '150px',
height: '100%',
overflow: 'auto',
}}
>
@@ -21,6 +21,7 @@ import Split, { SplitOptions } from 'split-grid'
const Gutter = styled(Divider)(({ theme, direction = 'row' }) => ({
position: 'relative',
cursor: `${direction}-resize`,
height: 8,
marginBlock: '1em',
background: `linear-gradient(
@@ -91,6 +92,9 @@ const useSplitGrid = (options) => {
<Gutter
key={`gutter-${direction}-${track}`}
className="gutter"
direction={direction}
track={track}
onMouseDown={handleDragStart}
onTouchStart={handleDragStart}
/>
)