diff --git a/client/src/components/InputsModal/AuthTypeSelector.tsx b/client/src/components/InputsModal/AuthTypeSelector.tsx index 922687c74..6979e209e 100644 --- a/client/src/components/InputsModal/AuthTypeSelector.tsx +++ b/client/src/components/InputsModal/AuthTypeSelector.tsx @@ -1,55 +1,55 @@ import React, { FC } from 'react'; -import { TestInput } from '~/models/testSuiteModels'; +import { InputOption, TestInput } from '~/models/testSuiteModels'; import InputCombobox from './InputCombobox'; export interface InputAccessProps { - requirement: TestInput; + input: TestInput; index: number; inputsMap: Map; setInputsMap: (map: Map, edited?: boolean) => void; } -const AuthTypeSelector: FC = ({ - requirement, - index, - inputsMap, - setInputsMap, -}) => { - const selectorSettings = requirement.options?.components - ? requirement.options?.components[0] +const AuthTypeSelector: FC = ({ input, index, inputsMap, setInputsMap }) => { + const selectorSettings = input.options?.components + ? input.options?.components[0] : // Default auth type settings { name: 'auth_type', default: 'public', }; + const selectorOptions: InputOption[] = + input.options?.components?.find((component) => component.name === 'auth_type')?.options + ?.list_options || + ([ + { + label: 'Public', + value: 'public', + }, + { + label: 'Confidential Symmetric', + value: 'symmetric', + }, + { + label: 'Confidential Asymmetric', + value: 'asymmetric', + }, + { + label: 'Backend Services', + value: 'backend_services', + }, + ] as InputOption[]); + const selectorModel: TestInput = { name: 'auth_type', type: 'select', title: 'Auth Type', - description: requirement.description, + description: input.description, default: selectorSettings.default || 'public', optional: selectorSettings.optional, locked: selectorSettings.locked, options: { - list_options: [ - { - label: 'Public', - value: 'public', - }, - { - label: 'Confidential Symmetric', - value: 'symmetric', - }, - { - label: 'Confidential Asymmetric', - value: 'asymmetric', - }, - { - label: 'Backend Services', - value: 'backend_services', - }, - ], + list_options: selectorOptions, }, }; diff --git a/client/src/components/InputsModal/InputAccess.tsx b/client/src/components/InputsModal/InputAccess.tsx index 7c2b6bdac..cc321c82e 100644 --- a/client/src/components/InputsModal/InputAccess.tsx +++ b/client/src/components/InputsModal/InputAccess.tsx @@ -126,7 +126,7 @@ const InputAccess: FC = ({ requirement, index, inputsMap, setI )} = ({ requirement, index, inputsMap, setInput )}