Skip to content

Commit 85c6b0f

Browse files
#1873: Block security group selection during scaling L2 Agent (#1962)
1 parent 010acd6 commit 85c6b0f

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

ui/src/features/agents/components/ScaleUpDrawer.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, FormControl, MenuItem, Select, Checkbox, ListItemText } from '@mui/material'
1+
import { Box, FormControl, MenuItem, Select, Checkbox, ListItemText, Alert } from '@mui/material'
22
import { useState, useCallback, useEffect, useMemo } from 'react'
33
import { useForm, SubmitHandler } from 'react-hook-form'
44
import {
@@ -77,8 +77,6 @@ export default function ScaleUpDrawer({ open, onClose, masterNode }: ScaleUpDraw
7777
const openstackCredsValidated =
7878
openstackCredentials?.status?.openstackValidationStatus === 'Succeeded'
7979

80-
const isL2Credential = Boolean(openstackCredentials?.spec?.vjbinstanceid?.trim())
81-
8280
const [volumeTypes, setVolumeTypes] = useState<Array<string>>([])
8381
const [selectedVolumeType, setSelectedVolumeType] = useState('')
8482

@@ -386,7 +384,11 @@ export default function ScaleUpDrawer({ open, onClose, masterNode }: ScaleUpDraw
386384
error={!!flavorsError}
387385
/>
388386
</FormGrid>
389-
387+
{!useMasterSecurityGroups && (
388+
<Alert severity="warning" sx={{ mt: 1 }}>
389+
Security groups apply only when the vJailbreak VM is on a non-Layer 2 network.
390+
</Alert>
391+
)}
390392
<FormGrid minWidth={260} gap={2}>
391393
<FormControl
392394
fullWidth
@@ -407,7 +409,7 @@ export default function ScaleUpDrawer({ open, onClose, masterNode }: ScaleUpDraw
407409
size="small"
408410
>
409411
<MenuItem value="USE_MASTER">
410-
Use volume type of primary VJB instance
412+
Use volume type of primary vJailbreak instance
411413
</MenuItem>
412414
{volumeTypes.map((volumeType) => (
413415
<MenuItem key={volumeType} value={volumeType}>
@@ -423,20 +425,15 @@ export default function ScaleUpDrawer({ open, onClose, masterNode }: ScaleUpDraw
423425
fullWidth
424426
size="small"
425427
disabled={
426-
!openstackCredsValidated ||
427-
!openstackCredentials ||
428-
securityGroups.length === 0 ||
429-
isL2Credential
428+
!openstackCredsValidated || !openstackCredentials || securityGroups.length === 0
430429
}
431430
>
432431
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.5 }}>
433432
<FieldLabel label="Security Groups" align="flex-start" />
434-
435433
<Select
436434
multiple
437435
value={useMasterSecurityGroups ? ['USE_MASTER'] : selectedSecurityGroups}
438436
label=""
439-
disabled={isL2Credential}
440437
onChange={(e) => {
441438
const value = e.target.value as string[]
442439
if (value.includes('USE_MASTER')) {
@@ -450,7 +447,7 @@ export default function ScaleUpDrawer({ open, onClose, masterNode }: ScaleUpDraw
450447
size="small"
451448
renderValue={(selected) => {
452449
if (useMasterSecurityGroups) {
453-
return 'Use security groups of primary VJB instance'
450+
return 'Use security groups of primary vJailbreak instance'
454451
}
455452
return (selected as string[])
456453
.map((id) => securityGroups.find((sg) => sg.id === id)?.name || id)
@@ -459,7 +456,7 @@ export default function ScaleUpDrawer({ open, onClose, masterNode }: ScaleUpDraw
459456
>
460457
<MenuItem value="USE_MASTER">
461458
<Checkbox checked={useMasterSecurityGroups} />
462-
<ListItemText primary="Use security groups of primary VJB instance" />
459+
<ListItemText primary="Use security groups of primary vJailbreak instance" />
463460
</MenuItem>
464461
{securityGroups.map((sg) => (
465462
<MenuItem key={sg.id} value={sg.id} disabled={useMasterSecurityGroups}>

0 commit comments

Comments
 (0)