Newer
Older
A web component for building SPAs consisting of one topic with multiple
activities. Handles login, language selection, activity switching, menus etc.
```bash
npm i @dbp-toolkit/app-shell
```
<dbp-app-shell src="/example.topic.metadata.json"></dbp-app-shell>
<script type="module" src="node_modules/@dbp-toolkit/app-shell/dist/dbp-app-shell.js"></script>
```
## Attributes
- `lang` (optional, default: `de`): set to `de` or `en` for German or English
- example `<dbp-app-shell lang="de"></dbp-app-shell>`
- `base-path` (optional, default: `/`): An absolute base path for routing
- `entry-point-url`: Entry point URL to access the API
- `keycloak-config`: An object with the following keys: url, realm, clientId, silentCheckSsoRedirectUri, scope
- `matomo-url` (optional): set to your *Matomo* server (required only for tracking)
- example `<dbp-app-shell matomo-url="https://my-matomo.tld"></dbp-app-shell>`
- `matomo-site-id` (optional): set to your site id (required only for tracking)
- example `<dbp-app-shell matomo-site-id="456789"></dbp-app-shell>`
- `no-welcome-page` (optional): skips the welcome page and welcome page isn't visible in menu
- example `<dbp-app-shell no-welcome-page></dbp-app-shell>`
- `shell-name` (optional, default: ``): sets the shell name in the left upper corner of the header
- example `<dbp-app-shell shell-name="Testpage"></dbp-app-shell>`
- `shell-subname` (optional, default: ``): sets the shell subname in the left upper corner of the header
- example `<dbp-app-shell shell-name="Testpage subtitle"></dbp-app-shell>`
- `no-brand` (optional): disables the logo in the right upper corner of the header
- example `<dbp-app-shell no-brand></dbp-app-shell>`
### Emitted attributes
The component emits `dbp-set-property` events for these attributes:
- `lang` to propagate a language change (possible values `en`, `de`)
- `requested-login-status` (possible values `logged-in`, `logged-out`)
### Emitted events
#### dbp-lang
The component emits a `dbp-lang` event when the language is changed (for example in the language picker).
The `details` attribute of the event is the language (possible values `en`, `de`).
## Topic Metadata
```json
{
"name": {
"de": "Beispiel",
"en": "Example"
},
"short_name": {
"de": "Beispiel",
"en": "Example"
},
"description": {
"de": "Ich bin eine Beschreibung der Applikation",
"en": "I am a description of this application"
},
"routing_name": "example",
"activities": [
{"path": "example.metadata.json", "visible": true}
"element": "dbp-activity-example",
"module_src": "dbp-activity-example.js",
"routing_name": "activity-example",
"name": {
"de": "Beispielaktivität",
"en": "Example Activity"
},
"short_name": {
"de": "Beispielaktivität",
"en": "Example Activity"
},
"description": {
"de": "Eine Beschreibung",
"en": "A Description"
}
}
```
## Local development
```bash
# get the source
git clone git@gitlab.tugraz.at:dbp/web-components/toolkit.git
cd toolkit/packages/app-shell
# constantly build dist/bundle.js and run a local web-server on port 8002
yarn run watch
# run tests
yarn test
# build local packages in dist directory
yarn run build
```
Jump to <http://localhost:8002> and you should get a Single Sign On login page.