Commit 633f067a091daae589e36e1d604b806e159a528e

Authored by Benjamin Renard
1 parent 6f1f2556

Fix regression with Open Reference in interactive plot

js/app/views/PlotComponents/PlotContextManager.js
@@ -82,16 +82,22 @@ Ext.define('amdaPlotComp.PlotContextManager', { @@ -82,16 +82,22 @@ Ext.define('amdaPlotComp.PlotContextManager', {
82 var intToPush = { 82 var intToPush = {
83 'id': id, 83 'id': id,
84 'start': interval.start, 84 'start': interval.start,
85 - 'stop': interval.stop 85 + 'stop': interval.stop,
  86 + 'links': []
86 }; 87 };
87 - if ((columnToShow != '') && (columnName != '') && interval.hasOwnProperty('params')) {  
88 - Ext.Object.each(interval.params, function (param_id, param_value) {  
89 - if (param_id == columnToShow) { 88 +
  89 + Ext.Object.each(interval.params, function (param_id, param_value) {
  90 + if (interval.hasOwnProperty('params')) {
  91 + if ((columnToShow != '') && (columnName != '') && (param_id == columnToShow)) {
90 intToPush['info'] = columnName + ': ' + param_value; 92 intToPush['info'] = columnName + ': ' + param_value;
91 - return;  
92 } 93 }
93 - });  
94 - } 94 + if (param_value.toLowerCase().startsWith("http://") || param_value.toLowerCase().startsWith("https://")) {
  95 + if (intToPush['links'].indexOf(param_value) < 0) {
  96 + intToPush['links'].push(param_value);
  97 + }
  98 + }
  99 + }
  100 + });
95 101
96 intervalsOver[parameter.ttorcat.name].push(intToPush); 102 intervalsOver[parameter.ttorcat.name].push(intToPush);
97 103
js/app/views/PlotTabResultUI.js
@@ -502,21 +502,9 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, { @@ -502,21 +502,9 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
502 502
503 if (timeAxisContext) { 503 if (timeAxisContext) {
504 var intervals = amdaPlotComp.PlotContextManager.getIntervalsOverMouse(me.crtContext, panel, crtTimestamp); 504 var intervals = amdaPlotComp.PlotContextManager.getIntervalsOverMouse(me.crtContext, panel, crtTimestamp);
505 - if (Object.keys(intervals).length > 0) {  
506 - var links = [];  
507 - Ext.Object.each(intervals, function (ttorcatname, intervals) {  
508 - Ext.each(intervals, function (interval) {  
509 - if (interval.params) {  
510 - Ext.Object.each(interval.params, function (paramKey, paramValue) {  
511 - if (paramValue.toLowerCase().startsWith("http://") || paramValue.toLowerCase().startsWith("https://")) {  
512 - if (links.indexOf(paramValue) < 0) {  
513 - links.push(paramValue);  
514 - }  
515 - }  
516 - });  
517 - }  
518 - });  
519 - }); 505 +
  506 + if (Object.keys(intervals).length > 0) {
  507 + var links = me.getIntervalsLinks(intervals);
520 if (links.length > 0) { 508 if (links.length > 0) {
521 var menu = Ext.create('Ext.menu.Menu', { plain: true }); 509 var menu = Ext.create('Ext.menu.Menu', { plain: true });
522 Ext.each(links, function (link) { 510 Ext.each(links, function (link) {
@@ -586,6 +574,24 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, { @@ -586,6 +574,24 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
586 return intervalText; 574 return intervalText;
587 }, 575 },
588 576
  577 + getIntervalsLinks: function(intervals) {
  578 + var links = [];
  579 + Ext.Object.each(intervals, function (ttorcatname, intervals) {
  580 + Ext.each(intervals, function (interval) {
  581 + if (interval.hasOwnProperty('links') && interval.links.length > 0) {
  582 + Ext.each(interval.links, function (link) {
  583 + if (link.toLowerCase().startsWith("http://") || link.toLowerCase().startsWith("https://")) {
  584 + if (links.indexOf(link) < 0) {
  585 + links.push(link);
  586 + }
  587 + }
  588 + });
  589 + }
  590 + });
  591 + });
  592 + return links;
  593 + },
  594 +
589 updateTimeTableInfo: function () { 595 updateTimeTableInfo: function () {
590 if (!this.navToolBar) 596 if (!this.navToolBar)
591 return; 597 return;