Skip to content

Commit

Permalink
Merge pull request #782 from MadhuMosip/develop
Browse files Browse the repository at this point in the history
MOSIP-37782 removed hardcoded language value and displying language dropdown if there is more then one language
  • Loading branch information
aranaravi authored Nov 25, 2024
2 parents 6064158 + ee8dd7b commit b08cd45
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 112 deletions.
140 changes: 70 additions & 70 deletions resident-ui/src/app/app-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,76 +8,76 @@ export class AppConfigService {
appConfig: any;
constructor(public http: HttpClient) { }

async loadAppConfig() {
localStorage.setItem("isDataLoaded", 'false')
this.appConfig = await this.http.get('./assets/config.json').toPromise();
this.http.get(this.appConfig.baseUrl + '/proxy/config/ui-properties').subscribe(
(response) => {
let responseData = response["response"];
this.appConfig["supportedLanguages"] = responseData["mosip.mandatory-languages"]+","+responseData["mosip.optional-languages"];
this.appConfig["mosip.iam.adapter.clientid"] = responseData["mosip.iam.adapter.clientid"];
this.appConfig["mosip.resident.api.id.otp.request"] = responseData["mosip.resident.api.id.otp.request"];
this.appConfig["mosip.resident.api.version.otp.request"] = responseData["mosip.resident.api.version.otp.request"];
this.appConfig["resident.vid.id"] = responseData["resident.vid.id"];
this.appConfig["resident.vid.version"] = responseData["resident.vid.version"];
this.appConfig["mosip.resident.request.response.version"] = responseData["mosip.resident.request.response.version"];
this.appConfig["resident.revokevid.id"] = responseData["resident.revokevid.id"];
this.appConfig["mosip-prereg-host"] = responseData["mosip-prereg-host"];
this.appConfig["mosip-prereg-ui-url"] = responseData["mosip-prereg-ui-url"];
this.appConfig["auth.types.allowed"] = responseData["auth.types.allowed"];
this.appConfig["resident.view.history.serviceType.filters"] = responseData["resident.view.history.serviceType.filters"];
this.appConfig["resident.view.history.status.filters"] = responseData["resident.view.history.status.filters"];
this.appConfig["mosip.resident.grievance.url"] = responseData["mosip.resident.grievance.url"];
this.appConfig["resident.vid.id.generate"] = responseData["resident.vid.id.generate"];
this.appConfig["resident.vid.version.new"] = responseData["resident.vid.version.new"];
this.appConfig["mosip.resident.revokevid.id"] = responseData["mosip.resident.revokevid.id"];
this.appConfig["resident.revokevid.version.new"] = responseData["resident.revokevid.version.new"];
this.appConfig["mosip.resident.download.personalized.card.id"] = responseData["mosip.resident.download.personalized.card.id"]
this.appConfig["mosip.resident.download.registration.centre.file.name.convention"] = responseData["mosip.resident.download.registration.centre.file.name.convention"];
this.appConfig["mosip.resident.download.supporting.document.file.name.convention"] = responseData["mosip.resident.download.supporting.document.file.name.convention"];
this.appConfig["mosip.resident.download.personalized.card.naming.convention"] = responseData["mosip.resident.download.personalized.card.naming.convention"];
this.appConfig["mosip.resident.ack.manage_my_vid.name.convention"] = responseData["mosip.resident.ack.manage_my_vid.name.convention"];
this.appConfig["mosip.resident.ack.secure_my_id.name.convention"] = responseData["mosip.resident.ack.secure_my_id.name.convention"];
this.appConfig["mosip.resident.ack.personalised_card.name.convention"] = responseData["mosip.resident.ack.personalised_card.name.convention"];
this.appConfig["mosip.resident.ack.update_my_data.name.convention"] = responseData["mosip.resident.ack.update_my_data.name.convention"];
this.appConfig["mosip.resident.ack.share_credential.name.convention"] = responseData["mosip.resident.ack.share_credential.name.convention"];
this.appConfig["mosip.resident.ack.order_physical_card.name.convention"] = responseData["mosip.resident.ack.order_physical_card.name.convention"];
this.appConfig["mosip.resident.ack.name.convention"] = responseData["mosip.resident.ack.name.convention"];
this.appConfig["mosip.resident.uin.card.name.convention"] = responseData["mosip.resident.uin.card.name.convention"];
this.appConfig["mosip.resident.vid.card.name.convention"] = responseData["mosip.resident.vid.card.name.convention"];
this.appConfig["mosip.resident.download.service.history.file.name.convention"] = responseData["mosip.resident.download.service.history.file.name.convention"];
this.appConfig["mosip.resident.download.nearest.registration.centre.file.name.convention"] = responseData["mosip.resident.download.nearest.registration.centre.file.name.convention"];
this.appConfig["resident.nearby.centers.distance.meters"] = responseData["resident.nearby.centers.distance.meters"];
this.appConfig["mosip.resident.captcha.sitekey"] = responseData["mosip.resident.captcha.sitekey"];
this.appConfig["mosip.resident.captcha.secretkey"] = responseData["mosip.resident.captcha.secretkey"];
this.appConfig["mosip.webui.auto.logout.idle"] = responseData["mosip.webui.auto.logout.idle"];
this.appConfig["mosip.webui.auto.logout.ping"] = responseData["mosip.webui.auto.logout.ping"];
this.appConfig["mosip.webui.auto.logout.timeout"] = responseData["mosip.webui.auto.logout.timeout"];
this.appConfig["resident.updateuin.id"] = responseData["resident.updateuin.id"];
this.appConfig["resident.ui.notification.update.interval.seconds"] = responseData["resident.ui.notification.update.interval.seconds"];
this.appConfig["mosip.kernel.otp.expiry-time"] = responseData["mosip.kernel.otp.expiry-time"];
this.appConfig["resident.grievance-redressal.comments.chars.limit"] = responseData["resident.grievance-redressal.comments.chars.limit"];
this.appConfig["resident.grievance-redressal.alt-email.chars.limit"] = responseData["resident.grievance-redressal.alt-email.chars.limit"];
this.appConfig["resident.grievance-redressal.alt-phone.chars.limit"] = responseData["resident.grievance-redressal.alt-phone.chars.limit"];
this.appConfig["resident.validation.event-id.regex"] = responseData["resident.validation.event-id.regex"];
this.appConfig["resident.purpose.allowed.special.char.regex"] = responseData["resident.purpose.allowed.special.char.regex"];
this.appConfig["mosip.resident.captcha.enable"] = responseData["mosip.resident.captcha.enable"];
this.appConfig["mosip.kernel.vid.length"] = responseData["mosip.kernel.vid.length"];
this.appConfig["mosip.kernel.uin.length"] = responseData["mosip.kernel.uin.length"];
this.appConfig["mosip.kernel.rid.length"] = responseData["mosip.kernel.rid.length"];
this.appConfig["mosip.resident.transliteration.transliterate.id"] = responseData["mosip.resident.transliteration.transliterate.id"];
this.appConfig["resident.contact.details.update.id"] = responseData["resident.contact.details.update.id"];
this.appConfig["mosip.resident.zoom"] = responseData["mosip.resident.zoom"];
this.appConfig["mosip.resident.maxZoom"] = responseData["mosip.resident.maxZoom"];
this.appConfig["mosip.resident.minZoom"] = responseData["mosip.resident.minZoom"];
this.appConfig["resident.update-uin.machine-zone-code"] = responseData["resident.update-uin.machine-zone-code"];
this.appConfig["resident-multi-language-enable"] = responseData["resident-multi-language-enable"];
localStorage.setItem("isDataLoaded", 'true')
},
(error) => {
console.log(error);
}
);
async loadAppConfig(): Promise<void> {
try {
// Load local config.json
this.appConfig = await this.http.get('./assets/config.json').toPromise();
// Load additional config from remote endpoint
const response = await this.http.get(this.appConfig.baseUrl + '/proxy/config/ui-properties').toPromise();
const responseData = response["response"];
localStorage.setItem("langCode", responseData["mosip.mandatory-languages"]);
this.appConfig["supportedLanguages"] = responseData["mosip.mandatory-languages"] + ","+ responseData["mosip.optional-languages"];
this.appConfig["mosip.iam.adapter.clientid"] = responseData["mosip.iam.adapter.clientid"];
this.appConfig["mosip.resident.api.id.otp.request"] = responseData["mosip.resident.api.id.otp.request"];
this.appConfig["mosip.resident.api.version.otp.request"] = responseData["mosip.resident.api.version.otp.request"];
this.appConfig["resident.vid.id"] = responseData["resident.vid.id"];
this.appConfig["resident.vid.version"] = responseData["resident.vid.version"];
this.appConfig["mosip.resident.request.response.version"] = responseData["mosip.resident.request.response.version"];
this.appConfig["resident.revokevid.id"] = responseData["resident.revokevid.id"];
this.appConfig["mosip-prereg-host"] = responseData["mosip-prereg-host"];
this.appConfig["mosip-prereg-ui-url"] = responseData["mosip-prereg-ui-url"];
this.appConfig["auth.types.allowed"] = responseData["auth.types.allowed"];
this.appConfig["resident.view.history.serviceType.filters"] = responseData["resident.view.history.serviceType.filters"];
this.appConfig["resident.view.history.status.filters"] = responseData["resident.view.history.status.filters"];
this.appConfig["mosip.resident.grievance.url"] = responseData["mosip.resident.grievance.url"];
this.appConfig["resident.vid.id.generate"] = responseData["resident.vid.id.generate"];
this.appConfig["resident.vid.version.new"] = responseData["resident.vid.version.new"];
this.appConfig["mosip.resident.revokevid.id"] = responseData["mosip.resident.revokevid.id"];
this.appConfig["resident.revokevid.version.new"] = responseData["resident.revokevid.version.new"];
this.appConfig["mosip.resident.download.personalized.card.id"] = responseData["mosip.resident.download.personalized.card.id"]
this.appConfig["mosip.resident.download.registration.centre.file.name.convention"] = responseData["mosip.resident.download.registration.centre.file.name.convention"];
this.appConfig["mosip.resident.download.supporting.document.file.name.convention"] = responseData["mosip.resident.download.supporting.document.file.name.convention"];
this.appConfig["mosip.resident.download.personalized.card.naming.convention"] = responseData["mosip.resident.download.personalized.card.naming.convention"];
this.appConfig["mosip.resident.ack.manage_my_vid.name.convention"] = responseData["mosip.resident.ack.manage_my_vid.name.convention"];
this.appConfig["mosip.resident.ack.secure_my_id.name.convention"] = responseData["mosip.resident.ack.secure_my_id.name.convention"];
this.appConfig["mosip.resident.ack.personalised_card.name.convention"] = responseData["mosip.resident.ack.personalised_card.name.convention"];
this.appConfig["mosip.resident.ack.update_my_data.name.convention"] = responseData["mosip.resident.ack.update_my_data.name.convention"];
this.appConfig["mosip.resident.ack.share_credential.name.convention"] = responseData["mosip.resident.ack.share_credential.name.convention"];
this.appConfig["mosip.resident.ack.order_physical_card.name.convention"] = responseData["mosip.resident.ack.order_physical_card.name.convention"];
this.appConfig["mosip.resident.ack.name.convention"] = responseData["mosip.resident.ack.name.convention"];
this.appConfig["mosip.resident.uin.card.name.convention"] = responseData["mosip.resident.uin.card.name.convention"];
this.appConfig["mosip.resident.vid.card.name.convention"] = responseData["mosip.resident.vid.card.name.convention"];
this.appConfig["mosip.resident.download.service.history.file.name.convention"] = responseData["mosip.resident.download.service.history.file.name.convention"];
this.appConfig["mosip.resident.download.nearest.registration.centre.file.name.convention"] = responseData["mosip.resident.download.nearest.registration.centre.file.name.convention"];
this.appConfig["resident.nearby.centers.distance.meters"] = responseData["resident.nearby.centers.distance.meters"];
this.appConfig["mosip.resident.captcha.sitekey"] = responseData["mosip.resident.captcha.sitekey"];
this.appConfig["mosip.resident.captcha.secretkey"] = responseData["mosip.resident.captcha.secretkey"];
this.appConfig["mosip.webui.auto.logout.idle"] = responseData["mosip.webui.auto.logout.idle"];
this.appConfig["mosip.webui.auto.logout.ping"] = responseData["mosip.webui.auto.logout.ping"];
this.appConfig["mosip.webui.auto.logout.timeout"] = responseData["mosip.webui.auto.logout.timeout"];
this.appConfig["resident.updateuin.id"] = responseData["resident.updateuin.id"];
this.appConfig["resident.ui.notification.update.interval.seconds"] = responseData["resident.ui.notification.update.interval.seconds"];
this.appConfig["mosip.kernel.otp.expiry-time"] = responseData["mosip.kernel.otp.expiry-time"];
this.appConfig["resident.grievance-redressal.comments.chars.limit"] = responseData["resident.grievance-redressal.comments.chars.limit"];
this.appConfig["resident.grievance-redressal.alt-email.chars.limit"] = responseData["resident.grievance-redressal.alt-email.chars.limit"];
this.appConfig["resident.grievance-redressal.alt-phone.chars.limit"] = responseData["resident.grievance-redressal.alt-phone.chars.limit"];
this.appConfig["resident.validation.event-id.regex"] = responseData["resident.validation.event-id.regex"];
this.appConfig["resident.purpose.allowed.special.char.regex"] = responseData["resident.purpose.allowed.special.char.regex"];
this.appConfig["mosip.resident.captcha.enable"] = responseData["mosip.resident.captcha.enable"];
this.appConfig["mosip.kernel.vid.length"] = responseData["mosip.kernel.vid.length"];
this.appConfig["mosip.kernel.uin.length"] = responseData["mosip.kernel.uin.length"];
this.appConfig["mosip.kernel.rid.length"] = responseData["mosip.kernel.rid.length"];
this.appConfig["mosip.resident.transliteration.transliterate.id"] = responseData["mosip.resident.transliteration.transliterate.id"];
this.appConfig["resident.contact.details.update.id"] = responseData["resident.contact.details.update.id"];
this.appConfig["mosip.resident.zoom"] = responseData["mosip.resident.zoom"];
this.appConfig["mosip.resident.maxZoom"] = responseData["mosip.resident.maxZoom"];
this.appConfig["mosip.resident.minZoom"] = responseData["mosip.resident.minZoom"];
this.appConfig["resident.update-uin.machine-zone-code"] = responseData["resident.update-uin.machine-zone-code"];
this.appConfig["mosip.mandatory-languages"] = responseData["mosip.mandatory-languages"];
} catch (error) {
console.error("Error loading configuration", error);
throw error;
}
}

getConfig() {
Expand Down
5 changes: 1 addition & 4 deletions resident-ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ export class AppComponent {
if(window.location.href.includes('error=invalid_transaction')){
this.router.navigate(['error']);
}

if(!localStorage.getItem("langCode")){
localStorage.setItem("langCode", "eng");
}

this.subscriptions.push(this.autoLogout.currentMessageAutoLogout.subscribe(() => {}));
this.autoLogout.changeMessage({ timerFired: false });
this.routerType();
Expand Down
21 changes: 7 additions & 14 deletions resident-ui/src/app/feature/getuin/getuin/getuin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,13 @@ export class GetuinComponent implements OnInit {
}

getConfigData(){
if(localStorage.getItem('isDataLoaded') === 'true'){
this.siteKey = this.appConfigService.getConfig()["mosip.resident.captcha.sitekey"];
this.captchaEnable = JSON.parse(this.appConfigService.getConfig()["mosip.resident.captcha.enable"]);
this.vidLength = this.appConfigService.getConfig()["mosip.kernel.vid.length"];
this.uinLength = this.appConfigService.getConfig()["mosip.kernel.uin.length"];
this.aidLength = this.appConfigService.getConfig()["mosip.kernel.rid.length"];
this.getLangData()
this.isLoading = false;
return
}else{
setTimeout(()=>{
this.getConfigData()
},500)
}
this.siteKey = this.appConfigService.getConfig()["mosip.resident.captcha.sitekey"];
this.captchaEnable = JSON.parse(this.appConfigService.getConfig()["mosip.resident.captcha.enable"]);
this.vidLength = this.appConfigService.getConfig()["mosip.kernel.vid.length"];
this.uinLength = this.appConfigService.getConfig()["mosip.kernel.uin.length"];
this.aidLength = this.appConfigService.getConfig()["mosip.kernel.rid.length"];
this.getLangData()
this.isLoading = false;
}

getLangData(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
})

if (type.value === data.attributeName) {
value = this.createDefaultValue(data)
data.formatOption[this.langCode].forEach(item => {
item.checked = true
})
value = this.createDefaultValue(data);
} else {
value = this.createCheckedVal(data);
this.checkDefaultVal(data, $event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class VerifyComponent implements OnInit, OnDestroy {
onItemSelected(item: any) {
if (item === "home") {
this.router.navigate(["dashboard"]);
} else if ("back") {
} else if (item === "back") {
this.showOtpPanel = false;
this.resetBtnDisable = true;
this.submitBtnDisable = true;
Expand Down
4 changes: 2 additions & 2 deletions resident-ui/src/app/shared/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
{{item.label}}</button>
</mat-menu>

<mat-list-item *ngIf="activeUrl !== '#/dashboard/expired' && showLangDropDown === 'true'">
<mat-list-item *ngIf="activeUrl !== '#/dashboard/expired' && showLangDropDown">
<button [style.font-size]="fontSize.lableText" id="languages" mat-button [matMenuTriggerFor]="languages"> <span class="mat-button-wrapper"><mat-icon>g_translate</mat-icon>
<span class="selected-lang">{{selectedLanguage}}</span> <mat-icon>keyboard_arrow_down</mat-icon></span></button>
</mat-list-item>

<mat-menu class="language-menu" [backdropClass]="'zoom'" #languages="matMenu" [overlapTrigger]="false">
<button [style.font-size]="fontSize.lableText" mat-menu-item (click)="onlanguagechange(item)"
<button [style.font-size]="fontSize.lableText" [ngClass]="item.code === langCode ? 'sel-font-size-btn' : 'font-size-btn'" mat-menu-item (click)="onlanguagechange(item)"
*ngFor="let item of selectLanguagesArr" id="lang{{item.code}}" >{{item.value}}</button>
</mat-menu>

Expand Down
Loading

0 comments on commit b08cd45

Please sign in to comment.