This is an automated email from the ASF dual-hosted git repository.

ppawar pushed a commit to branch ATLAS-5105
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit dddfb23d418f573f4c60aa8f4e243d4d669dffad
Author: Prasad Pawar <[email protected]>
AuthorDate: Tue Sep 23 16:20:52 2025 +0530

    ATLAS-5105: [REACT UI] Incorrect errors being displayed when assigning 
blank term to entity.
---
 dashboard/src/components/Forms/FormTreeView.tsx         | 13 ++++++++++++-
 dashboard/src/views/DetailPage/DetailPageAttributes.tsx | 12 ++++++++++++
 dashboard/src/views/DetailPage/EntityDetailPage.tsx     | 14 +++++++++++++-
 dashboard/src/views/Glossary/AssignTerm.tsx             |  6 ++++++
 4 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/dashboard/src/components/Forms/FormTreeView.tsx 
b/dashboard/src/components/Forms/FormTreeView.tsx
index 1b1cd7bc3..896fe6467 100644
--- a/dashboard/src/components/Forms/FormTreeView.tsx
+++ b/dashboard/src/components/Forms/FormTreeView.tsx
@@ -222,10 +222,21 @@ const FormTreeView: React.FC<{
     node?.id && (
       <CustomTreeItem
         key={node.id}
-        itemId={node.types != "parent" ? `${node.id}@${node?.parent}` : 
node.id}
+        itemId={
+          node.types != "parent"
+            ? node.id === "No Records Found"
+              ? node.id
+              : `${node.id}@${node?.parent}`
+            : node.id
+        }
         label={
           <div
             onClick={(_event: React.MouseEvent<HTMLElement>) => {
+              if (node.id === "No Records Found") {
+                toast.dismiss(toastId.current);
+                toastId.current = toast.info("No terms present");
+                return;
+              }
               if (node.types == "parent" && isEmpty(node.children)) {
                 toast.dismiss(toastId.current);
                 toastId.current = toast.warning(`No ${treeName}`);
diff --git a/dashboard/src/views/DetailPage/DetailPageAttributes.tsx 
b/dashboard/src/views/DetailPage/DetailPageAttributes.tsx
index 4fbe50e7c..403150836 100644
--- a/dashboard/src/views/DetailPage/DetailPageAttributes.tsx
+++ b/dashboard/src/views/DetailPage/DetailPageAttributes.tsx
@@ -31,6 +31,8 @@ import {
   sanitizeHtmlContent
 } from "@utils/Utils";
 import { useState } from "react";
+import { useAppSelector } from "@hooks/reducerHook";
+import { toast } from "react-toastify";
 import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
 import { removeClassification } from "@api/apiMethods/classificationApiMethod";
 import { useParams, useSearchParams } from "react-router-dom";
@@ -104,6 +106,11 @@ const DetailPageAttribute = ({
   const { name }: { name: string; found: boolean; key: any } =
     extractKeyValueFromEntity(data);
 
+  const { glossaryData }: any = useAppSelector((state: any) => state.glossary);
+  const hasAnyGlossaryTerms = Array.isArray(glossaryData)
+    ? glossaryData.some((g: any) => Array.isArray(g?.terms) && g.terms.length 
> 0)
+    : false;
+
   return (
     <>
       <Stack
@@ -373,6 +380,11 @@ const DetailPageAttribute = ({
                           size="small"
                           color="primary"
                           onClick={() => {
+                            if (!hasAnyGlossaryTerms) {
+                              toast.dismiss();
+                              toast.info("There are no available terms");
+                              return;
+                            }
                             setOpenAddTermModal(true);
                           }}
                         >
diff --git a/dashboard/src/views/DetailPage/EntityDetailPage.tsx 
b/dashboard/src/views/DetailPage/EntityDetailPage.tsx
index 6d88d31b0..dfec7b491 100644
--- a/dashboard/src/views/DetailPage/EntityDetailPage.tsx
+++ b/dashboard/src/views/DetailPage/EntityDetailPage.tsx
@@ -33,6 +33,7 @@ import SkeletonLoader from "@components/SkeletonLoader";
 import RelationshipsTab from "./EntityDetailTabs/RelationshipsTab";
 import ClassificationsTab from "./EntityDetailTabs/ClassificationsTab";
 import { CustomButton, LightTooltip, LinkTab } from 
"@components/muiComponents";
+import { toast } from "react-toastify";
 import AuditsTab from "./EntityDetailTabs/AuditsTab";
 import { EntityState } from "@models/relationshipSearchType";
 import { useSelector } from "react-redux";
@@ -82,6 +83,10 @@ const EntityDetailPage: React.FC = () => {
   const { entity, referredEntities }: any = detailPageData || {};
   const { classifications = {}, relationshipAttributes = {} } = entity || {};
   const { meanings = [] } = relationshipAttributes || {};
+  const { glossaryData }: any = useAppSelector((state: any) => state.glossary);
+  const hasAnyGlossaryTerms = Array.isArray(glossaryData)
+    ? glossaryData.some((g: any) => Array.isArray(g?.terms) && g.terms.length 
> 0)
+    : false;
 
   const { name }: { name: string; found: boolean; key: any } =
     extractKeyValueFromEntity(entity);
@@ -417,7 +422,14 @@ const EntityDetailPage: React.FC = () => {
                         tabIndex={-1}
                         size="small"
                         color="primary"
-                        onClick={() => setOpenAddTermModal(true)}
+                        onClick={() => {
+                          if (!hasAnyGlossaryTerms) {
+                            toast.dismiss();
+                            toast.info("There are no available terms");
+                            return;
+                          }
+                          setOpenAddTermModal(true);
+                        }}
                       >
                         <AddCircleOutlineIcon
                           className="mr-0"
diff --git a/dashboard/src/views/Glossary/AssignTerm.tsx 
b/dashboard/src/views/Glossary/AssignTerm.tsx
index e7525a12c..61f66d1fe 100644
--- a/dashboard/src/views/Glossary/AssignTerm.tsx
+++ b/dashboard/src/views/Glossary/AssignTerm.tsx
@@ -294,6 +294,11 @@ const AssignTerm = ({
   }, []);
 
   const handleNodeSelect = (nodeId: any) => {
+    if (nodeId === "No Records Found") {
+      toast.dismiss(toastId.current);
+      toastId.current = toast.info("No terms present");
+      return;
+    }
     setSelectedNode(nodeId);
   };
 
@@ -445,6 +450,7 @@ const AssignTerm = ({
         maxWidth="sm"
         button2Handler={relatedTerm ? handleSubmit(onSubmit) : assignTerm}
         disableButton2={isSubmitting}
+        isDirty={!isEmpty(selectedNode)}
       >
         {relatedTerm ? (
           <Stack gap="16px" sx={{ width: "100%" }}>

Reply via email to