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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dc3089b2ac9f444e1b9b0d01e1f0615db553d441fec27cfb957f9971ecd4e5e
4
- data.tar.gz: 14695f0f6de3dd032aaf15316b5136e695f3ec61e1879592379515419431771e
3
+ metadata.gz: 395c9514652523bda8cc32eb9ae1f7c0b0d19941c2df9cb3c09654e5dcc63d9c
4
+ data.tar.gz: 5f444cf5c5dbc03ca4ca4515646882365f9e5a6347c083b2b590f2893944bcf8
5
5
  SHA512:
6
- metadata.gz: 8b9f4fdbd637ad60ddb4de4068db591d851e342e91717587ec773e4351de6b58ed11cdee8f5452345f41061d397bc613621d4994e737a6701459dd9c4ea7887a
7
- data.tar.gz: 2c455c1fd909169d491387bb05be7d19fffe90ba3660788dc6135d2e905fc8a8a10bd1b1e8c640b875918db24efdd41f3d588cbff81025c3ea2b10e8666ea40f
6
+ metadata.gz: 41d34ad14160c153fb02a256d23bd5fd858f30d0593afe551d50738fdd60bea6009ef8e86f2d04e4220891db3ef19492906250d5fa34ed29a3e44ede30e082ef
7
+ data.tar.gz: 81b45b14001c436a710a1ab766811cbae0671087bce17bd29aff06512545889a0fb6e317eaf9c6eac9239aaf08062e64f15fa3e086605b4ff5af939714734e15
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.6
4
- - 2.5.5
5
- - 2.6.2
3
+ - 2.4.7
4
+ - 2.5.6
5
+ - 2.6.4
6
6
  deploy:
7
7
  provider: rubygems
8
8
  api_key:
@@ -2,7 +2,14 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
- ## 1.18.4
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
 
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.18.4'.freeze
3
+ VERSION = '1.18.5'.freeze
4
4
  end
5
5
  end
@@ -86,15 +86,18 @@ class ConsulKeys {
86
86
 
87
87
  onClickServiceName(source) {
88
88
  this.selectKey(source);
89
- this.updateURL($(source).find(".key-name").html());
89
+ this.selectedKeyName = $(source).find(".key-name").html()
90
+ this.updateURL();
90
91
  }
91
92
 
92
- updateURL(link) {
93
- var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
94
- if (link) {
95
- newUrl += '?key=' + link
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 = new URL(location.href).searchParams.get('service');
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
- this.serviceFilter.val(urlParam);
60
- this.filterService()
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 serviceVal = consulService.serviceFilter.val();
172
+ var filterValue = consulService.serviceFilter.val();
167
173
  try {
168
- filter = new RegExp(serviceVal);
174
+ filter = new RegExp(filterValue);
169
175
  } catch (e) {
170
- var safeReg = serviceVal.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&")
171
- console.log("Failed to compile regexp for '" + serviceVal + "', using strict lookup due to: " + e);
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.updateURL($(source).find(".service-name").html());
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(link) {
225
- var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
226
- if (link) {
227
- newUrl += '?service=' + link
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
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-19 00:00:00.000000000 Z
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