mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-17 11:43:54 +00:00
* added support for displayName in adding ingestion * added test cases * minor code fix --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
6612ac9a51
commit
c601dde801
@ -129,7 +129,12 @@ const AddIngestion = ({
|
||||
};
|
||||
|
||||
const createNewIngestion = (extraData: WorkflowExtraConfig) => {
|
||||
const { name = '', enableDebugLog, ...rest } = workflowData ?? {};
|
||||
const {
|
||||
name = '',
|
||||
enableDebugLog,
|
||||
displayName,
|
||||
...rest
|
||||
} = workflowData ?? {};
|
||||
const ingestionName = trim(name);
|
||||
setSaveState(LOADING_STATE.WAITING);
|
||||
|
||||
@ -148,7 +153,7 @@ const AddIngestion = ({
|
||||
},
|
||||
loggerLevel: enableDebugLog ? LogLevels.Debug : LogLevels.Info,
|
||||
name: ingestionName,
|
||||
displayName: ingestionName,
|
||||
displayName: displayName,
|
||||
owner: {
|
||||
id: currentUser?.id ?? '',
|
||||
type: 'user',
|
||||
@ -194,12 +199,14 @@ const AddIngestion = ({
|
||||
: scheduleInterval,
|
||||
retries: extraData.retries,
|
||||
},
|
||||
displayName: workflowData?.displayName,
|
||||
loggerLevel: workflowData?.enableDebugLog
|
||||
? LogLevels.Debug
|
||||
: LogLevels.Info,
|
||||
sourceConfig: {
|
||||
config: {
|
||||
...(omit(workflowData, ['name', 'enableDebugLog']) ?? {}),
|
||||
...(omit(workflowData, ['name', 'enableDebugLog', 'displayName']) ??
|
||||
{}),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -123,6 +123,7 @@ export type ConfigData =
|
||||
export type IngestionWorkflowData = Pipeline & {
|
||||
name: string;
|
||||
enableDebugLog?: boolean;
|
||||
displayName?: string;
|
||||
};
|
||||
|
||||
export interface IngestionWorkflowFormProps {
|
||||
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2023 Collate.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ServiceCategory } from '../enums/service.enum';
|
||||
import { PipelineType as WorkflowType } from '../generated/api/services/ingestionPipelines/createIngestionPipeline';
|
||||
import {
|
||||
getMetadataSchemaByServiceCategory,
|
||||
getSchemaByWorkflowType,
|
||||
} from './IngestionWorkflowUtils';
|
||||
|
||||
describe('Ingestion Workflow tests', () => {
|
||||
it('should getMetadataSchemaByServiceCategory return the correct schema for each service category', () => {
|
||||
const databaseSchema = getMetadataSchemaByServiceCategory(
|
||||
ServiceCategory.DATABASE_SERVICES
|
||||
);
|
||||
const dashboardSchema = getMetadataSchemaByServiceCategory(
|
||||
ServiceCategory.DASHBOARD_SERVICES
|
||||
);
|
||||
const messagingSchema = getMetadataSchemaByServiceCategory(
|
||||
ServiceCategory.MESSAGING_SERVICES
|
||||
);
|
||||
|
||||
expect(databaseSchema).toBeDefined();
|
||||
expect(dashboardSchema).toBeDefined();
|
||||
expect(messagingSchema).toBeDefined();
|
||||
});
|
||||
|
||||
it('should getMetadataSchemaByServiceCategory return an empty object for an unknown service category', () => {
|
||||
const unknownSchema = getMetadataSchemaByServiceCategory(
|
||||
'unknown-category' as ServiceCategory
|
||||
);
|
||||
|
||||
expect(unknownSchema).toEqual({});
|
||||
});
|
||||
|
||||
it('should getSchemaByWorkflowType return the correct schema for each workflow type', () => {
|
||||
const metadataSchema = getSchemaByWorkflowType(
|
||||
WorkflowType.Metadata,
|
||||
ServiceCategory.PIPELINE_SERVICES
|
||||
);
|
||||
const profilerSchema = getSchemaByWorkflowType(
|
||||
WorkflowType.Profiler,
|
||||
ServiceCategory.PIPELINE_SERVICES
|
||||
);
|
||||
const usageSchema = getSchemaByWorkflowType(
|
||||
WorkflowType.Usage,
|
||||
ServiceCategory.PIPELINE_SERVICES
|
||||
);
|
||||
|
||||
expect(metadataSchema).toBeDefined();
|
||||
expect(profilerSchema).toBeDefined();
|
||||
expect(usageSchema).toBeDefined();
|
||||
});
|
||||
|
||||
it('should getSchemaByWorkflowType return a default object with for an unknown workflow type', () => {
|
||||
const unknownSchema = getSchemaByWorkflowType(
|
||||
'unknown-type' as WorkflowType,
|
||||
ServiceCategory.PIPELINE_SERVICES
|
||||
);
|
||||
|
||||
expect(unknownSchema).toHaveProperty('properties.displayName');
|
||||
});
|
||||
|
||||
it('should getSchemaByWorkflowType include display Name for each schema', () => {
|
||||
const metadataSchema = getSchemaByWorkflowType(
|
||||
WorkflowType.Metadata,
|
||||
ServiceCategory.PIPELINE_SERVICES
|
||||
);
|
||||
|
||||
expect(metadataSchema).toBeDefined();
|
||||
expect(metadataSchema).toHaveProperty('properties.displayName');
|
||||
});
|
||||
});
|
@ -61,6 +61,10 @@ export const getSchemaByWorkflowType = (
|
||||
serviceCategory: ServiceCategory
|
||||
) => {
|
||||
const customProperties = {
|
||||
displayName: {
|
||||
description: 'Display Name of the workflow',
|
||||
type: 'string',
|
||||
},
|
||||
name: {
|
||||
description: 'Name of the workflow',
|
||||
type: 'string',
|
||||
@ -126,9 +130,6 @@ export const getSchemaByWorkflowType = (
|
||||
break;
|
||||
|
||||
default:
|
||||
schema = {};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
const rjsfSchema = schema as RJSFSchema;
|
||||
|
Loading…
x
Reference in New Issue
Block a user