fix(ui) Make LookML deploy key a textarea and format key (#5946)

Co-authored-by: Chris Collins <chriscollins@Chriss-MBP-2.lan>
This commit is contained in:
Chris Collins 2022-09-14 20:29:46 -04:00 committed by GitHub
parent 9384a52b23
commit a3af5106e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -100,7 +100,9 @@ function FormField(props: Props) {
if (field.type === FieldType.DICT) return <DictField field={field} />;
const isBoolean = field.type === FieldType.BOOLEAN;
const input = isBoolean ? <Checkbox /> : <Input placeholder={field.placeholder} />;
let input = <Input placeholder={field.placeholder} />;
if (isBoolean) input = <Checkbox />;
if (field.type === FieldType.TEXTAREA) input = <Input.TextArea placeholder={field.placeholder} />;
const valuePropName = isBoolean ? 'checked' : 'value';
const getValueFromEvent = isBoolean ? undefined : (e) => (e.target.value === '' ? null : e.target.value);

View File

@ -8,6 +8,7 @@ export enum FieldType {
SELECT,
SECRET,
DICT,
TEXTAREA,
}
interface Option {

View File

@ -24,14 +24,19 @@ export const LOOKML_GITHUB_INFO_REPO: RecipeField = {
rules: [{ required: true, message: 'Github Repo is required' }],
};
const deployKeyFieldPath = 'source.config.github_info.deploy_key';
export const DEPLOY_KEY: RecipeField = {
name: 'github_info.deploy_key',
label: 'GitHub Deploy Key',
tooltip: 'The SSH private key that has been provisioned for read access on the GitHub repository.',
type: FieldType.SECRET,
type: FieldType.TEXTAREA,
fieldPath: 'source.config.github_info.deploy_key',
placeholder: 'DEPLOY_KEY',
placeholder: '-----BEGIN OPENSSH PRIVATE KEY-----\n...',
rules: [{ required: true, message: 'Github Deploy Key is required' }],
setValueOnRecipeOverride: (recipe: any, value: string) => {
const valueWithNewLine = `${value}\n`;
return setFieldValueOnRecipe(recipe, valueWithNewLine, deployKeyFieldPath);
},
};
function validateApiSection(getFieldValue, fieldName) {