mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 09:55:52 +00:00
This commit is contained in:
parent
6a5ffb0626
commit
2a6208f9b4
@ -529,7 +529,7 @@ const AddIngestion = ({
|
||||
{activeIngestionStep === 2 && (
|
||||
<DBTConfigFormBuilder
|
||||
cancelText="Back"
|
||||
data={dbtConfigSource}
|
||||
data={dbtConfigSource || {}}
|
||||
gcsType={gcsConfigType}
|
||||
handleGcsTypeChange={(type) => setGcsConfigType(type)}
|
||||
handleSourceChange={(src) => setDbtConfigSourceType(src)}
|
||||
|
@ -26,7 +26,7 @@ export interface DBTFormCommonProps {
|
||||
}
|
||||
|
||||
export interface DBTConfigFormProps extends DBTFormCommonProps {
|
||||
data?: DbtConfigSource;
|
||||
data: DbtConfigSource;
|
||||
gcsType?: GCS_CONFIG;
|
||||
source?: DBT_SOURCES;
|
||||
handleGcsTypeChange?: (type: GCS_CONFIG) => void;
|
||||
|
@ -28,7 +28,7 @@ import { DBTLocalConfig } from './DBTLocalConfig';
|
||||
import { DBTS3Config } from './DBTS3Config';
|
||||
|
||||
const DBTConfigFormBuilder: FunctionComponent<DBTConfigFormProps> = ({
|
||||
data = {},
|
||||
data,
|
||||
okText,
|
||||
cancelText,
|
||||
gcsType,
|
||||
@ -39,7 +39,6 @@ const DBTConfigFormBuilder: FunctionComponent<DBTConfigFormProps> = ({
|
||||
onSubmit,
|
||||
}: DBTConfigFormProps) => {
|
||||
const [dbtConfig, setDbtConfig] = useState<DbtConfigSource>(data);
|
||||
const [dbtSource, setDbtSource] = useState<DBT_SOURCES>(source);
|
||||
|
||||
const updateDbtConfig = (
|
||||
key: keyof DbtConfigSource,
|
||||
@ -124,7 +123,7 @@ const DBTConfigFormBuilder: FunctionComponent<DBTConfigFormProps> = ({
|
||||
};
|
||||
|
||||
const getFields = () => {
|
||||
switch (dbtSource) {
|
||||
switch (source) {
|
||||
case DBT_SOURCES.local: {
|
||||
return getLocalConfigFields();
|
||||
}
|
||||
@ -168,13 +167,9 @@ const DBTConfigFormBuilder: FunctionComponent<DBTConfigFormProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
handleSourceChange && handleSourceChange(dbtSource);
|
||||
}, [dbtSource]);
|
||||
|
||||
useEffect(() => {
|
||||
setDbtConfig(data);
|
||||
}, [data, dbtSource, gcsType]);
|
||||
}, [data, source, gcsType]);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
@ -191,9 +186,10 @@ const DBTConfigFormBuilder: FunctionComponent<DBTConfigFormProps> = ({
|
||||
id="dbt-source"
|
||||
name="dbt-source"
|
||||
placeholder="Select DBT Source"
|
||||
value={dbtSource}
|
||||
value={source}
|
||||
onChange={(e) => {
|
||||
setDbtSource(e.target.value as DBT_SOURCES);
|
||||
handleSourceChange &&
|
||||
handleSourceChange(e.target.value as DBT_SOURCES);
|
||||
}}>
|
||||
{DBTSources.map((option, i) => (
|
||||
<option key={i} value={option.value}>
|
||||
|
@ -138,7 +138,7 @@ function getInvalidEmailErrors<
|
||||
) {
|
||||
let isValid = true;
|
||||
for (const field of ruleFields[rule]) {
|
||||
if (!isValidEmail(data[field] as unknown as string)) {
|
||||
if (data[field] && !isValidEmail(data[field] as unknown as string)) {
|
||||
isValid = false;
|
||||
errors[field] = jsonData['form-error-messages'][
|
||||
'invalid-email'
|
||||
@ -164,7 +164,7 @@ function getInvalidUrlErrors<
|
||||
) {
|
||||
let isValid = true;
|
||||
for (const field of ruleFields[rule]) {
|
||||
if (!isValidUrl(data[field] as unknown as string)) {
|
||||
if (data[field] && !isValidUrl(data[field] as unknown as string)) {
|
||||
isValid = false;
|
||||
errors[field] = jsonData['form-error-messages'][
|
||||
'invalid-url'
|
||||
@ -214,13 +214,6 @@ export const checkDbtGCSCredsConfigRules = (
|
||||
isValid =
|
||||
getInvalidUrlErrors(data, errors, ruleFields, rule) && isValid;
|
||||
|
||||
for (const field of ruleFields[rule]) {
|
||||
if (!isValidUrl(data[field] || '')) {
|
||||
isValid = false;
|
||||
errors[field] = jsonData['form-error-messages']['invalid-url'];
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user