Skip to content

Commit

Permalink
added a button to share multiple studies at once
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Nov 27, 2023
1 parent ea2ad07 commit 62dfd76
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
11 changes: 9 additions & 2 deletions WebApplication/src/components/ResourceButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ export default {
return true;
}
},
isShareEnabled() {
if (this.resourceLevel == 'bulk') {
return this.selectedStudiesIds.length > 0
} else {
return true;
}
},
hasWsiButton() {
if (this.resourceLevel != 'series' || !("wsi" in this.installedPlugins)) {
return false;
Expand Down Expand Up @@ -530,9 +537,9 @@ export default {
:cancelText="$t('cancel')" :bodyText="$t(this.deleteResourceBody)" @ok="deleteResource($event)">
</Modal>
</div>
<div class="btn-group" v-if="this.resourceLevel != 'bulk'">
<div class="btn-group">
<button v-if="uiOptions.EnableShares" class="btn btn-sm btn-secondary m-1" type="button" data-bs-toggle="modal"
v-bind:data-bs-target="'#share-modal-' + this.resourceOrthancId">
v-bind:data-bs-target="'#share-modal-' + this.resourceOrthancId" :disabled="!isShareEnabled">
<i class="bi bi-share" data-bs-toggle="tooltip" :title="$t('share.button_title')"></i>
</button>
<ShareModal v-if="uiOptions.EnableShares" :id="'share-modal-' + this.resourceOrthancId"
Expand Down
22 changes: 19 additions & 3 deletions WebApplication/src/components/ShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ export default {
return "" + duration + " " + this.$i18n.t('share.days');
},
async share() {
let resourcesIds = [this.orthancId];
if (this.isBulkSelection) {
resourcesIds = this.selectedStudiesIds;
}
let token = await api.createToken({
tokenType: this.tokens.ShareType, // defined in configuration file
resourcesIds: [this.orthancId],
resourcesIds: resourcesIds,
level: 'study',
validityDuration: this.expirationInDays * 24 * 3600
})
Expand All @@ -55,9 +59,20 @@ export default {
...mapState({
uiOptions: state => state.configuration.uiOptions,
tokens: state => state.configuration.tokens,
selectedStudiesIds: state => state.studies.selectedStudiesIds,
}),
isBulkSelection() {
return !(this.patientMainDicomTags && this.studyMainDicomTags && Object.keys(this.patientMainDicomTags).length > 0 && Object.keys(this.studyMainDicomTags).length > 0);
},
resourceTitle() {
return resourceHelpers.getResourceTitle("study", this.patientMainDicomTags, this.studyMainDicomTags, null, null);
if (!this.isBulkSelection) {
return resourceHelpers.getResourceTitle("study", this.patientMainDicomTags, this.studyMainDicomTags, null, null);
} else {
return "";
}
},
studiesCount() {
return this.selectedStudiesIds.length;
}
},
components: { CopyToClipboardButton }
Expand All @@ -71,7 +86,8 @@ export default {
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalLabel">{{ $t("share.modal_title") + " " + resourceTitle }} </h5>
<h5 class="modal-title" id="modalLabel" v-if="!isBulkSelection">{{ $t("share.modal_title") + " " + resourceTitle }} </h5>
<h5 class="modal-title" id="modalLabel" v-if="isBulkSelection">{{ $t("share.modal_title_multiple_studies", { count: studiesCount}) }} </h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Expand Down
1 change: 1 addition & 0 deletions WebApplication/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"expires_in": "Expires in",
"link": "Link",
"modal_title": "Share study",
"modal_title_multiple_studies": "Share {count} studies",
"never": "never"
},
"show_errors": "Show errors",
Expand Down
1 change: 1 addition & 0 deletions WebApplication/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"expires_in": "Expire dans",
"link": "Lien",
"modal_title": "Partager l'examen",
"modal_title_multiple_studies": "Partager {count} examens",
"never": "jamais"
},
"show_errors": "Afficher les erreurs",
Expand Down
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changes:
- new configuration "UiOptions.ShowSamePatientStudiesFilter" to list the tags that
are used to identify studies belonging to the same patient.
- added Russian translations
- added a button to share multiple studies at once.


1.1.3 (2023-10-04)
Expand Down

0 comments on commit 62dfd76

Please sign in to comment.