allow custom dashboard to request only a fixed set of colors
Costa Tsaousis (ktsaou) committed
Jan 14, 2018 at 12:44 UTC
1f03e5a95eb9f3779213683d3d6b5eb3fc885a80
2 files changed
+13
-5
web/dashboard.js
+12
-4
@@ -3721,18 +3721,26 @@ var NETDATA = window.NETDATA || {};
3721
3722
if(this.colors_available.length === 0) {
3723
var len;
3724
+ var copy_standard = true;
3725
3726
// copy the custom colors
3727
if(this.colors_custom !== null) {
3728
len = this.colors_custom.length;
3729
+ if(len > 0 && this.colors_custom[len - 1] === 'ONLY') {
3730
+ len--;
3731
+ copy_standard = false;
3732
+ }
3733
+
3734
while (len--)
3735
this.colors_available.unshift(this.colors_custom[len]);
3736
}
3737
3732
- // copy the standard palette colors
3733
- len = NETDATA.themes.current.colors.length;
3734
- while(len--)
3735
- this.colors_available.unshift(NETDATA.themes.current.colors[len]);
3738
+ if(copy_standard === true) {
3739
+ // copy the standard palette colors
3740
+ len = NETDATA.themes.current.colors.length;
3741
+ while (len--)
3742
+ this.colors_available.unshift(NETDATA.themes.current.colors[len]);
3743
+ }
3744
}
3745
3746
// assign a color to this dimension
web/index.html
+1
-1
@@ -5622,6 +5622,6 @@
5622
</div>
5623
</div>
5624
<div id="hiddenDownloadLinks" style="display: none;" hidden></div>
5625
- <script type="text/javascript" src="dashboard.js?v20180114-1"></script>
5625
+ <script type="text/javascript" src="dashboard.js?v20180114-2"></script>
5626
</body>
5627
</html>