Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async startRetrieveViews() {
if (this.props.iModelInfo) {
const projectInfo = this.props.iModelInfo.projectInfo;
const iModelWsgId = this.props.iModelInfo.wsgId;
// this.setState({ waitingForViews: true });
this._iModelConnection = await UiFramework.iModelServices.openIModel(projectInfo.wsgId, iModelWsgId);
} else if (this.props.iModelConnection) {
this._iModelConnection = this.props.iModelConnection;
} else {
throw Error("IModelViewPicker: Either iModelInfo or iModelConnection must be passed as Props");
}
const viewQueryParams: ViewQueryParams = { wantPrivate: false };
let viewProps: ViewDefinitionProps[] = [];
try {
viewProps = await this._iModelConnection.views.queryProps(viewQueryParams);
this.setState({ views: viewProps, waitingForViews: false });
} catch (e) {
// tslint:disable-next-line:no-console
console.log("error getting views", e);
}
}
private async startRetrieveIModels(project: ProjectInfo) {
this.setState({
prompt: "Fetching iModel information...",
isLoadingiModels: true,
isLoadingProjects: false,
currentProject: project,
});
const iModelInfos: IModelInfo[] = await UiFramework.iModelServices.getIModels(project, 40, 0);
// tslint:disable-next-line:no-console
// console.log(JSON.stringify(iModelInfos));
this.setState({
isLoadingiModels: false,
iModels: iModelInfos,
});
}
public static async openIModelAndViews(projectId: string, iModelId: string, viewIdsSelected: Id64String[]) {
// Close the current iModelConnection
await SampleAppIModelApp.closeCurrentIModel();
// open the imodel
Logger.logInfo(SampleAppIModelApp.loggerCategory(this), `openIModelAndViews: projectId=${projectId}&iModelId=${iModelId}`);
const iModelConnection = await UiFramework.iModelServices.openIModel(projectId, iModelId);
SampleAppIModelApp.setIsIModelLocal(false, true);
await this.openViews(iModelConnection, viewIdsSelected);
}
private async startRetrieveThumbnail(projectId: string, iModelId: string) {
const _thumbnail = await UiFramework.iModelServices.getThumbnail(projectId, iModelId);
this.setState({ thumbnail: _thumbnail });
}
private async startRetrieveThumbnail(thisIModel: IModelInfo) {
this.setState({ waitingForThumbnail: true });
thisIModel.thumbnail = await UiFramework.iModelServices.getThumbnail(thisIModel.projectInfo.wsgId, thisIModel.wsgId);
this.setState({ waitingForThumbnail: false });
}