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
c060ba2a
Commit
c060ba2a
authored
4 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
Port to EventBus
parent
ce38bedf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/auth/src/auth.js
+11
-14
11 additions, 14 deletions
packages/auth/src/auth.js
with
11 additions
and
14 deletions
packages/auth/src/auth.js
+
11
−
14
View file @
c060ba2a
...
...
@@ -5,8 +5,7 @@ import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import
JSONLD
from
'
vpu-common/jsonld
'
;
import
*
as
commonUtils
from
'
vpu-common/utils
'
;
import
*
as
commonStyles
from
'
vpu-common/styles
'
;
import
*
as
events
from
'
vpu-common/events.js
'
;
import
{
Icon
}
from
'
vpu-common
'
;
import
{
Icon
,
EventBus
}
from
'
vpu-common
'
;
import
VPULitElement
from
'
vpu-common/vpu-lit-element
'
;
import
{
KeycloakWrapper
}
from
'
./keycloak.js
'
;
...
...
@@ -49,18 +48,7 @@ export class Auth extends ScopedElementsMixin(VPULitElement) {
this
.
person
=
null
;
this
.
entryPointUrl
=
commonUtils
.
getAPiUrl
();
this
.
keycloakConfig
=
null
;
const
_getLoginData
=
()
=>
{
const
message
=
{
status
:
this
.
_loginStatus
,
token
:
this
.
token
,
};
return
message
;
};
this
.
_loginStatus
=
LoginStatus
.
UNKNOWN
;
this
.
_emitter
=
new
events
.
EventEmitter
(
'
vpu-auth-update
'
,
'
vpu-auth-update-request
'
);
this
.
_emitter
.
registerCallback
(
_getLoginData
);
// Create the events
this
.
initEvent
=
new
CustomEvent
(
"
vpu-auth-init
"
,
{
"
detail
"
:
"
KeyCloak init event
"
,
bubbles
:
true
,
composed
:
true
});
...
...
@@ -162,7 +150,13 @@ export class Auth extends ScopedElementsMixin(VPULitElement) {
return
;
this
.
_loginStatus
=
status
;
this
.
_emitter
.
emit
();
this
.
_bus
.
publish
(
'
auth-update
'
,
{
status
:
this
.
_loginStatus
,
token
:
this
.
token
,
},
{
retain
:
true
,
});
}
/**
...
...
@@ -197,6 +191,8 @@ export class Auth extends ScopedElementsMixin(VPULitElement) {
connectedCallback
()
{
super
.
connectedCallback
();
this
.
_bus
=
new
EventBus
();
// Keycloak config
let
baseURL
=
''
;
let
realm
=
''
;
...
...
@@ -257,6 +253,7 @@ export class Auth extends ScopedElementsMixin(VPULitElement) {
}
disconnectedCallback
()
{
this
.
_bus
.
close
();
this
.
_kcwrapper
.
removeEventListener
(
'
changed
'
,
this
.
_onKCChanged
);
document
.
removeEventListener
(
'
click
'
,
this
.
closeDropdown
);
super
.
disconnectedCallback
();
...
...
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