From f6ca0075461a59872d3ed1f6e9ac4e6ca8e56845 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Tue, 7 Sep 2021 09:32:00 +0530 Subject: [PATCH] Fixed #392 Add entity type icons and show it at all the relevant places (#410) --- .../resources/ui/src/assets/svg/dashboard.svg | 3 +++ .../resources/ui/src/assets/svg/table.svg | 3 +++ .../resources/ui/src/assets/svg/topic.svg | 3 +++ .../common/table-data-card/TableDataCard.tsx | 23 ++++++++++++------- .../main/resources/ui/src/utils/SvgUtils.tsx | 18 +++++++++++++++ .../resources/ui/src/utils/TableUtils.tsx | 23 +++++++++++++++++++ 6 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 catalog-rest-service/src/main/resources/ui/src/assets/svg/dashboard.svg create mode 100644 catalog-rest-service/src/main/resources/ui/src/assets/svg/table.svg create mode 100644 catalog-rest-service/src/main/resources/ui/src/assets/svg/topic.svg diff --git a/catalog-rest-service/src/main/resources/ui/src/assets/svg/dashboard.svg b/catalog-rest-service/src/main/resources/ui/src/assets/svg/dashboard.svg new file mode 100644 index 00000000000..685e3b7f6ee --- /dev/null +++ b/catalog-rest-service/src/main/resources/ui/src/assets/svg/dashboard.svg @@ -0,0 +1,3 @@ + + + diff --git a/catalog-rest-service/src/main/resources/ui/src/assets/svg/table.svg b/catalog-rest-service/src/main/resources/ui/src/assets/svg/table.svg new file mode 100644 index 00000000000..bcab0e19208 --- /dev/null +++ b/catalog-rest-service/src/main/resources/ui/src/assets/svg/table.svg @@ -0,0 +1,3 @@ + + + diff --git a/catalog-rest-service/src/main/resources/ui/src/assets/svg/topic.svg b/catalog-rest-service/src/main/resources/ui/src/assets/svg/topic.svg new file mode 100644 index 00000000000..fb565b92e6a --- /dev/null +++ b/catalog-rest-service/src/main/resources/ui/src/assets/svg/topic.svg @@ -0,0 +1,3 @@ + + + diff --git a/catalog-rest-service/src/main/resources/ui/src/components/common/table-data-card/TableDataCard.tsx b/catalog-rest-service/src/main/resources/ui/src/components/common/table-data-card/TableDataCard.tsx index 0c50040a897..66748c160f1 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/common/table-data-card/TableDataCard.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/common/table-data-card/TableDataCard.tsx @@ -18,7 +18,11 @@ import React, { FunctionComponent } from 'react'; import { Link } from 'react-router-dom'; import { stringToHTML } from '../../../utils/StringsUtils'; -import { getEntityLink, getUsagePercentile } from '../../../utils/TableUtils'; +import { + getEntityIcon, + getEntityLink, + getUsagePercentile, +} from '../../../utils/TableUtils'; import TableDataCardBody from './TableDataCardBody'; type Props = { @@ -58,13 +62,16 @@ const TableDataCard: FunctionComponent = ({ return (
-
- - - -
+
+ {getEntityIcon(indexType)} +
+ + + +
+
= ({ @@ -315,6 +321,18 @@ const SVGIcons: FunctionComponent = ({ case Icons.API: IconComponent = IconAPI; + break; + case Icons.TABLE: + IconComponent = IconTable; + + break; + case Icons.TOPIC: + IconComponent = IconTopic; + + break; + case Icons.DASHBOARD: + IconComponent = IconDashboard; + break; default: diff --git a/catalog-rest-service/src/main/resources/ui/src/utils/TableUtils.tsx b/catalog-rest-service/src/main/resources/ui/src/utils/TableUtils.tsx index dc572264549..83dae9a3b24 100644 --- a/catalog-rest-service/src/main/resources/ui/src/utils/TableUtils.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/utils/TableUtils.tsx @@ -165,3 +165,26 @@ export const getEntityLink = ( return getDatasetDetailsPath(fullyQualifiedName); } }; + +export const getEntityIcon = (indexType: string) => { + let icon = ''; + switch (indexType) { + case SearchIndex.TOPIC: + icon = 'topic'; + + break; + + case SearchIndex.DASHBOARD: + icon = 'dashboard'; + + break; + + case SearchIndex.TABLE: + default: + icon = 'table'; + + break; + } + + return ; +};