From 182ba42324d65090b1fcc0c8adfffae07acbef46 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Thu, 26 Sep 2024 23:21:39 +0530 Subject: [PATCH] Refactor CustomPropertyTable component to improve UI and functionality --- .../CustomPropertyTable/PropertyValue.tsx | 133 ++++++++++++------ .../CustomPropertyTable/property-value.less | 27 +++- 2 files changed, 117 insertions(+), 43 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/PropertyValue.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/PropertyValue.tsx index f19ffbe2f7d8..1ac5ca804cd1 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/PropertyValue.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/PropertyValue.tsx @@ -11,12 +11,13 @@ * limitations under the License. */ -import Icon from '@ant-design/icons'; +import Icon, { DownOutlined, UpOutlined } from '@ant-design/icons'; import { Button, Card, Col, DatePicker, + Divider, Form, Input, Row, @@ -40,7 +41,14 @@ import { toUpper, } from 'lodash'; import moment, { Moment } from 'moment'; -import React, { CSSProperties, FC, useState } from 'react'; +import React, { + CSSProperties, + FC, + useEffect, + useMemo, + useRef, + useState, +} from 'react'; import { Link } from 'react-router-dom'; import { ReactComponent as EditIconComponent } from '../../../assets/svg/edit-new.svg'; import { @@ -83,14 +91,26 @@ export const PropertyValue: FC = ({ property, isRenderedInRightPanel = false, }) => { - const propertyName = property.name; - const propertyType = property.propertyType; + const { propertyName, propertyType, value } = useMemo(() => { + const propertyName = property.name; + const propertyType = property.propertyType; - const value = extension?.[propertyName]; + const value = extension?.[propertyName]; + + return { + propertyName, + propertyType, + value, + }; + }, [property, extension]); const [showInput, setShowInput] = useState(false); const [isLoading, setIsLoading] = useState(false); + const [isExpanded, setIsExpanded] = useState(false); + const [isOverflowing, setIsOverflowing] = useState(false); + const contentRef = useRef(null); + const onShowInput = () => setShowInput(true); const onHideInput = () => setShowInput(false); @@ -721,34 +741,16 @@ export const PropertyValue: FC = ({ return (
{isArray(value) ? ( -
+
{value.map((val) => ( - - {val} - + {val} ))}
) : ( - - {value} - + {value} )}
@@ -819,7 +821,7 @@ export const PropertyValue: FC = ({ item.fullyQualifiedName as string )}> + )} + + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/property-value.less b/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/property-value.less index c67a268db99c..3f505fd3b3d8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/property-value.less +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/property-value.less @@ -10,6 +10,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +@btn-bg-color: #00000005; +@enum-tag-bg-color: #00000008; + .entity-reference-list-item:last-child { border-bottom: none; } @@ -21,8 +25,27 @@ align-items: center; justify-content: center; svg { - height: 18px; - width: 18px; + height: 24px; + width: 24px; } } } + +.ant-btn-text.custom-property-value-toggle-btn { + border-radius: 100%; + background: @btn-bg-color; + border-color: transparent; + height: 30px; + width: 30px; + .anticon { + vertical-align: middle; + } +} + +.enum-key-tag { + width: max-content; + margin: 0px; + border: none; + padding: 4px; + background: @enum-tag-bg-color; +}