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

F OpenNebula/one#6121: Fixed group allocation ()

This commit is contained in:
vichansson 2023-09-18 14:46:18 +03:00 committed by GitHub
parent b5b32350db
commit 43515c1fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 16 deletions
src/fireedge/src/client
components
Forms/User/CreateForm/Steps
SecondaryGroups
index.js
Tables/Groups
Tabs/User
constants

@ -26,7 +26,7 @@ const Content = () => {
const secondaryGroups = useWatch({ name: STEP_ID })
const handleSelectedRows = (rows) => {
const newValue = rows?.map((row) => row?.ID) || []
const newValue = rows?.map((row) => row?.id) || []
setValue(STEP_ID, newValue)
}

@ -36,8 +36,7 @@ const Steps = createSteps([General, PrimaryGroup, SecondaryGroups], {
username: generalData.username,
password: generalData.password,
driver: generalData.authType,
primaryGroup: primaryGroupsData.primaryGroup,
secondaryGroups: secondaryGroupsData.secondaryGroups,
group: [primaryGroupsData, ...secondaryGroupsData],
}
},
})

@ -14,7 +14,7 @@
* limitations under the License. *
* ------------------------------------------------------------------------- */
import { useMemo, Component } from 'react'
import { Chip, Box, Grid } from '@mui/material'
import { Chip, Box, Grid, Typography } from '@mui/material'
import { useViews } from 'client/features/Auth'
import { useGetGroupsQuery } from 'client/features/OneApi/group'
import EnhancedTable, { createColumns } from 'client/components/Tables/Enhanced'
@ -82,16 +82,40 @@ const GroupsTable = (props) => {
return (
<div>
<Grid container spacing={2} alignItems="center">
<Grid item xs={12}>
<Typography variant="h7">{T.Primary}</Typography>
</Grid>
{primaryGroupName && (
<Grid item>
<Chip label={`${T.Primary}: ${primaryGroupName}`} color="primary" />
<Chip
label={
<Typography variant="subtitle2" component="span">
{primaryGroupName}
</Typography>
}
color="primary"
/>
</Grid>
)}
{secondaryGroupNames.length > 0 && (
<Grid item xs={12}>
<Typography variant="body2">{T.Secondary}</Typography>
</Grid>
)}
{secondaryGroupNames.length > 0 &&
secondaryGroupNames.map((name, index) => (
<Grid item key={index}>
<Chip label={`${T.Secondary}: ${name}`} color="secondary" />
<Chip
label={
<Typography variant="body2" component="span">
{name}
</Typography>
}
color="secondary"
/>
</Grid>
))}
</Grid>

@ -33,18 +33,14 @@ const GroupsInfoTab = ({ id }) => {
const path = PATH.SYSTEM.GROUPS.DETAIL
const history = useHistory()
const { data: user } = useGetUserQuery({ id })
const { GID, GROUPS } = user
const { GROUPS } = user
const handleRowClick = (rowId) => {
history.push(generatePath(path, { id: String(rowId) }))
}
const primaryGroup = GID
const secondaryGroups = Array.isArray(GROUPS)
? GROUPS.map((group) => group.ID)
: GROUPS
? [GROUPS.ID]
: []
const primaryGroup = GROUPS.ID[0]
const secondaryGroups = GROUPS.ID.slice(1)
return (
<GroupsTable

@ -33,9 +33,9 @@ const InformationPanel = ({ user = {} }) => {
const isEnabled = stringToBoolean(ENABLED)
const info = [
{ name: T.ID, value: ID },
{ name: T.Name, value: NAME },
{ name: T.State, value: booleanToString(isEnabled) },
{ name: T.ID, value: ID, dataCy: 'id' },
{ name: T.Name, value: NAME, dataCy: 'name' },
{ name: T.Enabled, value: booleanToString(isEnabled), dataCy: 'state' },
]
return <List title={T.Information} list={info} />

@ -112,6 +112,7 @@ module.exports = {
Edit: 'Edit',
EditSomething: 'Edit: %s',
Enable: 'Enable',
Enabled: 'Enabled',
Failure: 'Failure',
Finish: 'Finish',
Flatten: 'Flatten',