Skip to content

Commit e35c819

Browse files
ATLAS-5168: React UI: Classification searches parent classification instead of child (#488)
1 parent 59b5aba commit e35c819

File tree

10 files changed

+69
-64
lines changed

10 files changed

+69
-64
lines changed

dashboard/src/components/Table/TableFilters.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ export const TableFilter = ({
104104
columnVisibilityParams,
105105
setUpdateTable,
106106
getSelectedRowModel,
107-
memoizedData
107+
memoizedData,
108+
customLeftButton
108109
}: any) => {
109110
const [open, setOpen] = useState<null | HTMLElement>(null);
110111
const location = useLocation();
@@ -299,6 +300,7 @@ export const TableFilter = ({
299300
<>
300301
<Stack direction="row" justifyContent={"space-between"}>
301302
<Stack direction="row" spacing={1}>
303+
{customLeftButton}
302304
{allTableFilters && (
303305
<CustomButton
304306
variant="outlined"

dashboard/src/components/Table/TableLayout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ const TableLayout: FC<TableProps> = ({
352352
isClientSidePagination,
353353
isEmptyData,
354354
setIsEmptyData,
355-
showGoToPage
355+
showGoToPage,
356+
customLeftButton
356357
}) => {
357358
let defaultHideColumns = { ...defaultColumnVisibility };
358359
const location = useLocation();
@@ -550,6 +551,7 @@ const TableLayout: FC<TableProps> = ({
550551
setUpdateTable={setUpdateTable}
551552
getSelectedRowModel={getSelectedRowModel}
552553
memoizedData={memoizedData}
554+
customLeftButton={customLeftButton}
553555
/>
554556
)}
555557
{isfilterQuery && <Divider />}

dashboard/src/components/TreeNodeIcons.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,12 @@ const TreeNodeIcons = (props: {
277277
onClick={(_e) => {
278278
if (treeName == "Classifications") {
279279
const searchParams = new URLSearchParams();
280-
searchParams.set(
281-
"tag",
282-
node.types == "child" ? node.label : node.nodeName
283-
);
280+
const classificationName = node.label
281+
? node.label.split(" (")[0]
282+
: node.nodeName || node.id;
283+
searchParams.set("tag", classificationName);
284284
navigate({
285-
pathname: `/tag/tagAttribute/${
286-
node.types == "child" ? node.label : node.nodeName
287-
}`,
285+
pathname: `/tag/tagAttribute/${classificationName}`,
288286
search: searchParams.toString()
289287
});
290288
setExpandNode(null);
@@ -380,9 +378,20 @@ const TreeNodeIcons = (props: {
380378
const searchParams = new URLSearchParams();
381379
searchParams.set("searchType", "basic");
382380
if (treeName == "Classifications") {
383-
searchParams.set("tag", node.nodeName || node.id);
381+
let classificationName: string;
382+
if (node.label) {
383+
classificationName = node.label.split(" (")[0];
384+
} else if (node.nodeName) {
385+
classificationName = node.nodeName;
386+
} else {
387+
classificationName = node.id;
388+
}
389+
searchParams.set("tag", classificationName);
384390
} else if (treeName == "Glossary") {
385-
searchParams.set("term", node.id);
391+
const termValue = node.types == "child" && node.parent
392+
? `${node.id}@${node.parent}`
393+
: node.id;
394+
searchParams.set("term", termValue);
386395
}
387396
navigate({
388397
pathname: "/search/searchResult",

dashboard/src/models/tableLayoutType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ export interface TableProps {
5656
isEmptyData?: boolean;
5757
setIsEmptyData?: React.Dispatch<React.SetStateAction<boolean>>;
5858
showGoToPage?: boolean;
59+
customLeftButton?: React.ReactNode;
5960
}

dashboard/src/views/Administrator/BusinessMetadataTab.tsx

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -197,29 +197,7 @@ const BusinessMetadataTab = ({ setForm, setBMAttribute }: any) => {
197197

198198
return (
199199
<Stack direction="column">
200-
<Stack padding={2} position="relative">
201-
<div style={{ height: "0" }}>
202-
<CustomButton
203-
variant="contained"
204-
sx={{
205-
position: "absolute",
206-
marginTop: "13px",
207-
marginLeft: "13px",
208-
left: "16px"
209-
}}
210-
size="small"
211-
onClick={(_e: any) => {
212-
setForm(true);
213-
setBMAttribute({});
214-
dispatchState(setEditBMAttribute({}));
215-
}}
216-
startIcon={<AddIcon fontSize="small" />}
217-
data-cy="createBusinessMetadata"
218-
>
219-
Create Business Metadata
220-
</CustomButton>
221-
</div>
222-
200+
<Stack padding={2}>
223201
<TableLayout
224202
data={businessMetadataDefs || []}
225203
columns={defaultColumns}
@@ -233,6 +211,21 @@ const BusinessMetadataTab = ({ setForm, setBMAttribute }: any) => {
233211
showRowSelection={false}
234212
tableFilters={true}
235213
expandRow={true}
214+
customLeftButton={
215+
<CustomButton
216+
variant="contained"
217+
size="small"
218+
onClick={(_e: any) => {
219+
setForm(true);
220+
setBMAttribute({});
221+
dispatchState(setEditBMAttribute({}));
222+
}}
223+
startIcon={<AddIcon fontSize="small" />}
224+
data-cy="createBusinessMetadata"
225+
>
226+
Create Business Metadata
227+
</CustomButton>
228+
}
236229
auditTableDetails={{
237230
Component: BusinessMetadataAtrribute,
238231
componentProps: {

dashboard/src/views/DetailPage/ClassificationDetailsLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const ClassificationDetailsLayout = () => {
5656
loading={loading}
5757
attributeDefs={attributeDefs}
5858
/>
59-
<SearchResult classificationParams={tagName} />
59+
<SearchResult classificationParams={tagName} hideFilters={true} />
6060
</Stack>
6161
);
6262
};

dashboard/src/views/DetailPage/EntityDetailTabs/PropertiesTab/BMAttributesFields.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,20 @@ const BMAttributesFields = ({ obj, control, index }: any) => {
140140
defaultValue={""}
141141
render={({ field }) => {
142142
return (
143-
<Stack gap="0.5rem">
144-
<div style={{ position: "relative", flexBasis: "100%" }}>
145-
{typeName == "string" ? (
146-
<ReactQuill
143+
<Stack gap="0.5rem">
144+
<div style={{ position: "relative", flexBasis: "100%" }}>
145+
{typeName == "string" ? (
146+
<ReactQuill
147147
key={`quill-${index}-${name}`}
148-
theme="snow"
149-
placeholder={"Enter String"}
150-
onChange={(text) => {
151-
field.onChange(text);
152-
}}
153-
className="classification-form-editor"
154-
value={typeof field.value === "string" ? field.value : ""}
155-
/>
156-
) : (
148+
theme="snow"
149+
placeholder={"Enter String"}
150+
onChange={(text) => {
151+
field.onChange(text);
152+
}}
153+
className="classification-form-editor"
154+
value={typeof field.value === "string" ? field.value : ""}
155+
/>
156+
) : (
157157
<TextField
158158
margin="none"
159159
fullWidth

dashboard/src/views/DetailPage/GlossaryDetails/GlossaryDetailsLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const GlossaryDetailLayout = () => {
142142
{(activeTab == undefined || activeTab === "entities") &&
143143
!isEmpty(data) && (
144144
<div style={{ padding: "16px" }}>
145-
<SearchResult glossaryTypeParams={qualifiedName} />
145+
<SearchResult glossaryTypeParams={qualifiedName} hideFilters={true} />
146146
</div>
147147
)}
148148
{activeTab === "entitiesProperties" && (

dashboard/src/views/SearchResult/SearchResult.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ let defaultColumnsName: Array<string> = [
8383
"term"
8484
];
8585

86-
const SearchResult = ({ classificationParams, glossaryTypeParams }: any) => {
86+
const SearchResult = ({ classificationParams, glossaryTypeParams, hideFilters }: any) => {
8787
const [searchParams, setSearchParams] = useSearchParams();
8888
const [searchData, setSearchData] = useState<any>([]);
8989
const [loader, setLoader] = useState(true);
@@ -947,7 +947,7 @@ const SearchResult = ({ classificationParams, glossaryTypeParams }: any) => {
947947
showPagination={true}
948948
showRowSelection={!isDslAggregate}
949949
// showRowSelection={true}
950-
tableFilters={true}
950+
tableFilters={!hideFilters}
951951
assignFilters={
952952
!isEmpty(classificationParams || glossaryTypeParams)
953953
? {
@@ -956,10 +956,10 @@ const SearchResult = ({ classificationParams, glossaryTypeParams }: any) => {
956956
}
957957
: null
958958
}
959-
queryBuilder={true}
960-
allTableFilters={true}
959+
queryBuilder={!hideFilters}
960+
allTableFilters={!hideFilters}
961961
setUpdateTable={setUpdateTable}
962-
isfilterQuery={true}
962+
isfilterQuery={!hideFilters}
963963
isEmptyData={isEmptyData}
964964
setIsEmptyData={setIsEmptyData}
965965
showGoToPage={true}

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -595,15 +595,13 @@ const BarTreeView: FC<{
595595
break;
596596
}
597597

598-
// Note: Don't delete filters here for CustomFilters - they will be set by setCustomFiltersSearchParams
599598
if (treeName !== "CustomFilters") {
600-
searchParams.delete("attributes");
601-
searchParams.delete("entityFilters");
602-
searchParams.delete("tagFilters");
603-
searchParams.delete("relationshipFilters");
604-
// Always reset pagination defaults on tree navigation
605-
searchParams.set("pageLimit", "25");
606-
searchParams.set("pageOffset", "0");
599+
searchParams.delete("attributes");
600+
searchParams.delete("entityFilters");
601+
searchParams.delete("tagFilters");
602+
searchParams.delete("relationshipFilters");
603+
searchParams.set("pageLimit", "25");
604+
searchParams.set("pageOffset", "0");
607605
}
608606
};
609607

@@ -654,7 +652,7 @@ const BarTreeView: FC<{
654652

655653
// Step 1: Set searchType based on saved search type
656654
if (params.searchType) {
657-
const searchTypeValue = params.searchType.toLowerCase() === "advanced" ? "advanced" : "basic";
655+
const searchTypeValue = params.searchType === "ADVANCED" ? "dsl" : "basic";
658656
searchParams.set("searchType", searchTypeValue);
659657
}
660658

@@ -729,7 +727,7 @@ const BarTreeView: FC<{
729727
}
730728
}
731729

732-
searchParams.set("isCF", "true");
730+
searchParams.set("isCF", "true");
733731
}
734732
} else {
735733
searchParams.set("relationshipName", node.id);

0 commit comments

Comments
 (0)