diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/graphicsSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/graphicsSchema.js index 7f5d7668d6c..b4f8ff86f5a 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/graphicsSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/graphicsSchema.js @@ -24,7 +24,7 @@ import { getObjectSchemaFromFields, } from 'client/utils' -const { vcenter, lxc, kvm } = HYPERVISORS +const { lxc } = HYPERVISORS const CUSTOM_KEYMAP_VALUE = 'custom' const KEYMAP_VALUES = { ar: T.Arabic, @@ -68,21 +68,13 @@ const KEYMAP_VALUES = { /** @type {Field} Type field */ export const TYPE = (isUpdate) => ({ name: 'GRAPHICS.TYPE', - type: INPUT_TYPES.TOGGLE, + type: INPUT_TYPES.SWITCH, + label: T.Vnc, dependOf: ['HYPERVISOR', '$general.HYPERVISOR'], - values: ([templateHyperv = kvm, hypervisor = templateHyperv] = []) => { - const types = { - [vcenter]: [T.Vmrc], - [lxc]: [T.Vnc], - }[hypervisor] ?? [T.Vnc, T.Sdl, T.Spice] - - return arrayToOptions(types) - }, - validation: string() - .trim() + validation: boolean() .notRequired() - .uppercase() - .default(() => (isUpdate ? undefined : T.Vnc)), + .afterSubmit((value, { context }) => (value ? 'VNC' : undefined)) + .default(() => (isUpdate ? undefined : true)), grid: { md: 12 }, }) diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js index ff59177baf6..b763e0de57b 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js @@ -86,6 +86,15 @@ const Steps = createSteps([General, ExtraConfiguration, CustomVariables], { } } + // Init GRPAHICS.TYPE + const type = vmTemplate?.TEMPLATE?.GRAPHICS?.TYPE === 'VNC' + if (type) { + objectSchema[EXTRA_ID].GRAPHICS = { + ...vmTemplate?.GRAPHICS, + TYPE: type, + } + } + const knownTemplate = schema.cast(objectSchema, { stripUnknown: true, context: { ...vmTemplate, [EXTRA_ID]: vmTemplate.TEMPLATE },