Skip to content

Commit 2111e80

Browse files
committed
WEB-457: Tenant aware feature
1 parent 9ded425 commit 2111e80

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

src/app/home/home.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
<div class="container">
1111
<mat-card>
12-
<mat-card-header>
13-
<mat-card-title class="title"> {{ 'labels.text.Welcome' | translate }}, {{ username }}! </mat-card-title>
12+
<mat-card-header>
13+
<mat-card-title class="title"> {{ 'labels.text.Welcome' | translate }} {{ username }} {{ 'labels.text.To' | translate }} {{ tenant | titlecase}}! </mat-card-title>
1414
</mat-card-header>
1515

1616
<mat-card-content #searchActivity>
@@ -27,8 +27,8 @@
2727
</mat-option>
2828
</mat-autocomplete>
2929
</mat-card-content>
30-
31-
<img mat-card-image src="assets/images/mifos_lg-logo.png" alt="Mifos X" />
30+
31+
<img mat-card-image src="assets/images/{{ tenant }}_home.png" alt="Mifos X" />
3232
</mat-card>
3333
</div>
3434

src/app/home/home.component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { WarningDialogComponent } from './warning-dialog/warning-dialog.componen
1616
import { AuthenticationService } from '../core/authentication/authentication.service';
1717
import { PopoverService } from '../configuration-wizard/popover/popover.service';
1818
import { ConfigurationWizardService } from '../configuration-wizard/configuration-wizard.service';
19+
import { SettingsService } from 'app/settings/settings.service';
1920

2021
/** Custom Components */
2122
import { NextStepDialogComponent } from '../configuration-wizard/next-step-dialog/next-step-dialog.component';
@@ -46,6 +47,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
4647
export class HomeComponent implements OnInit, AfterViewInit {
4748
/** Username of authenticated user. */
4849
username: string;
50+
/** Tenant name */
51+
tenant: string;
4952
/** Activity Form. */
5053
activityForm: any;
5154
/** Search Text. */
@@ -71,14 +74,16 @@ export class HomeComponent implements OnInit, AfterViewInit {
7174
* @param {MatDialog} dialog MatDialog.
7275
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
7376
* @param {PopoverService} popoverService PopoverService.
77+
* @param {SettingsService} settingsService SettingsService.
7478
*/
7579
constructor(
7680
private authenticationService: AuthenticationService,
7781
private activatedRoute: ActivatedRoute,
7882
private router: Router,
7983
private dialog: MatDialog,
8084
private configurationWizardService: ConfigurationWizardService,
81-
private popoverService: PopoverService
85+
private popoverService: PopoverService,
86+
private settingsService: SettingsService
8287
) {}
8388

8489
/**
@@ -88,6 +93,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
8893
ngOnInit() {
8994
const credentials = this.authenticationService.getCredentials();
9095
this.username = credentials.username;
96+
this.tenant = this.tenantIdentifier();
9197
this.setFilteredActivities();
9298
if (!this.authenticationService.hasDialogBeenShown()) {
9399
this.dialog.open(WarningDialogComponent);
@@ -193,4 +199,11 @@ export class HomeComponent implements OnInit, AfterViewInit {
193199
this.router.onSameUrlNavigation = 'reload';
194200
this.router.navigate(['/home']);
195201
}
202+
203+
tenantIdentifier() {
204+
if (!this.settingsService.tenantIdentifier || this.settingsService.tenantIdentifier === '') {
205+
return 'default';
206+
}
207+
return this.settingsService.tenantIdentifier;
208+
}
196209
}

src/app/shared/footer/footer.component.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
<mat-divider class="divider align-center"></mat-divider>
33
<div class="layout-column m-b-20 content-wrapper footer-center">
44
<table class="versions">
5+
<tr>
6+
<td class="footer-content">Tenant</td>
7+
<td class="right footer-content">
8+
{{ tenant | titlecase }}
9+
</td>
10+
</tr>
511
<tr>
612
<td class="footer-content">Mifos</td>
713
<td class="right footer-content">

src/app/shared/footer/footer.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export class FooterComponent implements OnInit, OnDestroy {
4545
server = '';
4646
/** Business Date */
4747
businessDate: Date = null;
48+
/** Tenant name */
49+
tenant: string;
4850

4951
isBusinessDateEnabled = false;
5052
isBusinessDateDefined = false;
@@ -87,6 +89,7 @@ export class FooterComponent implements OnInit, OnDestroy {
8789
});
8890
this.getConfigurations();
8991
this.server = this.settingsService.server;
92+
this.tenant = this.tenantIdentifier();
9093
this.versionService.getBackendInfo().subscribe((data: any) => {
9194
if (data.git && data.git.build && data.git.build.version) {
9295
const buildVersion: string = data.git.build.version.split('-');
@@ -97,6 +100,14 @@ export class FooterComponent implements OnInit, OnDestroy {
97100
}
98101
}
99102

103+
tenantIdentifier() {
104+
if (!this.settingsService.tenantIdentifier || this.settingsService.tenantIdentifier === '') {
105+
return 'default';
106+
}
107+
return this.settingsService.tenantIdentifier;
108+
}
109+
110+
100111
ngOnDestroy() {
101112
if (this.displayBackEndInfo) {
102113
clearTimeout(this.timer);

0 commit comments

Comments
 (0)