WEB-457 Tenant aware feature (#2854)
* refactor: use inject() for DI in HomeComponent (eslint fix) * Tenant Fix * fix: JSON syntax in translation file
This commit is contained in:
@@ -10,7 +10,10 @@
|
||||
<div class="container">
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title class="title"> {{ 'labels.text.Welcome' | translate }}, {{ username }}! </mat-card-title>
|
||||
<mat-card-title class="title">
|
||||
{{ 'labels.text.Welcome' | translate }} {{ username }} {{ 'labels.text.To' | translate }}
|
||||
{{ tenant | titlecase }}!
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content #searchActivity>
|
||||
@@ -30,7 +33,7 @@
|
||||
</mat-autocomplete>
|
||||
</mat-card-content>
|
||||
|
||||
<img mat-card-image src="assets/images/mifos_lg-logo.png" alt="Mifos X" />
|
||||
<img mat-card-image src="assets/images/{{ tenant }}_home.png" alt="Mifos X" />
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import { WarningDialogComponent } from './warning-dialog/warning-dialog.componen
|
||||
import { AuthenticationService } from '../core/authentication/authentication.service';
|
||||
import { PopoverService } from '../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../configuration-wizard/configuration-wizard.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { NextStepDialogComponent } from '../configuration-wizard/next-step-dialog/next-step-dialog.component';
|
||||
@@ -50,9 +51,12 @@ export class HomeComponent implements OnInit, AfterViewInit {
|
||||
private dialog = inject(MatDialog);
|
||||
private configurationWizardService = inject(ConfigurationWizardService);
|
||||
private popoverService = inject(PopoverService);
|
||||
private settingsService = inject(SettingsService);
|
||||
|
||||
/** Username of authenticated user. */
|
||||
username: string;
|
||||
/** Tenant name */
|
||||
tenant: string;
|
||||
/** Activity Form. */
|
||||
activityForm: any;
|
||||
/** Search Text. */
|
||||
@@ -71,6 +75,9 @@ export class HomeComponent implements OnInit, AfterViewInit {
|
||||
/* Template for popover on search activity */
|
||||
@ViewChild('templateSearchActivity', { static: false }) templateSearchActivity: TemplateRef<any>;
|
||||
|
||||
// All dependencies are injected using inject() above. No constructor needed.
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Sets the username of the authenticated user.
|
||||
* Set Form.
|
||||
@@ -78,6 +85,7 @@ export class HomeComponent implements OnInit, AfterViewInit {
|
||||
ngOnInit() {
|
||||
const credentials = this.authenticationService.getCredentials();
|
||||
this.username = credentials.username;
|
||||
this.tenant = this.tenantIdentifier();
|
||||
this.setFilteredActivities();
|
||||
if (!this.authenticationService.hasDialogBeenShown()) {
|
||||
this.dialog.open(WarningDialogComponent);
|
||||
@@ -183,4 +191,11 @@ export class HomeComponent implements OnInit, AfterViewInit {
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/home']);
|
||||
}
|
||||
|
||||
tenantIdentifier() {
|
||||
if (!this.settingsService.tenantIdentifier || this.settingsService.tenantIdentifier === '') {
|
||||
return 'default';
|
||||
}
|
||||
return this.settingsService.tenantIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user