Skip to content

Commit 288085e

Browse files
authored
F #7510: Add new NIC interface (#4218)
Signed-off-by: Victor Hansson <vhansson@opennebula.io>
1 parent 289ffed commit 288085e

19 files changed

Lines changed: 976 additions & 387 deletions

File tree

src/fireedge/src/modules/components/Cards/PciCard.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const PciCard = memo(
4646
NAME,
4747
PCI_ID,
4848
VMID,
49+
IFNAME,
4950
} = pci
5051

5152
const name = PCI_ID ? `PCI${PCI_ID}` : NAME && `${NAME}`
@@ -99,6 +100,11 @@ const PciCard = memo(
99100
<span data-cy="vm">{` ${VMID}`}</span>
100101
</span>
101102
)}
103+
{IFNAME && (
104+
<span title={`${Tr(T.IfName)}: ${IFNAME}`}>{`${Tr(
105+
T.IfName
106+
)}: ${IFNAME}`}</span>
107+
)}
102108
</div>
103109
</Box>
104110
<div className={classes.actions}>{actions}</div>

src/fireedge/src/modules/components/FormControl/RadioController.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
Box,
2121
FormControl,
2222
FormHelperText,
23-
Radio,
2423
RadioGroup,
2524
useTheme,
2625
} from '@mui/material'
@@ -171,7 +170,7 @@ const RadioController = memo(
171170
className={classes.root}
172171
data-cy={cy}
173172
>
174-
{values.map(({ text, value, svg }) => (
173+
{values.map(({ text, value, svg, description }) => (
175174
<Box
176175
key={`${name}-${value}`}
177176
data-value={value}
@@ -183,20 +182,23 @@ const RadioController = memo(
183182
}
184183
>
185184
<Box className={svg ? classes.paddingSvg : classes.padding}>
186-
<Box className={classes.row}>
187-
<Box className={classes.cell}>
188-
<Radio
189-
inputRef={ref}
190-
disabled={readOnly}
191-
checked={optionSelected === value}
192-
className={classes.radio}
193-
inputProps={{ 'data-value': value }}
194-
/>
185+
<Box sx={{ fontWeight: 500 }}>{Tr(text)}</Box>
186+
{description && (
187+
<Box
188+
component="p"
189+
sx={{
190+
m: 0,
191+
mt: 0.5,
192+
fontSize: '0.75rem',
193+
color: 'text.secondary',
194+
lineHeight: 1.4,
195+
}}
196+
>
197+
{labelCanBeTranslated(description)
198+
? Tr(description)
199+
: description}
195200
</Box>
196-
<Box className={clsx(classes.cell, classes.cellFull)}>
197-
{Tr(text)}
198-
</Box>
199-
</Box>
201+
)}
200202
{svg && (
201203
<Box className={classes.row}>
202204
<Box className={classes.cell} />
@@ -236,6 +238,7 @@ RadioController.propTypes = {
236238
text: PropTypes.string.isRequired,
237239
value: PropTypes.string.isRequired,
238240
svg: PropTypes.string,
241+
description: PropTypes.string,
239242
})
240243
).isRequired,
241244
watcher: PropTypes.func,

src/fireedge/src/modules/components/FormControl/SwitchController.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const SwitchController = memo(
4747
onConditionChange,
4848
watcher,
4949
dependencies,
50+
description,
5051
}) => {
5152
const {
5253
field: { value = false, onChange, onBlur },
@@ -101,6 +102,11 @@ const SwitchController = memo(
101102
}
102103
labelPlacement="end"
103104
/>
105+
{description && (
106+
<FormHelperText>
107+
{labelCanBeTranslated(description) ? Tr(description) : description}
108+
</FormHelperText>
109+
)}
104110
{Boolean(error) && (
105111
<FormHelperText data-cy={`${cy}-error`}>
106112
<ErrorHelper label={error?.message} />
@@ -125,6 +131,7 @@ SwitchController.propTypes = {
125131
PropTypes.string,
126132
PropTypes.arrayOf(PropTypes.string),
127133
]),
134+
description: PropTypes.string,
128135
}
129136

130137
SwitchController.displayName = 'SwitchController'

src/fireedge/src/modules/components/FormControl/ToggleController.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ import PropTypes from 'prop-types'
1919
import {
2020
styled,
2121
FormControl,
22+
Typography,
2223
ToggleButtonGroup,
2324
ToggleButton,
2425
FormHelperText,
26+
Box,
2527
} from '@mui/material'
2628
import { useController } from 'react-hook-form'
2729

@@ -105,9 +107,25 @@ const ToggleController = memo(
105107
data-cy={cy}
106108
{...fieldProps}
107109
>
108-
{values?.map(({ text, value = '' }) => (
110+
{values?.map(({ text, value = '', description }) => (
109111
<ToggleButton key={`${name}-${value}`} value={value} sx={{ p: 1 }}>
110-
{Tr(text)}
112+
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
113+
<Typography variant="body2" fontWeight={600}>
114+
{Tr(text)}
115+
</Typography>
116+
117+
{description && (
118+
<Typography
119+
variant="caption"
120+
display="block"
121+
color="text.secondary"
122+
>
123+
{labelCanBeTranslated(description)
124+
? Tr(description)
125+
: description}
126+
</Typography>
127+
)}
128+
</Box>
111129
</ToggleButton>
112130
))}
113131
</ToggleButtonGroup>

src/fireedge/src/modules/components/Forms/Vm/AttachNicForm/Steps/AdvancedOptions/index.js

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,35 @@ const Content = (props) => {
3232

3333
return (
3434
<Box
35-
display="grid"
36-
gap="2em"
37-
sx={{ gridTemplateColumns: { lg: '1fr 1fr', md: '1fr' } }}
35+
sx={{
36+
display: 'flex',
37+
flexDirection: 'column',
38+
gap: '2px',
39+
}}
3840
>
39-
{sections.map(({ id, legend, fields }) => (
40-
<FormWithSchema
41-
key={id}
42-
rootProps={{
43-
sx: (id === 'general' || id === 'guacamole-connections') && {
44-
gridColumn: '1 / -1',
45-
},
46-
}}
47-
cy={id}
48-
saveState={true}
49-
fields={fields}
50-
legend={legend}
51-
id={STEP_ID}
52-
/>
53-
))}
41+
<Box
42+
display="grid"
43+
gap="2em"
44+
sx={{ gridTemplateColumns: { lg: '1fr 1fr', md: '1fr' } }}
45+
>
46+
{sections.map(({ id, legend, fields }) => (
47+
<FormWithSchema
48+
key={id}
49+
rootProps={{
50+
sx: (id === 'general' ||
51+
id === 'guacamole-connections' ||
52+
id === 'hardware') && {
53+
gridColumn: '1 / -1',
54+
},
55+
}}
56+
cy={id}
57+
saveState={true}
58+
fields={fields}
59+
legend={legend}
60+
id={STEP_ID}
61+
/>
62+
))}
63+
</Box>
5464
</Box>
5565
)
5666
}

0 commit comments

Comments
 (0)