Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cines Vitamui
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dad
Cines Vitamui
Commits
d98736fd
Commit
d98736fd
authored
4 years ago
by
Fadil
Committed by
pybelecalo
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[US TRTL-615] Fix tenant selection in portal app
parent
e24bd0e2
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
ui/ui-frontend-common/src/app/modules/application.service.ts
+21
-0
21 additions, 0 deletions
ui/ui-frontend-common/src/app/modules/application.service.ts
ui/ui-frontend/projects/portal/src/app/portal/portal.component.ts
+4
-6
4 additions, 6 deletions
...ontend/projects/portal/src/app/portal/portal.component.ts
with
25 additions
and
6 deletions
ui/ui-frontend-common/src/app/modules/application.service.ts
+
21
−
0
View file @
d98736fd
...
...
@@ -41,6 +41,7 @@ import { BehaviorSubject } from 'rxjs';
import
{
Observable
,
of
,
Subject
}
from
'
rxjs
'
;
import
{
catchError
,
map
}
from
'
rxjs/operators
'
;
import
{
ApplicationApiService
}
from
'
./api/application-api.service
'
;
import
{
ApplicationId
}
from
'
./application-id.enum
'
;
import
{
AuthService
}
from
'
./auth.service
'
;
import
{
GlobalEventService
}
from
'
./global-event.service
'
;
import
{
ApplicationInfo
}
from
'
./models/application/application.interface
'
;
...
...
@@ -191,6 +192,26 @@ export class ApplicationService {
return
new
Map
([...
appMap
.
entries
()].
sort
((
a
,
b
)
=>
a
[
0
].
order
<
b
[
0
].
order
?
-
1
:
1
));
}
public
getAppById
(
identifier
:
string
):
Application
{
return
this
.
applications
.
find
(
value
=>
value
.
identifier
===
identifier
);
}
/**
* Return an observable that notify if the current application has a tenant list or not.
*/
public
hasTenantList
():
Observable
<
boolean
>
{
return
new
Observable
((
observer
)
=>
{
this
.
globalEventService
.
pageEvent
.
subscribe
((
appId
:
string
)
=>
{
if
(
appId
===
ApplicationId
.
PORTAL_APP
)
{
observer
.
next
(
true
);
}
else
{
const
app
=
this
.
applications
.
find
(
value
=>
value
.
identifier
===
appId
);
app
?
observer
.
next
(
app
.
hasTenantList
)
:
observer
.
next
(
false
);
}
});
});
}
private
fillCategoriesWithApps
(
categoriesByIds
:
{
[
categoryId
:
string
]:
Category
},
applications
:
Application
[])
{
const
resultMap
=
new
Map
<
Category
,
Application
[]
>
();
let
categories
:
Category
[]
=
Object
.
values
(
categoriesByIds
);
...
...
This diff is collapsed.
Click to expand it.
ui/ui-frontend/projects/portal/src/app/portal/portal.component.ts
+
4
−
6
View file @
d98736fd
...
...
@@ -38,7 +38,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import
{
SafeResourceUrl
}
from
'
@angular/platform-browser
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
Subscription
}
from
'
rxjs
'
;
import
{
A
uth
Service
,
StartupService
,
ThemeDataType
,
ThemeService
}
from
'
ui-frontend-common
'
;
import
{
A
pplicationId
,
AuthService
,
GlobalEvent
Service
,
StartupService
,
ThemeDataType
,
ThemeService
}
from
'
ui-frontend-common
'
;
import
{
Application
,
ApplicationService
,
Category
}
from
'
ui-frontend-common
'
;
@
Component
({
...
...
@@ -49,13 +49,9 @@ import { Application, ApplicationService, Category } from 'ui-frontend-common';
export
class
PortalComponent
implements
OnInit
,
OnDestroy
{
public
applications
:
Map
<
Category
,
Application
[]
>
;
public
welcomeTitle
:
string
;
public
welcomeMessage
:
string
;
public
customerLogoUrl
:
SafeResourceUrl
;
public
loading
=
true
;
private
sub
:
Subscription
;
...
...
@@ -65,7 +61,8 @@ export class PortalComponent implements OnInit, OnDestroy {
private
startupService
:
StartupService
,
private
authService
:
AuthService
,
private
themeService
:
ThemeService
,
private
router
:
Router
)
{
}
private
router
:
Router
,
private
globalEventService
:
GlobalEventService
)
{
}
ngOnInit
()
{
this
.
sub
=
this
.
applicationService
.
getActiveTenantAppsMap
().
subscribe
((
appMap
)
=>
{
...
...
@@ -75,6 +72,7 @@ export class PortalComponent implements OnInit, OnDestroy {
this
.
welcomeTitle
=
this
.
themeService
.
getData
(
this
.
authService
.
user
,
ThemeDataType
.
PORTAL_TITLE
)
as
string
;
this
.
welcomeMessage
=
this
.
themeService
.
getData
(
this
.
authService
.
user
,
ThemeDataType
.
PORTAL_MESSAGE
)
as
string
;
this
.
customerLogoUrl
=
this
.
themeService
.
getData
(
this
.
authService
.
user
,
ThemeDataType
.
PORTAL_LOGO
);
this
.
globalEventService
.
pageEvent
.
next
(
ApplicationId
.
PORTAL_APP
);
}
ngOnDestroy
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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