Skip to content

Commit

Permalink
Fix #3581 : UI Navigation Copy or Move entities / Link Instances to M…
Browse files Browse the repository at this point in the history
…WL : Extend error information displayed to user showing error message returned by service
  • Loading branch information
vrindanayak committed Feb 28, 2022
1 parent c82d8d3 commit f0863a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
18 changes: 18 additions & 0 deletions dcm4chee-arc-ui2/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,24 @@ export class AppService implements OnInit, OnDestroy{
})
}

showMsgCopyMoveLink(res, action:string) {
let msg;
const errorCount = res.filter(result=>result.isError).length;
let errorDetail = _.hasIn(res, "0.error.error.errorMessage") ? _.get(res, "0.error.error.errorMessage") : '';
if(errorCount === res.length){
msg = $localize `:@@study.process_executed_all_failed_detail:${action}:@@action: process executed - all failed:<br>\nErrors: ${errorCount}:@@error:`;
errorDetail = msg + `<br>\n` + errorDetail;
this.showError(errorDetail);
} else {
msg = $localize `:@@study.process_executed_successfully_detailed:${action}:@@action: process executed successfully:<br>\nErrors: ${errorCount}:@@error:<br>\nSuccessful: ${res.length - errorCount}:@@successfull:`;
if(errorCount > 0){
this.showWarning(msg);
}else{
this.showMsg(msg);
}
}
}

showMsgUpdateCharsets(res) {
let detail = '';
let successful = _.hasIn(res, "updated") ? _.get(res, "updated") : '';
Expand Down
28 changes: 2 additions & 26 deletions dcm4chee-arc-ui2/src/app/study/study/study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,19 +659,7 @@ export class StudyComponent implements OnInit, OnDestroy, AfterContentChecked{
this.service.linkStudyToMwl(this.selectedElements, this.studyWebService.selectedWebService, result.reject).subscribe(res=>{
console.log("res",res);
this.cfpLoadingBar.complete();
const errorCount = res.filter(result=>result.isError).length;
let msg;
if(errorCount === res.length){
msg = $localize `:@@study.process_executed_all_failed_detail:${this.service.getTextFromAction(this.selectedElements.action)}:@@action: process executed - all failed:<br>\nErrors: ${errorCount}:@@error:`;
this.appService.showError(msg);
}else{
msg = $localize `:@@study.process_executed_successfully_detailed:${this.service.getTextFromAction(this.selectedElements.action)}:@@action: process executed successfully:<br>\nErrors: ${errorCount}:@@error:<br>\nSuccessful: ${res.length - errorCount}:@@successfull:`;
if(errorCount > 0){
this.appService.showWarning(msg);
}else{
this.appService.showMsg(msg);
}
}
this.appService.showMsgCopyMoveLink(res, this.service.getTextFromAction(this.selectedElements.action));
this.clearClipboard();
},err=>{
this.cfpLoadingBar.complete();
Expand All @@ -682,19 +670,7 @@ export class StudyComponent implements OnInit, OnDestroy, AfterContentChecked{
this.service.copyMove(this.selectedElements, this.studyWebService.selectedWebService,result.reject).subscribe(res=>{
try{
console.log("res",res);
const errorCount = res.filter(result=>result.isError).length;
let msg;
if(errorCount === res.length){
msg = $localize `:@@study.process_executed_all_failed_detail:${this.service.getTextFromAction(this.selectedElements.action)}:@@action: process executed - all failed:<br>\nErrors: ${errorCount}:@@error:`;
this.appService.showError(msg);
}else{
msg = $localize `:@@study.process_executed_successfully_detailed:${this.service.getTextFromAction(this.selectedElements.action)}:@@action: process executed successfully:<br>\nErrors: ${errorCount}:@@error:<br>\nSuccessful: ${res.length - errorCount}:@@successfull:`;
if(errorCount > 0){
this.appService.showWarning(msg);
}else{
this.appService.showMsg(msg);
}
}
this.appService.showMsgCopyMoveLink(res, this.service.getTextFromAction(this.selectedElements.action));
}catch (e) {
this.httpErrorHandler.handleError(res);
}
Expand Down

0 comments on commit f0863a0

Please sign in to comment.