Skip to content

Commit

Permalink
Add link to observation detail page from scheduling plot
Browse files Browse the repository at this point in the history
  • Loading branch information
eheinrich committed Sep 20, 2019
1 parent 68fd408 commit 502c8c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion static/js/components/observationhistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
}
};
return {
options: options
options: options,
plotItemToObservationIds: {},
};
},
computed: {
Expand Down Expand Up @@ -113,6 +114,7 @@
if (observation.start !== previousObservation.start || observation.site !== previousObservation.site || observation.state !== previousObservation.state
|| observation.enclosure !== previousObservation.enclosure || observation.telescope !== previousObservation.telescope) {
let className = 'timeline_observation ' + previousObservation.state;
this.plotItemToObservationIds[index] = previousObservation.id;
visGroups.add({id: index, content: previousObservationIndex});
visData.add({
id: index,
Expand All @@ -130,6 +132,7 @@
}
previousObservation = observation;
}
this.plotItemToObservationIds[index] = previousObservation.id;
visGroups.add({id: index, content: previousObservationIndex});
visData.add({
id: index,
Expand Down Expand Up @@ -176,6 +179,13 @@
},
mounted: function () {
this.plot = this.buildPlot();
let that = this;
this.plot.on('click', function(event) {
let observationId = that.plotItemToObservationIds[event.item];
if (observationId) {
window.location.assign('/observations/' + observationId);
}
})
},
methods: {
buildPlot: function () {
Expand Down

0 comments on commit 502c8c8

Please sign in to comment.