LT-288: Fixing viewer crash for non associated studies
This commit is contained in:
parent
0eeb05e72b
commit
396f83b449
@ -26,8 +26,14 @@ class TimepointApi {
|
||||
});
|
||||
}
|
||||
|
||||
// Return the prior timepoint
|
||||
prior() {
|
||||
const latestDate = this.current().latestDate;
|
||||
const current = this.current();
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const latestDate = current.latestDate;
|
||||
return this.timepoints.findOne({
|
||||
latestDate: {
|
||||
$lt: latestDate
|
||||
@ -41,9 +47,15 @@ class TimepointApi {
|
||||
|
||||
// Return only the current and prior Timepoints
|
||||
currentAndPrior() {
|
||||
let timepoints = [this.current()];
|
||||
const timepoints = [];
|
||||
|
||||
const current = this.current();
|
||||
if (current) {
|
||||
timepoints.push(current);
|
||||
}
|
||||
|
||||
const prior = this.prior();
|
||||
if (prior) {
|
||||
if (current && prior._id !== current._id) {
|
||||
timepoints.push(prior);
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,14 @@ Template.caseProgress.onCreated(() => {
|
||||
instance.progressText = new ReactiveVar();
|
||||
instance.isLocked = new ReactiveVar();
|
||||
|
||||
// Get the current timepoint
|
||||
const current = instance.data.timepointApi.current();
|
||||
|
||||
// Stop here if no timepoint was found
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.timepointId) {
|
||||
console.warn('Case has no timepointId');
|
||||
return;
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
<template name="lesionTable">
|
||||
<div id="lesionTableContainer">
|
||||
<div class="lesionTableLayoutChanger viewerRoundedButtonGroup">
|
||||
{{>roundedButtonGroup buttonGroupData}}
|
||||
</div>
|
||||
<div class="lesionTableTimepointHeaderRow">
|
||||
{{#each this.timepoints.get}}
|
||||
{{>lesionTableTimepointHeader}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{>lesionTableView (clone this)}}
|
||||
{{#if this.timepoints.get.length}}
|
||||
<div class="lesionTableLayoutChanger viewerRoundedButtonGroup">
|
||||
{{>roundedButtonGroup buttonGroupData}}
|
||||
</div>
|
||||
<div class="lesionTableTimepointHeaderRow">
|
||||
{{#each this.timepoints.get}}
|
||||
{{>lesionTableTimepointHeader}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{>lesionTableView (clone this)}}
|
||||
{{else}}
|
||||
<h3 class="p-x-1 text-center">No associated timepoint</h3>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -16,7 +16,14 @@ Template.lesionTableHeaderRow.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
instance.maxNumLesions = new ReactiveVar();
|
||||
|
||||
// Get the current timepoint
|
||||
const current = instance.data.timepointApi.current();
|
||||
|
||||
// Stop here if no timepoint was found
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timepointType = current.timepointType;
|
||||
|
||||
if (!instance.data.currentTimepointId) {
|
||||
|
||||
@ -53,7 +53,10 @@ Template.toolbarSection.helpers({
|
||||
},
|
||||
|
||||
toolbarButtons() {
|
||||
var buttonData = [];
|
||||
// Check if the measure tools shall be disabled
|
||||
const isMesureDisabled = !Template.instance().data.timepointApi.currentTimepointId;
|
||||
const buttonData = [];
|
||||
|
||||
buttonData.push({
|
||||
id: 'zoom',
|
||||
title: 'Zoom',
|
||||
@ -86,14 +89,16 @@ Template.toolbarSection.helpers({
|
||||
id: 'bidirectional',
|
||||
title: 'Target',
|
||||
classes: 'imageViewerTool rm-l-3',
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-target'
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-target',
|
||||
disabled: isMesureDisabled
|
||||
});
|
||||
|
||||
buttonData.push({
|
||||
id: 'nonTarget',
|
||||
title: 'Non-Target',
|
||||
classes: 'imageViewerTool toolbarSectionButton',
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-non-target'
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-non-target',
|
||||
disabled: isMesureDisabled
|
||||
});
|
||||
|
||||
buttonData.push({
|
||||
@ -107,28 +112,33 @@ Template.toolbarSection.helpers({
|
||||
},
|
||||
|
||||
extraToolbarButtons() {
|
||||
let buttonData = [];
|
||||
// Check if the measure tools shall be disabled
|
||||
const isMesureDisabled = !Template.instance().data.timepointApi.currentTimepointId;
|
||||
const buttonData = [];
|
||||
|
||||
// TODO: Get real icons for CR / UN / EX
|
||||
buttonData.push({
|
||||
id: 'crTool',
|
||||
title: 'CR Tool',
|
||||
classes: 'imageViewerTool toolbarSectionButton',
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-temp'
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-temp',
|
||||
disabled: isMesureDisabled
|
||||
});
|
||||
|
||||
buttonData.push({
|
||||
id: 'unTool',
|
||||
title: 'UN Tool',
|
||||
classes: 'imageViewerTool toolbarSectionButton',
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-temp'
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-temp',
|
||||
disabled: isMesureDisabled
|
||||
});
|
||||
|
||||
buttonData.push({
|
||||
id: 'exTool',
|
||||
title: 'EX Tool',
|
||||
classes: 'imageViewerTool toolbarSectionButton',
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-temp'
|
||||
svgLink: '/packages/viewerbase/assets/icons.svg#icon-tools-measure-temp',
|
||||
disabled: isMesureDisabled
|
||||
});
|
||||
|
||||
return buttonData;
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
<template name="toolbarSectionButton">
|
||||
{{ #if this.buttonTemplateName }}
|
||||
{{> UI.dynamic template=this.buttonTemplateName data=this }}
|
||||
{{ else }}
|
||||
<div id="{{this.id}}"
|
||||
class="toolbarSectionButton rp-x-1 {{this.classes}} {{activeClass}}"
|
||||
title="{{this.title}}">
|
||||
<div class="svgContainer">
|
||||
{{ #if this.svgLink }}
|
||||
<svg>
|
||||
<use xlink:href={{this.svgLink}}></use>
|
||||
</svg>
|
||||
{{ else }}
|
||||
<i class={{iconClasses}}></i>
|
||||
{{ /if }}
|
||||
{{#if this.buttonTemplateName}}
|
||||
{{>UI.dynamic template=this.buttonTemplateName data=this}}
|
||||
{{else}}
|
||||
<div id="{{this.id}}"
|
||||
class="toolbarSectionButton rp-x-1 {{this.classes}} {{activeClass}} {{#if this.disabled}}disabled{{/if}}"
|
||||
title="{{this.title}}">
|
||||
<div class="svgContainer">
|
||||
{{#if this.svgLink}}
|
||||
<svg>
|
||||
<use xlink:href={{this.svgLink}}></use>
|
||||
</svg>
|
||||
{{else}}
|
||||
<i class={{iconClasses}}></i>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="buttonLabel">
|
||||
{{this.title}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttonLabel">
|
||||
{{this.title}}
|
||||
</div>
|
||||
</div>
|
||||
{{ /if }}
|
||||
{{/if}}
|
||||
</template>
|
||||
|
||||
@ -15,6 +15,11 @@ Template.toolbarSectionButton.helpers({
|
||||
|
||||
Template.toolbarSectionButton.events({
|
||||
'click .imageViewerTool'(event, instance) {
|
||||
// Stop here if the tool is disabled
|
||||
if ($(event.currentTarget).hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tool = event.currentTarget.id;
|
||||
const elements = instance.$('.imageViewerViewport');
|
||||
|
||||
@ -29,6 +34,11 @@ Template.toolbarSectionButton.events({
|
||||
}
|
||||
},
|
||||
'click .imageViewerCommand'(event, instance) {
|
||||
// Stop here if the tool is disabled
|
||||
if ($(event.currentTarget).hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const command = event.currentTarget.id;
|
||||
if (!OHIF.viewer.functionList || !OHIF.viewer.functionList.hasOwnProperty(command)) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user