consul-templaterb 1.28.1 → 1.28.2

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: ca62994383929bd3874db5527f85efeaaf184fdb83b8f3b17e05fbadbfbbc90a
4
- data.tar.gz: e878ff880557ffdfd8db6e5cb900a19e8191d4db11ba28fa0b4e7bbe9b1b9240
3
+ metadata.gz: 5b99b274e76706dd09a6da62555cc79c462d5072237825fb10fea80ef3d3e558
4
+ data.tar.gz: 68e4a32addfb0decb19e8dbda17dfc99665c6e19da03d789cddf61196c051c7a
5
5
  SHA512:
6
- metadata.gz: 62afc852ef61329a30bba3a67f43ed372130d9a87cd1afce559b5f88f9aa0a6db336c84c63b173eaa96896e8c9088686cfa37f10d540cd91c80ca2fb976b00b3
7
- data.tar.gz: 4a02aa15f2d4f95e5d144e916bf6a51190a90756e134456aece5b4afbf7ba106e150faeb8cf7b0e09ff27f1f61b237c47dd11f236299d922a519e91b019e3705
6
+ metadata.gz: c1385863a2b51bb12c4b900c869a82048acecec0abe9e6875e151cf39151e5f0ff983b130549191d236315c22ff45e61810c515397d75fe2847dc28e70044499
7
+ data.tar.gz: 9a6acde596746461c64b99145f13952e4e4cfc4ea009b9e31f65afab96f5e7ecf93f5764ad7d0e5fd98e5b37419bc5b60c169abf6aefdc5bb2cbbd55f1495c30
@@ -2,7 +2,13 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
- ## 1.28.1 (Sept 30,, 2020)
5
+ ## 1.28.2 (Oct 5, 2020)
6
+
7
+ NEW FEATURES:
8
+
9
+ * Added new decorator to compute node names in consul-ui ([#70](https://github.com/criteo/consul-templaterb/pull/70))
10
+
11
+ ## 1.28.1 (Sept 30, 2020)
6
12
 
7
13
  IMPROVEMENTS:
8
14
 
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.28.1'.freeze
3
+ VERSION = '1.28.2'.freeze
4
4
  end
5
5
  end
@@ -36,6 +36,13 @@ function usefullLinksGenerator(instance, serviceName, node_meta_info) {
36
36
  return top;
37
37
  }
38
38
 
39
+ /**
40
+ * createNodeDisplayElement resolves and displays the node name.
41
+ */
42
+ function createNodeDisplayElement(nodeName, nodemeta) {
43
+ return document.createTextNode(nodeName);
44
+ }
45
+
39
46
  /**
40
47
  * serviceInstanceDecorator is called to decorate an instance.
41
48
  */
@@ -71,7 +71,7 @@ class NodeMainSelector extends MainSelector {
71
71
  content.setAttribute('class', 'instance-content');
72
72
  var contentHead = document.createElement('div');
73
73
  contentHead.setAttribute('class', 'instance-content-header');
74
- contentHead.appendChild(nodeNameGenator(node['Node']['Name'], node['Node']['Address']));
74
+ contentHead.appendChild(nodeNameGenator(node['Node']));
75
75
  contentHead.appendChild(nodeAddressGenator(node['Node']['Address']));
76
76
  contentHead.appendChild(nodeMetaGenerator(node['Node']['Meta']));
77
77
  content.appendChild(contentHead);
@@ -304,8 +304,8 @@ class ServiceMainSelector extends MainSelector {
304
304
  element.setAttribute("class", "list-group-item service-instance");
305
305
  var state = nodeState(instance.checks);
306
306
  element.appendChild(weightsGenerator(instance.weights, state));
307
- element.appendChild(serviceTitleGenerator(instance, serviceName));
308
307
  var node_info = this.nodes[instance.name];
308
+ element.appendChild(serviceTitleGenerator(instance, serviceName, node_info));
309
309
  if (node_info != null) {
310
310
  node_info = node_info.meta;
311
311
  element.appendChild(nodeMetaGenerator(node_info, instance.sMeta));
@@ -63,7 +63,7 @@ function nodeState(checks) {
63
63
 
64
64
  supported_protocols = ['https', 'http', 'sftp', 'ftp', 'ssh', 'telnet']
65
65
 
66
- function serviceTitleGenerator(instance, serviceName) {
66
+ function serviceTitleGenerator(instance, serviceName, node_info) {
67
67
  var protocol = null;
68
68
  for (i in supported_protocols) {
69
69
  var protoc = supported_protocols[i]
@@ -86,7 +86,10 @@ function serviceTitleGenerator(instance, serviceName) {
86
86
  instanceLink.setAttribute('target', '_blank');
87
87
  }
88
88
 
89
- instanceLink.appendChild(document.createTextNode(instance.name + appendPort));
89
+ var nodemeta = (node_info != null) ? node_info.meta : null;
90
+ instanceLink.appendChild(createNodeDisplayElement(instance.name, nodemeta));
91
+ instanceLink.appendChild(document.createTextNode(appendPort));
92
+
90
93
  const nodeInfo = document.createElement('a');
91
94
  nodeInfo.appendChild(document.createTextNode('\u24D8'));
92
95
  nodeInfo.setAttribute('title', 'Click to see details of Node: ' + instance.name +
@@ -103,7 +106,7 @@ function serviceTitleGenerator(instance, serviceName) {
103
106
  return htmlTitle;
104
107
  }
105
108
 
106
- function nodeNameGenator(nodename, nodeaddr) {
109
+ function nodeNameGenator(node) {
107
110
  var protocol = 'ssh://'
108
111
 
109
112
  var htmlTitle = document.createElement('h5');
@@ -111,10 +114,10 @@ function nodeNameGenator(nodename, nodeaddr) {
111
114
  var instanceLink = document.createElement('a');
112
115
  instanceLink.setAttribute('class', 'instance-name');
113
116
  if (protocol != null) {
114
- instanceLink.setAttribute('href', protocol + nodeaddr);
117
+ instanceLink.setAttribute('href', protocol + node['Address']);
115
118
  instanceLink.setAttribute('target', '_blank');
116
119
  }
117
- instanceLink.appendChild(document.createTextNode(nodename));
120
+ instanceLink.appendChild(createNodeDisplayElement(node['Name'], node['Meta']));
118
121
  htmlTitle.appendChild(instanceLink);
119
122
 
120
123
  return htmlTitle;
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.28.1
4
+ version: 1.28.2
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: 2020-09-29 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request