Skip to content

Commit 8f46852

Browse files
committed
ATLAS-5044: [React UI] Fix node expand/collapse and selection issues in TreeView component within sidebar
1 parent 09d02b9 commit 8f46852

File tree

8 files changed

+199
-85
lines changed

8 files changed

+199
-85
lines changed

dashboard/src/models/treeStructureType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface TypeHeaderState {
2727
}
2828

2929
export interface TreeNode {
30+
text: string | null;
3031
id: string;
3132
label: string;
3233
children?: TreeNode[];

dashboard/src/utils/Utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ let groupBy = function (xs: any[], key: string) {
440440
};
441441

442442
const noTreeData = () => {
443-
return [{ id: "No Records Found", label: "No Records Found" }];
443+
return [
444+
{
445+
id: "No Records Found",
446+
label: "No Records Found",
447+
text: "No Records Found"
448+
}
449+
];
444450
};
445451

446452
const sanitizeHtmlContent = (htmlContent: HTMLElement | string | any) => {

dashboard/src/views/DetailPage/DetailPageAttributes.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import AddTagAttributes from "@views/Classification/AddTagAttributes";
4646
import AssignCategory from "@views/Glossary/AssignCategory";
4747
import AssignTerm from "@views/Glossary/AssignTerm";
4848
import ShowMoreText from "@components/ShowMore/ShowMoreText";
49+
import AddUpdateGlossaryForm from "@views/Glossary/AddUpdateGlossaryForm";
4950

5051
const DetailPageAttribute = ({
5152
data,
@@ -63,13 +64,17 @@ const DetailPageAttribute = ({
6364
const [tagModal, setTagModal] = useState<boolean>(false);
6465
const [editTermModal, setEditTermModal] = useState(false);
6566
const [editCategoryModal, setEditCategoryModal] = useState(false);
66-
67+
const [glossaryModal, setGlossaryModal] = useState<boolean>(false);
6768
const [openAddTagModal, setOpenAddTagModal] = useState<boolean>(false);
6869
const [attributeModal, setAttributeModal] = useState<boolean>(false);
6970
const [openAddTermModal, setOpenAddTermModal] = useState<boolean>(false);
7071

7172
const [categoryModal, setCategoryModal] = useState<boolean>(false);
7273

74+
const handleCloseGlossaryModal = () => {
75+
setGlossaryModal(false);
76+
};
77+
7378
const handleCloseTermModal = () => {
7479
setOpenAddTermModal(false);
7580
};
@@ -140,14 +145,17 @@ const DetailPageAttribute = ({
140145
if (!isEmpty(tagName)) {
141146
setTagModal(true);
142147
}
148+
if (!isEmpty(guid) && gtypeParams == "glossary") {
149+
setGlossaryModal(true);
150+
}
143151
if (!isEmpty(guid) && gtypeParams == "term") {
144152
setEditTermModal(true);
145153
}
146154
if (!isEmpty(guid) && gtypeParams == "category") {
147155
setEditCategoryModal(true);
148156
}
149157
}}
150-
data-cy="addTag"
158+
data-cy="editButton"
151159
>
152160
<EditOutlinedIcon className="table-filter-refresh" />
153161
</CustomButton>
@@ -696,6 +704,15 @@ const DetailPageAttribute = ({
696704
relatedTerm={undefined}
697705
/>
698706
)}
707+
708+
{glossaryModal && (
709+
<AddUpdateGlossaryForm
710+
open={glossaryModal}
711+
isAdd={false}
712+
onClose={handleCloseGlossaryModal}
713+
node={data || {}}
714+
/>
715+
)}
699716
</>
700717
);
701718
};

dashboard/src/views/Glossary/AssignCategory.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ const AssignCategory = ({
182182
return {
183183
id: obj?.name,
184184
label: obj?.name,
185+
text: obj?.name ?? null,
185186
children:
186187
obj?.children != undefined
187188
? child(
@@ -204,6 +205,7 @@ const AssignCategory = ({
204205
serviceTypeData.map((entity: any) => ({
205206
id: entity[Object.keys(entity)[0]].name,
206207
label: entity[Object.keys(entity)[0]].name,
208+
text: entity[Object.keys(entity)[0]].name ?? null,
207209
children: child(
208210
entity[Object.keys(entity)[0]].children as ChildrenInterfaces[]
209211
),

dashboard/src/views/Glossary/AssignTerm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ const AssignTerm = ({
275275
return (serviceTypeData: ServiceTypeInterface[]) =>
276276
serviceTypeData.map((entity: any) => ({
277277
id: entity[Object.keys(entity)[0]].name,
278+
text: entity[Object.keys(entity)[0]].name,
278279
label: entity[Object.keys(entity)[0]].name,
279280
children: child(
280281
entity[Object.keys(entity)[0]].children as ChildrenInterfaces[]

dashboard/src/views/SearchResult/SearchResult.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -765,17 +765,7 @@ const SearchResult = ({ classificationParams, glossaryTypeParams }: any) => {
765765
const getDefaultSort = useMemo(() => [{ id: "name", asc: true }], []);
766766

767767
return (
768-
<Stack
769-
// paddingTop={
770-
// isEmpty(classificationParams || glossaryTypeParams) ? 0 : "40px"
771-
// }
772-
// marginTop={
773-
// isEmpty(classificationParams || glossaryTypeParams) ? 0 : "20px"
774-
// }
775-
// padding="16px"
776-
position="relative"
777-
gap={"1rem"}
778-
>
768+
<Stack position="relative" gap={"1rem"}>
779769
{!isEmpty(classificationParams || glossaryTypeParams) && (
780770
<Stack
781771
direction="row"

dashboard/src/views/SideBar/SideBarTree/GlossaryTree.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const GlossaryTree = ({ sideBarOpen, searchTerm }: Props) => {
159159
return {
160160
id: obj?.name,
161161
label: obj?.name,
162+
text: obj?.name ?? null,
162163
children:
163164
obj?.children != undefined
164165
? child(
@@ -181,6 +182,7 @@ const GlossaryTree = ({ sideBarOpen, searchTerm }: Props) => {
181182
serviceTypeData.map((entity: any) => ({
182183
id: entity[Object.keys(entity)[0]].name,
183184
label: entity[Object.keys(entity)[0]].name,
185+
text: entity[Object.keys(entity)[0]].name ?? null,
184186
children: child(
185187
entity[Object.keys(entity)[0]].children as ChildrenInterfaces[]
186188
),

0 commit comments

Comments
 (0)