1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-08 21:17:43 +03:00

M #-: Delete all graphics connection type except VNC (#3140)

Signed-off-by: dcarracedo <dcarracedo@opennebula.io>
Co-authored-by: Tino Vázquez <cvazquez@opennebula.io>
This commit is contained in:
David 2024-07-04 15:31:31 +02:00 committed by GitHub
parent cd4388bbb5
commit 7310494ee0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 14 deletions

View File

@ -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 },
})

View File

@ -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 },