PWV-73 Make study availability reactive
This commit is contained in:
parent
66dd8a0cec
commit
277bf94029
@ -14,7 +14,7 @@
|
||||
<div class="study-date">{{formatDA studyData.studyDate 'D-MMM-YYYY'}}</div>
|
||||
<div class="study-description">{{studyData.studyDescription}}</div>
|
||||
{{else}}
|
||||
<div class="study-availability">{{#if eq studyData.available false}}N/A{{else}}Click to load{{/if}}</div>
|
||||
<div class="study-availability">{{#if eq studyAvailable false}}N/A{{else}}Click to load{{/if}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -113,5 +113,14 @@ Template.studyBrowserItem.helpers({
|
||||
// If we have more than two modalities, change the line height to display multiple rows
|
||||
return 'font-size:0.7em;line-height:1.4em;padding-top:0.5em';
|
||||
}
|
||||
},
|
||||
|
||||
studyAvailable() {
|
||||
const { studyInformation } = Template.instance().data;
|
||||
if (!studyInformation) {
|
||||
return;
|
||||
}
|
||||
|
||||
return studyInformation.available;
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,9 +1,24 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.studyBrowserList.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
if (instance.data.studiesData) {
|
||||
instance.studiesData = instance.data.studiesData;
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyBrowserList.helpers({
|
||||
getStudiesInformation() {
|
||||
const instance = Template.instance();
|
||||
const studiesInformation = instance.data.studiesInformation || [];
|
||||
|
||||
let studiesInformation;
|
||||
if (instance.studiesData) {
|
||||
studiesInformation = instance.studiesData.get() || [];
|
||||
} else {
|
||||
studiesInformation = instance.data.studiesInformation || [];
|
||||
}
|
||||
|
||||
const result = new Map();
|
||||
studiesInformation.forEach(item => result.set(item.studyInstanceUid, item));
|
||||
return Array.from(result.values());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user