Skip to content

Commit

Permalink
allow fetching all iTwins regardless of subclass (#139)
Browse files Browse the repository at this point in the history
* allow fetching all iTwins regardless of subclass

* rush change

---------

Co-authored-by: Ben Polinsky <[email protected]>
  • Loading branch information
ben-polinsky and ben-polinsky authored Jan 15, 2025
1 parent 7515823 commit ccfeb58
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/imodel-browser-react",
"comment": "add ITwinSubClass \"All\" option to fetch all itwins regardless of subclass",
"type": "minor"
}
],
"packageName": "@itwin/imodel-browser-react"
}
2 changes: 1 addition & 1 deletion packages/apps/storybook/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Registered client which have access to scopes "imodels:read", "imodels:modify", "itwins:read" and "itwins:modify", redirectUrl should be http://localhost:6006/signin-oidc.html
# Registered client which has access to the "itwin-platform" scope, redirectUrl should be http://localhost:6006/signin-oidc.html
# Please create .env.local file and put the client id there to avoid accidentally commiting this file.
STORYBOOK_AUTH_CLIENT_ID=
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,9 @@ export const WithPostProcessCallback: Story<ITwinGridProps> =
WithPostProcessCallback.args = {
apiOverrides: { serverEnvironmentPrefix: "qa" },
};

export const FetchAllSubclasses = Template.bind({});
FetchAllSubclasses.args = {
apiOverrides: { serverEnvironmentPrefix: "qa" },
iTwinSubClass: "All",
};
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export const useITwinData = ({
const endpoint = ["favorites", "recents"].includes(requestType)
? requestType
: "";
const subClass = `?subClass=${iTwinSubClass}`;
const resolvedITwinSubClass = iTwinSubClass === "All" ? "" : iTwinSubClass;
const subClass = `?subClass=${resolvedITwinSubClass}`;
const paging = `&$skip=${page * PAGE_SIZE}&$top=${PAGE_SIZE}`;
const search =
["favorites", "recents"].includes(requestType) || !filterOptions
Expand Down
3 changes: 2 additions & 1 deletion packages/modules/imodel-browser/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export type ITwinSubClass =
| "Asset"
| "Portfolio"
| "Program"
| "WorkPackage";
| "WorkPackage"
| "All";
export type ITwinClassType = "Thing" | "Endeavor";
export type ITwinStatus =
| "Active"
Expand Down

0 comments on commit ccfeb58

Please sign in to comment.