From c07a155614666b509a310d80a02e6fd600103d79 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Thu, 7 Jul 2022 12:48:20 +0530 Subject: [PATCH] Fix #5857 Add icon for foreign key constraint (#5904) * Fix #5857 Add icon for foreign key constraint * Change icon to line icon --- .../ui/src/assets/svg/foriegnKey.svg | 21 +++++++++++++++++++ .../main/resources/ui/src/enums/table.enum.ts | 1 + .../main/resources/ui/src/utils/SvgUtils.tsx | 6 ++++++ .../resources/ui/src/utils/TableUtils.tsx | 15 +++++++++---- 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 openmetadata-ui/src/main/resources/ui/src/assets/svg/foriegnKey.svg diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/foriegnKey.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/foriegnKey.svg new file mode 100644 index 00000000000..2c8ddfe818f --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/foriegnKey.svg @@ -0,0 +1,21 @@ + + + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/enums/table.enum.ts b/openmetadata-ui/src/main/resources/ui/src/enums/table.enum.ts index 2dda9c7455a..0c778df88c6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/enums/table.enum.ts +++ b/openmetadata-ui/src/main/resources/ui/src/enums/table.enum.ts @@ -16,6 +16,7 @@ export enum ConstraintTypes { NULL = 'NULL', NOT_NULL = 'NOT_NULL', UNIQUE = 'UNIQUE', + FOREIGN_KEY = 'FOREIGN_KEY', } export enum PrimaryTableDataTypes { diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx index cb0a0cb1d1c..d046443921c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx @@ -61,6 +61,7 @@ import IconExternalLinkWhite from '../assets/svg/external-link-white.svg'; import IconExternalLink from '../assets/svg/external-link.svg'; import IconFailBadge from '../assets/svg/fail-badge.svg'; import IconFitView from '../assets/svg/fitview.svg'; +import IconForeignKey from '../assets/svg/foriegnKey.svg'; import IconGithubStar from '../assets/svg/github-star.svg'; import IconAllApplication from '../assets/svg/ic-all-application.svg'; import IconCheckCircle from '../assets/svg/ic-check-circle.svg'; @@ -319,6 +320,7 @@ export const Icons = { TASK_ICON: 'task-icon', TASK_CLOSED: 'task-closed', TASK_OPEN: 'task-open', + FOREGIN_KEY: 'foreign-key', }; const SVGIcons: FunctionComponent = ({ @@ -933,6 +935,10 @@ const SVGIcons: FunctionComponent = ({ case Icons.TASK_OPEN: IconComponent = IconTaskOpen; + break; + case Icons.FOREGIN_KEY: + IconComponent = IconForeignKey; + break; default: diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx index 380b1983714..37cd3bc5ad5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx @@ -39,7 +39,7 @@ import { TagLabel } from '../generated/type/tagLabel'; import { ModifiedTableColumn } from '../interface/dataQuality.interface'; import { getGlossaryPath } from './RouterUtils'; import { ordinalize } from './StringsUtils'; -import SVGIcons from './SvgUtils'; +import SVGIcons, { Icons } from './SvgUtils'; export const getBadgeName = (tableType?: string) => { switch (tableType) { @@ -130,21 +130,28 @@ export const getConstraintIcon = (constraint = '', className = '') => { case ConstraintTypes.PRIMARY_KEY: { title = 'Primary key'; - icon = 'key'; + icon = Icons.KEY; } break; case ConstraintTypes.UNIQUE: { title = 'Unique'; - icon = 'unique'; + icon = Icons.UNIQUE; } break; case ConstraintTypes.NOT_NULL: { title = 'Not null'; - icon = 'not-null'; + icon = Icons.NOT_NULL; + } + + break; + case ConstraintTypes.FOREIGN_KEY: + { + title = 'Foreign key'; + icon = Icons.FOREGIN_KEY; } break;