Fineract backend settings with environment variables

This commit is contained in:
Jose Alberto Hernandez
2022-07-13 16:40:23 +02:00
committed by Arnold Gálovics
parent 1b72136411
commit 14ceb4f3fd
44 changed files with 815 additions and 291 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
<div fxLayout="column" id="footer" class="m-b-20">
<mat-divider fxFlexAlign="center" class="divider"></mat-divider>
<p fxFlexAlign="center" class="footer-content">Version {{ version }}</p>
<p fxFlexAlign="center" class="footer-content">Mifos X is up to date</p>
<p fxFlexAlign="center" class="footer-content">Version <b>{{ version }}</b> - <b>{{ hash }}</b></p>
<p fxFlexAlign="center" class="footer-content" *ngIf="isBusinessDateDefined">Current Business Date: <b>{{ businessDate | date: 'EEEE, MMMM dd, y' }}</b></p>
<mat-divider fxFlexAlign="center" class="divider"></mat-divider>
<p fxFlexAlign="center" class="footer-content">Mifos X by Mifos</p>
</div>
+68 -3
View File
@@ -1,8 +1,14 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Alert } from 'app/core/alert/alert.model';
import { AlertService } from 'app/core/alert/alert.service';
import { AuthenticationService } from 'app/core/authentication/authentication.service';
import { SettingsService } from 'app/settings/settings.service';
import { SystemService } from 'app/system/system.service';
/** Environment Configuration */
import { environment } from 'environments/environment';
import { Subscription } from 'rxjs';
/**
* Footer component.
@@ -12,14 +18,73 @@ import { environment } from 'environments/environment';
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss']
})
export class FooterComponent implements OnInit {
export class FooterComponent implements OnInit, OnDestroy {
/** Mifos X version. */
version: string = environment.version;
/** Mifos X hash */
hash: string = environment.hash;
/** Business Date */
businessDate: Date = null;
constructor() { }
isBusinessDateEnabled = false;
isBusinessDateDefined = false;
/** Subscription to alerts. */
alert$: Subscription;
timer: any;
constructor(private systemService: SystemService,
private authenticationService: AuthenticationService,
private alertService: AlertService) { }
ngOnInit() {
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
const alertType = alertEvent.type;
if (alertType === SettingsService.businessDateType + ' Set Config') {
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
this.isBusinessDateDefined = false;
if (this.isBusinessDateEnabled) {
this.setBusinessDate();
}
} else if (alertType === SettingsService.businessDateType + ' Set') {
if (this.isBusinessDateEnabled) {
this.setBusinessDate();
}
} else if (alertType === 'Authentication Start') {
this.timer = setTimeout(() => { this.getConfigurations(); }, 60000);
}
});
this.getConfigurations();
}
ngOnDestroy() {
clearTimeout(this.timer);
}
/**
* Get the Configuration for Business Date
*/
getConfigurations(): void {
if (this.authenticationService.isAuthenticated()) {
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
.subscribe((configurationData: any) => {
this.isBusinessDateEnabled = configurationData.enabled;
if (this.isBusinessDateEnabled) {
this.setBusinessDate();
this.timer = setTimeout(() => { this.getConfigurations(); }, 60000);
}
});
}
}
/**
* Get the Business Date data
*/
setBusinessDate(): void {
this.systemService.getBusinessDate(SettingsService.businessDateType)
.subscribe((data: any) => {
this.businessDate = new Date(data.date);
this.isBusinessDateDefined = true;
});
}
}