Skip to content

Commit

Permalink
feat(ingestion-ui) Update source ingestion type if editing yaml inges…
Browse files Browse the repository at this point in the history
…tion type (datahub-project#6156)
  • Loading branch information
Ankit-Keshari-Vituity authored and cccs-tom committed Nov 18, 2022
1 parent 660c7ac commit 5d335ea
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Alert, Button, Space, Typography } from 'antd';
import { Alert, Button, message, Space, Typography } from 'antd';
import styled from 'styled-components';
import { StepProps } from './types';
import { getPlaceholderRecipe, getSourceConfigs, jsonToYaml } from '../utils';
Expand Down Expand Up @@ -73,12 +73,21 @@ export const DefineRecipeStep = ({ state, updateState, goTo, prev, ingestionSour
const recipeJson = getRecipeJson(stagedRecipeYml);
if (!recipeJson) return;

if (!JSON.parse(recipeJson).source?.type) {
message.warning({
content: `Please add valid ingestion type`,
duration: 3,
});
return;
}

const newState = {
...state,
config: {
...state.config,
recipe: recipeJson,
},
type: JSON.parse(recipeJson).source.type,
};
updateState(newState);

Expand Down

0 comments on commit 5d335ea

Please sign in to comment.