Skip to content

Commit

Permalink
UI: Improve rendering speed of the filters #4628
Browse files Browse the repository at this point in the history
  • Loading branch information
shral committed Dec 13, 2024
1 parent ae770ac commit 71ff2cb
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 25 deletions.
1 change: 1 addition & 0 deletions dcm4chee-arc-ui2/src/app/study/study/study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6790,6 +6790,7 @@ export class StudyComponent implements OnInit, OnDestroy, AfterContentChecked{

// aets;
initWebApps(){
this.setSchema();
let aetsTemp;
let aesTemp;
let webAppsTemp:DcmWebApp[];
Expand Down
65 changes: 40 additions & 25 deletions dcm4chee-arc-ui2/src/app/study/study/study.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class StudyService {
selectedElements:SelectionActionElement;
institutions;
dcmuiInstitutionNameFilterType;
sharedObservables$:any = {};
constructor(
private aeListService: AeListService,
private $http: J4careHttpService,
Expand All @@ -81,8 +82,15 @@ export class StudyService {
) {}

getWebApps(filter?:any) {
return this.webAppListService.getWebApps(filter)
.pipe(map((webApp:any)=> this.webAppHasPermission(webApp)));
const filterMarker = [filter?.dcmWebServiceClass || "", filter?.dicomDeviceName || ""].join("_") || "all";
if(!(this.sharedObservables$["webapps"] && this.sharedObservables$["webapps"][filterMarker])){
this.sharedObservables$["webapps"] = this.sharedObservables$["webapps"] || {};
this.sharedObservables$["webapps"][filterMarker] = this.webAppListService.getWebApps(filter)
.pipe(
map((webApp:any)=> this.webAppHasPermission(webApp)),
shareReplay(1));
}
return this.sharedObservables$["webapps"][filterMarker]
}

getEntrySchema(devices, aetWebService): { schema: FilterSchema, lineLength: number } {
Expand Down Expand Up @@ -414,27 +422,29 @@ export class StudyService {

});
}
schema.push({
tag: "html-select",
options: studyWebService.webServices.map((webApp: DcmWebApp) => {
return new SelectDropdown(
webApp.dcmWebAppName,
webApp.dcmWebAppName,
webApp.dicomDescription,
undefined,
undefined,
webApp,
(studyWebService.selectedWebService && studyWebService.selectedWebService.dcmWebAppName === webApp.dcmWebAppName)
);
}),
filterKey: 'webApp',
text: $localize `:@@web_app_service:Web App Service`,
title: $localize `:@@web_app_service:Web App Service`,
showStar:tab === "diff",
placeholder: $localize `:@@web_app_service:Web App Service`,
cssClass: 'study_order',
showSearchField: true
});
if(studyWebService){
schema.push({
tag: "html-select",
options: studyWebService?.webServices.map((webApp: DcmWebApp) => {
return new SelectDropdown(
webApp.dcmWebAppName,
webApp.dcmWebAppName,
webApp.dicomDescription,
undefined,
undefined,
webApp,
(studyWebService.selectedWebService && studyWebService.selectedWebService.dcmWebAppName === webApp.dcmWebAppName)
);
}),
filterKey: 'webApp',
text: $localize `:@@web_app_service:Web App Service`,
title: $localize `:@@web_app_service:Web App Service`,
showStar:tab === "diff",
placeholder: $localize `:@@web_app_service:Web App Service`,
cssClass: 'study_order',
showSearchField: true
});
}
if (j4care.arrayIsNotEmpty(studyWebService,"webServices"))
schema.push({
tag: "button",
Expand Down Expand Up @@ -998,7 +1008,6 @@ export class StudyService {
}

getDiffAttributeSet = (baseUrl?: string) => this.$http.get(`${baseUrl ? j4care.addLastSlash(baseUrl): j4care.addLastSlash(this.appService.baseUrl)}attribute-set/DIFF_RS`);
sharedObservables$ = {};
getAets(){
if(!this.sharedObservables$["aets"]){
this.sharedObservables$["aets"] = this.aeListService.getAets().pipe(shareReplay(1))
Expand Down Expand Up @@ -4896,7 +4905,13 @@ export class StudyService {
return this.$http.put(`${url}/${studyUID}/expire/${expiredDate}${localParams}`, {})
}

getExporters = () => this.$http.get(`${j4care.addLastSlash(this.appService.baseUrl)}export`);
getExporters(){
if(!this.sharedObservables$["export"]){
this.sharedObservables$["export"] = this.$http.get(`${j4care.addLastSlash(this.appService.baseUrl)}export`)
.pipe(shareReplay(1));
}
return this.sharedObservables$["export"];
}

deleteStudy = (studyInstanceUID: string, dcmWebApp: DcmWebApp, param) =>
this.$http.delete(`${this.getDicomURL("study", dcmWebApp)}/${studyInstanceUID}${j4care.param(param)}`);
Expand Down

0 comments on commit 71ff2cb

Please sign in to comment.