mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-05 09:17:41 +03:00
M #-: Disable network mode auto (#3209)
when attach nic after create a vm Signed-off-by: dcarracedo <dcarracedo@opennebula.io>
This commit is contained in:
parent
875fe29ade
commit
1fd2e22d34
@ -66,9 +66,13 @@ const fillPCIAtributes =
|
||||
/**
|
||||
* @param {object} [data] - VM or VM Template data
|
||||
* @param {boolean} [data.isAlias] - If it's an alias
|
||||
* @param {boolean} [data.disableNetworkAutoMode] - Disable the switch to enable network auto mode
|
||||
* @returns {Field[]} List of general fields
|
||||
*/
|
||||
const GENERAL_FIELDS = ({ isAlias = false } = {}) =>
|
||||
const GENERAL_FIELDS = ({
|
||||
isAlias = false,
|
||||
disableNetworkAutoMode = false,
|
||||
} = {}) =>
|
||||
[
|
||||
isAlias && {
|
||||
name: 'EXTERNAL',
|
||||
@ -78,26 +82,27 @@ const GENERAL_FIELDS = ({ isAlias = false } = {}) =>
|
||||
validation: boolean().yesOrNo(),
|
||||
grid: { sm: 6 },
|
||||
},
|
||||
!isAlias && {
|
||||
name: 'NETWORK_MODE',
|
||||
label: T.AutomaticNetworkMode,
|
||||
tooltip: T.NetworkMoeConcept,
|
||||
type: INPUT_TYPES.SWITCH,
|
||||
validation: boolean()
|
||||
.yesOrNo()
|
||||
.afterSubmit((value) => (value ? 'auto' : '')),
|
||||
grid: { sm: 6 },
|
||||
stepControl: [
|
||||
{
|
||||
condition: (value) => value === true,
|
||||
steps: ['network'],
|
||||
},
|
||||
{
|
||||
condition: (value) => value === false,
|
||||
steps: ['network-auto'],
|
||||
},
|
||||
],
|
||||
},
|
||||
!isAlias &&
|
||||
!disableNetworkAutoMode && {
|
||||
name: 'NETWORK_MODE',
|
||||
label: T.AutomaticNetworkMode,
|
||||
tooltip: T.NetworkMoeConcept,
|
||||
type: INPUT_TYPES.SWITCH,
|
||||
validation: boolean()
|
||||
.yesOrNo()
|
||||
.afterSubmit((value) => (value ? 'auto' : '')),
|
||||
grid: { sm: 6 },
|
||||
stepControl: [
|
||||
{
|
||||
condition: (value) => value === true,
|
||||
steps: ['network'],
|
||||
},
|
||||
{
|
||||
condition: (value) => value === false,
|
||||
steps: ['network-auto'],
|
||||
},
|
||||
],
|
||||
},
|
||||
].filter(Boolean)
|
||||
|
||||
const GUACAMOLE_CONNECTIONS = [
|
||||
@ -640,6 +645,7 @@ const GUEST_FIELDS = [
|
||||
* @param {boolean} [data.hasAlias] - If has an alias
|
||||
* @param {boolean} [data.isPci] - If it's a PCI
|
||||
* @param {boolean} [data.isAlias] - If it's an alias
|
||||
* @param {boolean} [data.disableNetworkAutoMode] - Disable the switch to enable network auto mode
|
||||
* @returns {Section[]} Sections
|
||||
*/
|
||||
const SECTIONS = ({
|
||||
@ -652,6 +658,7 @@ const SECTIONS = ({
|
||||
hasAlias,
|
||||
isPci,
|
||||
isAlias,
|
||||
disableNetworkAutoMode,
|
||||
} = {}) => {
|
||||
const filters = { driver, hypervisor }
|
||||
|
||||
@ -663,7 +670,13 @@ const SECTIONS = ({
|
||||
legend: T.General,
|
||||
fields: disableFields(
|
||||
filterByHypAndDriver(
|
||||
GENERAL_FIELDS({ nics, hasAlias, isPci, isAlias }),
|
||||
GENERAL_FIELDS({
|
||||
nics,
|
||||
hasAlias,
|
||||
isPci,
|
||||
isAlias,
|
||||
disableNetworkAutoMode,
|
||||
}),
|
||||
filters
|
||||
),
|
||||
'NIC',
|
||||
|
@ -51,6 +51,7 @@ const AttachAction = memo(
|
||||
hasAlias,
|
||||
isPci,
|
||||
isAlias,
|
||||
disableNetworkAutoMode,
|
||||
}) => {
|
||||
const { setFieldPath } = useGeneralApi()
|
||||
const disableSteps = useDisableStep()
|
||||
@ -99,6 +100,7 @@ const AttachAction = memo(
|
||||
isPci,
|
||||
isAlias,
|
||||
disableSteps,
|
||||
disableNetworkAutoMode,
|
||||
},
|
||||
initialValues: nic,
|
||||
})
|
||||
@ -388,6 +390,7 @@ const ActionPropTypes = {
|
||||
methods: PropTypes.object,
|
||||
index: PropTypes.number,
|
||||
indexNicAlias: PropTypes.number,
|
||||
disableNetworkAutoMode: PropTypes.bool,
|
||||
}
|
||||
|
||||
AttachAction.propTypes = ActionPropTypes
|
||||
|
@ -157,6 +157,7 @@ const VmNetworkTab = ({
|
||||
oneConfig={oneConfig}
|
||||
adminGroup={adminGroup}
|
||||
onSubmit={handleAttach}
|
||||
disableNetworkAutoMode={true}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user