consul-templaterb 1.18.4 → 1.18.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +8 -1
- data/lib/consul/async/version.rb +1 -1
- data/samples/consul-ui/js/keys.js +9 -6
- data/samples/consul-ui/js/nodes.js +22 -0
- data/samples/consul-ui/js/service.js +36 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 395c9514652523bda8cc32eb9ae1f7c0b0d19941c2df9cb3c09654e5dcc63d9c
|
4
|
+
data.tar.gz: 5f444cf5c5dbc03ca4ca4515646882365f9e5a6347c083b2b590f2893944bcf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d34ad14160c153fb02a256d23bd5fd858f30d0593afe551d50738fdd60bea6009ef8e86f2d04e4220891db3ef19492906250d5fa34ed29a3e44ede30e082ef
|
7
|
+
data.tar.gz: 81b45b14001c436a710a1ab766811cbae0671087bce17bd29aff06512545889a0fb6e317eaf9c6eac9239aaf08062e64f15fa3e086605b4ff5af939714734e15
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
## (UNRELEASED)
|
4
4
|
|
5
|
-
## 1.18.
|
5
|
+
## 1.18.5 (September 30, 2019)
|
6
|
+
|
7
|
+
IMPROVEMENTS:
|
8
|
+
|
9
|
+
* build on travis with latest ruby versions
|
10
|
+
* consul-ui: allow filtering from URL to create shortcuts easily
|
11
|
+
|
12
|
+
## 1.18.4 (September 19, 2019)
|
6
13
|
|
7
14
|
IMPROVEMENTS:
|
8
15
|
|
data/lib/consul/async/version.rb
CHANGED
@@ -86,15 +86,18 @@ class ConsulKeys {
|
|
86
86
|
|
87
87
|
onClickServiceName(source) {
|
88
88
|
this.selectKey(source);
|
89
|
-
this.
|
89
|
+
this.selectedKeyName = $(source).find(".key-name").html()
|
90
|
+
this.updateURL();
|
90
91
|
}
|
91
92
|
|
92
|
-
updateURL(
|
93
|
-
var newUrl =
|
94
|
-
if (
|
95
|
-
newUrl
|
93
|
+
updateURL() {
|
94
|
+
var newUrl = new URL(location.href);
|
95
|
+
if (this.selectedKeyName) {
|
96
|
+
newUrl.searchParams.set('key', this.selectedKeyName);
|
97
|
+
} else {
|
98
|
+
newUrl.searchParams.delete('key')
|
96
99
|
}
|
97
|
-
window.history.pushState({},"",newUrl);
|
100
|
+
window.history.pushState({},"",newUrl.href);
|
98
101
|
}
|
99
102
|
|
100
103
|
selectKey(source) {
|
@@ -3,12 +3,23 @@ class ConsulNodes {
|
|
3
3
|
this.ressourceURL = ressourceURL;
|
4
4
|
this.fetchRessource();
|
5
5
|
this.instanceFilter = $("#instance-filter");
|
6
|
+
var filter = new URL(location.href).searchParams.get('filter');
|
7
|
+
if (filter!=null && filter!='') {
|
8
|
+
this.instanceFilter.val(filter);
|
9
|
+
};
|
6
10
|
this.instanceFilter.keyup(debounce(this.filterInstances, 400));
|
7
11
|
this.refresh = parseInt(refresh);
|
8
12
|
this.filterStatus = null;
|
9
13
|
this.maxDisplayed = 100;
|
10
14
|
this.displayedCount = 0;
|
11
15
|
this.servicesStatus = {};
|
16
|
+
window.setTimeout(function(){
|
17
|
+
if (filter!=null && filter!='') {
|
18
|
+
consulNodes.instanceFilter.val(filter);
|
19
|
+
console.log(this.instanceFilter.value)
|
20
|
+
consulNodes.filterInstances();
|
21
|
+
}
|
22
|
+
}, 100);
|
12
23
|
}
|
13
24
|
|
14
25
|
fetchRessource() {
|
@@ -29,8 +40,19 @@ class ConsulNodes {
|
|
29
40
|
this.filterInstances();
|
30
41
|
}
|
31
42
|
|
43
|
+
updateURL() {
|
44
|
+
var newUrl = new URL(location.href);
|
45
|
+
if (consulNodes.instanceFilter.val()!='') {
|
46
|
+
newUrl.searchParams.set('filter', consulNodes.instanceFilter.val());
|
47
|
+
} else {
|
48
|
+
newUrl.searchParams.delete('filter')
|
49
|
+
}
|
50
|
+
window.history.pushState({},"",newUrl);
|
51
|
+
}
|
52
|
+
|
32
53
|
filterInstances() {
|
33
54
|
updateFilterDisplay(consulNodes.filterStatus);
|
55
|
+
consulNodes.updateURL();
|
34
56
|
consulNodes.displayedCount = 0;
|
35
57
|
consulNodes.servicesStatus = {};
|
36
58
|
var filter = new RegExp(consulNodes.instanceFilter.val());
|
@@ -12,12 +12,22 @@ class ConsulService {
|
|
12
12
|
this.serviceFilterCounter = $("#service-counter");
|
13
13
|
this.serviceFilterCount = 0;
|
14
14
|
this.showProxiesInList = false;
|
15
|
+
this.selectedServiceName = new URL(location.href).searchParams.get('service');
|
16
|
+
this.serviceFilterValue = new URL(location.href).searchParams.get('filter');
|
15
17
|
var cs = this
|
16
18
|
this.loadFavorites();
|
17
19
|
window.setTimeout(function(){
|
18
20
|
cs.showTags($('#showTagsInList:checked').length > 0);
|
19
21
|
cs.showProxies($('#showProxiesInList:checked').length > 0);
|
20
22
|
}, 100);
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
initFilterValue() {
|
27
|
+
if (this.serviceFilterValue) {
|
28
|
+
this.serviceFilter.val(this.serviceFilterValue);
|
29
|
+
this.filterService()
|
30
|
+
}
|
21
31
|
}
|
22
32
|
|
23
33
|
showTags(enableTags) {
|
@@ -44,31 +54,28 @@ class ConsulService {
|
|
44
54
|
await this.reloadServiceList();
|
45
55
|
console.log('Data generated at: ' + data['generated_at']);
|
46
56
|
|
47
|
-
var urlParam =
|
48
|
-
|
57
|
+
var urlParam = this.selectedServiceName
|
49
58
|
if (urlParam) {
|
50
59
|
var nodes = document.getElementById('service-list').childNodes;
|
51
60
|
for (const node of nodes) {
|
52
61
|
if($(node).find(".service-name").html() == urlParam) {
|
53
|
-
var selectedElement = $(node)
|
62
|
+
var selectedElement = $(node);
|
54
63
|
this.selectService(selectedElement);
|
55
|
-
selectedElement.focus()
|
64
|
+
selectedElement.focus();
|
56
65
|
break;
|
57
66
|
}
|
58
67
|
}
|
59
|
-
|
60
|
-
|
61
|
-
} else {
|
62
|
-
var servicePrefix = '#service_'
|
68
|
+
} else {
|
69
|
+
var servicePrefix = '#service_';
|
63
70
|
if (location.hash.startsWith(servicePrefix)) {
|
64
|
-
urlParam = location.hash.substr(servicePrefix.length)
|
71
|
+
urlParam = location.hash.substr(servicePrefix.length);
|
65
72
|
}
|
66
73
|
this.selectService(document.getElementById('service-list').firstElementChild);
|
67
74
|
}
|
68
|
-
|
69
75
|
if(this.refresh > 0) {
|
70
76
|
setTimeout(this.fetchRessource, this.refresh * 1000);
|
71
77
|
}
|
78
|
+
this.initFilterValue();
|
72
79
|
}
|
73
80
|
|
74
81
|
async reloadServiceList() {
|
@@ -95,7 +102,6 @@ class ConsulService {
|
|
95
102
|
|
96
103
|
this.serviceFilterCounter.html(this.serviceFilterCount);
|
97
104
|
resizeWrapper('service-wrapper', 'service-list');
|
98
|
-
this.filterService();
|
99
105
|
}
|
100
106
|
|
101
107
|
appendService(service, index) {
|
@@ -163,14 +169,16 @@ class ConsulService {
|
|
163
169
|
|
164
170
|
filterService() {
|
165
171
|
var filter;
|
166
|
-
var
|
172
|
+
var filterValue = consulService.serviceFilter.val();
|
167
173
|
try {
|
168
|
-
filter = new RegExp(
|
174
|
+
filter = new RegExp(filterValue);
|
169
175
|
} catch (e) {
|
170
|
-
var safeReg =
|
171
|
-
console.log("Failed to compile regexp for '" +
|
176
|
+
var safeReg = filterValue.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&")
|
177
|
+
console.log("Failed to compile regexp for '" + filterValue + "', using strict lookup due to: " + e);
|
172
178
|
filter = new RegExp(safeReg);
|
173
179
|
}
|
180
|
+
consulService.serviceFilterValue = filterValue
|
181
|
+
consulService.updateURL()
|
174
182
|
consulService.serviceFilterCount = 0;
|
175
183
|
var showProxiesInList = consulService.showProxiesInList;
|
176
184
|
consulService.serviceList.children('.serviceListItem').each(function (){
|
@@ -189,7 +197,8 @@ class ConsulService {
|
|
189
197
|
|
190
198
|
onClickServiceName(source) {
|
191
199
|
this.selectService(source);
|
192
|
-
this.
|
200
|
+
this.selectedServiceName = $(source).find(".service-name").html()
|
201
|
+
this.updateURL();
|
193
202
|
}
|
194
203
|
|
195
204
|
onClickFilter(source) {
|
@@ -221,11 +230,18 @@ class ConsulService {
|
|
221
230
|
})
|
222
231
|
}
|
223
232
|
|
224
|
-
updateURL(
|
225
|
-
var newUrl =
|
226
|
-
if (
|
227
|
-
newUrl
|
233
|
+
updateURL() {
|
234
|
+
var newUrl = new URL(location.href);
|
235
|
+
if (this.selectedServiceName) {
|
236
|
+
newUrl.searchParams.set('service', this.selectedServiceName);
|
237
|
+
} else {
|
238
|
+
newUrl.searchParams.delete('service')
|
228
239
|
}
|
240
|
+
if (this.serviceFilterValue) {
|
241
|
+
newUrl.searchParams.set('filter', this.serviceFilterValue);
|
242
|
+
} else {
|
243
|
+
newUrl.searchParams.delete('filter')
|
244
|
+
}
|
229
245
|
window.history.pushState({},"",newUrl);
|
230
246
|
}
|
231
247
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul-templaterb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SRE Core Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|