pawarprasad123 commented on code in PR #697:
URL: https://github.com/apache/atlas/pull/697#discussion_r3781904078


##########
dashboard/src/utils/EntityStatus.ts:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export enum EntityStatus {

Review Comment:
   line 18-27
   No EntityStatus.test.ts
   Add unit tests for isEntityModificationAllowed: ACTIVE → true, DELETED → 
false, PURGED → false, undefined → true



##########
dashboard/src/views/__tests__/EntityDetailPage.test.tsx:
##########
@@ -287,6 +287,22 @@ describe('EntityDetailPage', () => {
                }
        });
 
+       it('should hide Add Classification and Add Term buttons for DELETED 
entities', () => {

Review Comment:
   line 290-302:
   Test uses queryByLabelText(/add.*tag/i) / 
queryByText(/add.*classification/i), but Add buttons are IconButton inside 
LightTooltip with no aria-label. These selectors likely return null even for 
ACTIVE entities, so the test may pass vacuously. Use the same pattern as 
DetailPageAttributes.test.tsx: document.querySelector('[data-title="Add 
Classifications"]').



##########
dashboard/src/views/DetailPage/EntityDetailPage.tsx:
##########
@@ -408,20 +409,22 @@ const EntityDetailPage: React.FC = () => {
                   >
                     Classifications
                   </Typography>
-                  <LightTooltip title={"Add Classifications"}>
-                    <IconButton
-                      component="label"
-                      role={undefined}
-                      tabIndex={-1}
-                      size="small"
-                      color="primary"
-                      onClick={() => {
-                        setOpenAddTagModal(true);
-                      }}
-                    >
-                      <AddCircleOutlineIcon className="mr-0" fontSize="small" 
/>{" "}
-                    </IconButton>
-                  </LightTooltip>
+                  {entity?.status !== EntityStatus.DELETED && (

Review Comment:
   line 331, 391, 454
   
   Good addition: loading || detailPageData === null skeleton guard. Add a test 
for detailPageData === null to lock this in.
   
   
   line 412-475:
   Add buttons check entity?.status !== EntityStatus.DELETED but not !loading. 
DetailPageAttributes.tsx uses !loading && data?.status !== 
EntityStatus.DELETED. Align to prevent brief button flash on entity detail 
header.
   



##########
dashboard/src/components/__tests__/EntityDisplayImage.test.tsx:
##########
@@ -29,6 +29,7 @@
 import React from 'react'

Review Comment:
   check and verify this:
   
   PURGED gap: Helper treats PURGED as non-modifiable, but UI only checks 
DELETED. If PURGED entities can still be viewed, Add/Edit may remain active 
incorrectly.
   
   
   
   All PropertiesTab tests
   
   missing test: No PURGED entity tests
   Add negative cases mirroring DELETED



##########
dashboard/src/views/DetailPage/__tests__/DetailPageAttributes.test.tsx:
##########
@@ -392,6 +392,27 @@ describe('DetailPageAttribute', () => {
                fireEvent.click(screen.getByText('close-assign-cat'))
        })
 
+       it('hides Add Classifications button for DELETED entities', () => {

Review Comment:
   missing test:
   No test for Add Attributes / Edit Classification hidden on DELETED
   
   Add tests for lines 151, 624



##########
dashboard/src/utils/EntityStatus.ts:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export enum EntityStatus {
+  ACTIVE = "ACTIVE",
+  DELETED = "DELETED",
+  PURGED = "PURGED"
+}
+
+export const isEntityModificationAllowed = (status: EntityStatus | string | 
undefined): boolean => {

Review Comment:
   line 24=27
   isEntityModificationAllowed() blocks both DELETED and PURGED, but no 
component uses it. Every file repeats entity?.status !== EntityStatus.DELETED. 
Either use this helper everywhere, or remove it and document why PURGED is 
excluded.



##########
dashboard/src/views/DetailPage/EntityDetailTabs/PropertiesTab/PropertiesTab.tsx:
##########
@@ -56,7 +56,7 @@ const PropertiesTab = (props: {
             customAttributes={customAttributes}
             entity={entity}
           />
-          <Labels loading={loading} labels={labels} />
+          <Labels loading={loading} labels={labels} entity={entity} />

Review Comment:
   missing test:
   No loading=true tests for button hiding
   Verify Add/Edit buttons hidden while loading



##########
dashboard/src/components/ShowMore/ShowMoreView.tsx:
##########
@@ -73,6 +74,12 @@ const ShowMoreView = ({
   const gType = searchParams.get("gtype");
   const dispatchApi = useAppDispatch();
 
+  useEffect(() => {

Review Comment:
   missing test:
   No test for closeDrawer() on unmount
   Add test verifying cleanup dispatches closeDrawer



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to