consul-templaterb 1.8.5 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/CHANGELOG.md +7 -0
- data/lib/consul/async/version.rb +1 -1
- data/samples/consul-ui/consul-timeline-ui.html.erb +9 -5
- data/samples/consul-ui/js/timeline.js +64 -105
- data/samples/consul-ui/timeline.json.erb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19a273b406bb2bc529957446c5555ffd0ec2792dffc05d6aeb89b26999f474a6
|
4
|
+
data.tar.gz: d720a5cd38cc5ce993bd952690ac893ed011c661bbdffe7830d1ab15993710a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 056bcf7ee589aa4021ff6eaa83db44fa91fa9ef82f392165e42a06172e4a1502a23a9904cd3f46672b26ed20f707ae549fb86c51d226e90e51d8a052355509ed
|
7
|
+
data.tar.gz: 2a62c016f97c615e8f77b400b8bfc5f60ad0a76b64b7c147f8e03fc6dd130de672b954b8c8378ccf9fb5a829b63735c13cee97df9cef84f7397b6bdbc058396c
|
data/.travis.yml
CHANGED
@@ -8,8 +8,6 @@ deploy:
|
|
8
8
|
api_key:
|
9
9
|
secure: l78H6Ow9HCeEz0hcAP2XCXaGGBNRXZ/QLFPNzwyNmHToko9WqZj6mbiNIcVwZ8aCcZEzFmtcB7m1lC1l+mvot3Snfh4OUErK7EXMLiNxUWybtA4qJqmsb2J8JGS69pTohPKagi1YyRbyVs2tJpM5OVazcNxEQDAVkWVxJuPVz6tsn4rXZsL77nTSVyB6YGKgguRGhtS/3M0ufk1ymOpuk8pxXKaotlYGRXmht2OHW+FDQczTMgqu6jiZubjWlNHVxtYn+CsLYNj1BswzD6fF1uous6nchV0if2QW5N4OJVyZCx3yEQ0RswfI8G1kG/Jm8wd2lSknY2wpnd1qkRnAcFlKBpUv8aQd6SdbSO84GTAOvucgK7Mcf0LRvYSE2FyagaAPFSfMybWd+GS26g5AuRPpkhtsS9ijfdIzpudiF18pvnJ+wQj+hWM/THWowYNyKv9NeckxdrULaHPisA346r5eM/EADOhyEUtPm11PFgcheGjff1H4qXGc9gcm50u6mNNHkWv38oGhAPpRk/bU7qybTKqRKNGWGP0MiT4WVIFXp62/JMY7AmufOdJx5Ca5JVsaWoN4fsS9r3+R+FxvRtV9NOrRJVKKaQhzi4UHEUDQ2hQjpLDijD5L0vUsl6arl+nufTt5G5jp9QvdY7fhYT1mpGgWj0hTBd8Pxsl3N8U=
|
10
10
|
gem: consul-templaterb
|
11
|
-
edge:
|
12
|
-
branch: v1.8.47
|
13
11
|
on:
|
14
12
|
tags: true
|
15
13
|
repo: criteo/consul-templaterb
|
data/CHANGELOG.md
CHANGED
data/lib/consul/async/version.rb
CHANGED
@@ -16,15 +16,19 @@
|
|
16
16
|
</div>
|
17
17
|
</div>
|
18
18
|
<div class="col-10 col-m-9">
|
19
|
-
<div id="autorefresh">
|
20
|
-
<input id="autorefresh-check" type="checkbox" checked><label for="autorefresh-check">Autorefresh</label><br/>
|
21
|
-
<label for="autorefresh-check">Max Rows:</label>
|
22
|
-
<input id="maxRows" style="width: 5em;" type="number" min="100" max="<%= (ENV['CONSUL_TIMELINE_BUFFER'] || 10000) %>" step="100" value="5000"/>
|
23
|
-
</div>
|
24
19
|
<h2 class="text-center" id="service-title" style="clear:both"></h2>
|
25
20
|
<div class="row mb-2">
|
26
21
|
<div class="input-group float-left col-12">
|
27
22
|
<input id="instance-filter" type="search" placeholder="filter events" class="form-control" />
|
23
|
+
<div class="input-group-append">
|
24
|
+
<div class="input-group-append">
|
25
|
+
<span class="input-group-text">
|
26
|
+
<input title="Auto-Refresh" id="autorefresh-check" type="checkbox" checked>
|
27
|
+
<span id="numRowsDisplayed" class="lookup badge badge-pill badge-primary">loading…</span>
|
28
|
+
</span>
|
29
|
+
</div>
|
30
|
+
<input id="maxRows" title="max rows to display" placeholder="max rows" style="width: 5em !important;" type="number" min="100" max="<%= (ENV['CONSUL_TIMELINE_BUFFER'] || 10000) %>" step="25" value="5000" class="form-control"/>
|
31
|
+
</div>
|
28
32
|
</div>
|
29
33
|
</div>
|
30
34
|
<div id="instances-wrapper">
|
@@ -134,8 +134,6 @@ class ServiceTimeline {
|
|
134
134
|
}
|
135
135
|
setInterval(sT.reloadDataFromJSON, 10000);
|
136
136
|
}, 150);
|
137
|
-
} else {
|
138
|
-
this.performFiltering($('#instance-filter')[0].value);
|
139
137
|
}
|
140
138
|
}
|
141
139
|
|
@@ -170,61 +168,6 @@ class ServiceTimeline {
|
|
170
168
|
return span;
|
171
169
|
}
|
172
170
|
|
173
|
-
performFiltering(filterValue) {
|
174
|
-
this.refreshTimeout = null;
|
175
|
-
var matcher;
|
176
|
-
try {
|
177
|
-
matcher = new RegExp(filterValue);
|
178
|
-
} catch (e) {
|
179
|
-
var safeReg = filterValue.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&")
|
180
|
-
console.log("Failed to compile regexp for '" + filterValue + "', using strict lookup due to: " + e);
|
181
|
-
matcher = new RegExp(safeReg);
|
182
|
-
}
|
183
|
-
console.log("Filtering on service", serviceTimeline.serviceInstanceFilter, " with ", matcher, "filterValue:=", filterValue);
|
184
|
-
var isCorrectService = function(){ return true; };
|
185
|
-
if (serviceTimeline.serviceInstanceFilter == 'All') {
|
186
|
-
serviceTimeline.serviceInstanceFilter = '';
|
187
|
-
}
|
188
|
-
if (serviceTimeline.serviceInstanceFilter == ''){
|
189
|
-
var stylesheet = document.getElementById('serviceCol');
|
190
|
-
var txt = '';
|
191
|
-
if (filterValue != '') {
|
192
|
-
txt+='tr.filtered { display: none; }';
|
193
|
-
}
|
194
|
-
stylesheet.textContent = txt;
|
195
|
-
} else {
|
196
|
-
var stylesheet = document.getElementById('serviceCol');
|
197
|
-
var txt = '.serviceCol';
|
198
|
-
if (filterValue != '') {
|
199
|
-
txt+=',tr.filtered'
|
200
|
-
}
|
201
|
-
for (var i in this.presentServices) {
|
202
|
-
if (i != serviceTimeline.serviceInstanceFilter) {
|
203
|
-
txt+=',tr.srv-'+i;
|
204
|
-
}
|
205
|
-
}
|
206
|
-
stylesheet.textContent = txt + ' { display: none; }';
|
207
|
-
isCorrectService = function(ui) { return ui.hasClass('srv-' + serviceTimeline.serviceInstanceFilter) };
|
208
|
-
}
|
209
|
-
if (filterValue != '') {
|
210
|
-
$("#all-events > tbody").children('tr').each(function (){
|
211
|
-
var ui = $(this);
|
212
|
-
var shouldShow = isCorrectService(ui) && ui.children('.lookup').is(function (){
|
213
|
-
var elem = $(this);
|
214
|
-
if (elem[0].innerHTML.match(matcher)) {
|
215
|
-
return true;
|
216
|
-
}
|
217
|
-
return false;
|
218
|
-
});
|
219
|
-
if (shouldShow) {
|
220
|
-
ui.removeClass('filtered');
|
221
|
-
} else {
|
222
|
-
ui.addClass('filtered');
|
223
|
-
}
|
224
|
-
});
|
225
|
-
}
|
226
|
-
}
|
227
|
-
|
228
171
|
doFilter() {
|
229
172
|
var filterValue = $('#instance-filter')[0].value;
|
230
173
|
if (this.refreshTimeout) {
|
@@ -232,7 +175,7 @@ class ServiceTimeline {
|
|
232
175
|
this.refreshTimeout = null;
|
233
176
|
}
|
234
177
|
this.refreshTimeout = window.setTimeout(function(){
|
235
|
-
serviceTimeline.
|
178
|
+
serviceTimeline.displayEvents(false, filterValue);
|
236
179
|
}, 16);
|
237
180
|
}
|
238
181
|
|
@@ -286,48 +229,72 @@ class ServiceTimeline {
|
|
286
229
|
}
|
287
230
|
|
288
231
|
displayEvents(firstReload) {
|
232
|
+
var filterValue = $('#instance-filter')[0].value;
|
233
|
+
var serviceName = serviceTimeline.serviceInstanceFilter;
|
234
|
+
var serviceEvaluator = function(){return true};
|
235
|
+
if (serviceName != '' && serviceName != 'All') {
|
236
|
+
serviceEvaluator = function(e){ return e.service === serviceName }
|
237
|
+
}
|
289
238
|
var maxRows = document.getElementById("maxRows").value;
|
290
239
|
//$("#service-title").html(service['name']);
|
291
240
|
var tableBody = $('#all-events > tbody');
|
292
241
|
var startIndex = 0;
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
console.log("
|
305
|
-
|
306
|
-
} else {
|
307
|
-
console.log("Index ", lastDisplayedIndex, " -> ", newestIndexInNewDocument);
|
242
|
+
var newDoc = document.createDocumentFragment();
|
243
|
+
var frag = document.createElement('tbody');
|
244
|
+
newDoc.appendChild(frag);
|
245
|
+
var filter = "";
|
246
|
+
var count = 0;
|
247
|
+
if (filterValue != ''){
|
248
|
+
var matcher;
|
249
|
+
try {
|
250
|
+
matcher = new RegExp(filterValue);
|
251
|
+
} catch (e) {
|
252
|
+
var safeReg = filterValue.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&")
|
253
|
+
console.log("Failed to compile regexp for '" + filterValue + "', using strict lookup due to: " + e);
|
254
|
+
matcher = new RegExp(safeReg);
|
308
255
|
}
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
256
|
+
var delegateServiceEvaluator = serviceEvaluator;
|
257
|
+
const fields = ['instance', 'service'];
|
258
|
+
const instance_info_fields = ['node', 'port'];
|
259
|
+
const check_fields = ['name', 'output'];
|
260
|
+
serviceEvaluator = function(e) {
|
261
|
+
var res = delegateServiceEvaluator(e);
|
262
|
+
if (!res) {
|
263
|
+
return false;
|
315
264
|
}
|
265
|
+
for (var i = 0; i < fields.length; i++) {
|
266
|
+
var field = fields[i];
|
267
|
+
if (matcher.test(e[field])){
|
268
|
+
return true;
|
269
|
+
}
|
270
|
+
}
|
271
|
+
for (var i = 0; i < instance_info_fields.length; i++) {
|
272
|
+
var field = instance_info_fields[i];
|
273
|
+
if (matcher.test(e.instance_info[field])){
|
274
|
+
return true;
|
275
|
+
}
|
276
|
+
}
|
277
|
+
for (var checkId in e.instance_info.checks) {
|
278
|
+
if (matcher.test(checkId)) {
|
279
|
+
return true;
|
280
|
+
}
|
281
|
+
var check = e.instance_info.checks[checkId];
|
282
|
+
for (var i = 0; i < check_fields.length; i++) {
|
283
|
+
var field = check_fields[i];
|
284
|
+
if (matcher.test(check[field])){
|
285
|
+
return true;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
}
|
289
|
+
return false;
|
316
290
|
}
|
317
291
|
}
|
318
|
-
var
|
319
|
-
var filter = "";
|
320
|
-
var lastEntryFound = null;
|
321
|
-
if (this.data.length > maxRows) {
|
322
|
-
var remaining = this.data.length - startIndex;
|
323
|
-
if (startIndex < remaining) {
|
324
|
-
startIndex = this.data.length - maxRows;
|
325
|
-
console.log('Skip first ', startIndex, " entries on ", this.data.length, " lines...");
|
326
|
-
}
|
327
|
-
}
|
328
|
-
for (var i = startIndex ; i < this.data.length; i++) {
|
292
|
+
for (var i = this.data.length - 1 ; i >= 0 && count <= maxRows; i--) {
|
329
293
|
var e = this.data[i];
|
330
|
-
|
294
|
+
if (!serviceEvaluator(e)) {
|
295
|
+
continue;
|
296
|
+
}
|
297
|
+
count++;
|
331
298
|
var row = document.createElement('tr');
|
332
299
|
row.setAttribute("class", 'srv-' + e.service);
|
333
300
|
var timestamp;
|
@@ -413,22 +380,14 @@ class ServiceTimeline {
|
|
413
380
|
}
|
414
381
|
this.buildCell(row, 'td', 'ipercents', this.createBadge(percent + " %", clazz));
|
415
382
|
}
|
416
|
-
frag.
|
383
|
+
frag.append(row);
|
417
384
|
}
|
385
|
+
$('#numRowsDisplayed').html(count + ' / ' + this.data.length);
|
418
386
|
var tbody = tableBody[0];
|
419
|
-
tbody.
|
420
|
-
this.
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
var tbody = tableBody.children('tr').each (function() {
|
425
|
-
i++;
|
426
|
-
if (i > maxRows) {
|
427
|
-
$(this).remove()
|
428
|
-
}
|
429
|
-
});
|
430
|
-
if (i > maxRows) {
|
431
|
-
console.log("Removed ", maxRows - i, " lines.")
|
387
|
+
tbody.parentNode.replaceChild(frag, tbody);
|
388
|
+
if (this.data.length > 1) {
|
389
|
+
this.lastEntryLoaded = this.data[this.data.length - 1];
|
390
|
+
console.log("Last entry loaded: ", indexOfTimelineEvent(this.lastEntryLoaded));
|
432
391
|
}
|
433
392
|
}
|
434
393
|
}
|