From 7310494ee06e7267bb17b8d26be6f66e9ef9d702 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 4 Jul 2024 15:31:31 +0200 Subject: [PATCH] M #-: Delete all graphics connection type except VNC (#3140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dcarracedo Co-authored-by: Tino Vázquez --- .../inputOutput/graphicsSchema.js | 20 ++++++------------- .../VmTemplate/CreateForm/Steps/index.js | 9 +++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) 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 },