From 9358b31a977f7cc604326e9cc49aa4865a1c3517 Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Wed, 14 Sep 2022 19:31:08 -0400 Subject: [PATCH] fix(ui) Make LookML deploy key a textarea and format key --- .../app/ingest/source/builder/RecipeForm/FormField.tsx | 4 +++- .../src/app/ingest/source/builder/RecipeForm/common.tsx | 1 + .../src/app/ingest/source/builder/RecipeForm/lookml.tsx | 9 +++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/datahub-web-react/src/app/ingest/source/builder/RecipeForm/FormField.tsx b/datahub-web-react/src/app/ingest/source/builder/RecipeForm/FormField.tsx index 66081579c95bff..faa4ebd3fc65cd 100644 --- a/datahub-web-react/src/app/ingest/source/builder/RecipeForm/FormField.tsx +++ b/datahub-web-react/src/app/ingest/source/builder/RecipeForm/FormField.tsx @@ -100,7 +100,9 @@ function FormField(props: Props) { if (field.type === FieldType.DICT) return ; const isBoolean = field.type === FieldType.BOOLEAN; - const input = isBoolean ? : ; + let input = ; + if (isBoolean) input = ; + if (field.type === FieldType.TEXTAREA) input = ; const valuePropName = isBoolean ? 'checked' : 'value'; const getValueFromEvent = isBoolean ? undefined : (e) => (e.target.value === '' ? null : e.target.value); diff --git a/datahub-web-react/src/app/ingest/source/builder/RecipeForm/common.tsx b/datahub-web-react/src/app/ingest/source/builder/RecipeForm/common.tsx index d498cd537fc8ea..ca04b8fbc2c7a0 100644 --- a/datahub-web-react/src/app/ingest/source/builder/RecipeForm/common.tsx +++ b/datahub-web-react/src/app/ingest/source/builder/RecipeForm/common.tsx @@ -8,6 +8,7 @@ export enum FieldType { SELECT, SECRET, DICT, + TEXTAREA, } interface Option { diff --git a/datahub-web-react/src/app/ingest/source/builder/RecipeForm/lookml.tsx b/datahub-web-react/src/app/ingest/source/builder/RecipeForm/lookml.tsx index e343089198ed91..656fe3de5e025e 100644 --- a/datahub-web-react/src/app/ingest/source/builder/RecipeForm/lookml.tsx +++ b/datahub-web-react/src/app/ingest/source/builder/RecipeForm/lookml.tsx @@ -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) {