1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F OpenNebula/one#5422: Show splitpane with select rows only

This commit is contained in:
Sergio Betanzos 2021-06-28 17:34:11 +02:00
parent c6da2438b7
commit 49be6b5b59
No known key found for this signature in database
GPG Key ID: E3E704F097737136
4 changed files with 27 additions and 17 deletions

View File

@ -8,7 +8,7 @@ import {
import { Skeleton } from '@material-ui/lab'
import useNearScreen from 'client/hooks/useNearScreen'
import ConditionalWrap from 'client/components/HOC/ConditionalWrap'
import { ConditionalWrap } from 'client/components/HOC'
import { Action } from 'client/components/Cards/SelectCard'
import selectCardStyles from 'client/components/Cards/SelectCard/styles'

View File

@ -13,5 +13,6 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
export { default as ConditionalWrap } from 'client/components/HOC/ConditionalWrap'
export { default as InternalLayout } from 'client/components/HOC/InternalLayout'
export * from 'client/components/HOC/Translate'

View File

@ -19,7 +19,7 @@ import Filters from 'client/components/Tables/Enhanced/filters'
import DefaultFilter from 'client/components/Table/Filters/DefaultFilter'
import EnhancedTableStyles from 'client/components/Tables/Enhanced/styles'
import { Tr } from 'client/components/HOC'
import { Tr, ConditionalWrap } from 'client/components/HOC'
import { T } from 'client/constants'
const EnhancedTable = ({
@ -103,7 +103,10 @@ const EnhancedTable = ({
}
return (
<SplitPane>
<ConditionalWrap
condition={selectedRows?.length > 0}
wrap={children => <SplitPane>{children}</SplitPane>}
>
<Box {...getTableProps()} className={classes.root}>
<div className={classes.toolbar}>
{!isFetching && <Toolbar useTableProps={useTableProps} />}
@ -158,19 +161,21 @@ const EnhancedTable = ({
</div>
</Box>
<div style={{ display: 'flex', flexDirection: 'column', overflow: 'auto' }}>
{selectedRows?.length === 1 && renderDetail
? renderDetail?.(selectedRows[0]?.values)
: renderAllSelected && (
<pre>
<code>
{JSON.stringify(Object.keys(selectedRowIds)?.join(', '), null, 2)}
</code>
</pre>
)
}
</div>
</SplitPane>
{selectedRows?.length > 0 && (
<div style={{ display: 'flex', flexDirection: 'column', overflow: 'auto' }}>
{selectedRows?.length === 1 && renderDetail
? renderDetail?.(selectedRows[0]?.values)
: renderAllSelected && (
<pre>
<code>
{JSON.stringify(Object.keys(selectedRowIds)?.join(', '), null, 2)}
</code>
</pre>
)
}
</div>
)}
</ConditionalWrap>
)
}

View File

@ -43,7 +43,11 @@ const Newstone = () => {
), [resource])
return (
<Container maxWidth='xl'>
<Container maxWidth='xl' style={{
display: 'flex',
flexDirection: 'column',
height: '100%'
}}>
{Object.values(TABS).includes(history.location.pathname) && renderTabs}
<Box py={2} overflow='auto'>