diff --git a/frontend/app/shared/model/componentStructure.ts b/frontend/app/shared/model/componentStructure.ts index 29ed772..1885345 100644 --- a/frontend/app/shared/model/componentStructure.ts +++ b/frontend/app/shared/model/componentStructure.ts @@ -141,6 +141,7 @@ export const normalizeStructureForSave = (input: any): any => { const value: Record = { type: field.type, required: !!field.required, + machineContextOnly: !!field.machineContextOnly, } if (field.options && field.options.length) { value.options = field.options diff --git a/frontend/app/shared/model/componentStructureHydrate.ts b/frontend/app/shared/model/componentStructureHydrate.ts index 6393ea6..e04c2c8 100644 --- a/frontend/app/shared/model/componentStructureHydrate.ts +++ b/frontend/app/shared/model/componentStructureHydrate.ts @@ -78,10 +78,18 @@ export const hydrateCustomFields = (fields: any[]): any[] => { const customFieldId = typeof field?.customFieldId === 'string' ? field.customFieldId : undefined const orderIndex = typeof field?.orderIndex === 'number' ? field.orderIndex : index + const machineContextOnly = + typeof field?.machineContextOnly === 'boolean' + ? field.machineContextOnly + : typeof valueObject?.machineContextOnly === 'boolean' + ? valueObject.machineContextOnly + : false + return { name, type, required, + machineContextOnly, options, optionsText, defaultValue, @@ -153,6 +161,7 @@ export const mapComponentCustomFields = (fields: any[]) => { name: typeof field?.name === 'string' ? field.name : '', type: field?.type ?? 'text', required: !!field?.required, + machineContextOnly: !!field?.machineContextOnly, options: Array.isArray(field?.options) ? field.options : [], optionsText: typeof field?.optionsText === 'string' ? field.optionsText : '', defaultValue, diff --git a/frontend/app/shared/model/pieceProductStructure.ts b/frontend/app/shared/model/pieceProductStructure.ts index 24a1c7c..314d2ea 100644 --- a/frontend/app/shared/model/pieceProductStructure.ts +++ b/frontend/app/shared/model/pieceProductStructure.ts @@ -82,7 +82,7 @@ const sanitizePieceCustomFields = (fields: any[]): PieceModelCustomField[] => { options = parsed.length > 0 ? parsed : undefined } - const result: PieceModelCustomField = { name, type, required } + const result: PieceModelCustomField = { name, type, required, machineContextOnly: !!field?.machineContextOnly } if (options) { result.options = options } @@ -131,6 +131,7 @@ const hydratePieceCustomFields = (fields: any[]): PieceModelStructureEditorField name: field?.name ?? '', type: field?.type ?? 'text', required: !!field?.required, + machineContextOnly: !!field?.machineContextOnly, options: Array.isArray(field?.options) ? field.options : undefined, optionsText: typeof field?.optionsText === 'string' ? field.optionsText