Skip to content

Commit

Permalink
Merge pull request #241 from MadhuMosip/develop
Browse files Browse the repository at this point in the history
MOSIP-22207 Message displayed should be properly according to logged in language in entire PMP UI.
  • Loading branch information
aranaravi authored Mar 13, 2024
2 parents 48268fc + cf04b93 commit 4b5bc77
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 43 deletions.
11 changes: 7 additions & 4 deletions pmp-ui/src/app/core/services/common.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class CommonService {
approved : string = "Approved";
rejected : string = "Rejected";
descr: string;
langJson:any;
constructor(
public router: Router,
public dataService: DataStorageService,
Expand All @@ -49,6 +50,7 @@ export class CommonService {
.subscribe(result => {
this.actionMessages = result.actionMessages;
this.serverMessages = result.serverError;
this.langJson = result;
});
}

Expand Down Expand Up @@ -248,7 +250,8 @@ export class CommonService {
this.dataService.updateDetails(mapping, request).subscribe(
response => {
if (!response.errors || response.errors.length === 0) {
this.createMessage('success', callingFunction, response.response);
let successMessage = this.langJson.successMessages.sbi[callingFunction]
this.createMessage('success', callingFunction, successMessage);
this.router.navigateByUrl(this.router.url);
} else {
this.createMessage('error', callingFunction, response.errors);
Expand Down Expand Up @@ -325,14 +328,14 @@ export class CommonService {
}

viewCertificate(data: any){
this.dataService.viewCertificate(data).subscribe(response =>{
this.dataService.viewCertificate(data).subscribe(response =>{
if(response.errors.length <= 0) {
this.showCertificate('activate', response.response.certificateData);
} else {
let obj = {};
obj = {
title: 'Certificate',
message: response.errors[0].message,
title: this.langJson.generickeys.certificate,
message: this.serverMessages[response.errors[0].errorCode],
btnTxt: 'Ok'
};
this.showCertificateDetails(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class CertUploadComponent {
fetchRequest = {} as CenterRequest;
uploadcertificate:any;
files: any[] = [];
langJson:any;

constructor(
public formBuilder: FormBuilder,
Expand All @@ -61,9 +62,11 @@ export class CertUploadComponent {
this.primaryLangCode = this.headerService.getlanguageCode();
this.translate
.getTranslation(this.primaryLangCode)
.subscribe(response => (
this.uploadcertificate = response.uploadcertificate,
this.popupMessages = response.genericerror));
.subscribe(response => {
this.uploadcertificate = response.uploadcertificate;
this.popupMessages = response.genericerror;
this.langJson = response;
});
this.activatedRoute.params.subscribe(response => {
this.id = response.id;
this.masterdataType = response.type;
Expand Down Expand Up @@ -100,7 +103,7 @@ export class CertUploadComponent {
};
fileReader.readAsText(file);
}else{
self.showErrorPopup("pem or cer format file only supported.");
self.showErrorPopup(this.uploadcertificate.supportedDoc);
}
}

Expand Down Expand Up @@ -185,7 +188,7 @@ export class CertUploadComponent {
width: '550px',
data: {
case: 'MESSAGE',
title: 'Error',
title: this.langJson.generickeys.error,
message: message,
btnTxt: 'Ok'
},
Expand All @@ -200,16 +203,16 @@ export class CertUploadComponent {
if(response.errors.length > 0){
data = {
case: 'MESSAGE',
title: "Failure !",
message: response.errors[0].message,
title: this.langJson.generickeys.failure,
message: this.langJson.serverError[response.errors[0].errorCode],
btnTxt: "DONE"
};
}else{
data = {
case: 'MESSAGE',
title: "Success",
message: response.response.status,
btnTxt: "DONE"
title: this.langJson.generickeys.success,
message: this.langJson.generickeys.updatedSuccessfully,
btnTxt: this.langJson.generickeys.ok
};
}
const dialogRef = self.dialog.open(DialogComponent, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ <h2 class="filter-heading">{{ "filters.titleTxt" | translate }}</h2>
height="45px"
width="45px"
class="success-img"
*ngIf="input.title === 'Success' || input.title === 'النجاح' || input.title === 'Succès'|| input.title === 'सफलता' || input.title === 'ಯಶಸ್ಸು' || input.title === 'வெற்றி'" />
*ngIf="input.title === 'Success' || input.title === 'خطأ' || input.title === 'Succès'|| input.title === 'सफलता' || input.title === 'ಯಶಸ್ಸು' || input.title === 'வெற்றி'" />
<img
src="assets/images/cross.png"
height="45px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class MaterDataCommonBodyComponent implements OnInit {
}
}

getSbidetailFilterValues(key){
getSbidetailFilterValues(key){
if(this.router.url.includes("editable")){
this.showSecondaryForm = true;
this.showSecondarySBIPanel = true;
Expand Down Expand Up @@ -619,8 +619,8 @@ export class MaterDataCommonBodyComponent implements OnInit {
this.showErrorPopup(response.errors[0].message);
}
});
}else{
if(url === "partnermanager/partners/apikey/request"){
}else{
if(url === "partnermanager/partners/apikey/request"){
this.primaryData["useCaseDescription"] = this.primaryData["requestDetail"];
let request = new RequestModel(
"",
Expand All @@ -637,14 +637,15 @@ export class MaterDataCommonBodyComponent implements OnInit {
this.changePage();
});
}else {
let errorMessage = this.popupMessages.serverError[response.errors[0].errorCode]
if(response.errors.length > 0){
this.showErrorPopup(response.errors[0].message);
this.showErrorPopup(errorMessage);
}else{
this.showErrorPopup(response.errors.message);
}
}
});
}else{
}else{
let request = new RequestModel(
"",
null,
Expand All @@ -662,9 +663,16 @@ export class MaterDataCommonBodyComponent implements OnInit {
this.changePage();
});
}else {
if(response.errors.length > 0){
this.showErrorPopup(response.errors[0].message);
let errorMessage
let policyName = response.errors[0].message.split(':')[1]
if(policyName){
errorMessage = this.popupMessages.serverError[response.errors[0].errorCode] + policyName
}else{
errorMessage = this.popupMessages.serverError[response.errors[0].errorCode]
}
if(response.errors.length > 0){
this.showErrorPopup(errorMessage);
}else{
this.showErrorPopup(response.errors.message);
}
}
Expand Down Expand Up @@ -695,7 +703,7 @@ export class MaterDataCommonBodyComponent implements OnInit {
width: '550px',
data: {
case: 'MESSAGE',
title: 'Success',
title: this.popupMessages.generickeys.success,
message: message,
btnTxt: this.popupMessages.generickeys.ok
}
Expand All @@ -709,7 +717,7 @@ export class MaterDataCommonBodyComponent implements OnInit {
width: '550px',
data: {
case: 'MESSAGE',
title: 'Error',
title: this.popupMessages.generickeys.error,
message: message,
btnTxt: this.popupMessages.generickeys.ok
},
Expand Down
2 changes: 1 addition & 1 deletion pmp-ui/src/app/shared/dialog/dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ <h2 class="filter-heading">{{ "filters.titleTxt" | translate }}</h2>
height="45px"
width="45px"
class="success-img"
*ngIf="input.title === 'Success' || input.title === 'النجاح' || input.title === 'Succès'|| input.title === 'सफलता' || input.title === 'ಯಶಸ್ಸು' || input.title === 'வெற்றி'" />
*ngIf="input.title === 'Success' || input.title === 'نجاح' || input.title === 'Succès'|| input.title === 'सफलता' || input.title === 'ಯಶಸ್ಸು' || input.title === 'வெற்றி'" />
<img
src="assets/images/cross.png"
height="45px"
Expand Down
19 changes: 16 additions & 3 deletions pmp-ui/src/assets/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@
"chooseFile": "اختر ملف",
"uploadYourFile": "ارفع ملفك",
"button": "تحميل",
"cancel": "إلغاء"
"cancel": "إلغاء",
"supportedDoc":"ملف تنسيق PEM أو CER مدعوم فقط."
},
"filters": {
"titleTxt": "إضافة عوامل التصفية",
Expand All @@ -477,6 +478,12 @@
"fieldNameValidation": " مطلوب",
"invalidJson": "تنسيق JSON غير صالح لبيانات السياسات"
},
"successMessages":{
"sbi":{
"Activate":"تمت الموافقة على التفاصيل البيومترية الآمنة بنجاح.",
"De-activate":"تم رفض التفاصيل البيومترية الآمنة بنجاح."
}
},
"serverError": {
"PMS_COR_001": "معلمة الإدخال مفقود",
"PMS_PRT_002": " مجموعة السياسة غير موجود",
Expand Down Expand Up @@ -605,7 +612,11 @@
"PMS_POL_055": "لا يمكن تحديث السياسة المنشورة.",
"PMS_POL_056": "السياسات النشطة موجودة ضمن مجموعة السياسة.",
"PMS_POL_057": "نشط apiKey موجود بموجب السياسة.",
"PMS_POL_058": "لا يمكن تغيير الحالة للنهج المنشور .؛"
"PMS_POL_058": "لا يمكن تغيير الحالة للنهج المنشور .؛",
"KER-PCM-006": "لم يتم العثور على شهادات CA الجذر/CA المتوسطة.",
"KER-PCM-015": "الشهادة الموقعة ذاتيًا غير مسموح بها كشريك.",
"KER-PCM-004": "تواريخ الشهادة غير صالحة.",
"KER-KMS-013": "خطأ في تحليل الشهادة. تم تجاوز التجاوز، البايتات = 917"
},
"generickeys":{
"save": "حفظ",
Expand All @@ -615,7 +626,9 @@
"updatedSuccessfully": "تم التحديث بنجاح",
"createdSuccessfully": "تم الإنشاء بنجاح",
"success": "نجاح",
"error": "خطأ"
"error": "خطأ",
"failure":"فشل !",
"certificate": "شهادة"
},
"paginatorIntl": {
"itemsPerPageLabel": "مواد لكل صفحة",
Expand Down
21 changes: 18 additions & 3 deletions pmp-ui/src/assets/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@
"chooseFile": "Choose File",
"uploadYourFile": "Upload Your File",
"button": "Upload",
"cancel": "Cancel"
"cancel": "Cancel",
"supportedDoc":"PEM or CER format file only supported."
},
"filters": {
"titleTxt": "Add Filters",
Expand All @@ -470,6 +471,12 @@
"fieldNameValidation": " is required",
"invalidJson": "Invalid JSON format for policies data"
},
"successMessages":{
"sbi":{
"Activate":"Secure biometric details approved successfully.",
"De-activate":"Secure biometric details rejected successfully."
}
},
"serverError": {
"PMS_COR_001": "Missing Input Parameter",
"PMS_PRT_002": " Policy group does not exist",
Expand Down Expand Up @@ -598,7 +605,13 @@
"PMS_POL_055": "Published policy cannot be updated.",
"PMS_POL_056": "Active policies exists under the policy group.",
"PMS_POL_057": "Active apiKey exists under the policy.",
"PMS_POL_058": "Status cannot be changed for published policy.;"
"PMS_POL_058": "Status cannot be changed for published policy.;",
"KER-PCM-006": "Root CA/Intermediate CA Certificates not found.",
"KER-PCM-015": "Self Signed Certificate not allowed as partner.",
"KER-PCM-004": "Certificate Dates are not valid.",
"KER-KMS-013": "Certificate Parsing Error.signed overrun, bytes = 917",
"PMS_AUT_001": "Reg Device Sub Type Code not found in the list of Reg Device Sub Types"

},
"generickeys":{
"save":"Save",
Expand All @@ -608,7 +621,9 @@
"updatedSuccessfully":"Updated Successfully",
"createdSuccessfully":"Created Successfully",
"success":"Success",
"error":"Error"
"error":"Error",
"failure":"Failure !",
"certificate": "Certificate"
},
"paginatorIntl": {
"itemsPerPageLabel": "Items per page: ",
Expand Down
19 changes: 16 additions & 3 deletions pmp-ui/src/assets/i18n/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@
"chooseFile": "Choisir le fichier",
"uploadYourFile": "Téléchargez votre fichier",
"button": "Télécharger",
"cancel": "Annuler"
"cancel": "Annuler",
"supportedDoc":"Fichier au format PEM ou CER uniquement pris en charge."
},
"filters": {
"titleTxt": "Ajouter des filtres",
Expand All @@ -473,6 +474,12 @@
"fieldNameValidation": " est requis",
"invalidJson": "Format JSON non valide pour les données des règles"
},
"successMessages":{
"sbi":{
"Activate":"Informations biométriques sécurisées approuvées avec succès.",
"De-activate":"Les informations biométriques sécurisées ont été rejetées avec succès."
}
},
"serverError": {
"PMS_COR_001": "Paramètre d'entrée manquant",
"PMS_PRT_002": "Le groupe de stratégies n'existe pas",
Expand Down Expand Up @@ -601,7 +608,11 @@
"PMS_POL_055": "La politique publiée ne peut pas être mise à jour.",
"PMS_POL_056": "Les stratégies actives existent sous le groupe de stratégies.",
"PMS_POL_057": "L'apiKey active existe sous la stratégie.",
"PMS_POL_058": "Le statut ne peut pas être modifié pour la politique publiée.;"
"PMS_POL_058": "Le statut ne peut pas être modifié pour la politique publiée.;",
"KER-PCM-006": "Certificats d'autorité de certification racine/autorité de certification intermédiaire introuvables.",
"KER-PCM-015": "Certificat auto-signé non autorisé en tant que partenaire.",
"KER-PCM-004": "Les dates des certificats ne sont pas valides.",
"KER-KMS-013": "Erreur d'analyse du certificat. dépassement de signature, octets = 917"
},
"generickeys":{
"save": "Enregistrer",
Expand All @@ -611,7 +622,9 @@
"updatedSuccessfully": "Mise à jour réussie",
"createdSuccessfully": "Création réussie",
"success": "Succès",
"error": "Erreur"
"error": "Erreur",
"failure":"Échec !",
"certificate": "Certificat"
},
"paginatorIntl": {
"itemsPerPageLabel": "objets par page",
Expand Down
19 changes: 16 additions & 3 deletions pmp-ui/src/assets/i18n/hin.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@
"chooseFile": "फाइलें चुनें",
"uploadYourFile": "अपनी फ़ाइल अपलोड करें",
"button": "डालना",
"cancel": "रद्द करना"
"cancel": "रद्द करना",
"supportedDoc":"केवल PEM या CER प्रारूप फ़ाइल समर्थित है।"
},
"filters": {
"titleTxt": "फ़िल्टर जोड़ें",
Expand All @@ -473,6 +474,12 @@
"fieldNameValidation": " आवश्यक है",
"invalidJson": "नीतियों के डेटा के लिए अमान्य JSON प्रारूप"
},
"successMessages":{
"sbi":{
"Activate":"सुरक्षित बायोमेट्रिक विवरण सफलतापूर्वक स्वीकृत।",
"De-activate":"सुरक्षित बायोमेट्रिक विवरण सफलतापूर्वक अस्वीकृत कर दिया गया।"
}
},
"serverError": {
"PMS_COR_001": "गुम इनपुट पैरामीटर",
"PMS_PRT_002": "नीति समूह मौजूद नहीं है",
Expand Down Expand Up @@ -601,7 +608,11 @@
"PMS_POL_055": "प्रकाशित नीति को अपडेट नहीं किया जा सकता है।",
"PMS_POL_056": "नीति समूह के अंतर्गत सक्रिय नीतियां मौजूद हैं।",
"PMS_POL_057": "नीति के तहत सक्रिय apiKey मौजूद है।",
"PMS_POL_058": "प्रकाशित नीति के लिए स्थिति नहीं बदली जा सकती.;"
"PMS_POL_058": "प्रकाशित नीति के लिए स्थिति नहीं बदली जा सकती.;",
"KER-PCM-006": "रूट सीए/इंटरमीडिएट सीए प्रमाणपत्र नहीं मिले।",
"KER-PCM-015": "स्वहस्ताक्षरित प्रमाणपत्र को भागीदार के रूप में अनुमति नहीं है।",
"KER-PCM-004": "प्रमाणपत्र दिनांक मान्य नहीं हैं.",
"KER-KMS-013": "प्रमाणपत्र पार्सिंग त्रुटि.हस्ताक्षरित ओवररन, बाइट्स = 917"
},
"generickeys":{
"save": "सहेजें",
Expand All @@ -611,7 +622,9 @@
"updatedSuccessfully": "सफलतापूर्वक अपडेट किया गया",
"createdSuccessfully": "सफलतापूर्वक बनाया गया",
"success": "सफलता",
"error": "त्रुटि"
"error": "त्रुटि",
"failure":"असफलता !",
"certificate": "प्रमाणपत्र"
},
"paginatorIntl": {
"itemsPerPageLabel": "आइटम प्रति पेज",
Expand Down
Loading

0 comments on commit 4b5bc77

Please sign in to comment.