Skip to content

Commit

Permalink
use tools/find to display most recent studies
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Oct 16, 2024
1 parent 776fb2e commit c7bac83
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
7 changes: 7 additions & 0 deletions WebApplication/src/components/StudyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,14 @@ export default {
await this.$store.dispatch('studies/clearStudies');
if (this.uiOptions.StudyListContentIfNoSearch == "empty") {
return;
} else if (this.uiOptions.StudyListContentIfNoSearch == "most-recents" && this['configuration/hasExtendedChanges']) {
const studies = await api.getMostRecentStudies((this.filterLabels.length > 0 ? this.filterLabels[0] : null));
for (const study of studies) {
this.$store.dispatch('studies/addStudy', { studyId: study["ID"], study: study, reloadStats: false });
}
} else if (this.uiOptions.StudyListContentIfNoSearch == "most-recents") {
// legacy code
if (this.isLoadingLatestStudies) {
// if currently loading, stop it
this.shouldStopLoadingLatestStudies = true;
Expand Down
26 changes: 26 additions & 0 deletions WebApplication/src/orthancApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,32 @@ export default {
signal: window.axiosFindStudiesAbortController.signal
})).data;
},
async getMostRecentStudies(label) {
await this.cancelFindStudies();
window.axiosFindStudiesAbortController = new AbortController();

let payload = {
"Level": "Study",
"Limit": store.state.configuration.uiOptions.MaxStudiesDisplayed,
"Query": {},
"RequestedTags": store.state.configuration.requestedTagsForStudyList,
"OrderBy" : [{
'Type': 'Metadata',
'Key': 'LastUpdate',
'Direction': 'DESC'
}],
"Expand": true
};
if (label) {
payload["Labels"] = [label];
payload["LabelsConstraint"] = "All";
}

return (await axios.post(orthancApiUrl + "tools/find", payload,
{
signal: window.axiosFindStudiesAbortController.signal
})).data;
},
async getLastChangeId() {
const response = (await axios.get(orthancApiUrl + "changes?last"));
return response.data["Last"];
Expand Down
2 changes: 1 addition & 1 deletion release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Pending changes in the mainline
===============================

Changes:
- Optimized loading of "most-recent" studies when the Orthanc DB supports "ExtendedChanges"
- Optimized loading of "most-recent" studies when the Orthanc DB supports "ExtendedFind"
- Disable UI components on ReadOnly systems.
- new configuration "EnableLabelsCount" to enable/disable the display of the number of
studies with each label.
Expand Down

0 comments on commit c7bac83

Please sign in to comment.