mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 04:14:34 +00:00
UI: Refactor service configuration retrieval in ServiceUtilClassBase (#15959)
This commit is contained in:
parent
19fa15f010
commit
3435a9612e
@ -38,13 +38,7 @@ import {
|
||||
ServicesType,
|
||||
} from '../../../../interface/service.interface';
|
||||
import { getPipelineServiceHostIp } from '../../../../rest/ingestionPipelineAPI';
|
||||
import { getDashboardConfig } from '../../../../utils/DashboardServiceUtils';
|
||||
import { getDatabaseConfig } from '../../../../utils/DatabaseServiceUtils';
|
||||
import { formatFormDataForSubmit } from '../../../../utils/JSONSchemaFormUtils';
|
||||
import { getMessagingConfig } from '../../../../utils/MessagingServiceUtils';
|
||||
import { getMetadataConfig } from '../../../../utils/MetadataServiceUtils';
|
||||
import { getMlmodelConfig } from '../../../../utils/MlmodelServiceUtils';
|
||||
import { getSearchServiceConfig } from '../../../../utils/SearchServiceUtils';
|
||||
import serviceUtilClassBase from '../../../../utils/ServiceUtilClassBase';
|
||||
import AirflowMessageBanner from '../../../common/AirflowMessageBanner/AirflowMessageBanner';
|
||||
import FormBuilder from '../../../common/FormBuilder/FormBuilder';
|
||||
@ -129,17 +123,23 @@ const ConnectionConfigForm: FunctionComponent<Props> = ({
|
||||
|
||||
switch (serviceCategory) {
|
||||
case ServiceCategory.DATABASE_SERVICES: {
|
||||
connSch = getDatabaseConfig(serviceType as DatabaseServiceType);
|
||||
connSch = serviceUtilClassBase.getDatabaseServiceConfig(
|
||||
serviceType as DatabaseServiceType
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
case ServiceCategory.MESSAGING_SERVICES: {
|
||||
connSch = getMessagingConfig(serviceType as MessagingServiceType);
|
||||
connSch = serviceUtilClassBase.getMessagingServiceConfig(
|
||||
serviceType as MessagingServiceType
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
case ServiceCategory.DASHBOARD_SERVICES: {
|
||||
connSch = getDashboardConfig(serviceType as DashboardServiceType);
|
||||
connSch = serviceUtilClassBase.getDashboardServiceConfig(
|
||||
serviceType as DashboardServiceType
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -151,12 +151,16 @@ const ConnectionConfigForm: FunctionComponent<Props> = ({
|
||||
break;
|
||||
}
|
||||
case ServiceCategory.ML_MODEL_SERVICES: {
|
||||
connSch = getMlmodelConfig(serviceType as MlModelServiceType);
|
||||
connSch = serviceUtilClassBase.getMlModelServiceConfig(
|
||||
serviceType as MlModelServiceType
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
case ServiceCategory.METADATA_SERVICES: {
|
||||
connSch = getMetadataConfig(serviceType as MetadataServiceType);
|
||||
connSch = serviceUtilClassBase.getMetadataServiceConfig(
|
||||
serviceType as MetadataServiceType
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -168,7 +172,9 @@ const ConnectionConfigForm: FunctionComponent<Props> = ({
|
||||
break;
|
||||
}
|
||||
case ServiceCategory.SEARCH_SERVICES: {
|
||||
connSch = getSearchServiceConfig(serviceType as SearchServiceType);
|
||||
connSch = serviceUtilClassBase.getSearchServiceConfig(
|
||||
serviceType as SearchServiceType
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -34,12 +34,6 @@ import { PipelineServiceType } from '../../../../generated/entity/services/pipel
|
||||
import { SearchServiceType } from '../../../../generated/entity/services/searchService';
|
||||
import { StorageServiceType } from '../../../../generated/entity/services/storageService';
|
||||
import { ConfigData } from '../../../../interface/service.interface';
|
||||
import { getDashboardConfig } from '../../../../utils/DashboardServiceUtils';
|
||||
import { getDatabaseConfig } from '../../../../utils/DatabaseServiceUtils';
|
||||
import { getMessagingConfig } from '../../../../utils/MessagingServiceUtils';
|
||||
import { getMetadataConfig } from '../../../../utils/MetadataServiceUtils';
|
||||
import { getMlmodelConfig } from '../../../../utils/MlmodelServiceUtils';
|
||||
import { getSearchServiceConfig } from '../../../../utils/SearchServiceUtils';
|
||||
import serviceUtilClassBase from '../../../../utils/ServiceUtilClassBase';
|
||||
|
||||
type ServiceConnectionDetailsProps = {
|
||||
@ -211,18 +205,26 @@ const ServiceConnectionDetails = ({
|
||||
useEffect(() => {
|
||||
switch (serviceCategory.slice(0, -1)) {
|
||||
case EntityType.DATABASE_SERVICE:
|
||||
setSchema(getDatabaseConfig(serviceFQN as DatabaseServiceType).schema);
|
||||
setSchema(
|
||||
serviceUtilClassBase.getDatabaseServiceConfig(
|
||||
serviceFQN as DatabaseServiceType
|
||||
).schema
|
||||
);
|
||||
|
||||
break;
|
||||
case EntityType.DASHBOARD_SERVICE:
|
||||
setSchema(
|
||||
getDashboardConfig(serviceFQN as DashboardServiceType).schema
|
||||
serviceUtilClassBase.getDashboardServiceConfig(
|
||||
serviceFQN as DashboardServiceType
|
||||
).schema
|
||||
);
|
||||
|
||||
break;
|
||||
case EntityType.MESSAGING_SERVICE:
|
||||
setSchema(
|
||||
getMessagingConfig(serviceFQN as MessagingServiceType).schema
|
||||
serviceUtilClassBase.getMessagingServiceConfig(
|
||||
serviceFQN as MessagingServiceType
|
||||
).schema
|
||||
);
|
||||
|
||||
break;
|
||||
@ -235,11 +237,19 @@ const ServiceConnectionDetails = ({
|
||||
|
||||
break;
|
||||
case EntityType.MLMODEL_SERVICE:
|
||||
setSchema(getMlmodelConfig(serviceFQN as MlModelServiceType).schema);
|
||||
setSchema(
|
||||
serviceUtilClassBase.getMlModelServiceConfig(
|
||||
serviceFQN as MlModelServiceType
|
||||
).schema
|
||||
);
|
||||
|
||||
break;
|
||||
case EntityType.METADATA_SERVICE:
|
||||
setSchema(getMetadataConfig(serviceFQN as MetadataServiceType).schema);
|
||||
setSchema(
|
||||
serviceUtilClassBase.getMetadataServiceConfig(
|
||||
serviceFQN as MetadataServiceType
|
||||
).schema
|
||||
);
|
||||
|
||||
break;
|
||||
case EntityType.STORAGE_SERVICE:
|
||||
@ -252,7 +262,9 @@ const ServiceConnectionDetails = ({
|
||||
break;
|
||||
case EntityType.SEARCH_SERVICE:
|
||||
setSchema(
|
||||
getSearchServiceConfig(serviceFQN as SearchServiceType).schema
|
||||
serviceUtilClassBase.getSearchServiceConfig(
|
||||
serviceFQN as SearchServiceType
|
||||
).schema
|
||||
);
|
||||
}
|
||||
}, [serviceCategory, serviceFQN]);
|
||||
|
@ -101,7 +101,13 @@ import { MetadataServiceType } from '../generated/entity/services/metadataServic
|
||||
import { SearchSourceAlias } from '../interface/search.interface';
|
||||
import customConnection from '../jsons/connectionSchemas/connections/storage/customStorageConnection.json';
|
||||
import s3Connection from '../jsons/connectionSchemas/connections/storage/s3Connection.json';
|
||||
import { getDashboardConfig } from './DashboardServiceUtils';
|
||||
import { getDatabaseConfig } from './DatabaseServiceUtils';
|
||||
import { getMessagingConfig } from './MessagingServiceUtils';
|
||||
import { getMetadataConfig } from './MetadataServiceUtils';
|
||||
import { getMlmodelConfig } from './MlmodelServiceUtils';
|
||||
import { getPipelineConfig } from './PipelineServiceUtils';
|
||||
import { getSearchServiceConfig } from './SearchServiceUtils';
|
||||
import { customServiceComparator } from './StringsUtils';
|
||||
|
||||
class ServiceUtilClassBase {
|
||||
@ -415,6 +421,30 @@ class ServiceUtilClassBase {
|
||||
public getPipelineServiceConfig(type: PipelineServiceType) {
|
||||
return getPipelineConfig(type);
|
||||
}
|
||||
|
||||
public getDatabaseServiceConfig(type: DatabaseServiceType) {
|
||||
return getDatabaseConfig(type);
|
||||
}
|
||||
|
||||
public getDashboardServiceConfig(type: DashboardServiceType) {
|
||||
return getDashboardConfig(type);
|
||||
}
|
||||
|
||||
public getMessagingServiceConfig(type: MessagingServiceType) {
|
||||
return getMessagingConfig(type);
|
||||
}
|
||||
|
||||
public getMlModelServiceConfig(type: MlModelServiceType) {
|
||||
return getMlmodelConfig(type);
|
||||
}
|
||||
|
||||
public getSearchServiceConfig(type: SearchServiceType) {
|
||||
return getSearchServiceConfig(type);
|
||||
}
|
||||
|
||||
public getMetadataServiceConfig(type: MetadataServiceType) {
|
||||
return getMetadataConfig(type);
|
||||
}
|
||||
}
|
||||
|
||||
const serviceUtilClassBase = new ServiceUtilClassBase();
|
||||
|
Loading…
x
Reference in New Issue
Block a user