diff --git a/src/fireedge/src/client/components/Buttons/AddressRangeActions.js b/src/fireedge/src/client/components/Buttons/AddressRangeActions.js
index 8092c48892..ac7d84aa68 100644
--- a/src/fireedge/src/client/components/Buttons/AddressRangeActions.js
+++ b/src/fireedge/src/client/components/Buttons/AddressRangeActions.js
@@ -29,123 +29,155 @@ import { AddRangeForm } from 'client/components/Forms/VNetwork'
import { jsonToXml } from 'client/models/Helper'
import { Tr, Translate } from 'client/components/HOC'
-import { T, VN_ACTIONS } from 'client/constants'
+import { T, VN_ACTIONS, RESTRICTED_ATTRIBUTES_TYPE } from 'client/constants'
-const AddAddressRangeAction = memo(({ vnetId, onSubmit }) => {
- const [addAR] = useAddRangeToVNetMutation()
+import { hasRestrictedAttributes } from 'client/utils'
- const handleAdd = async (formData) => {
- if (onSubmit && typeof onSubmit === 'function') {
- return await onSubmit(formData)
+const AddAddressRangeAction = memo(
+ ({ vnetId, onSubmit, oneConfig, adminGroup }) => {
+ const [addAR] = useAddRangeToVNetMutation()
+
+ const handleAdd = async (formData) => {
+ if (onSubmit && typeof onSubmit === 'function') {
+ return await onSubmit(formData)
+ }
+
+ const template = jsonToXml({ AR: formData })
+ await addAR({ id: vnetId, template }).unwrap()
}
- const template = jsonToXml({ AR: formData })
- await addAR({ id: vnetId, template }).unwrap()
- }
-
- return (
- ,
- label: T.AddressRange,
- variant: 'outlined',
- }}
- options={[
- {
- dialogProps: {
- title: T.AddressRange,
- dataCy: 'modal-add-ar',
- },
- form: AddRangeForm,
- onSubmit: handleAdd,
- },
- ]}
- />
- )
-})
-
-const UpdateAddressRangeAction = memo(({ vnetId, ar, onSubmit }) => {
- const [updateAR] = useUpdateVNetRangeMutation()
- const { AR_ID } = ar
-
- const handleUpdate = async (formData) => {
- if (onSubmit && typeof onSubmit === 'function') {
- return await onSubmit(formData)
+ const formConfig = {
+ stepProps: {
+ vnetId,
+ oneConfig,
+ adminGroup,
+ restrictedAttributesType: RESTRICTED_ATTRIBUTES_TYPE.VNET,
+ nameParentAttribute: 'AR',
+ },
}
- const template = jsonToXml({ AR: formData })
- await updateAR({ id: vnetId, template })
- }
-
- return (
- ,
- tooltip: T.Edit,
- }}
- options={[
- {
- dialogProps: {
- title: `${Tr(T.AddressRange)}: #${AR_ID}`,
- dataCy: 'modal-update-ar',
+ return (
+ ,
+ label: T.AddressRange,
+ variant: 'outlined',
+ }}
+ options={[
+ {
+ dialogProps: {
+ title: T.AddressRange,
+ dataCy: 'modal-add-ar',
+ },
+ form: () => AddRangeForm(formConfig),
+ onSubmit: handleAdd,
},
- form: () =>
- AddRangeForm({
- initialValues: ar,
- stepProps: { isUpdate: !onSubmit && AR_ID !== undefined },
- }),
- onSubmit: handleUpdate,
- },
- ]}
- />
- )
-})
+ ]}
+ />
+ )
+ }
+)
-const DeleteAddressRangeAction = memo(({ vnetId, ar, onSubmit }) => {
- const [removeAR] = useRemoveRangeFromVNetMutation()
- const { AR_ID } = ar
+const UpdateAddressRangeAction = memo(
+ ({ vnetId, ar, onSubmit, oneConfig, adminGroup }) => {
+ const [updateAR] = useUpdateVNetRangeMutation()
+ const { AR_ID } = ar
- const handleRemove = async () => {
- if (onSubmit && typeof onSubmit === 'function') {
- return await onSubmit(AR_ID)
+ const handleUpdate = async (formData) => {
+ if (onSubmit && typeof onSubmit === 'function') {
+ return await onSubmit(formData)
+ }
+
+ const template = jsonToXml({ AR: formData })
+ await updateAR({ id: vnetId, template })
}
- await removeAR({ id: vnetId, address: AR_ID })
- }
-
- return (
- ,
- tooltip: T.Delete,
- }}
- options={[
- {
- isConfirmDialog: true,
- dialogProps: {
- title: (
- <>
-
- {`: #${AR_ID}`}
- >
- ),
- children:
{Tr(T.DoYouWantProceed)}
,
+ return (
+ ,
+ tooltip: T.Edit,
+ }}
+ options={[
+ {
+ dialogProps: {
+ title: `${Tr(T.AddressRange)}: #${AR_ID}`,
+ dataCy: 'modal-update-ar',
+ },
+ form: () =>
+ AddRangeForm({
+ initialValues: ar,
+ stepProps: {
+ isUpdate: !onSubmit && AR_ID !== undefined,
+ oneConfig,
+ adminGroup,
+ restrictedAttributesType: RESTRICTED_ATTRIBUTES_TYPE.VNET,
+ nameParentAttribute: 'AR',
+ },
+ }),
+ onSubmit: handleUpdate,
},
- onSubmit: handleRemove,
- },
- ]}
- />
- )
-})
+ ]}
+ />
+ )
+ }
+)
+
+const DeleteAddressRangeAction = memo(
+ ({ vnetId, ar, onSubmit, oneConfig, adminGroup }) => {
+ const [removeAR] = useRemoveRangeFromVNetMutation()
+ const { AR_ID } = ar
+
+ const handleRemove = async () => {
+ if (onSubmit && typeof onSubmit === 'function') {
+ return await onSubmit(AR_ID)
+ }
+
+ await removeAR({ id: vnetId, address: AR_ID })
+ }
+
+ // Disable action if the disk has a restricted attribute on the template
+ const disabledAction =
+ !adminGroup &&
+ hasRestrictedAttributes(ar, 'AR', oneConfig?.VNET_RESTRICTED_ATTR)
+
+ return (
+ ,
+ tooltip: !disabledAction ? Tr(T.Detach) : Tr(T.DetachRestricted),
+ disabled: disabledAction,
+ }}
+ options={[
+ {
+ isConfirmDialog: true,
+ dialogProps: {
+ title: (
+ <>
+
+ {`: #${AR_ID}`}
+ >
+ ),
+ children: {Tr(T.DoYouWantProceed)}
,
+ },
+ onSubmit: handleRemove,
+ },
+ ]}
+ />
+ )
+ }
+)
const ActionPropTypes = {
vnetId: PropTypes.string,
ar: PropTypes.object,
onSubmit: PropTypes.func,
+ oneConfig: PropTypes.object,
+ adminGroup: PropTypes.bool,
}
AddAddressRangeAction.propTypes = ActionPropTypes
diff --git a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/index.js b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/index.js
index cac545a0b3..d98235ed2a 100644
--- a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/index.js
+++ b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/index.js
@@ -23,21 +23,28 @@ import { T } from 'client/constants'
export const STEP_ID = 'advanced'
-const Content = () => (
-
+const Content = (oneConfig, adminGroup) => (
+
)
/**
* Advanced options create image.
*
+ * @param {object} props - Step properties
+ * @param {object} props.oneConfig - Open Nebula configuration
+ * @param {boolean} props.adminGroup - If the user belongs to oneadmin group
* @returns {object} Advanced options configuration step
*/
-const AdvancedOptions = () => ({
+const AdvancedOptions = ({ oneConfig, adminGroup }) => ({
id: STEP_ID,
label: T.AdvancedOptions,
- resolver: SCHEMA,
+ resolver: SCHEMA(oneConfig, adminGroup),
optionsValidate: { abortEarly: false },
- content: Content,
+ content: () => Content(oneConfig, adminGroup),
})
export default AdvancedOptions
diff --git a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js
index 50baad9a13..5dbd80eda3 100644
--- a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js
+++ b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js
@@ -14,8 +14,13 @@
* limitations under the License. *
* ------------------------------------------------------------------------- */
import { string, object, ObjectSchema } from 'yup'
-import { Field, arrayToOptions, getValidationFromFields } from 'client/utils'
-import { T, INPUT_TYPES } from 'client/constants'
+import {
+ Field,
+ arrayToOptions,
+ getValidationFromFields,
+ disableFields,
+} from 'client/utils'
+import { T, INPUT_TYPES, RESTRICTED_ATTRIBUTES_TYPE } from 'client/constants'
import {
IMAGE_LOCATION_TYPES,
IMAGE_LOCATION_FIELD,
@@ -156,18 +161,23 @@ export const FS = {
}
/**
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
* @returns {Field[]} Fields
*/
-export const FIELDS = [
- DEV_PREFIX,
- DEVICE,
- CUSTOM_DEV_PREFIX,
- FORMAT_FIELD,
- FS,
- CUSTOM_FORMAT,
-]
+export const FIELDS = (oneConfig, adminGroup) =>
+ disableFields(
+ [DEV_PREFIX, DEVICE, CUSTOM_DEV_PREFIX, FORMAT_FIELD, FS, CUSTOM_FORMAT],
+ '',
+ oneConfig,
+ adminGroup,
+ RESTRICTED_ATTRIBUTES_TYPE.IMAGE
+ )
/**
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
* @returns {ObjectSchema} Schema
*/
-export const SCHEMA = object(getValidationFromFields(FIELDS))
+export const SCHEMA = (oneConfig, adminGroup) =>
+ object(getValidationFromFields(FIELDS(oneConfig, adminGroup)))
diff --git a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/index.js b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/index.js
index 9c5ac68678..0efec7de41 100644
--- a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/index.js
+++ b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/index.js
@@ -24,21 +24,28 @@ import { T } from 'client/constants'
export const STEP_ID = 'general'
-const Content = () => (
-
+const Content = (oneConfig, adminGroup) => (
+
)
/**
* General configuration about VM Template.
*
+ * @param {object} props - Step properties
+ * @param {object} props.oneConfig - Open Nebula configuration
+ * @param {boolean} props.adminGroup - If the user belongs to oneadmin group
* @returns {object} General configuration step
*/
-const General = () => ({
+const General = ({ oneConfig, adminGroup }) => ({
id: STEP_ID,
label: T.Configuration,
- resolver: SCHEMA,
+ resolver: SCHEMA(oneConfig, adminGroup),
optionsValidate: { abortEarly: false },
- content: Content,
+ content: () => Content(oneConfig, adminGroup),
})
export default General
diff --git a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js
index 7d04ff6170..e6c5098bea 100644
--- a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js
+++ b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js
@@ -19,6 +19,7 @@ import {
arrayToOptions,
getValidationFromFields,
upperCaseFirst,
+ disableFields,
} from 'client/utils'
import {
T,
@@ -26,6 +27,7 @@ import {
IMAGE_TYPES_STR,
IMAGE_TYPES_FOR_IMAGES,
UNITS,
+ RESTRICTED_ATTRIBUTES_TYPE,
} from 'client/constants'
export const IMAGE_LOCATION_TYPES = {
@@ -193,22 +195,33 @@ export const SIZEUNIT = {
}
/**
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
* @returns {Field[]} Fields
*/
-export const FIELDS = [
- NAME,
- DESCRIPTION,
- TYPE,
- PERSISTENT,
- IMAGE_LOCATION_FIELD,
- PATH_FIELD,
- UPLOAD_FIELD,
- SIZE,
- SIZEUNIT,
-]
+export const FIELDS = (oneConfig, adminGroup) =>
+ disableFields(
+ [
+ NAME,
+ DESCRIPTION,
+ TYPE,
+ PERSISTENT,
+ IMAGE_LOCATION_FIELD,
+ PATH_FIELD,
+ UPLOAD_FIELD,
+ SIZE,
+ SIZEUNIT,
+ ],
+ '',
+ oneConfig,
+ adminGroup,
+ RESTRICTED_ATTRIBUTES_TYPE.IMAGE
+ )
/**
- * @param {object} [stepProps] - Step props
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
* @returns {ObjectSchema} Schema
*/
-export const SCHEMA = object(getValidationFromFields(FIELDS))
+export const SCHEMA = (oneConfig, adminGroup) =>
+ object(getValidationFromFields(FIELDS(oneConfig, adminGroup)))
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/content.js b/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/content.js
index 88b11a72b4..2550f2922a 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/content.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/content.js
@@ -32,9 +32,11 @@ export const CUSTOM_ATTRS_ID = 'custom-attributes'
/**
* @param {object} props - Props
* @param {boolean} [props.isUpdate] - Is `true` the form will be filter immutable attributes
+ * @param {object} props.oneConfig - Open Nebula configuration
+ * @param {boolean} props.adminGroup - If the user belongs to oneadmin group
* @returns {ReactElement} Form content component
*/
-const Content = ({ isUpdate }) => {
+const Content = ({ isUpdate, oneConfig, adminGroup }) => {
const { setValue } = useFormContext()
const customAttrs = useWatch({ name: CUSTOM_ATTRS_ID }) || {}
@@ -47,7 +49,13 @@ const Content = ({ isUpdate }) => {
return (
-
+
{
)
}
-Content.propTypes = { isUpdate: PropTypes.bool }
+Content.propTypes = {
+ isUpdate: PropTypes.bool,
+ oneConfig: PropTypes.object,
+ adminGroup: PropTypes.bool,
+}
export default Content
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/schema.js b/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/schema.js
index 4a93de8198..3e1590877e 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/schema.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/AddRangeForm/schema.js
@@ -23,8 +23,9 @@ import {
REG_V4,
REG_V6,
REG_MAC,
+ disableFields,
} from 'client/utils'
-import { T, INPUT_TYPES } from 'client/constants'
+import { T, INPUT_TYPES, RESTRICTED_ATTRIBUTES_TYPE } from 'client/constants'
const AR_TYPES = {
IP4: 'IP4',
@@ -183,25 +184,50 @@ const ULA_PREFIX_FIELD = {
}
/** @type {Field[]} Fields */
-const FIELDS = [
- TYPE_FIELD,
- IP_FIELD,
- MAC_FIELD,
- IP6_FIELD,
- SIZE_FIELD,
- GLOBAL_PREFIX_FIELD,
- PREFIX_LENGTH_FIELD,
- ULA_PREFIX_FIELD,
-]
+const FIELDS = (oneConfig, adminGroup) =>
+ disableFields(
+ [
+ TYPE_FIELD,
+ IP_FIELD,
+ MAC_FIELD,
+ IP6_FIELD,
+ SIZE_FIELD,
+ GLOBAL_PREFIX_FIELD,
+ PREFIX_LENGTH_FIELD,
+ ULA_PREFIX_FIELD,
+ ],
+ 'AR',
+ oneConfig,
+ adminGroup,
+ RESTRICTED_ATTRIBUTES_TYPE.VNET
+ )
-const MUTABLE_FIELDS = [SIZE_FIELD]
+/**
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
+ * @returns {Array} - Mutable fields
+ */
+const MUTABLE_FIELDS = (oneConfig, adminGroup) =>
+ disableFields(
+ [SIZE_FIELD],
+ 'AR',
+ oneConfig,
+ adminGroup,
+ RESTRICTED_ATTRIBUTES_TYPE.VNET
+ )
/**
* @param {object} stepProps - Step props
* @param {boolean} stepProps.isUpdate - If true the form is to update the AR
+ * @param {object} stepProps.oneConfig - Open Nebula configuration
+ * @param {boolean} stepProps.adminGroup - If the user belongs to oneadmin group
* @returns {BaseSchema} Schema
*/
-const SCHEMA = ({ isUpdate }) =>
- getObjectSchemaFromFields([...(isUpdate ? MUTABLE_FIELDS : FIELDS)])
+const SCHEMA = ({ isUpdate, oneConfig, adminGroup }) =>
+ getObjectSchemaFromFields([
+ ...(isUpdate
+ ? MUTABLE_FIELDS(oneConfig, adminGroup)
+ : FIELDS(oneConfig, adminGroup)),
+ ])
export { FIELDS, MUTABLE_FIELDS, SCHEMA }
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/addresses.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/addresses.js
index e0b8626b29..b48b9d52d1 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/addresses.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/addresses.js
@@ -37,7 +37,7 @@ export const TAB_ID = 'AR'
const mapNameFunction = mapNameByIndex('AR')
-const AddressesContent = () => {
+const AddressesContent = ({ oneConfig, adminGroup }) => {
const {
fields: addresses,
remove,
@@ -63,7 +63,11 @@ const AddressesContent = () => {
return (
<>
-
+
{
vm={{}}
ar={fakeValues}
onSubmit={(updatedAr) => handleUpdate(updatedAr, index)}
+ oneConfig={oneConfig}
+ adminGroup={adminGroup}
/>
{
)
}
-const Content = ({ isUpdate }) =>
+AddressesContent.propTypes = {
+ oneConfig: PropTypes.object,
+ adminGroup: PropTypes.bool,
+}
+
+const Content = ({ isUpdate, oneConfig, adminGroup }) =>
isUpdate ? (
) : (
-
+
)
-Content.propTypes = { isUpdate: PropTypes.bool }
+Content.propTypes = {
+ isUpdate: PropTypes.bool,
+ oneConfig: PropTypes.object,
+ adminGroup: PropTypes.bool,
+}
/** @type {TabType} */
const TAB = {
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/index.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/index.js
index 466ba4c619..863276d6e9 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/index.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/index.js
@@ -14,7 +14,7 @@
* limitations under the License. *
* ------------------------------------------------------------------------- */
import ContextIcon from 'iconoir-react/dist/Folder'
-
+import PropTypes from 'prop-types'
import {
TabType,
STEP_ID as EXTRA_ID,
@@ -25,20 +25,29 @@ import CustomAttributes from 'client/components/Forms/VNetwork/CreateForm/Steps/
import FormWithSchema from 'client/components/Forms/FormWithSchema'
import { T } from 'client/constants'
-const ContextContent = () => (
+const ContextContent = ({ oneConfig, adminGroup }) => (
<>
-
+
>
)
+ContextContent.propTypes = {
+ oneConfig: PropTypes.object,
+ adminGroup: PropTypes.bool,
+}
+
/** @type {TabType} */
const TAB = {
id: 'context',
name: T.Context,
icon: ContextIcon,
Content: ContextContent,
- getError: (error) => FIELDS.some(({ name }) => error?.[name]),
+ getError: (error) => FIELDS().some(({ name }) => error?.[name]),
}
export default TAB
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js
index aaf8f2ad85..cf8d63dd25 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js
@@ -15,8 +15,19 @@
* ------------------------------------------------------------------------- */
import { string } from 'yup'
-import { Field, arrayToOptions, getObjectSchemaFromFields } from 'client/utils'
-import { T, INPUT_TYPES, VNET_METHODS, VNET_METHODS6 } from 'client/constants'
+import {
+ Field,
+ arrayToOptions,
+ getObjectSchemaFromFields,
+ disableFields,
+} from 'client/utils'
+import {
+ T,
+ INPUT_TYPES,
+ VNET_METHODS,
+ VNET_METHODS6,
+ RESTRICTED_ATTRIBUTES_TYPE,
+} from 'client/constants'
/** @type {Field} Network address field */
const NETWORK_ADDRESS_FIELD = {
@@ -96,15 +107,33 @@ const IP6_METHOD_FIELD = {
validation: string().trim().notRequired(),
}
-export const FIELDS = [
- NETWORK_ADDRESS_FIELD,
- NETWORK_MASK_FIELD,
- GATEWAY_FIELD,
- GATEWAY6_FIELD,
- DNS_FIELD,
- GUEST_MTU_FIELD,
- METHOD_FIELD,
- IP6_METHOD_FIELD,
-]
+/**
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
+ * @returns {Array} Fields
+ */
+export const FIELDS = (oneConfig, adminGroup) =>
+ disableFields(
+ [
+ NETWORK_ADDRESS_FIELD,
+ NETWORK_MASK_FIELD,
+ GATEWAY_FIELD,
+ GATEWAY6_FIELD,
+ DNS_FIELD,
+ GUEST_MTU_FIELD,
+ METHOD_FIELD,
+ IP6_METHOD_FIELD,
+ ],
+ '',
+ oneConfig,
+ adminGroup,
+ RESTRICTED_ATTRIBUTES_TYPE.VNET
+ )
-export const SCHEMA = getObjectSchemaFromFields(FIELDS)
+/**
+ * @param {object} oneConfig - Open Nebula configuration
+ * @param {boolean} adminGroup - If the user belongs to oneadmin group
+ * @returns {object} Schema
+ */
+export const SCHEMA = (oneConfig, adminGroup) =>
+ getObjectSchemaFromFields(FIELDS(oneConfig, adminGroup))
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/index.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/index.js
index 75ed9f886e..642fecfb41 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/index.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/index.js
@@ -45,7 +45,7 @@ export const STEP_ID = 'extra'
/** @type {TabType[]} */
export const TABS = [Addresses, Security, QoS, Context]
-const Content = ({ isUpdate }) => {
+const Content = ({ isUpdate, oneConfig, adminGroup }) => {
const {
watch,
formState: { errors },
@@ -61,7 +61,14 @@ const Content = ({ isUpdate }) => {
...section,
name,
label: ,
- renderContent: () => ,
+ renderContent: () => (
+
+ ),
error: getError?.(errors[STEP_ID]),
})),
[totalErrors, driver]
@@ -73,18 +80,19 @@ const Content = ({ isUpdate }) => {
/**
* Optional configuration about Virtual network.
*
- * @param {VirtualNetwork} vnet - Virtual network
+ * @param {VirtualNetwork} data - Virtual network
* @returns {object} Optional configuration step
*/
-const ExtraConfiguration = (vnet) => {
- const isUpdate = vnet?.NAME !== undefined
+const ExtraConfiguration = ({ data, oneConfig, adminGroup }) => {
+ const isUpdate = data?.NAME !== undefined
return {
id: STEP_ID,
label: T.AdvancedOptions,
- resolver: SCHEMA(isUpdate),
+ resolver: SCHEMA(isUpdate, oneConfig, adminGroup),
optionsValidate: { abortEarly: false },
- content: (formProps) => Content({ ...formProps, isUpdate }),
+ content: (formProps) =>
+ Content({ ...formProps, isUpdate, oneConfig, adminGroup }),
}
}
@@ -92,6 +100,8 @@ Content.propTypes = {
data: PropTypes.any,
setFormData: PropTypes.func,
isUpdate: PropTypes.bool,
+ oneConfig: PropTypes.object,
+ adminGroup: PropTypes.bool,
}
export default ExtraConfiguration
diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/qos/index.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/qos/index.js
index 653f4dc593..884b9d8d6c 100644
--- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/qos/index.js
+++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/qos/index.js
@@ -14,6 +14,7 @@
* limitations under the License. *
* ------------------------------------------------------------------------- */
import QoSIcon from 'iconoir-react/dist/DataTransferBoth'
+import PropTypes from 'prop-types'
import {
STEP_ID as EXTRA_ID,
@@ -27,9 +28,9 @@ import {
import FormWithSchema from 'client/components/Forms/FormWithSchema'
import { T } from 'client/constants'
-const QoSContent = () => (
+const QoSContent = ({ oneConfig, adminGroup }) => (
<>
- {SECTIONS.map(({ id, ...section }) => (
+ {SECTIONS(oneConfig, adminGroup).map(({ id, ...section }) => (