Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum FieldType {
SELECT,
SECRET,
DICT,
TEXTAREA,
}

interface Option {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down