-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(ingestion-ui) Add new form for the bigquery-beta connector #6200
Merged
shirshanka
merged 2 commits into
datahub-project:master
from
chriscollins3456:cc--bigquery-beta-form
Oct 13, 2022
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ export const BIGQUERY_PROJECT_ID: RecipeField = { | |
name: 'project_id', | ||
label: 'BigQuery Project ID', | ||
tooltip: 'Project ID where you have rights to run queries and create tables.', | ||
placeholder: 'my-project-123', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.project_id', | ||
rules: null, | ||
|
@@ -13,6 +14,7 @@ export const BIGQUERY_CREDENTIAL_PROJECT_ID: RecipeField = { | |
name: 'credential.project_id', | ||
label: 'Credentials Project ID', | ||
tooltip: 'Project id to set the credentials.', | ||
placeholder: 'my-project-123', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.project_id', | ||
rules: null, | ||
|
@@ -22,6 +24,7 @@ export const BIGQUERY_PRIVATE_KEY_ID: RecipeField = { | |
name: 'credential.private_key_id', | ||
label: 'Private Key Id', | ||
tooltip: 'Private key id.', | ||
placeholder: 'BQ_PRIVATE_KEY_ID', | ||
type: FieldType.SECRET, | ||
fieldPath: 'source.config.credential.private_key_id', | ||
rules: null, | ||
|
@@ -30,6 +33,7 @@ export const BIGQUERY_PRIVATE_KEY_ID: RecipeField = { | |
export const BIGQUERY_PRIVATE_KEY: RecipeField = { | ||
name: 'credential.private_key', | ||
label: 'Private Key', | ||
placeholder: 'BQ_PRIVATE_KEY', | ||
tooltip: 'Private key in a form of "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n".', | ||
type: FieldType.SECRET, | ||
fieldPath: 'source.config.credential.private_key', | ||
|
@@ -40,6 +44,7 @@ export const BIGQUERY_CLIENT_EMAIL: RecipeField = { | |
name: 'credential.client_email', | ||
label: 'Client Email', | ||
tooltip: 'Client email.', | ||
placeholder: '[email protected]', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.client_email', | ||
rules: null, | ||
|
@@ -49,6 +54,7 @@ export const BIGQUERY_CLIENT_ID: RecipeField = { | |
name: 'credential.client_id', | ||
label: 'Client ID', | ||
tooltip: 'Client ID.', | ||
placeholder: '123456789098765432101', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.client_id', | ||
rules: null, | ||
|
71 changes: 71 additions & 0 deletions
71
datahub-web-react/src/app/ingest/source/builder/RecipeForm/bigqueryBeta.ts
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,71 @@ | ||
import { FieldType, RecipeField, setListValuesOnRecipe } from './common'; | ||
|
||
export const BIGQUERY_BETA_PROJECT_ID: RecipeField = { | ||
name: 'credential.project_id', | ||
label: 'Project ID', | ||
tooltip: 'Project id to set the credentials.', | ||
placeholder: 'my-project-123', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.project_id', | ||
rules: null, | ||
}; | ||
|
||
const projectIdAllowFieldPath = 'source.config.project_id_pattern.allow'; | ||
export const PROJECT_ALLOW: RecipeField = { | ||
name: 'project_id_pattern.allow', | ||
label: 'Allow Patterns', | ||
tooltip: 'Use regex here to filter for project IDs.', | ||
placeholder: '^my_db$', | ||
type: FieldType.LIST, | ||
buttonLabel: 'Add pattern', | ||
fieldPath: projectIdAllowFieldPath, | ||
rules: null, | ||
section: 'Projects', | ||
setValueOnRecipeOverride: (recipe: any, values: string[]) => | ||
setListValuesOnRecipe(recipe, values, projectIdAllowFieldPath), | ||
}; | ||
|
||
const projectIdDenyFieldPath = 'source.config.project_id_pattern.deny'; | ||
export const PROJECT_DENY: RecipeField = { | ||
name: 'project_id_pattern.deny', | ||
label: 'Deny Patterns', | ||
tooltip: 'Use regex here to filter for project IDs.', | ||
placeholder: '^my_db$', | ||
type: FieldType.LIST, | ||
buttonLabel: 'Add pattern', | ||
fieldPath: projectIdDenyFieldPath, | ||
rules: null, | ||
section: 'Projects', | ||
setValueOnRecipeOverride: (recipe: any, values: string[]) => | ||
setListValuesOnRecipe(recipe, values, projectIdDenyFieldPath), | ||
}; | ||
|
||
const datasetAllowFieldPath = 'source.config.dataset_pattern.allow'; | ||
export const DATASET_ALLOW: RecipeField = { | ||
name: 'dataset_pattern.allow', | ||
label: 'Allow Patterns', | ||
tooltip: 'Use regex here.', | ||
placeholder: '^my_db$', | ||
type: FieldType.LIST, | ||
buttonLabel: 'Add pattern', | ||
fieldPath: datasetAllowFieldPath, | ||
rules: null, | ||
section: 'Datasets', | ||
setValueOnRecipeOverride: (recipe: any, values: string[]) => | ||
setListValuesOnRecipe(recipe, values, datasetAllowFieldPath), | ||
}; | ||
|
||
const datasetDenyFieldPath = 'source.config.dataset_pattern.deny'; | ||
export const DATASET_DENY: RecipeField = { | ||
name: 'dataset_pattern.deny', | ||
label: 'Deny Patterns', | ||
tooltip: 'Use regex here.', | ||
placeholder: '^my_db$', | ||
type: FieldType.LIST, | ||
buttonLabel: 'Add pattern', | ||
fieldPath: datasetDenyFieldPath, | ||
rules: null, | ||
section: 'Datasets', | ||
setValueOnRecipeOverride: (recipe: any, values: string[]) => | ||
setListValuesOnRecipe(recipe, values, datasetDenyFieldPath), | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import React from 'react'; | ||
import { set, get } from 'lodash'; | ||
import moment, { Moment } from 'moment-timezone'; | ||
|
||
export enum FieldType { | ||
TEXT, | ||
|
@@ -9,6 +10,7 @@ export enum FieldType { | |
SECRET, | ||
DICT, | ||
TEXTAREA, | ||
DATE, | ||
} | ||
|
||
interface Option { | ||
|
@@ -357,3 +359,34 @@ export const SKIP_PERSONAL_FOLDERS: RecipeField = { | |
fieldPath: 'source.config.skip_personal_folders', | ||
rules: null, | ||
}; | ||
|
||
const NUM_CHARACTERS_TO_REMOVE_FROM_DATE = 5; | ||
|
||
const startTimeFieldPath = 'source.config.start_time'; | ||
export const START_TIME: RecipeField = { | ||
name: 'start_time', | ||
label: 'Start Time', | ||
tooltip: | ||
'Earliest date of audit logs to process for usage, lineage etc. Default: Last full day in UTC or last time DataHub ingested usage (if stateful ingestion is enabled). Tip: Set this to an older date (e.g. 1 month ago) for your first ingestion run, and then uncheck it for future runs.', | ||
placeholder: 'Select date and time', | ||
type: FieldType.DATE, | ||
fieldPath: startTimeFieldPath, | ||
rules: null, | ||
getValueFromRecipeOverride: (recipe: any) => { | ||
const isoDateString = get(recipe, startTimeFieldPath); | ||
if (isoDateString) { | ||
return moment(isoDateString); | ||
} | ||
return isoDateString; | ||
}, | ||
setValueOnRecipeOverride: (recipe: any, value?: Moment) => { | ||
if (!value) { | ||
return setFieldValueOnRecipe(recipe, null, startTimeFieldPath); | ||
} | ||
const isoDateString = value.toISOString(); | ||
const formattedDateString = isoDateString | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you see this being used elsewhere (and should it be in a utils file)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I certainly can - good call |
||
.substring(0, isoDateString.length - NUM_CHARACTERS_TO_REMOVE_FROM_DATE) | ||
.concat('Z'); | ||
return setFieldValueOnRecipe(recipe, formattedDateString, startTimeFieldPath); | ||
}, | ||
}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this renaming