properly check highlights stored in snapshots
Costa Tsaousis (ktsaou) committed
Nov 18, 2017 at 22:07 UTC
ce4bc0d9dfd6e2d8203c0046be555ce9885f09d6
1 file changed
+14
-2
web/index.html
+14
-2
@@ -659,6 +659,12 @@
659
},
660
661
netdataHighlightCallback: function(status, after, before) {
662
+ if(status === true && (after === null || before === null || after <= 0 || before <= 0 || after < before)) {
663
+ status = false;
664
+ after = 0;
665
+ before = 0;
666
+ }
667
+
668
if(netdataSnapshotData === null) {
669
urlOptions.highlight = status;
670
urlOptions.highlight_after = Math.round(after);
@@ -666,7 +672,7 @@
672
urlOptions.hashUpdate();
673
}
674
669
- if(status === true) {
675
+ if(status === true && after > 0 && before > 0 && after < before) {
676
var d1 = NETDATA.dateTime.localeDateString(after);
677
var d2 = NETDATA.dateTime.localeDateString(before);
678
if(d1 === d2) d2 = '';
@@ -3110,7 +3116,13 @@
3116
tmpSnapshotData.uncompress = snapshotOptions.compressions[tmpSnapshotData.compression].uncompress;
3117
netdataSnapshotData = tmpSnapshotData;
3118
3113
- if( typeof tmpSnapshotData.highlight_after_ms !== 'undefined' && tmpSnapshotData.highlight_after_ms !== null && typeof tmpSnapshotData.highlight_before_ms !== 'undefined' && tmpSnapshotData.highlight_before_ms !== null) {
3119
+ if( typeof tmpSnapshotData.highlight_after_ms !== 'undefined'
3120
+ && tmpSnapshotData.highlight_after_ms !== null
3121
+ && tmpSnapshotData.highlight_after_ms > 0
3122
+ && typeof tmpSnapshotData.highlight_before_ms !== 'undefined'
3123
+ && tmpSnapshotData.highlight_before_ms !== null
3124
+ && tmpSnapshotData.highlight_before_ms > 0
3125
+ ) {
3126
NETDATA.options.highlight_after = tmpSnapshotData.highlight_after_ms;
3127
NETDATA.options.highlight_before = tmpSnapshotData.highlight_before_ms;
3128
urlOptions.netdataHighlightCallback(true, tmpSnapshotData.highlight_after_ms, tmpSnapshotData.highlight_before_ms);