Fix #5116: Update UI connection for Pipeline Services (#5408)

This commit is contained in:
darth-coder00 2022-06-11 10:32:06 +05:30 committed by GitHub
parent 685cb4733f
commit ce149c86be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 208 additions and 178 deletions

View File

@ -22,7 +22,7 @@
"connectionType": { "connectionType": {
"description": "Type of database service such as MySQL, BigQuery, Snowflake, Redshift, Postgres...", "description": "Type of database service such as MySQL, BigQuery, Snowflake, Redshift, Postgres...",
"type": "string", "type": "string",
"enum": ["Database", "Dashboard", "Messaging"], "enum": ["Database", "Dashboard", "Messaging", "Pipeline"],
"javaEnums": [ "javaEnums": [
{ {
"name": "Database" "name": "Database"
@ -32,6 +32,9 @@
}, },
{ {
"name": "Messaging" "name": "Messaging"
},
{
"name": "Pipeline"
} }
] ]
} }

View File

@ -13,7 +13,7 @@ const rootDir = 'connTemp';
const srcDir = 'schema/entity/services/connections'; const srcDir = 'schema/entity/services/connections';
const destDir = 'src/jsons/connectionSchemas/connections'; const destDir = 'src/jsons/connectionSchemas/connections';
const playDir = `${rootDir}/${srcDir}/${rootDir}`; const playDir = `${rootDir}/${srcDir}`;
const globalParserOptions = { const globalParserOptions = {
continueOnError: true, continueOnError: true,
@ -24,8 +24,11 @@ const globalParserOptions = {
async function parseSchema(filePath, destPath) { async function parseSchema(filePath, destPath) {
try { try {
const fileDir = `${cwd}/${path.dirname(filePath)}`;
const fileName = path.basename(filePath);
process.chdir(fileDir);
const parser = new $RefParser(globalParserOptions); const parser = new $RefParser(globalParserOptions);
const schema = await parser.parse(filePath); const schema = await parser.parse(fileName);
const api = await parser.bundle(schema); const api = await parser.bundle(schema);
const dirname = `${cwd}/${path.dirname(destPath)}`; const dirname = `${cwd}/${path.dirname(destPath)}`;
if (!fs.existsSync(dirname)) { if (!fs.existsSync(dirname)) {
@ -38,54 +41,44 @@ async function parseSchema(filePath, destPath) {
fs.writeFileSync(`${cwd}/${destPath}`, JSON.stringify(api, null, 2)); fs.writeFileSync(`${cwd}/${destPath}`, JSON.stringify(api, null, 2));
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} finally {
process.chdir(cwd);
} }
} }
function traverseDirectory(Directory) { async function traverseDirectory(Directory) {
fs.readdirSync(Directory).forEach((File) => { const Files = fs.readdirSync(Directory);
for (const File of Files) {
const Absolute = path.join(Directory, File); const Absolute = path.join(Directory, File);
if (fs.statSync(Absolute).isDirectory()) { if (fs.statSync(Absolute).isDirectory()) {
return traverseDirectory(Absolute); await traverseDirectory(Absolute);
} else { } else {
const name = Absolute.replace(srcDir, destDir); const name = Absolute.replace(playDir, destDir);
return parseSchema(Absolute, name); await parseSchema(Absolute, name);
}
} }
});
} }
function copySourceFiles() { function copySourceFiles() {
try { try {
fse.copySync(schemaDir, `${rootDir}/schema`); fse.copySync(schemaDir, `${rootDir}/schema`);
fse.copySync(schemaDir, `${playDir}/schema`);
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }
} }
function main() { async function main() {
try { try {
if (fs.existsSync(destDir)) { if (fs.existsSync(destDir)) {
fs.rmSync(destDir, { recursive: true }); fs.rmSync(destDir, { recursive: true });
} }
fs.mkdirSync(destDir, { recursive: true }); fs.mkdirSync(destDir, { recursive: true });
copySourceFiles(); copySourceFiles();
await traverseDirectory(`${playDir}`);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
process.chdir(`${cwd}/${playDir}`);
fs.readdir(srcDir, (err, Files) => {
if (err) console.log(err);
else {
Files.forEach((File, index) => {
const Absolute = path.join(srcDir, File);
if (fs.statSync(Absolute).isDirectory()) {
traverseDirectory(Absolute);
}
});
}
});
} }
main(); main();

View File

@ -122,6 +122,11 @@ const AddIngestion = ({
const [showChartFilter, setShowChartFilter] = useState( const [showChartFilter, setShowChartFilter] = useState(
!isUndefined((data?.sourceConfig.config as ConfigClass)?.chartFilterPattern) !isUndefined((data?.sourceConfig.config as ConfigClass)?.chartFilterPattern)
); );
const [showPipelineFilter, setShowPipelineFilter] = useState(
!isUndefined(
(data?.sourceConfig.config as ConfigClass)?.pipelineFilterPattern
)
);
const [showFqnFilter, setShowFqnFilter] = useState( const [showFqnFilter, setShowFqnFilter] = useState(
!isUndefined((data?.sourceConfig.config as ConfigClass)?.fqnFilterPattern) !isUndefined((data?.sourceConfig.config as ConfigClass)?.fqnFilterPattern)
); );
@ -155,6 +160,9 @@ const AddIngestion = ({
const [includeView, setIncludeView] = useState( const [includeView, setIncludeView] = useState(
Boolean((data?.sourceConfig.config as ConfigClass)?.includeViews) Boolean((data?.sourceConfig.config as ConfigClass)?.includeViews)
); );
const [includeLineage, setIncludeLineage] = useState(
Boolean((data?.sourceConfig.config as ConfigClass)?.includeLineage ?? true)
);
const [enableDebugLog, setEnableDebugLog] = useState( const [enableDebugLog, setEnableDebugLog] = useState(
data?.loggerLevel === LogLevels.Debug data?.loggerLevel === LogLevels.Debug
); );
@ -184,6 +192,11 @@ const AddIngestion = ({
(data?.sourceConfig.config as ConfigClass)?.chartFilterPattern ?? (data?.sourceConfig.config as ConfigClass)?.chartFilterPattern ??
INITIAL_FILTER_PATTERN INITIAL_FILTER_PATTERN
); );
const [pipelineFilterPattern, setPipelineFilterPattern] =
useState<FilterPattern>(
(data?.sourceConfig.config as ConfigClass)?.pipelineFilterPattern ??
INITIAL_FILTER_PATTERN
);
const [fqnFilterPattern, setFqnFilterPattern] = useState<FilterPattern>( const [fqnFilterPattern, setFqnFilterPattern] = useState<FilterPattern>(
(data?.sourceConfig.config as ConfigClass)?.fqnFilterPattern ?? (data?.sourceConfig.config as ConfigClass)?.fqnFilterPattern ??
INITIAL_FILTER_PATTERN INITIAL_FILTER_PATTERN
@ -237,12 +250,16 @@ const AddIngestion = ({
break; break;
case FilterPatternEnum.CHART: case FilterPatternEnum.CHART:
setChartFilterPattern({ ...topicFilterPattern, includes: value }); setChartFilterPattern({ ...chartFilterPattern, includes: value });
break; break;
case FilterPatternEnum.FQN: case FilterPatternEnum.FQN:
setFqnFilterPattern({ ...fqnFilterPattern, includes: value }); setFqnFilterPattern({ ...fqnFilterPattern, includes: value });
break;
case FilterPatternEnum.PIPELINE:
setPipelineFilterPattern({ ...pipelineFilterPattern, includes: value });
break; break;
} }
}; };
@ -272,12 +289,16 @@ const AddIngestion = ({
break; break;
case FilterPatternEnum.CHART: case FilterPatternEnum.CHART:
setChartFilterPattern({ ...topicFilterPattern, excludes: value }); setChartFilterPattern({ ...chartFilterPattern, excludes: value });
break; break;
case FilterPatternEnum.FQN: case FilterPatternEnum.FQN:
setFqnFilterPattern({ ...fqnFilterPattern, excludes: value }); setFqnFilterPattern({ ...fqnFilterPattern, excludes: value });
break;
case FilterPatternEnum.PIPELINE:
setPipelineFilterPattern({ ...pipelineFilterPattern, excludes: value });
break; break;
} }
}; };
@ -311,6 +332,10 @@ const AddIngestion = ({
case FilterPatternEnum.FQN: case FilterPatternEnum.FQN:
setShowFqnFilter(value); setShowFqnFilter(value);
break;
case FilterPatternEnum.PIPELINE:
setShowPipelineFilter(value);
break; break;
} }
}; };
@ -404,6 +429,16 @@ const AddIngestion = ({
type: ConfigType.DashboardMetadata, type: ConfigType.DashboardMetadata,
}; };
} }
case ServiceCategory.PIPELINE_SERVICES: {
return {
includeLineage: includeLineage,
pipelineFilterPattern: getFilterPatternData(
pipelineFilterPattern,
showPipelineFilter
),
type: ConfigType.PipelineMetadata,
};
}
default: { default: {
return {}; return {};
} }
@ -580,6 +615,7 @@ const AddIngestion = ({
getIncludeValue={getIncludeValue} getIncludeValue={getIncludeValue}
handleDescription={(val) => setDescription(val)} handleDescription={(val) => setDescription(val)}
handleEnableDebugLog={() => setEnableDebugLog((pre) => !pre)} handleEnableDebugLog={() => setEnableDebugLog((pre) => !pre)}
handleIncludeLineage={() => setIncludeLineage((pre) => !pre)}
handleIncludeView={() => setIncludeView((pre) => !pre)} handleIncludeView={() => setIncludeView((pre) => !pre)}
handleIngestionName={(val) => setIngestionName(val)} handleIngestionName={(val) => setIngestionName(val)}
handleMarkDeletedTables={() => setMarkDeletedTables((pre) => !pre)} handleMarkDeletedTables={() => setMarkDeletedTables((pre) => !pre)}
@ -587,9 +623,11 @@ const AddIngestion = ({
handleResultLimit={(val) => setResultLimit(val)} handleResultLimit={(val) => setResultLimit(val)}
handleShowFilter={handleShowFilter} handleShowFilter={handleShowFilter}
handleStageFileLocation={(val) => setStageFileLocation(val)} handleStageFileLocation={(val) => setStageFileLocation(val)}
includeLineage={includeLineage}
includeView={includeView} includeView={includeView}
ingestionName={ingestionName} ingestionName={ingestionName}
markDeletedTables={markDeletedTables} markDeletedTables={markDeletedTables}
pipelineFilterPattern={pipelineFilterPattern}
pipelineType={pipelineType} pipelineType={pipelineType}
queryLogDuration={queryLogDuration} queryLogDuration={queryLogDuration}
resultLimit={resultLimit} resultLimit={resultLimit}
@ -599,6 +637,7 @@ const AddIngestion = ({
showDashboardFilter={showDashboardFilter} showDashboardFilter={showDashboardFilter}
showDatabaseFilter={showDatabaseFilter} showDatabaseFilter={showDatabaseFilter}
showFqnFilter={showFqnFilter} showFqnFilter={showFqnFilter}
showPipelineFilter={showPipelineFilter}
showSchemaFilter={showSchemaFilter} showSchemaFilter={showSchemaFilter}
showTableFilter={showTableFilter} showTableFilter={showTableFilter}
showTopicFilter={showTopicFilter} showTopicFilter={showTopicFilter}

View File

@ -54,10 +54,15 @@ const mockConfigureIngestion: ConfigureIngestionProps = {
includes: [], includes: [],
excludes: [], excludes: [],
}, },
pipelineFilterPattern: {
includes: [],
excludes: [],
},
fqnFilterPattern: { fqnFilterPattern: {
includes: [], includes: [],
excludes: [], excludes: [],
}, },
includeLineage: false,
includeView: false, includeView: false,
pipelineType: PipelineType.Metadata, pipelineType: PipelineType.Metadata,
queryLogDuration: 1, queryLogDuration: 1,
@ -70,7 +75,9 @@ const mockConfigureIngestion: ConfigureIngestionProps = {
showTableFilter: false, showTableFilter: false,
showTopicFilter: false, showTopicFilter: false,
showChartFilter: false, showChartFilter: false,
showPipelineFilter: false,
showFqnFilter: false, showFqnFilter: false,
handleIncludeLineage: jest.fn(),
handleIncludeView: jest.fn(), handleIncludeView: jest.fn(),
handleIngestionName: jest.fn(), handleIngestionName: jest.fn(),
handleMarkDeletedTables: jest.fn(), handleMarkDeletedTables: jest.fn(),

View File

@ -34,7 +34,9 @@ const ConfigureIngestion = ({
tableFilterPattern, tableFilterPattern,
topicFilterPattern, topicFilterPattern,
chartFilterPattern, chartFilterPattern,
pipelineFilterPattern,
fqnFilterPattern, fqnFilterPattern,
includeLineage,
includeView, includeView,
markDeletedTables, markDeletedTables,
serviceCategory, serviceCategory,
@ -45,6 +47,7 @@ const ConfigureIngestion = ({
showTableFilter, showTableFilter,
showTopicFilter, showTopicFilter,
showChartFilter, showChartFilter,
showPipelineFilter,
showFqnFilter, showFqnFilter,
queryLogDuration, queryLogDuration,
stageFileLocation, stageFileLocation,
@ -56,6 +59,7 @@ const ConfigureIngestion = ({
handleIngestionName, handleIngestionName,
handleDescription, handleDescription,
handleShowFilter, handleShowFilter,
handleIncludeLineage,
handleIncludeView, handleIncludeView,
handleMarkDeletedTables, handleMarkDeletedTables,
handleQueryLogDuration, handleQueryLogDuration,
@ -128,6 +132,28 @@ const ConfigureIngestion = ({
); );
}; };
const getPipelineFieldToggles = () => {
return (
<div>
<Field>
<div className="tw-flex tw-gap-1">
<label>Include lineage</label>
<ToggleSwitchV1
checked={includeLineage}
handleCheck={handleIncludeLineage}
testId="include-lineage"
/>
</div>
<p className="tw-text-grey-muted tw-mt-3">
Configuration to turn off fetching lineage from pipelines.
</p>
{getSeparator('')}
</Field>
{getDebugLogToggle()}
</div>
);
};
const getMetadataFilterPatternField = () => { const getMetadataFilterPatternField = () => {
switch (serviceCategory) { switch (serviceCategory) {
case ServiceCategory.DATABASE_SERVICES: case ServiceCategory.DATABASE_SERVICES:
@ -221,6 +247,25 @@ const ConfigureIngestion = ({
{getDebugLogToggle()} {getDebugLogToggle()}
</Fragment> </Fragment>
); );
case ServiceCategory.PIPELINE_SERVICES:
return (
<Fragment>
<FilterPattern
checked={showPipelineFilter}
excludePattern={pipelineFilterPattern.excludes ?? []}
getExcludeValue={getExcludeValue}
getIncludeValue={getIncludeValue}
handleChecked={(value) =>
handleShowFilter(value, FilterPatternEnum.PIPELINE)
}
includePattern={pipelineFilterPattern.includes ?? []}
showSeparator={false}
type={FilterPatternEnum.PIPELINE}
/>
{getSeparator('')}
{getPipelineFieldToggles()}
</Fragment>
);
default: default:
return <></>; return <></>;
} }

View File

@ -64,7 +64,9 @@ export interface ConfigureIngestionProps {
tableFilterPattern: FilterPattern; tableFilterPattern: FilterPattern;
topicFilterPattern: FilterPattern; topicFilterPattern: FilterPattern;
chartFilterPattern: FilterPattern; chartFilterPattern: FilterPattern;
pipelineFilterPattern: FilterPattern;
fqnFilterPattern: FilterPattern; fqnFilterPattern: FilterPattern;
includeLineage: boolean;
includeView: boolean; includeView: boolean;
markDeletedTables?: boolean; markDeletedTables?: boolean;
enableDebugLog: boolean; enableDebugLog: boolean;
@ -75,12 +77,14 @@ export interface ConfigureIngestionProps {
showTableFilter: boolean; showTableFilter: boolean;
showTopicFilter: boolean; showTopicFilter: boolean;
showChartFilter: boolean; showChartFilter: boolean;
showPipelineFilter: boolean;
showFqnFilter: boolean; showFqnFilter: boolean;
queryLogDuration: number; queryLogDuration: number;
stageFileLocation: string; stageFileLocation: string;
resultLimit: number; resultLimit: number;
handleIngestionName: (value: string) => void; handleIngestionName: (value: string) => void;
handleDescription?: (value: string) => void; handleDescription?: (value: string) => void;
handleIncludeLineage: () => void;
handleIncludeView: () => void; handleIncludeView: () => void;
handleMarkDeletedTables?: () => void; handleMarkDeletedTables?: () => void;
handleEnableDebugLog: () => void; handleEnableDebugLog: () => void;

View File

@ -21,17 +21,12 @@ import { FormSubmitType } from '../../enums/form.enum';
import { PageLayoutType } from '../../enums/layout.enum'; import { PageLayoutType } from '../../enums/layout.enum';
import { ServiceCategory } from '../../enums/service.enum'; import { ServiceCategory } from '../../enums/service.enum';
import { PipelineType } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline'; import { PipelineType } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline';
import { import { ConfigData, DataObj } from '../../interface/service.interface';
ConfigData,
DataObj,
DataService,
} from '../../interface/service.interface';
import { getCurrentUserId } from '../../utils/CommonUtils'; import { getCurrentUserId } from '../../utils/CommonUtils';
import { getAddServicePath } from '../../utils/RouterUtils'; import { getAddServicePath } from '../../utils/RouterUtils';
import { import {
getServiceCreatedLabel, getServiceCreatedLabel,
getServiceIngestionStepGuide, getServiceIngestionStepGuide,
isIngestionSupported,
} from '../../utils/ServiceUtils'; } from '../../utils/ServiceUtils';
import AddIngestion from '../AddIngestion/AddIngestion.component'; import AddIngestion from '../AddIngestion/AddIngestion.component';
import SuccessScreen from '../common/success-screen/SuccessScreen'; import SuccessScreen from '../common/success-screen/SuccessScreen';
@ -129,10 +124,7 @@ const AddService = ({
}); });
}; };
const handleConfigUpdate = ( const handleConfigUpdate = (oData: ConfigData) => {
oData: ConfigData,
serviceCat: ServiceCategory
) => {
const data = { const data = {
name: serviceName, name: serviceName,
serviceType: selectServiceType, serviceType: selectServiceType,
@ -142,10 +134,7 @@ const AddService = ({
type: 'user', type: 'user',
}, },
}; };
const configData = const configData = {
serviceCat === ServiceCategory.PIPELINE_SERVICES
? { ...data, pipelineUrl: oData.pipelineUrl }
: {
...data, ...data,
connection: { connection: {
config: oData, config: oData,
@ -229,30 +218,23 @@ const AddService = ({
{activeServiceStep === 3 && ( {activeServiceStep === 3 && (
<ConnectionConfigForm <ConnectionConfigForm
cancelText="Back" cancelText="Back"
data={
(serviceCategory !== ServiceCategory.PIPELINE_SERVICES
? {
connection: { config: { type: selectServiceType } },
}
: {}) as DataService
}
serviceCategory={serviceCategory} serviceCategory={serviceCategory}
serviceType={selectServiceType} serviceType={selectServiceType}
status={saveServiceState} status={saveServiceState}
onCancel={handleConnectionDetailsBackClick} onCancel={handleConnectionDetailsBackClick}
onSave={(e) => { onSave={(e) => {
handleConfigUpdate(e.formData, serviceCategory); handleConfigUpdate(e.formData);
}} }}
/> />
)} )}
{activeServiceStep > 3 && ( {activeServiceStep > 3 && (
<SuccessScreen <SuccessScreen
showIngestionButton
handleIngestionClick={() => handleAddIngestion(true)} handleIngestionClick={() => handleAddIngestion(true)}
handleViewServiceClick={handleViewServiceClick} handleViewServiceClick={handleViewServiceClick}
isAirflowSetup={isAirflowRunning} isAirflowSetup={isAirflowRunning}
name={serviceName} name={serviceName}
showIngestionButton={isIngestionSupported(serviceCategory)}
state={FormSubmitType.ADD} state={FormSubmitType.ADD}
suffix={getServiceCreatedLabel(serviceCategory)} suffix={getServiceCreatedLabel(serviceCategory)}
onCheckAirflowStatus={onAirflowStatusCheck} onCheckAirflowStatus={onAirflowStatusCheck}

View File

@ -18,19 +18,22 @@ import React, { Fragment, FunctionComponent, useMemo } from 'react';
import { TestConnection } from '../../axiosAPIs/serviceAPI'; import { TestConnection } from '../../axiosAPIs/serviceAPI';
import { ServiceCategory } from '../../enums/service.enum'; import { ServiceCategory } from '../../enums/service.enum';
import { import {
DashboardConnection,
DashboardService, DashboardService,
DashboardServiceType,
} from '../../generated/entity/services/dashboardService'; } from '../../generated/entity/services/dashboardService';
import { import {
DatabaseConnection,
DatabaseService, DatabaseService,
DatabaseServiceType,
} from '../../generated/entity/services/databaseService'; } from '../../generated/entity/services/databaseService';
import { import {
MessagingConnection,
MessagingService, MessagingService,
MessagingServiceType,
} from '../../generated/entity/services/messagingService'; } from '../../generated/entity/services/messagingService';
import { PipelineService } from '../../generated/entity/services/pipelineService'; import {
import { ConfigData } from '../../interface/service.interface'; PipelineService,
PipelineServiceType,
} from '../../generated/entity/services/pipelineService';
import { ConfigData, DataService } from '../../interface/service.interface';
import jsonData from '../../jsons/en'; import jsonData from '../../jsons/en';
import { getDashboardConfig } from '../../utils/DashboardServiceUtils'; import { getDashboardConfig } from '../../utils/DashboardServiceUtils';
import { getDatabaseConfig } from '../../utils/DatabaseServiceUtils'; import { getDatabaseConfig } from '../../utils/DatabaseServiceUtils';
@ -45,7 +48,11 @@ import { showErrorToast } from '../../utils/ToastUtils';
import FormBuilder from '../common/FormBuilder/FormBuilder'; import FormBuilder from '../common/FormBuilder/FormBuilder';
interface Props { interface Props {
data: DatabaseService | MessagingService | DashboardService | PipelineService; data?:
| DatabaseService
| MessagingService
| DashboardService
| PipelineService;
okText?: string; okText?: string;
cancelText?: string; cancelText?: string;
serviceType: string; serviceType: string;
@ -66,17 +73,11 @@ const ConnectionConfigForm: FunctionComponent<Props> = ({
onSave, onSave,
}: Props) => { }: Props) => {
const allowTestConn = useMemo(() => { const allowTestConn = useMemo(() => {
return shouldTestConnection(serviceType, serviceCategory); return shouldTestConnection(serviceType);
}, [serviceType, serviceCategory]); }, [serviceType]);
const config = !isNil(data) const config = !isNil(data)
? /* eslint-disable-next-line no-prototype-builtins */ ? ((data as DataService).connection.config as ConfigData)
data.hasOwnProperty('connection')
? ((data as DatabaseService | MessagingService | DashboardService)
.connection.config as ConfigData)
: ({
pipelineUrl: (data as PipelineService).connection.config?.hostPort,
} as ConfigData)
: ({} as ConfigData); : ({} as ConfigData);
const handleSave = (data: ISubmitEvent<ConfigData>) => { const handleSave = (data: ISubmitEvent<ConfigData>) => {
@ -124,28 +125,22 @@ const ConnectionConfigForm: FunctionComponent<Props> = ({
switch (serviceCategory) { switch (serviceCategory) {
case ServiceCategory.DATABASE_SERVICES: { case ServiceCategory.DATABASE_SERVICES: {
connSch = getDatabaseConfig( connSch = getDatabaseConfig(serviceType as DatabaseServiceType);
validConfig as DatabaseConnection['config']
);
break; break;
} }
case ServiceCategory.MESSAGING_SERVICES: { case ServiceCategory.MESSAGING_SERVICES: {
connSch = getMessagingConfig( connSch = getMessagingConfig(serviceType as MessagingServiceType);
validConfig as MessagingConnection['config']
);
break; break;
} }
case ServiceCategory.DASHBOARD_SERVICES: { case ServiceCategory.DASHBOARD_SERVICES: {
connSch = getDashboardConfig( connSch = getDashboardConfig(serviceType as DashboardServiceType);
validConfig as DashboardConnection['config']
);
break; break;
} }
case ServiceCategory.PIPELINE_SERVICES: { case ServiceCategory.PIPELINE_SERVICES: {
connSch = getPipelineConfig(); connSch = getPipelineConfig(serviceType as PipelineServiceType);
break; break;
} }

View File

@ -131,10 +131,17 @@ export const STEPS_FOR_ADD_SERVICE: Array<StepperStepType> = [
{ name: 'Connection Details', step: 3 }, { name: 'Connection Details', step: 3 },
]; ];
export const COMMON_UI_SCHEMA = { const DEF_UI_SCHEMA = {
supportsMetadataExtraction: { 'ui:widget': 'hidden', 'ui:hideError': true }, supportsMetadataExtraction: { 'ui:widget': 'hidden', 'ui:hideError': true },
supportsUsageExtraction: { 'ui:widget': 'hidden', 'ui:hideError': true }, supportsUsageExtraction: { 'ui:widget': 'hidden', 'ui:hideError': true },
supportsProfiler: { 'ui:widget': 'hidden', 'ui:hideError': true }, supportsProfiler: { 'ui:widget': 'hidden', 'ui:hideError': true },
supportsDatabase: { 'ui:widget': 'hidden', 'ui:hideError': true }, supportsDatabase: { 'ui:widget': 'hidden', 'ui:hideError': true },
type: { 'ui:widget': 'hidden' }, type: { 'ui:widget': 'hidden' },
}; };
export const COMMON_UI_SCHEMA = {
...DEF_UI_SCHEMA,
connection: {
...DEF_UI_SCHEMA,
},
};

View File

@ -19,4 +19,5 @@ export enum FilterPatternEnum {
DASHBOARD = 'dashboard', DASHBOARD = 'dashboard',
TOPIC = 'topic', TOPIC = 'topic',
FQN = 'fqn', FQN = 'fqn',
PIPELINE = 'pipeline',
} }

View File

@ -75,6 +75,5 @@ export interface ServiceResponse {
export type ConfigData = Partial<DatabaseService['connection']> & export type ConfigData = Partial<DatabaseService['connection']> &
Partial<MessagingService['connection']> & Partial<MessagingService['connection']> &
Partial<DashboardService['connection']> & { Partial<DashboardService['connection']> &
pipelineUrl: string; Partial<PipelineService['connection']>;
};

View File

@ -63,7 +63,7 @@ import { IngestionPipeline } from '../../generated/entity/services/ingestionPipe
import { EntityReference } from '../../generated/type/entityReference'; import { EntityReference } from '../../generated/type/entityReference';
import { Paging } from '../../generated/type/paging'; import { Paging } from '../../generated/type/paging';
import { useAuth } from '../../hooks/authHooks'; import { useAuth } from '../../hooks/authHooks';
import { ServiceDataObj } from '../../interface/service.interface'; import { ConfigData, ServiceDataObj } from '../../interface/service.interface';
import jsonData from '../../jsons/en'; import jsonData from '../../jsons/en';
import { import {
getEntityDeleteMessage, getEntityDeleteMessage,
@ -77,7 +77,6 @@ import { getInfoElements } from '../../utils/EntityUtils';
import { getServicesWithTabPath } from '../../utils/RouterUtils'; import { getServicesWithTabPath } from '../../utils/RouterUtils';
import { import {
getCurrentServiceTab, getCurrentServiceTab,
getIsIngestionEnable,
getServiceCategoryFromType, getServiceCategoryFromType,
servicePageTabs, servicePageTabs,
serviceTypeLogo, serviceTypeLogo,
@ -96,9 +95,6 @@ const ServicePage: FunctionComponent = () => {
const [serviceName, setServiceName] = useState( const [serviceName, setServiceName] = useState(
serviceCategory || getServiceCategoryFromType(serviceType) serviceCategory || getServiceCategoryFromType(serviceType)
); );
const [isIngestionEnable] = useState(
getIsIngestionEnable(serviceName as ServiceCategory)
);
const [slashedTableName, setSlashedTableName] = useState< const [slashedTableName, setSlashedTableName] = useState<
TitleBreadcrumbProps['titleLinks'] TitleBreadcrumbProps['titleLinks']
>([]); >([]);
@ -155,7 +151,6 @@ const ServicePage: FunctionComponent = () => {
title: 'Sample Data', title: 'Sample Data',
selectedName: 'sample-data-color', selectedName: 'sample-data-color',
}, },
isHidden: !isIngestionEnable,
isProtected: false, isProtected: false,
position: 2, position: 2,
count: ingestions.length, count: ingestions.length,
@ -340,24 +335,8 @@ const ServicePage: FunctionComponent = () => {
}).finally(() => setIsloading(false)); }).finally(() => setIsloading(false));
}; };
const handleConfigUpdate = ( const handleConfigUpdate = (updatedData: ConfigData) => {
updatedData: ServicesData, const configData = {
serviceCategory: ServiceCategory
) => {
const configData =
serviceCategory === ServiceCategory.PIPELINE_SERVICES
? {
databaseConnection: updatedData.databaseConnection,
name: updatedData.name,
serviceType: updatedData.serviceType,
brokers: updatedData.brokers,
schemaRegistry: updatedData.schemaRegistry,
dashboardUrl: updatedData.dashboardUrl,
username: updatedData.username,
password: updatedData.password,
pipelineUrl: updatedData.pipelineUrl,
}
: {
name: serviceDetails?.name, name: serviceDetails?.name,
serviceType: serviceDetails?.serviceType, serviceType: serviceDetails?.serviceType,
description: serviceDetails?.description, description: serviceDetails?.description,
@ -735,7 +714,6 @@ const ServicePage: FunctionComponent = () => {
activeTabHandler(1); activeTabHandler(1);
} }
if (isIngestionEnable) {
getAirflowStatus() getAirflowStatus()
.then(() => { .then(() => {
setIsAirflowRunning(true); setIsAirflowRunning(true);
@ -744,7 +722,6 @@ const ServicePage: FunctionComponent = () => {
.catch(() => { .catch(() => {
setIsAirflowRunning(false); setIsAirflowRunning(false);
}); });
}
}, []); }, []);
const onCancel = () => { const onCancel = () => {

View File

@ -30,10 +30,10 @@ export const getDashboardURL = (config: DashboardConnection['config']) => {
: '--'; : '--';
}; };
export const getDashboardConfig = (config?: DashboardConnection['config']) => { export const getDashboardConfig = (type: DashboardServiceType) => {
let schema = {}; let schema = {};
const uiSchema = { ...COMMON_UI_SCHEMA }; const uiSchema = { ...COMMON_UI_SCHEMA };
switch (config?.type) { switch (type) {
case DashboardServiceType.Looker: { case DashboardServiceType.Looker: {
schema = lookerConnection; schema = lookerConnection;

View File

@ -13,10 +13,7 @@
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { COMMON_UI_SCHEMA } from '../constants/services.const'; import { COMMON_UI_SCHEMA } from '../constants/services.const';
import { import { DatabaseServiceType } from '../generated/entity/services/databaseService';
DatabaseConnection,
DatabaseServiceType,
} from '../generated/entity/services/databaseService';
import athenaConnection from '../jsons/connectionSchemas/connections/database/athenaConnection.json'; import athenaConnection from '../jsons/connectionSchemas/connections/database/athenaConnection.json';
import azureSQLConnection from '../jsons/connectionSchemas/connections/database/azureSQLConnection.json'; import azureSQLConnection from '../jsons/connectionSchemas/connections/database/azureSQLConnection.json';
import bigQueryConnection from '../jsons/connectionSchemas/connections/database/bigQueryConnection.json'; import bigQueryConnection from '../jsons/connectionSchemas/connections/database/bigQueryConnection.json';
@ -43,10 +40,10 @@ import sqliteConnection from '../jsons/connectionSchemas/connections/database/sq
import trinoConnection from '../jsons/connectionSchemas/connections/database/trinoConnection.json'; import trinoConnection from '../jsons/connectionSchemas/connections/database/trinoConnection.json';
import verticaConnection from '../jsons/connectionSchemas/connections/database/verticaConnection.json'; import verticaConnection from '../jsons/connectionSchemas/connections/database/verticaConnection.json';
export const getDatabaseConfig = (config?: DatabaseConnection['config']) => { export const getDatabaseConfig = (type: DatabaseServiceType) => {
let schema = {}; let schema = {};
const uiSchema = { ...COMMON_UI_SCHEMA }; const uiSchema = { ...COMMON_UI_SCHEMA };
switch (config?.type as unknown as DatabaseServiceType) { switch (type as unknown as DatabaseServiceType) {
case DatabaseServiceType.Athena: { case DatabaseServiceType.Athena: {
schema = athenaConnection; schema = athenaConnection;

View File

@ -30,10 +30,10 @@ export const getBrokers = (config: MessagingConnection['config']) => {
return !isUndefined(retVal) ? retVal : '--'; return !isUndefined(retVal) ? retVal : '--';
}; };
export const getMessagingConfig = (config: MessagingConnection['config']) => { export const getMessagingConfig = (type: MessagingServiceType) => {
let schema = {}; let schema = {};
const uiSchema = { ...COMMON_UI_SCHEMA }; const uiSchema = { ...COMMON_UI_SCHEMA };
if (config?.type === MessagingServiceType.Kafka) { if (type === MessagingServiceType.Kafka) {
schema = kafkaConnection; schema = kafkaConnection;
} }

View File

@ -11,25 +11,27 @@
* limitations under the License. * limitations under the License.
*/ */
import { JSONSchema7 } from 'json-schema';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { COMMON_UI_SCHEMA } from '../constants/services.const';
import { PipelineServiceType } from '../generated/entity/services/pipelineService';
import airflowConnection from '../jsons/connectionSchemas/connections/pipeline/airflowConnection.json';
import glueConnection from '../jsons/connectionSchemas/connections/pipeline/glueConnection.json';
export const getPipelineConfig = () => { export const getPipelineConfig = (type: PipelineServiceType) => {
const schema = { let schema = {};
$schema: 'http://json-schema.org/draft-07/schema#', const uiSchema = { ...COMMON_UI_SCHEMA };
title: 'PipelineConnection', switch (type) {
description: 'Pipeline Connection Config', case PipelineServiceType.Airflow: {
type: 'object', schema = airflowConnection;
properties: {
pipelineUrl: { break;
description: 'Pipeline Service Management/UI URL.', }
type: 'string', case PipelineServiceType.Glue: {
format: 'uri', schema = glueConnection;
},
}, break;
additionalProperties: false, }
} as JSONSchema7; }
const uiSchema = {};
return cloneDeep({ schema, uiSchema }); return cloneDeep({ schema, uiSchema });
}; };

View File

@ -339,23 +339,6 @@ export const getTotalEntityCountByService = (buckets: Array<Bucket> = []) => {
return entityCounts; return entityCounts;
}; };
export const getIsIngestionEnable = (serviceCategory: ServiceCategory) => {
switch (serviceCategory) {
case ServiceCategory.DATABASE_SERVICES:
case ServiceCategory.MESSAGING_SERVICES:
case ServiceCategory.DASHBOARD_SERVICES:
return true;
case ServiceCategory.PIPELINE_SERVICES:
default:
return false;
}
};
export const isIngestionSupported = (serviceCategory: ServiceCategory) => {
return getIsIngestionEnable(serviceCategory);
};
export const getKeyValuePair = (obj: DynamicObj) => { export const getKeyValuePair = (obj: DynamicObj) => {
return Object.entries(obj).map((v) => { return Object.entries(obj).map((v) => {
return { return {
@ -558,14 +541,8 @@ export const getIngestionName = (
} }
}; };
export const shouldTestConnection = ( export const shouldTestConnection = (serviceType: string) => {
serviceType: string, return serviceType !== DatabaseServiceType.SampleData;
serviceCategory: ServiceCategory
) => {
return (
serviceType !== DatabaseServiceType.SampleData &&
serviceCategory !== ServiceCategory.PIPELINE_SERVICES
);
}; };
export const getTestConnectionType = (serviceCat: ServiceCategory) => { export const getTestConnectionType = (serviceCat: ServiceCategory) => {
@ -574,6 +551,8 @@ export const getTestConnectionType = (serviceCat: ServiceCategory) => {
return ConnectionType.Messaging; return ConnectionType.Messaging;
case ServiceCategory.DASHBOARD_SERVICES: case ServiceCategory.DASHBOARD_SERVICES:
return ConnectionType.Dashboard; return ConnectionType.Dashboard;
case ServiceCategory.PIPELINE_SERVICES:
return ConnectionType.Pipeline;
case ServiceCategory.DATABASE_SERVICES: case ServiceCategory.DATABASE_SERVICES:
default: default:
return ConnectionType.Database; return ConnectionType.Database;