Skip to content

Commit

Permalink
Support #32335 - Add existing storage unit group rsql is incorrect (#…
Browse files Browse the repository at this point in the history
…1174)

* Support #32335 - Add existing storage unit group RSQL is incorrect

- Changed filter to generate an IN with all of the options instead.
- Updated the test for the new RSQL being generated.

* Support #32335 - Add existing storage unit group RSQL is incorrect

- Fixed another test
  • Loading branch information
brandonandre authored Nov 23, 2023
1 parent ba44687 commit 2712df1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
17 changes: 10 additions & 7 deletions packages/dina-ui/components/storage/StorageFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@ export function StorageFilter({ onChange }: StorageFilterProps) {
]
: []),
...(groupNames
? groupNames.map((group, index) => {
return {
id: -index,
? [
{
id: -1234,
type: "FILTER_ROW" as const,
attribute: "group",
predicate: "IS" as const,
searchType: "EXACT_MATCH" as const,
value: group
};
})
value: groupNames.join(","),
attribute: {
allowRange: true,
name: "group"
}
}
]
: [])
]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const mockGet = jest.fn<any, any>(async (path, params = {}) => {
case "collection-api/storage-unit":
if (
params.filter?.parentStorageUnit === null ||
params.filter?.rsql === "group==aafc;group==cnc"
params.filter?.rsql === "group=in=(aafc,cnc)"
) {
// Top-level units:
return { data: [STORAGE_A], meta: { totalResourceCount: 1 } };
Expand Down Expand Up @@ -158,7 +158,7 @@ describe("BrowseStorageTree component", () => {
// With no filter, gets the top-level units:
expect(mockGet).lastCalledWith("collection-api/storage-unit", {
filter: {
rsql: "group==aafc;group==cnc"
rsql: "group=in=(aafc,cnc)"
},
include: "storageUnitChildren,storageUnitType",
page: {
Expand All @@ -179,7 +179,7 @@ describe("BrowseStorageTree component", () => {
// With a filter, gets units from any level matching the search text:
expect(mockGet).lastCalledWith("collection-api/storage-unit", {
filter: {
rsql: "name==*test-search-text*;group==aafc;group==cnc"
rsql: "name==*test-search-text*;group=in=(aafc,cnc)"
},
include: "storageUnitChildren,storageUnitType",
page: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const mockGet = jest.fn<any, any>(async (path, params) => {
}
case "hierarchy,storageUnitType":
switch (params?.filter?.rsql) {
case "group==aafc;group==cnc":
case "group=in=(aafc,cnc)":
case "":
// The searchable table results:
return {
Expand Down

0 comments on commit 2712df1

Please sign in to comment.