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

L #~: Lint FireEdge Sunstone (#2033)

This commit is contained in:
Sergio Betanzos 2022-05-11 17:07:41 +02:00 committed by GitHub
parent 97f81707a8
commit bbd6a4a3ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 109 deletions

View File

@ -16,7 +16,7 @@
import { memo, useMemo, ReactElement } from 'react'
import PropTypes from 'prop-types'
import { useHistory } from 'react-router-dom'
import { Container, Box, CircularProgress, Grid } from '@mui/material'
import { Box, CircularProgress, Grid } from '@mui/material'
import {
ModernTv as VmsIcons,
List as TemplatesIcon,
@ -60,42 +60,41 @@ function SunstoneDashboard() {
},
})}
>
<Box py={3}>
<Grid
container
data-cy="dashboard-widget-total-sunstone-resources"
spacing={3}
>
<ResourceWidget
query={useGetVmsQuery}
bgColor="#fa7892"
text={T.VMs}
icon={VmsIcons}
onClick={vmAccess && (() => goTo(PATH.INSTANCE.VMS.LIST))}
/>
<ResourceWidget
query={useGetTemplatesQuery}
bgColor="#b25aff"
text={T.VMTemplates}
icon={TemplatesIcon}
onClick={templateAccess && (() => goTo(PATH.TEMPLATE.VMS.LIST))}
/>
<ResourceWidget
query={useGetImagesQuery}
bgColor="#1fbbc6"
text={T.Images}
icon={ImageIcon}
onClick={imageAccess && (() => goTo(PATH.STORAGE.IMAGES.LIST))}
/>
<ResourceWidget
query={useGetVNetworksQuery}
bgColor="#f09d42"
text={T.VirtualNetworks}
icon={NetworkIcon}
onClick={vnetAccess && (() => goTo(PATH.NETWORK.VNETS.LIST))}
/>
</Grid>
</Box>
<Grid
container
data-cy="dashboard-widget-total-sunstone-resources"
spacing={3}
>
<ResourceWidget
query={useGetVmsQuery}
bgColor="#fa7892"
text={T.VMs}
icon={VmsIcons}
onClick={vmAccess && (() => goTo(PATH.INSTANCE.VMS.LIST))}
/>
<ResourceWidget
query={useGetTemplatesQuery}
bgColor="#b25aff"
text={T.VMTemplates}
icon={TemplatesIcon}
onClick={templateAccess && (() => goTo(PATH.TEMPLATE.VMS.LIST))}
/>
<ResourceWidget
query={useGetImagesQuery}
bgColor="#1fbbc6"
text={T.Images}
icon={ImageIcon}
onClick={imageAccess && (() => goTo(PATH.STORAGE.IMAGES.LIST))}
/>
<ResourceWidget
query={useGetVNetworksQuery}
bgColor="#f09d42"
text={T.VirtualNetworks}
icon={NetworkIcon}
onClick={vnetAccess && (() => goTo(PATH.NETWORK.VNETS.LIST))}
/>
</Grid>
</Box>
)
}

View File

@ -15,7 +15,7 @@
* ------------------------------------------------------------------------- */
/* eslint-disable jsdoc/require-jsdoc */
import { useState } from 'react'
import { Container, Typography, Stack, Chip } from '@mui/material'
import { Typography, Stack, Chip } from '@mui/material'
import { VmsTable } from 'client/components/Tables'
import VmActions from 'client/components/Tables/Vms/actions'
@ -33,41 +33,35 @@ function VirtualMachines() {
onSelectedRowsChange={onSelectedRowsChange}
globalActions={actions}
/>
{selectedRows?.length > 0 && (
<Stack overflow="auto" data-cy={'detail'}>
{selectedRows?.length === 1 ? (
<>
<Typography color="text.primary" noWrap mb={1}>
{`#${selectedRows[0]?.original.ID} | ${selectedRows[0]?.original.NAME}`}
</Typography>
<VmTabs id={selectedRows[0]?.original.ID} />
</>
) : (
<Stack
direction="row"
flexWrap="wrap"
gap={1}
alignItems="center"
>
<MultipleTags
limitTags={10}
tags={selectedRows?.map(
({ original, id, toggleRowSelected }) => (
<Chip
key={id}
variant="outlined"
label={original?.NAME ?? id}
onDelete={() => toggleRowSelected(false)}
/>
)
)}
/>
</Stack>
)}
</Stack>
)}
</SplitPane>
{selectedRows?.length > 0 && (
<Stack overflow="auto" data-cy={'detail'}>
{selectedRows?.length === 1 ? (
<>
<Typography color="text.primary" noWrap mb={1}>
{`#${selectedRows[0]?.original.ID} | ${selectedRows[0]?.original.NAME}`}
</Typography>
<VmTabs id={selectedRows[0]?.original.ID} />
</>
) : (
<Stack direction="row" flexWrap="wrap" gap={1} alignItems="center">
<MultipleTags
limitTags={10}
tags={selectedRows?.map(
({ original, id, toggleRowSelected }) => (
<Chip
key={id}
variant="outlined"
label={original?.NAME ?? id}
onDelete={() => toggleRowSelected(false)}
/>
)
)}
/>
</Stack>
)}
</Stack>
)}
</SplitPane>
)
}

View File

@ -15,7 +15,7 @@
* ------------------------------------------------------------------------- */
/* eslint-disable jsdoc/require-jsdoc */
import { useState } from 'react'
import { Container, Typography, Stack, Chip } from '@mui/material'
import { Typography, Stack, Chip } from '@mui/material'
import { VmTemplatesTable } from 'client/components/Tables'
import VmTemplateActions from 'client/components/Tables/VmTemplates/actions'
@ -33,41 +33,35 @@ function VmTemplates() {
onSelectedRowsChange={onSelectedRowsChange}
globalActions={actions}
/>
{selectedRows?.length > 0 && (
<Stack overflow="auto">
{selectedRows?.length === 1 ? (
<>
<Typography color="text.primary" noWrap mb={1}>
{`#${selectedRows[0]?.original.ID} | ${selectedRows[0]?.original.NAME}`}
</Typography>
<VmTemplateTabs id={selectedRows[0]?.original.ID} />
</>
) : (
<Stack
direction="row"
flexWrap="wrap"
gap={1}
alignItems="center"
>
<MultipleTags
limitTags={10}
tags={selectedRows?.map(
({ original, id, toggleRowSelected }) => (
<Chip
key={id}
variant="text"
label={original?.NAME ?? id}
onDelete={() => toggleRowSelected(false)}
/>
)
)}
/>
</Stack>
)}
</Stack>
)}
</SplitPane>
{selectedRows?.length > 0 && (
<Stack overflow="auto">
{selectedRows?.length === 1 ? (
<>
<Typography color="text.primary" noWrap mb={1}>
{`#${selectedRows[0]?.original.ID} | ${selectedRows[0]?.original.NAME}`}
</Typography>
<VmTemplateTabs id={selectedRows[0]?.original.ID} />
</>
) : (
<Stack direction="row" flexWrap="wrap" gap={1} alignItems="center">
<MultipleTags
limitTags={10}
tags={selectedRows?.map(
({ original, id, toggleRowSelected }) => (
<Chip
key={id}
variant="text"
label={original?.NAME ?? id}
onDelete={() => toggleRowSelected(false)}
/>
)
)}
/>
</Stack>
)}
</Stack>
)}
</SplitPane>
)
}