-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FI-2608: Update ctrl + enter run test hotkey (#483)
* refactor input types button toggle * refactor input components * add lock on ctrl key for mac * remove redundant input props * update tests * allow both ctrl and meta keybindings irrespective of OS * npm audit fix --------- Co-authored-by: Alyssa Wang <awang@mitre.org>
- Loading branch information
1 parent
1828405
commit a741dec
Showing
7 changed files
with
156 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, { FC } from 'react'; | ||
import { List } from '@mui/material'; | ||
import { TestInput } from '~/models/testSuiteModels'; | ||
import InputOAuthCredentials from '~/components/InputsModal/InputOAuthCredentials'; | ||
import InputCheckboxGroup from '~/components/InputsModal/InputCheckboxGroup'; | ||
import InputRadioGroup from '~/components/InputsModal/InputRadioGroup'; | ||
import InputTextField from '~/components/InputsModal/InputTextField'; | ||
|
||
export interface InputFieldsProps { | ||
inputs: TestInput[]; | ||
inputsMap: Map<string, unknown>; | ||
setInputsMap: (newInputsMap: Map<string, unknown>, editStatus?: boolean) => void; | ||
} | ||
|
||
const InputFields: FC<InputFieldsProps> = ({ inputs, inputsMap, setInputsMap }) => { | ||
return ( | ||
<List> | ||
{inputs.map((requirement: TestInput, index: number) => { | ||
switch (requirement.type) { | ||
case 'oauth_credentials': | ||
return ( | ||
<InputOAuthCredentials | ||
requirement={requirement} | ||
index={index} | ||
inputsMap={inputsMap} | ||
setInputsMap={(newInputsMap) => setInputsMap(newInputsMap)} | ||
key={`input-${index}`} | ||
/> | ||
); | ||
case 'checkbox': | ||
return ( | ||
<InputCheckboxGroup | ||
requirement={requirement} | ||
index={index} | ||
inputsMap={inputsMap} | ||
setInputsMap={(newInputsMap, editStatus) => setInputsMap(newInputsMap, editStatus)} | ||
key={`input-${index}`} | ||
/> | ||
); | ||
case 'radio': | ||
return ( | ||
<InputRadioGroup | ||
requirement={requirement} | ||
index={index} | ||
inputsMap={inputsMap} | ||
setInputsMap={(newInputsMap) => setInputsMap(newInputsMap)} | ||
key={`input-${index}`} | ||
/> | ||
); | ||
default: | ||
return ( | ||
<InputTextField | ||
requirement={requirement} | ||
index={index} | ||
inputsMap={inputsMap} | ||
setInputsMap={(newInputsMap) => setInputsMap(newInputsMap)} | ||
key={`input-${index}`} | ||
/> | ||
); | ||
} | ||
})} | ||
</List> | ||
); | ||
}; | ||
|
||
export default InputFields; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.