Fix #6725 Ability to create multiple separate ingestions for one database service (#6737)

* Fix #6725 Ability to create multiple separate ingestions for one database service

* modify cypress test
This commit is contained in:
Sachin Chaurasiya 2022-08-16 16:33:02 +05:30 committed by GitHub
parent 2898d59d32
commit e6c5d2ccaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 6 deletions

View File

@ -140,7 +140,7 @@ export const testServiceCreationAndIngestion = (
cy.get('[data-testid="success-line"]', { timeout: 15000 }).should(
'be.visible'
);
cy.contains(`"${serviceName}_metadata"`).should('be.visible');
cy.contains(`${serviceName}_metadata`).should('be.visible');
cy.contains('has been created and deployed successfully').should(
'be.visible'
);

View File

@ -421,6 +421,24 @@ const ConfigureIngestion = ({
const getMetadataFields = () => {
return (
<>
<Field>
<label className="tw-block tw-form-label tw-mb-1" htmlFor="name">
Name
</label>
<p className="tw-text-grey-muted tw-mt-1 tw-mb-2 tw-text-sm">
Name that identifies this pipeline instance uniquely.
</p>
<input
className="tw-form-inputs tw-form-inputs-padding"
data-testid="name"
id="name"
name="name"
type="text"
value={ingestionName}
onChange={(e) => handleIngestionName(e.target.value)}
/>
{getSeparator('')}
</Field>
<div>{getMetadataFilterPatternField()}</div>
</>
);

View File

@ -113,7 +113,8 @@ const Ingestion: React.FC<IngestionProps> = ({
if (ingestionList.length > 0) {
return pipelineType.reduce((prev, curr) => {
if (
curr !== PipelineType.Profiler &&
// Prevent adding multiple usage pipeline
curr === PipelineType.Usage &&
ingestionList.find((d) => d.pipelineType === curr)
) {
return prev;
@ -263,12 +264,21 @@ const Ingestion: React.FC<IngestionProps> = ({
const getAddIngestionElement = () => {
const types = getIngestionPipelineTypeOption();
let element: JSX.Element | null = null;
// Check if service has atleast one metadata pipeline available or not
const hasMetadata = ingestionList.find(
(ingestion) => ingestion.pipelineType === PipelineType.Metadata
);
if (types.length) {
if (types[0] === PipelineType.Metadata || types.length === 1) {
element = getAddIngestionButton(types[0]);
} else {
// if service has metedata then show all available option
if (hasMetadata) {
element = getAddIngestionDropdown(types);
} else {
/**
* If service does not have any metedata pipeline then
* show only option for metadata ingestion
*/
element = getAddIngestionButton(PipelineType.Metadata);
}
}

View File

@ -484,7 +484,11 @@ export const getIngestionName = (
serviceName: string,
type: IngestionPipelineType
) => {
if (type === IngestionPipelineType.Profiler) {
if (
[IngestionPipelineType.Profiler, IngestionPipelineType.Metadata].includes(
type
)
) {
return `${serviceName}_${type}_${cryptoRandomString({
length: 8,
type: 'alphanumeric',