Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
3d3258e6
Commit
3d3258e6
authored
4 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
Always inject the user profile activity
parent
db76cc6d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/app-shell/src/index.js
+22
-4
22 additions, 4 deletions
packages/app-shell/src/index.js
packages/app-shell/src/vpu-app-shell-user-profile.js
+69
-0
69 additions, 0 deletions
packages/app-shell/src/vpu-app-shell-user-profile.js
with
91 additions
and
4 deletions
packages/app-shell/src/index.js
+
22
−
4
View file @
3d3258e6
...
...
@@ -13,6 +13,7 @@ import * as events from 'vpu-common/events.js';
import
'
./build-info.js
'
;
import
'
./tugraz-logo.js
'
;
import
{
send
as
notify
}
from
'
vpu-notification
'
;
import
{
userProfileMeta
}
from
'
./vpu-app-shell-user-profile.js
'
;
const
i18n
=
createI18nInstance
();
...
...
@@ -77,8 +78,8 @@ class VPUApp extends LitElement {
* @param {string} topicURL The topic metadata URL or relative path to load things from
*/
async
fetchMetadata
(
topicURL
)
{
cons
t
metadata
=
{};
cons
t
routes
=
[];
le
t
metadata
=
{};
le
t
routes
=
[];
const
result
=
await
(
await
fetch
(
topicURL
,
{
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
...
...
@@ -118,6 +119,13 @@ class VPUApp extends LitElement {
console
.
log
(
error
);
}
}
// Inject the user profile activity
routes
.
push
(
"
user-profile
"
);
metadata
=
Object
.
assign
(
metadata
,
{
"
user-profile
"
:
userProfileMeta
});
// this also triggers a rebuilding of the menu
this
.
metadata
=
metadata
;
this
.
routes
=
routes
;
...
...
@@ -225,7 +233,7 @@ class VPUApp extends LitElement {
// listen to the vpu-auth-profile event to switch to the person profile
window
.
addEventListener
(
"
vpu-auth-profile
"
,
()
=>
{
this
.
switchComponent
(
'
person
-profile
'
);
this
.
switchComponent
(
'
user
-profile
'
);
});
this
.
_subscriber
.
subscribe
(
this
.
_updateAuth
);
...
...
@@ -296,10 +304,20 @@ class VPUApp extends LitElement {
return
;
}
importNotify
(
import
(
metadata
.
module_src
)).
then
(
()
=>
{
let
updateFunc
=
()
=>
{
this
.
updatePageTitle
();
this
.
subtitle
=
this
.
activeMetaDataText
(
"
short_name
"
);
this
.
description
=
this
.
activeMetaDataText
(
"
description
"
);
};
// If it is empty assume the element is already registered through other means
if
(
!
metadata
.
module_src
)
{
updateFunc
();
return
;
}
importNotify
(
import
(
metadata
.
module_src
)).
then
(()
=>
{
updateFunc
();
}).
catch
((
e
)
=>
{
console
.
error
(
`Error loading
${
metadata
.
element
}
`
);
throw
e
;
...
...
This diff is collapsed.
Click to expand it.
packages/app-shell/src/vpu-app-shell-user-profile.js
0 → 100644
+
69
−
0
View file @
3d3258e6
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
'
vpu-person-profile
'
;
const
i18n
=
createI18nInstance
();
class
AppShellUserProfile
extends
LitElement
{
constructor
()
{
super
();
this
.
lang
=
i18n
.
language
;
this
.
_personId
=
window
.
VPUPersonId
;
this
.
entryPointUrl
=
commonUtils
.
getAPiUrl
();
}
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
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment