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:
Soni Jay
2025-12-17 10:53:45 -06:00
committed by GitHub
parent 4220abcb56
commit 79d0608491
18 changed files with 95 additions and 41 deletions
+5 -2
View File
@@ -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>
+15
View File
@@ -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;
}
}
+39 -39
View File
@@ -1,41 +1,41 @@
@if (displayBackEndInfo) {
<div class="layout-column m-b-20 f12" ngClass="{{ styleClass }}" id="footer">
<mat-divider class="divider align-center"></mat-divider>
<div class="layout-column m-b-20 content-wrapper footer-center">
<table class="versions">
<tr>
<td class="footer-content">Mifos</td>
<td class="right footer-content">
{{ versions.mifos }} - <b>{{ hash }}</b>
</td>
</tr>
<tr>
<td class="footer-content">{{ 'labels.text.Fineract' | translate }}</td>
<td class="right footer-content">
{{ versions.fineract.version }} - <b>{{ versions.fineract.hash }}</b>
</td>
</tr>
@if (displayBackEndInfo) {
<tr>
<td class="footer-content">{{ 'labels.inputs.Server' | translate }}</td>
<td class="right footer-content">
{{ server }}
</td>
</tr>
}
@if (isBusinessDateDefined) {
<tr>
<td class="footer-content">{{ 'labels.text.Current Business Date' | translate }}:</td>
<td class="center footer-content business-date">
<b>{{ businessDate | date: 'EEEE, MMMM dd, y' }}</b>
</td>
</tr>
}
</table>
</div>
<mat-divider class="divider align-center"></mat-divider>
<div class="layout-column m-b-20 f12" ngClass="{{ styleClass }}" id="footer" *ngIf="displayBackEndInfo">
<mat-divider class="divider align-center"></mat-divider>
<div class="layout-column m-b-20 content-wrapper footer-center">
<table class="versions">
<tr>
<td class="footer-content">Tenant</td>
<td class="right footer-content">
{{ tenant | titlecase }}
</td>
</tr>
<tr>
<td class="footer-content">Mifos</td>
<td class="right footer-content">
{{ versions.mifos }} - <b>{{ hash }}</b>
</td>
</tr>
<tr>
<td class="footer-content">{{ 'labels.text.Fineract' | translate }}</td>
<td class="right footer-content">
{{ versions.fineract.version }} - <b>{{ versions.fineract.hash }}</b>
</td>
</tr>
<tr *ngIf="displayBackEndInfo">
<td class="footer-content">{{ 'labels.inputs.Server' | translate }}</td>
<td class="right footer-content">
{{ server }}
</td>
</tr>
<tr *ngIf="isBusinessDateDefined">
<td class="footer-content">{{ 'labels.text.Current Business Date' | translate }}:</td>
<td class="center footer-content business-date">
<b>{{ businessDate | date: 'EEEE, MMMM dd, y' }}</b>
</td>
</tr>
</table>
</div>
<div class="layout-column m-b-20 copy-label">
<p class="footer-content align-center">{{ 'APP_NAME' | translate }} {{ 'labels.text.by' | translate }} Mifos</p>
</div>
}
<div class="layout-column m-b-20 copy-label">
<p class="footer-content align-center">{{ 'APP_NAME' | translate }} {{ 'labels.text.by' | translate }} Mifos</p>
</div>
+10
View File
@@ -52,6 +52,8 @@ export class FooterComponent implements OnInit, OnDestroy {
server = '';
/** Business Date */
businessDate: Date = null;
/** Tenant name */
tenant: string;
isBusinessDateEnabled = false;
isBusinessDateDefined = false;
@@ -87,6 +89,7 @@ export class FooterComponent implements OnInit, OnDestroy {
});
this.getConfigurations();
this.server = this.settingsService.server;
this.tenant = this.tenantIdentifier();
this.versionService.getBackendInfo().subscribe((data: any) => {
if (data.git && data.git.build && data.git.build.version) {
const buildVersion: string = data.git.build.version.split('-');
@@ -97,6 +100,13 @@ export class FooterComponent implements OnInit, OnDestroy {
}
}
tenantIdentifier() {
if (!this.settingsService.tenantIdentifier || this.settingsService.tenantIdentifier === '') {
return 'default';
}
return this.settingsService.tenantIdentifier;
}
ngOnDestroy() {
if (this.displayBackEndInfo) {
clearTimeout(this.timer);