faster linking from registry to server on alarm clicks
Costa Tsaousis (ktsaou) committed
Sep 11, 2016 at 22:39 UTC
776305b75765e4fd68172921c52676e587367ef6
3 files changed
+24
-16
web/dashboard.js
+6
-1
@@ -18,6 +18,8 @@
18
// var netdataShowHelp = false; // enable/disable help (default enabled)
19
// var netdataShowAlarms = true; // enable/disable alarms checks and notifications (default disabled)
20
//
21
+// var netdataRegistryAfterMs = 1500 // the time to consult to registry on startup
22
+//
23
// You can also set the default netdata server, using the following.
24
// When this variable is not set, we assume the page is hosted on your
25
// netdata server already.
@@ -175,6 +177,9 @@
177
if(typeof netdataShowAlarms === 'undefined')
178
netdataShowAlarms = false;
179
180
+ if(typeof netdataRegistryAfterMs !== 'number' || netdataRegistryAfterMs < 0)
181
+ netdataRegistryAfterMs = 1500;
182
+
183
if(typeof netdataRegistry === 'undefined') {
184
// backward compatibility
185
if(typeof netdataNoRegistry !== 'undefined' && netdataNoRegistry === false)
@@ -3461,7 +3466,7 @@
3466
setTimeout(NETDATA.alarms.init, 1000);
3467
3468
// Registry initialization
3464
- setTimeout(NETDATA.registry.init, 1500);
3469
+ setTimeout(NETDATA.registry.init, netdataRegistryAfterMs);
3470
};
3471
3472
// ----------------------------------------------------------------------------------------------------------------
web/goto-host-from-alarm.html
+17
-14
@@ -13,10 +13,11 @@
13
14
<script>
15
var netdataRegistry = true;
16
+ var netdataRegistryAfterMs = 0;
17
var netdataTheme = 'slate';
18
var netdataShowHelp = true;
19
</script>
19
- <script type="text/javascript" src="dashboard.js?v46"></script>
20
+ <script type="text/javascript" src="dashboard.js?v47"></script>
21
22
<script>
23
var urlOptions = {
@@ -41,15 +42,21 @@
42
if(urlOptions.hasProperty(p[0]) && typeof p[1] !== 'undefined')
43
urlOptions[p[0]] = decodeURIComponent(p[1]);
44
}
45
+
46
+ if(typeof urlOptions.family !== 'string')
47
+ urlOptions.family = '';
48
+
49
+ if(typeof urlOptions.chart !== 'string')
50
+ urlOptions.chart = '';
51
}
52
53
function netdataURL(url) {
54
return url + '#top'
55
+ ';nowelcome=1'
49
- + ';show_alarms=1'
50
- + ';chart=' + encodeURIComponent(urlOptions.chart.toString())
51
- + ';family=' + encodeURIComponent(urlOptions.family.toString())
52
- + ';alarm=' + encodeURIComponent(urlOptions.alarm.toString())
56
+ // + ';show_alarms=1'
57
+ + ';chart=' + encodeURIComponent(urlOptions.chart)
58
+ + ';family=' + encodeURIComponent(urlOptions.family)
59
+ + ';alarm=' + encodeURIComponent(urlOptions.alarm)
60
+ ';alarm_unique_id=' + urlOptions.alarm_unique_id.toString()
61
+ ';alarm_id=' + urlOptions.alarm_id.toString()
62
+ ';alarm_event_id=' + urlOptions.alarm_event_id.toString()
@@ -115,6 +122,11 @@
122
}
123
124
var netdataRegistryCallback = function(machines_array) {
125
+ if(typeof urlOptions.host !== 'string') {
126
+ document.getElementById('bodylog').innerHTML = "Sorry... bad request.";
127
+ return;
128
+ }
129
+
130
document.getElementById('message').innerHTML = 'These are the URLs this machine is known:';
131
132
if(document.location.toString().startsWith('https://'))
@@ -137,15 +149,6 @@
149
};
150
151
netdataQueryParse();
140
-
141
- if(typeof urlOptions.host !== 'string')
142
- document.getElementById('bodylog').innerHTML = "Sorry... bad request.";
143
-
144
- if(typeof urlOptions.family !== 'string')
145
- urlOptions.family = '';
146
-
147
- if(typeof urlOptions.chart !== 'string')
148
- urlOptions.chart = '';
152
</script>
153
154
</head>
web/index.html
+1
-1
@@ -613,7 +613,7 @@
613
</script>
614
615
<!-- load the dashboard manager - it will do the rest -->
616
- <script type="text/javascript" src="dashboard.js?v46"></script>
616
+ <script type="text/javascript" src="dashboard.js?v47"></script>
617
</head>
618
<body data-spy="scroll" data-target="#sidebar">
619
<div id="loadOverlay" class="loadOverlay" style="background-color: #888; color: #888;">