From c1e7669037c91a013f3e9513ca50b724ca2ef10b Mon Sep 17 00:00:00 2001 From: Sergio Betanzos Date: Tue, 24 May 2022 18:17:47 +0200 Subject: [PATCH] F #5637: Add VROUTER attribute to template form (#2073) --- .../src/client/components/Cards/VmTemplateCard.js | 5 ++--- .../CreateForm/Steps/BasicConfiguration/schema.js | 2 +- .../CreateForm/Steps/General/informationSchema.js | 11 ++++++++++- .../VmTemplate/CreateForm/Steps/General/schema.js | 3 ++- src/fireedge/src/client/constants/translates.js | 2 ++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/fireedge/src/client/components/Cards/VmTemplateCard.js b/src/fireedge/src/client/components/Cards/VmTemplateCard.js index 4b6da13057..9a13460568 100644 --- a/src/fireedge/src/client/components/Cards/VmTemplateCard.js +++ b/src/fireedge/src/client/components/Cards/VmTemplateCard.js @@ -64,8 +64,7 @@ const VmTemplateCard = memo( GNAME, REGTIME, LOCK, - VROUTER, - TEMPLATE: { HYPERVISOR, LABELS, LOGO = '' } = {}, + TEMPLATE: { VROUTER, HYPERVISOR, LABELS, LOGO = '' } = {}, } = template const isExternalImage = useMemo(() => isExternalURL(LOGO), [LOGO]) @@ -104,7 +103,7 @@ const VmTemplateCard = memo( {HYPERVISOR && } {LOCK && } - {VROUTER && } + {VROUTER && } diff --git a/src/fireedge/src/client/components/Forms/MarketplaceApp/CreateForm/Steps/BasicConfiguration/schema.js b/src/fireedge/src/client/components/Forms/MarketplaceApp/CreateForm/Steps/BasicConfiguration/schema.js index 1e7824c5a2..7309aba2d0 100644 --- a/src/fireedge/src/client/components/Forms/MarketplaceApp/CreateForm/Steps/BasicConfiguration/schema.js +++ b/src/fireedge/src/client/components/Forms/MarketplaceApp/CreateForm/Steps/BasicConfiguration/schema.js @@ -154,7 +154,7 @@ const RES_TABLE = { }, }, [TYPES.VM]: { - initialState: { filters: [{ id: 'STATE', value: STATES.POWEROFF }] }, + initialState: { filters: [{ id: 'state', value: STATES.POWEROFF }] }, }, [TYPES.VM_TEMPLATE]: { classes }, }[type] diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js index 1a55126096..373bf06c06 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { string } from 'yup' +import { string, boolean } from 'yup' import Image from 'client/components/Image' import { Field, arrayToOptions } from 'client/utils' @@ -99,6 +99,15 @@ export const LOGO = { grid: { md: 12 }, } +/** @type {Field} Virtual Router field */ +export const VROUTER_FIELD = { + name: 'VROUTER', + label: T.MakeTemplateAvailableForVROnly, + type: INPUT_TYPES.SWITCH, + validation: boolean().yesOrNo(), + grid: { md: 12 }, +} + /** * @param {boolean} isUpdate - If `true`, the form is being updated * @returns {Field[]} List of information fields diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/schema.js index 2df1d218f1..1a4e7d0d9d 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/schema.js @@ -18,6 +18,7 @@ import { BaseSchema } from 'yup' import { FIELDS as INFORMATION_FIELDS, HYPERVISOR_FIELD, + VROUTER_FIELD, } from './informationSchema' import { MEMORY_FIELDS, @@ -52,7 +53,7 @@ const SECTIONS = (hypervisor, isUpdate) => [ id: 'hypervisor', legend: T.Hypervisor, required: true, - fields: [HYPERVISOR_FIELD], + fields: [HYPERVISOR_FIELD, VROUTER_FIELD], }, { id: 'capacity', diff --git a/src/fireedge/src/client/constants/translates.js b/src/fireedge/src/client/constants/translates.js index d5485b780c..3285ec22f9 100644 --- a/src/fireedge/src/client/constants/translates.js +++ b/src/fireedge/src/client/constants/translates.js @@ -524,6 +524,8 @@ module.exports = { When creating several VMs, the wildcard %%idx will be replaced with a number starting from 0`, NumberOfInstances: 'Number of instances', + MakeTemplateAvailableForVROnly: + 'Make this template available for Virtual Router machines only', VmOnHoldState: 'Start VM on hold state', VmOnHoldStateConcept: ` Sets the new VM to hold state, instead of pending.