Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmaier authored Jun 8, 2020
0 parents commit e8eecca
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -----------------------------------------------------------------------------------------------------------
# Project and iModel (REQUIRED)
# Must un-comment the lines below and set these variables before testing - create a new project and
# iModel with the developer registration procedure here - https://git.io/fx8YP
# -----------------------------------------------------------------------------------------------------------
# imjs_test_imodel="pumpstation"
# imjs_test_project="test - pumpstation"

# -----------------------------------------------------------------------------------------------------------
# Client registration (RECOMMENDED but OPTIONAL)
# Must set these variables before deployment, but the supplied defaults can be used for testing on localhost.
# Create a client registration using the procedure here - https://git.io/fx8YP (Developer registration). For the purpose
# of running this sample on localhost, ensure your registration includes http://localhost:3000/signin-oidc as a
# valid redirect URI.
# -----------------------------------------------------------------------------------------------------------

# Use this client id when running electron app
imjs_electron_test_client_id="imodeljs-electron-samples"

# This redirect uri is set up to be used with the electron clientId above
imjs_electron_test_redirect_uri="http://localhost:3000/signin-callback"
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MIT License

Copyright © 2018-2020 Bentley Systems, Incorporated. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Sample App

Copyright © Bentley Systems, Inc. 2019

This iModel.js sample application uses the Bentley 9-Zone UI layout pattern and demonstrates opening an iModel and viewing its data.
For an overview of the 9-Zone UI layout pattern, see [9-Zone UI Pattern](https://imodeljs.github.io/iModelJs-docs-output//learning/ui/ninezone/).

The user interface is structured using nine zones located in the corners and along the edges of the screen.
Each zone contains one or more widgets. The entire screen contains the main content. There may be multiple content views in this area
separated by splitters.

- The zone in the top left contains tool buttons and a Backstage button.
- The zone in the top center contains tool settings.
- The zone in the top right contains navigation buttons and a 3d cube navigation aid.
- The zone in the center right contains the _Tree_ component.
- The zone in the bottom right contains the _Property Grid_ component.
- The zone across the bottom contains a status bar.
- The main content contains two views: the _Viewport_ component rendering geometric data, and the _Table_ component.

The data is presented using the following components:

- _Viewport_: Renders geometric data onto an HTMLCanvasElement.
- _Tree_: Displays a hierarchical view of iModel contents.
- _Property Grid_: Displays properties of selected element(s).
- _Table_: Displays element properties in a tabular format.

There is also a panel on the right edge that is empty initially. The widgets in the center right and bottom right zones can be dragged to this panel by
dragging their tabs. The widgets can also be dragged back to the zones.

A second frontstage may be activated from the backstage (opened by pressing the Home button). This frontstage displays two viewports side-by-side and uses panels to display the 3 data components. The view layout may also be switched to display a single viewport by clicking the button below the Home button.

This app serves as a guide on how you can develop your own 9-zone application.
See http://imodeljs.org for comprehensive documentation on the iModel.js API and the various constructs used in this sample.

![](./docs/header.png)

![](./docs/panels.png)

## Development setup

Follow the [App Development Setup](../../README.md) section under Sample Interactive Apps to configure, install dependencies, build, and run the app.

## Purpose

The purpose of this application is to demonstrate the following:

- [Dependencies](./package.json) required for iModel.js-based frontend applications.
- [Scripts](./package.json) recommended to build and run iModel.js-based applications.
- How to set up a simple backend for
[web](./src/backend/web/BackendServer.ts) and
[electron](./src/backend/electron/main.ts).
- How to set up a simple [frontend for web and electron](./src/frontend/app/NineZoneSampleApp.ts).
- How to implement unified selection between a
[viewport](./src/frontend/components/Viewport.tsx),
[tree](./src/frontend/components/Tree.tsx),
[property grid](./src/frontend/components/Properties.tsx) and a
[table](./src/frontend/components/Table.tsx).
- How to implement a [Frontstage with multiple Zones and Toolbars](./src/frontend/app-ui/frontstages/SampleFrontstage.tsx),
Widgets (
[Property Grid](./src/frontend/app-ui/widgets/PropertyGridWidget.tsx),
[Tree](./src/frontend/app-ui/widgets/TreeWidget.tsx)
), Content views (
[Table](./src/frontend/app-ui/contentviews/TableContent.tsx),
Viewport
), a [Status Bar](./src/frontend/app-ui/statusbars/AppStatusBar.tsx)
and a [Backstage](./src/frontend/app-ui/backstage/AppBackstageItemProvider.tsx).
- How to implement a [Frontstage with multiple Viewports](./src/frontend/app-ui/frontstages/SampleFrontstage2.tsx)

For more information about developing a 9-Zone app, see [Learning ui-framework Package](https://imodeljs.github.io/iModelJs-docs-output//learning/ui/framework/).

## Contributing

[Contributing to iModel.js](https://github.com/imodeljs/imodeljs/blob/master/CONTRIBUTING.md)
103 changes: 103 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"name": "sample-app",
"description": "Sample App",
"license": "MIT",
"author": {
"name": "Bentley Systems, Inc.",
"url": "http://www.bentley.com"
},
"os": [
"win32",
"linux",
"darwin"
],
"engines": {
"node": ">=10.16.0 <13.0"
},
"version": "0.0.0",
"private": true,
"scripts": {
"build": "npm run copy && npm run pseudolocalize && npm run build:backend && cross-env USE_FAST_SASS=true npm run build:frontend",
"build:prod": "npm run copy && npm run build:backend && npm run build:frontend",
"build:backend": "tsc -p tsconfig.backend.json",
"build:frontend": "react-scripts build",
"clean": "rimraf lib build .rush",
"copy": "npm run copy:assets && npm run copy:enUS",
"copy:assets": "cpx \"./assets/*\" ./build/assets/",
"copy:enUS": "cpx \"./build/locales/en/*\" ./build/locales/en-US/",
"electron": "electron lib/backend/main.js",
"electron:debug": "cross-env NODE_ENV=development electron lib/backend/main.js",
"electron-in": "electron lib/backend/main.js ./assets/Campus.bim",
"lint": "tslint -p . 1>&2",
"pseudolocalize": "betools pseudolocalize --englishDir ./public/locales/en --out ./build/locales/en-PSEUDO",
"start": "npm run build:backend && run-p \"start:frontend\" \"electron:debug\"",
"start:frontend": "npm run pseudolocalize && cross-env USE_FAST_SASS=true BROWSER=none react-scripts start"
},
"browserslist": [
"electron 6.0.0",
"last 4 chrome version",
"last 4 firefox version",
"last 4 safari version",
"last 4 ios version",
"last 4 ChromeAndroid version",
"last 4 edge version",
"not dead",
"not <0.2%"
],
"dependencies": {
"@bentley/backend-itwin-client": "2.1.0",
"@bentley/bentleyjs-core": "2.1.0",
"@bentley/context-registry-client": "2.1.0",
"@bentley/ecschema-metadata": "2.1.0",
"@bentley/electron-manager": "2.1.0",
"@bentley/express-server": "2.1.0",
"@bentley/frontend-authorization-client": "2.1.0",
"@bentley/geometry-core": "2.1.0",
"@bentley/icons-generic-webfont": "^1.0.0",
"@bentley/imodel-select-react": "file:bentley-imodel-select-react-2.0.0.tgz",
"@bentley/imodelhub-client": "2.1.0",
"@bentley/imodeljs-backend": "2.1.0",
"@bentley/imodeljs-common": "2.1.0",
"@bentley/imodeljs-frontend": "2.1.0",
"@bentley/imodeljs-i18n": "2.1.0",
"@bentley/imodeljs-markup": "2.1.0",
"@bentley/imodeljs-quantity": "2.1.0",
"@bentley/itwin-client": "2.1.0",
"@bentley/orbitgt-core": "2.1.0",
"@bentley/presentation-backend": "2.1.0",
"@bentley/presentation-common": "2.1.0",
"@bentley/presentation-components": "2.1.0",
"@bentley/presentation-frontend": "2.1.0",
"@bentley/product-settings-client": "2.1.0",
"@bentley/ui-abstract": "2.1.0",
"@bentley/ui-components": "2.1.0",
"@bentley/ui-core": "2.1.0",
"@bentley/ui-framework": "2.1.0",
"@bentley/ui-ninezone": "2.1.0",
"@bentley/webgl-compatibility": "2.1.0",
"electron": "^8.2.1",
"electron-devtools-installer": "^2.2.3",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-redux": "^7.2.0",
"react-resize-detector": "^3.4.0",
"redux": "^4.0.0"
},
"devDependencies": {
"@bentley/build-tools": "2.1.0",
"@bentley/react-scripts": "3.4.1",
"@types/electron-devtools-installer": "^2.2.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-redux": "^6.0.14",
"@types/react-resize-detector": "^3.1.0",
"cpx": "^1.5.0",
"cross-env": "^5.1.4",
"node-sass": "^4.0.0",
"npm-run-all": "^4.1.5",
"rimraf": "^2.6.2",
"tslint": "^5.16.0",
"typescript": "~3.7.4",
"webpack": "4.42.0"
}
}
17 changes: 17 additions & 0 deletions tsconfig.backend.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./node_modules/@bentley/build-tools/tsconfig-base.json",
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"outDir": "./lib"
},
"include": [
"./src/backend/*.ts",
"./src/common/*.ts"
],
"exclude": [
"build",
"lib",
"node_modules"
]
}
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"extends": "./node_modules/@bentley/build-tools/tsconfig-base.json",
"compilerOptions": {
"skipLibCheck": true,
"baseUrl": "./node_modules",
"outDir": "./lib",
"resolveJsonModule": true,
"allowJs": true,
"esModuleInterop": true,
"jsx": "react",
"allowSyntheticDefaultImports": true,
"module": "esnext",
"moduleResolution": "node",
"isolatedModules": true,
"noEmit": true,
"types": [
"@bentley/react-scripts"
]
},
"include": [
"./src/**/*.ts",
"./src/**/*.tsx"
],
"exclude": [
"build",
"lib",
"node_modules"
]
}
8 changes: 8 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@bentley/build-tools/tslint.json",
"linterOptions": {
"exclude": [
"**/*.json"
]
}
}

0 comments on commit e8eecca

Please sign in to comment.