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

B #5780: Remove ownwership and permissions from Provision (#1944)

This commit is contained in:
Frederick Borges 2022-04-13 17:03:13 +02:00 committed by GitHub
parent 53e1148ad4
commit e5db4f1e17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 112 deletions

View File

@ -55,11 +55,10 @@ const ProvisionCard = memo(
const isExternalImage = useMemo(() => isExternalURL(image), [image])
const imageUrl = useMemo(() => {
if (!image) return DEFAULT_IMAGE
if (!image) return DEFAULT_IMAGE
return isExternalImage ? image : `${IMAGES_URL}/${image}`
},[isExternalImage]
)
return isExternalImage ? image : `${IMAGES_URL}/${image}`
}, [isExternalImage])
return (
<SelectCard

View File

@ -18,11 +18,7 @@ import PropTypes from 'prop-types'
import clsx from 'clsx'
import { List, ListItem, Typography, Grid, Paper, Divider } from '@mui/material'
import {
Check as CheckIcon,
Square as BlankSquareIcon,
EyeEmpty as EyeIcon,
} from 'iconoir-react'
import { EyeEmpty as EyeIcon } from 'iconoir-react'
import {
useLazyGetProviderConnectionQuery,
@ -42,7 +38,7 @@ const Info = memo(({ id }) => {
] = useLazyGetProviderConnectionQuery()
const { data: provider } = useGetProviderQuery(id)
const { NAME, GNAME, UNAME, PERMISSIONS, TEMPLATE } = provider
const { NAME, TEMPLATE } = provider
const {
connection,
description,
@ -52,9 +48,6 @@ const Info = memo(({ id }) => {
const hasConnection = connection && Object.keys(connection).length > 0
const isChecked = (checked) =>
checked === '1' ? <CheckIcon /> : <BlankSquareIcon />
return (
<Grid container spacing={1}>
<Grid item xs={12} md={6}>
@ -120,53 +113,6 @@ const Info = memo(({ id }) => {
</Paper>
)}
</Grid>
<Grid item xs={12} md={6}>
<Paper variant="outlined" className={classes.marginBottom}>
<List className={clsx(classes.list, 'w-25')}>
<ListItem className={classes.title}>
<Typography>{Tr(T.Permissions)}</Typography>
<Typography>{Tr(T.Use)}</Typography>
<Typography>{Tr(T.Manage)}</Typography>
<Typography>{Tr(T.Admin)}</Typography>
</ListItem>
<Divider />
<ListItem>
<Typography>{Tr(T.Owner)}</Typography>
<Typography>{isChecked(PERMISSIONS.OWNER_U)}</Typography>
<Typography>{isChecked(PERMISSIONS.OWNER_M)}</Typography>
<Typography>{isChecked(PERMISSIONS.OWNER_A)}</Typography>
</ListItem>
<ListItem>
<Typography>{Tr(T.Group)}</Typography>
<Typography>{isChecked(PERMISSIONS.GROUP_U)}</Typography>
<Typography>{isChecked(PERMISSIONS.GROUP_M)}</Typography>
<Typography>{isChecked(PERMISSIONS.GROUP_A)}</Typography>
</ListItem>
<ListItem>
<Typography>{Tr(T.Other)}</Typography>
<Typography>{isChecked(PERMISSIONS.OTHER_U)}</Typography>
<Typography>{isChecked(PERMISSIONS.OTHER_M)}</Typography>
<Typography>{isChecked(PERMISSIONS.OTHER_A)}</Typography>
</ListItem>
</List>
</Paper>
<Paper variant="outlined">
<List className={clsx(classes.list, 'w-50')}>
<ListItem className={classes.title}>
<Typography>{Tr(T.Ownership)}</Typography>
</ListItem>
<Divider />
<ListItem>
<Typography>{Tr(T.Owner)}</Typography>
<Typography>{UNAME}</Typography>
</ListItem>
<ListItem>
<Typography>{Tr(T.Group)}</Typography>
<Typography>{GNAME}</Typography>
</ListItem>
</List>
</Paper>
</Grid>
</Grid>
)
})

View File

@ -18,7 +18,6 @@ import PropTypes from 'prop-types'
import clsx from 'clsx'
import { List, ListItem, Typography, Grid, Paper, Divider } from '@mui/material'
import { Check as CheckIcon, Square as BlankSquareIcon } from 'iconoir-react'
import { useGetProvisionQuery } from 'client/features/OneApi/provision'
import useStyles from 'client/containers/Provisions/DialogInfo/styles'
@ -30,7 +29,7 @@ const Info = memo(({ id }) => {
const classes = useStyles()
const { data = {} } = useGetProvisionQuery(id)
const { ID, GNAME, UNAME, PERMISSIONS, TEMPLATE } = data
const { ID, TEMPLATE } = data
const {
state,
description,
@ -44,9 +43,6 @@ const Info = memo(({ id }) => {
infrastructure?.clusters?.[0] ?? {}
const stateInfo = PROVISIONS_STATES[state]
const isChecked = (checked) =>
checked === '1' ? <CheckIcon /> : <BlankSquareIcon />
return (
<Grid container spacing={1}>
<Grid item xs={12} md={6}>
@ -92,53 +88,6 @@ const Info = memo(({ id }) => {
</List>
</Paper>
</Grid>
<Grid item xs={12} md={6}>
<Paper variant="outlined" className={classes.permissions}>
<List className={clsx(classes.list, 'w-25')}>
<ListItem className={classes.title}>
<Typography>{Tr(T.Permissions)}</Typography>
<Typography>{Tr(T.Use)}</Typography>
<Typography>{Tr(T.Manage)}</Typography>
<Typography>{Tr(T.Admin)}</Typography>
</ListItem>
<Divider />
<ListItem>
<Typography>{Tr(T.Owner)}</Typography>
<Typography>{isChecked(PERMISSIONS.OWNER_U)}</Typography>
<Typography>{isChecked(PERMISSIONS.OWNER_M)}</Typography>
<Typography>{isChecked(PERMISSIONS.OWNER_A)}</Typography>
</ListItem>
<ListItem>
<Typography>{Tr(T.Group)}</Typography>
<Typography>{isChecked(PERMISSIONS.GROUP_U)}</Typography>
<Typography>{isChecked(PERMISSIONS.GROUP_M)}</Typography>
<Typography>{isChecked(PERMISSIONS.GROUP_A)}</Typography>
</ListItem>
<ListItem>
<Typography>{Tr(T.Other)}</Typography>
<Typography>{isChecked(PERMISSIONS.OTHER_U)}</Typography>
<Typography>{isChecked(PERMISSIONS.OTHER_M)}</Typography>
<Typography>{isChecked(PERMISSIONS.OTHER_A)}</Typography>
</ListItem>
</List>
</Paper>
<Paper variant="outlined">
<List className={clsx(classes.list, 'w-50')}>
<ListItem className={classes.title}>
<Typography>{Tr(T.Ownership)}</Typography>
</ListItem>
<Divider />
<ListItem>
<Typography>{Tr(T.Owner)}</Typography>
<Typography>{UNAME}</Typography>
</ListItem>
<ListItem>
<Typography>{Tr(T.Group)}</Typography>
<Typography>{GNAME}</Typography>
</ListItem>
</List>
</Paper>
</Grid>
</Grid>
)
})