diff --git a/catalog-rest-service/src/main/resources/ui/src/assets/img/service-icon-superset.png b/catalog-rest-service/src/main/resources/ui/src/assets/img/service-icon-superset.png new file mode 100644 index 00000000000..b0d768b2b0f Binary files /dev/null and b/catalog-rest-service/src/main/resources/ui/src/assets/img/service-icon-superset.png differ diff --git a/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx b/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx index c7f894e0263..64dd6ade39b 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx @@ -44,6 +44,9 @@ export type DataObj = { }; brokers?: Array; schemaRegistry?: string; + dashboardUrl?: string; + username?: string; + password?: string; }; type DatabaseService = { @@ -57,6 +60,12 @@ type MessagingService = { schemaRegistry: string; }; +type DashboardService = { + dashboardUrl: string; + username: string; + password: string; +}; + export type ServiceDataObj = { description: string; href: string; @@ -65,7 +74,8 @@ export type ServiceDataObj = { serviceType: string; ingestionSchedule?: { repeatFrequency: string; startDate: string }; } & Partial & - Partial; + Partial & + Partial; export type EditObj = { edit: boolean; @@ -86,10 +96,11 @@ type ErrorMsg = { name: boolean; url?: boolean; // port: boolean; - // userName: boolean; - // password: boolean; driverClass?: boolean; broker?: boolean; + dashboardUrl?: boolean; + username?: boolean; + password?: boolean; }; type EditorContentRef = { getEditorContent: () => string; @@ -176,6 +187,9 @@ export const AddServiceModal: FunctionComponent = ({ const [schemaRegistry, setSchemaRegistry] = useState( data?.schemaRegistry || '' ); + const [dashboardUrl, setDashboardUrl] = useState(data?.dashboardUrl || ''); + const [username, setUsername] = useState(data?.username || ''); + const [password, setPassword] = useState(data?.password || ''); const [frequency, setFrequency] = useState( fromISOString(data?.ingestionSchedule?.repeatFrequency) ); @@ -261,18 +275,27 @@ export const AddServiceModal: FunctionComponent = ({ }; const onSaveHelper = (value: ErrorMsg) => { - const { selectService, name, url, driverClass, broker } = value; + const { + selectService, + name, + url, + driverClass, + broker, + dashboardUrl, + username, + password, + } = value; return ( !sameNameError && !selectService && !name && !url && - // !port && - // !userName && - // !password && !driverClass && - !broker + !broker && + !dashboardUrl && + !username && + !password ); }; @@ -287,9 +310,6 @@ export const AddServiceModal: FunctionComponent = ({ setMsg = { ...setMsg, url: !url, - // port: !port, - // userName: !userName, - // password: !password, driverClass: !driverClass, }; } @@ -303,6 +323,17 @@ export const AddServiceModal: FunctionComponent = ({ }; } + break; + case ServiceCategory.DASHBOARD_SERVICES: + { + setMsg = { + ...setMsg, + dashboardUrl: !dashboardUrl, + username: !username, + password: !password, + }; + } + break; default: break; @@ -347,6 +378,17 @@ export const AddServiceModal: FunctionComponent = ({ }; } + break; + case ServiceCategory.DASHBOARD_SERVICES: + { + dataObj = { + ...dataObj, + dashboardUrl: dashboardUrl, + username: username, + password: password, + }; + } + break; default: break; @@ -374,54 +416,7 @@ export const AddServiceModal: FunctionComponent = ({ /> {showErrorMsg.url && errorMsg('Connection url is required')} - - {/* didn't removed below code as it will be need in future relase */} - - {/*
- - - {showErrorMsg.port && errorMsg('Port is required')} -
*/} - {/*
-
- - - {showErrorMsg.userName && errorMsg('Username is required')} -
-
- - - {showErrorMsg.password && errorMsg('Password is required')} -
-
*/}
diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/service/index.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/service/index.tsx index 2834a27126e..556678eb4dc 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/service/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/service/index.tsx @@ -17,10 +17,11 @@ import { AxiosError, AxiosResponse } from 'axios'; import classNames from 'classnames'; -import { isNull, isUndefined } from 'lodash'; +import { isNil, isUndefined } from 'lodash'; import { Database, Paging, ServiceOption } from 'Models'; import React, { Fragment, FunctionComponent, useEffect, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; +import { getDashboards } from '../../axiosAPIs/dashboardAPI'; import { getDatabases } from '../../axiosAPIs/databaseAPI'; import { getServiceByFQN, updateService } from '../../axiosAPIs/serviceAPI'; import { getTopics } from '../../axiosAPIs/topicsAPI'; @@ -36,6 +37,7 @@ import Tags from '../../components/tags/tags'; import { pagingObject } from '../../constants/constants'; import { SearchIndex } from '../../enums/search.enum'; import { ServiceCategory } from '../../enums/service.enum'; +import { Dashboard } from '../../generated/entity/data/dashboard'; import { Topic } from '../../generated/entity/data/topic'; import useToastContext from '../../hooks/useToastContext'; import { isEven } from '../../utils/CommonUtils'; @@ -101,6 +103,30 @@ const ServicePage: FunctionComponent = () => { }); }; + const fetchDashboards = (paging?: string) => { + setIsloading(true); + getDashboards(serviceFQN, paging, [ + 'owner', + 'service', + 'usageSummary', + 'tags', + ]) + .then((res: AxiosResponse) => { + if (res.data.data) { + setData(res.data.data); + setPaging(res.data.paging); + setIsloading(false); + } else { + setData([]); + setPaging(pagingObject); + setIsloading(false); + } + }) + .catch(() => { + setIsloading(false); + }); + }; + const getOtherDetails = (paging?: string) => { switch (serviceName) { case ServiceCategory.DATABASE_SERVICES: { @@ -113,6 +139,11 @@ const ServicePage: FunctionComponent = () => { break; } + case ServiceCategory.DASHBOARD_SERVICES: { + fetchDashboards(paging); + + break; + } default: break; } @@ -123,9 +154,12 @@ const ServicePage: FunctionComponent = () => { case ServiceCategory.MESSAGING_SERVICES: return getEntityLink(SearchIndex.TOPIC, fqn); + case ServiceCategory.DASHBOARD_SERVICES: + return getEntityLink(SearchIndex.DASHBOARD, fqn); + case ServiceCategory.DATABASE_SERVICES: default: - return `/database/${fqn}`; + return getEntityLink(SearchIndex.TABLE, fqn); } }; @@ -205,6 +239,29 @@ const ServicePage: FunctionComponent = () => { ); } + case ServiceCategory.DASHBOARD_SERVICES: { + return ( + + + Dashboard Url : + {' '} + + {serviceDetails?.dashboardUrl ? ( + + {serviceDetails.dashboardUrl} + + ) : ( + '--' + )} + + + + ); + } default: { return <>; } @@ -233,6 +290,16 @@ const ServicePage: FunctionComponent = () => { ); } + case ServiceCategory.DASHBOARD_SERVICES: { + return ( + <> + Dashboard Name + Description + Owner + Tags + + ); + } default: return <>; } @@ -280,6 +347,33 @@ const ServicePage: FunctionComponent = () => { ); } + case ServiceCategory.DASHBOARD_SERVICES: { + const dashboard = data as Dashboard; + + return ( + + {dashboard.tags && dashboard.tags?.length > 0 + ? dashboard.tags.map((tag, tagIndex) => ( + + + + )) + : '--'} + + ); + } default: return <>; } @@ -427,7 +521,7 @@ const ServicePage: FunctionComponent = () => { {data.length > 0 ? ( - data.map((database, index) => ( + data.map((dataObj, index) => ( { data-testid="column" key={index}> - - {database.name} + + {serviceName === + ServiceCategory.DASHBOARD_SERVICES && + dataObj.displayName + ? dataObj.displayName + : dataObj.name} - {database.description ? ( + {dataObj.description ? ( ) : ( @@ -452,9 +550,9 @@ const ServicePage: FunctionComponent = () => { )} -

{database?.owner?.name || '--'}

+

{dataObj?.owner?.name || '--'}

- {getOptionalTableCells(database)} + {getOptionalTableCells(dataObj)} )) ) : ( @@ -467,7 +565,7 @@ const ServicePage: FunctionComponent = () => { - {Boolean(!isNull(paging.after) || !isNull(paging.before)) && ( + {Boolean(!isNil(paging.after) || !isNil(paging.before)) && ( )} diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx index b85d480ae1d..fa388f9efe5 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx @@ -70,6 +70,7 @@ const ServicesPage = () => { const [services, setServices] = useState({ databaseServices: [], messagingServices: [], + dashboardServices: [], }); const [serviceList, setServiceList] = useState>([]); const [editData, setEditData] = useState(); @@ -238,6 +239,18 @@ const ServicesPage = () => { ); } + case ServiceCategory.DASHBOARD_SERVICES: { + return ( + <> +
+ + + {service.dashboardUrl} + +
+ + ); + } default: { return <>; } diff --git a/catalog-rest-service/src/main/resources/ui/src/utils/ServiceUtils.ts b/catalog-rest-service/src/main/resources/ui/src/utils/ServiceUtils.ts index f2e63c2461d..85860dba940 100644 --- a/catalog-rest-service/src/main/resources/ui/src/utils/ServiceUtils.ts +++ b/catalog-rest-service/src/main/resources/ui/src/utils/ServiceUtils.ts @@ -17,8 +17,10 @@ import { serviceTypes, SERVICE_DEFAULT, SNOWFLAKE, + SUPERSET, } from '../constants/services.const'; import { + DashboardServiceType, DatabaseServiceType, MessagingServiceType, } from '../enums/service.enum'; @@ -62,6 +64,9 @@ export const serviceTypeLogo = (type: string) => { case MessagingServiceType.PULSAR: return PULSAR; + case DashboardServiceType.SUPERSET: + return SUPERSET; + default: return SERVICE_DEFAULT; }