@cryptotaxi247 / netdata-1 / commits / 5b57fc441

Snapshot uniqueId fix (#6400)

* when generating uniqueId for snapshot, dont take global NETDATA into account, because it can be different during snapshot exporting * make chartDataUniqueID() method backwards-compatible with old snapshots

Jacek Kolasa committed Jul 9, 2019 at 17:02 UTC 5b57fc441c40959514c4e2d0863be2e6a417e352
2 files changed +10 -6
web/gui/dashboard.js
+5 -3
@@ -8118,10 +8118,10 @@ let chartState = function (element) {
8118 };
8119
8120 this.chartDataUniqueID = function () {
8121 - return this.id + ',' + this.library_name + ',' + this.dimensions + ',' + this.chartURLOptions();
8121 + return this.id + ',' + this.library_name + ',' + this.dimensions + ',' + this.chartURLOptions(true);
8122 };
8123
8124 - this.chartURLOptions = function () {
8124 + this.chartURLOptions = function (isForUniqueId) {
8125 let ret = '';
8126
8127 if (this.override_options !== null) {
@@ -8136,7 +8136,9 @@ let chartState = function (element) {
8136
8137 ret += '%7C' + 'jsonwrap';
8138
8139 - if (NETDATA.options.current.eliminate_zero_dimensions) {
8139 + // always add `nonzero` when it's used to create a chartDataUniqueID
8140 + // we cannot just remove `nonzero` because of backwards compatibility with old snapshots
8141 + if (isForUniqueId || NETDATA.options.current.eliminate_zero_dimensions) {
8142 ret += '%7C' + 'nonzero';
8143 }
8144
web/gui/src/dashboard.js/main.js
+5 -3
@@ -3071,10 +3071,10 @@ let chartState = function (element) {
3071 };
3072
3073 this.chartDataUniqueID = function () {
3074 - return this.id + ',' + this.library_name + ',' + this.dimensions + ',' + this.chartURLOptions();
3074 + return this.id + ',' + this.library_name + ',' + this.dimensions + ',' + this.chartURLOptions(true);
3075 };
3076
3077 - this.chartURLOptions = function () {
3077 + this.chartURLOptions = function (isForUniqueId) {
3078 let ret = '';
3079
3080 if (this.override_options !== null) {
@@ -3089,7 +3089,9 @@ let chartState = function (element) {
3089
3090 ret += '%7C' + 'jsonwrap';
3091
3092 - if (NETDATA.options.current.eliminate_zero_dimensions) {
3092 + // always add `nonzero` when it's used to create a chartDataUniqueID
3093 + // we cannot just remove `nonzero` because of backwards compatibility with old snapshots
3094 + if (isForUniqueId || NETDATA.options.current.eliminate_zero_dimensions) {
3095 ret += '%7C' + 'nonzero';
3096 }
3097