diff --git a/packages/test-app-frontend/src/App/App.tsx b/packages/test-app-frontend/src/App/App.tsx index b19ffcdf..299e3e6e 100644 --- a/packages/test-app-frontend/src/App/App.tsx +++ b/packages/test-app-frontend/src/App/App.tsx @@ -72,6 +72,7 @@ function Main(): ReactElement { } /> } /> + } /> @@ -189,3 +190,15 @@ function OpenIModel(props: OpenIModelProps): ReactElement | null { return ; } + +interface OpenBlankConnectionProps { + iTwinJsApp: typeof ITwinJsApp | undefined; +} + +function OpenBlankConnection(props: OpenBlankConnectionProps): ReactElement { + if (props.iTwinJsApp === undefined) { + return Initializing...; + } + + return ; +} diff --git a/packages/test-app-frontend/src/App/ITwinJsApp/ITwinJsApp.tsx b/packages/test-app-frontend/src/App/ITwinJsApp/ITwinJsApp.tsx index e78b7f75..c81572db 100644 --- a/packages/test-app-frontend/src/App/ITwinJsApp/ITwinJsApp.tsx +++ b/packages/test-app-frontend/src/App/ITwinJsApp/ITwinJsApp.tsx @@ -3,11 +3,11 @@ * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import { - BentleyCloudRpcManager, BentleyCloudRpcParams, IModelReadRpcInterface, IModelTileRpcInterface, + BentleyCloudRpcManager, BentleyCloudRpcParams, Cartographic, IModelReadRpcInterface, IModelTileRpcInterface, type AuthorizationClient, } from "@itwin/core-common"; import { - CheckpointConnection, IModelApp, type IModelConnection, type Viewport, type ViewState, + BlankConnection, CheckpointConnection, IModelApp, type IModelConnection, type Viewport, type ViewState, } from "@itwin/core-frontend"; import { ITwinLocalization } from "@itwin/core-i18n"; import { UiCore } from "@itwin/core-react"; @@ -96,7 +96,17 @@ function useIModel( IModelApp.authorizationClient = authorizationClient; let disposed = false; - const iModelPromise = CheckpointConnection.openRemote(iTwinId, iModelId); + const iModelPromise = iModelId === "" + ? ( + Promise.resolve( + BlankConnection.create({ + name: "saved-viws-test-app-blank-connection", + location: Cartographic.createZero(), + extents: { low: { x: 0.0, y: 0.0, z: 0.0 }, high: { x: 1.0, y: 1.0, z: 1.0 } }, + }), + ) + ) + : CheckpointConnection.openRemote(iTwinId, iModelId); void (async () => { try { const openedIModel = await iModelPromise; diff --git a/packages/test-app-frontend/src/App/ITwinJsApp/SavedViewsWidget.tsx b/packages/test-app-frontend/src/App/ITwinJsApp/SavedViewsWidget.tsx index 19db0f30..36f956c2 100644 --- a/packages/test-app-frontend/src/App/ITwinJsApp/SavedViewsWidget.tsx +++ b/packages/test-app-frontend/src/App/ITwinJsApp/SavedViewsWidget.tsx @@ -70,6 +70,19 @@ export function SavedViewsWidget(props: SavedViewsWidgetProps): ReactElement { return Loading saved views...; } + const handleCaptureSavedView = async () => { + try { + const savedViewData = await captureSavedViewData({ viewport: props.viewport }); + toaster.positive("Captured saved view. See output in console."); + // eslint-disable-next-line no-console + console.log(savedViewData); + } catch (error) { + toaster.negative("Failed to capture saved view."); + // eslint-disable-next-line no-console + console.error(error); + } + }; + const handleCreateView = async () => { const savedViewData = await captureSavedViewData({ viewport: props.viewport }); const savedViewId = await savedViews.createSavedView({ displayName: "0 Saved View Name" }, savedViewData); @@ -124,7 +137,14 @@ export function SavedViewsWidget(props: SavedViewsWidgetProps): ReactElement { alignContent: "start", minHeight: 0, }}> -
+
+ {operationsInProgress > 0 && "Updating saved views..."} diff --git a/packages/test-app-frontend/src/App/imodel-browser/ITwinBrowser.tsx b/packages/test-app-frontend/src/App/imodel-browser/ITwinBrowser.tsx index 0669fcb0..f2cdd8b4 100644 --- a/packages/test-app-frontend/src/App/imodel-browser/ITwinBrowser.tsx +++ b/packages/test-app-frontend/src/App/imodel-browser/ITwinBrowser.tsx @@ -2,7 +2,7 @@ * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import { SvgProject } from "@itwin/itwinui-icons-react"; +import { SvgImodelHollow, SvgProject } from "@itwin/itwinui-icons-react"; import { FluidGrid, PageLayout } from "@itwin/itwinui-layouts-react"; import { Surface, Text, Tile } from "@itwin/itwinui-react"; import { type ReactElement } from "react"; @@ -27,20 +27,38 @@ export function ITwinBrowser(): ReactElement { { authorizationClient }, ); + const navigate = useNavigate(); + return (
- -
- Recent - - {(result) => } - -
-
+
+ + + + + + + + + navigate("/itwinjs/open-blank-connection")}> + Open blank connection + + + + + +
+ Recent + + {(result) => } + +
+
+
All iTwins