From d421e76c7e7e6d2ceb15813576c1f2922692f096 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Wed, 27 May 2020 12:10:01 +0200 Subject: [PATCH] Remove the user profile from the app shell --- packages/app-shell/src/app-shell.js | 12 +-- .../src/vpu-app-shell-user-profile.js | 75 ------------------- 2 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 packages/app-shell/src/vpu-app-shell-user-profile.js diff --git a/packages/app-shell/src/app-shell.js b/packages/app-shell/src/app-shell.js index 16945b7c..37144558 100644 --- a/packages/app-shell/src/app-shell.js +++ b/packages/app-shell/src/app-shell.js @@ -14,7 +14,6 @@ import * as events from 'vpu-common/events.js'; import {BuildInfo} from './build-info.js'; import {TUGrazLogo} from './tugraz-logo.js'; import {send as notify} from 'vpu-common/notification'; -import {userProfileMeta} from './vpu-app-shell-user-profile.js'; import {appWelcomeMeta} from './vpu-app-shell-welcome.js'; @@ -133,11 +132,9 @@ export class AppShell extends ScopedElementsMixin(LitElement) { } } - // Inject the user profile and welcome activity - routes.push("user-profile"); + // Inject the welcome activity routes.unshift("welcome"); metadata = Object.assign(metadata, { - "user-profile": userProfileMeta, "welcome": appWelcomeMeta, }); customElements.get("vpu-app-shell-welcome").app = this; @@ -248,11 +245,6 @@ export class AppShell extends ScopedElementsMixin(LitElement) { this.fetchMetadata(this.src); this.initRouter(); - // listen to the vpu-auth-profile event to switch to the person profile - window.addEventListener("vpu-auth-profile", () => { - this.switchComponent('user-profile'); - }); - this._subscriber.subscribe(this._updateAuth); } @@ -685,7 +677,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) { <div class="hd1-middle"> </div> <div class="hd1-right"> - <vpu-auth lang="${this.lang}" show-profile keycloak-config="${JSON.stringify(this.keycloakConfig)}" load-person try-login></vpu-auth> + <vpu-auth lang="${this.lang}" keycloak-config="${JSON.stringify(this.keycloakConfig)}" load-person try-login></vpu-auth> </div> <div class="hd2-left"> <div class="header"> diff --git a/packages/app-shell/src/vpu-app-shell-user-profile.js b/packages/app-shell/src/vpu-app-shell-user-profile.js deleted file mode 100644 index 8d62cace..00000000 --- a/packages/app-shell/src/vpu-app-shell-user-profile.js +++ /dev/null @@ -1,75 +0,0 @@ -import {createI18nInstance} from './i18n.js'; -import {css, html, LitElement} from 'lit-element'; -import * as commonUtils from 'vpu-common/utils'; -import * as commonStyles from 'vpu-common/styles'; -import {ScopedElementsMixin} from '@open-wc/scoped-elements'; -import {PersonProfile} from 'vpu-person-profile'; - -const i18n = createI18nInstance(); - -class AppShellUserProfile extends ScopedElementsMixin(LitElement) { - - constructor() { - super(); - this.lang = i18n.language; - this._personId = window.VPUPersonId; - this.entryPointUrl = commonUtils.getAPiUrl(); - } - - static get scopedElements() { - return { - 'vpu-person-profile': PersonProfile, - }; - } - - static get properties() { - return { - lang: { type: String }, - entryPointUrl: { type: String, attribute: 'entry-point-url' }, - _personId: {type: String, attribute: false}, - }; - } - - connectedCallback() { - super.connectedCallback(); - - window.addEventListener("vpu-auth-person-init", () => { - this._personId = window.VPUPersonId; - }); - } - - static get styles() { - // language=css - return css` - ${commonStyles.getThemeCSS()} - ${commonStyles.getGeneralCSS()} - `; - } - - render() { - return html` - <vpu-person-profile value="${this._personId}" entry-point-url="${this.entryPointUrl}" lang="${this.lang}"></vpu-person-profile> - `; - } -} - -export const userProfileMeta = { - "element": "vpu-app-shell-user-profile", - "module_src": "", - "routing_name": "user-profile", - "name": { - "de": "Benutzerprofil", - "en": "User profile" - }, - "short_name": { - "de": "Profil", - "en": "Profile" - }, - "description": { - "de": "Zeigt informationen über den Benutzer an", - "en": "Shows information about the user" - }, - visible: false -}; - -commonUtils.defineCustomElement('vpu-app-shell-user-profile', AppShellUserProfile); -- GitLab