Skip to content
Permalink
Browse files

Added serviceName info to all decorators

  • Loading branch information
pierresouchay committed Nov 23, 2019
1 parent 10fcf6b commit 07f367e29523cd0c52278a6343cff2d710eb8bb5
@@ -2,6 +2,10 @@

## (UNRELEASED)

## 1.21.3 (November 23, 2019)

* added serviceName information for all decorators of services

## 1.21.2 (November 22, 2019)

* Added instance information into serviceMetaDecorator() calls to
@@ -1,5 +1,5 @@
module Consul
module Async
VERSION = '1.21.2'.freeze
VERSION = '1.21.3'.freeze
end
end
@@ -14,15 +14,15 @@ function url_decorator(key, value) {
/**
* serviceInstanceDecorator is called to decorate an instance.
*/
function serviceInstanceDecorator(instance, element) {
function serviceInstanceDecorator(instance, element, serviceName) {
return element;
}

/**
* serviceMetaDecorator must return a HTML node to decorate a service instance meta.
* It should return the decorated element.
*/
function serviceMetaDecorator(instance, key, value) {
function serviceMetaDecorator(instance, key, value, serviceName) {
if (httpRegexp.test(value)) {
return url_decorator(key, value);
} else {
@@ -182,7 +182,7 @@ class ServiceSideSelector extends SideSelector {

selectItem(element, service) {
super.selectItem(element, service);
this.mainSelector.initSelector(this.data[service]);
this.mainSelector.initSelector(this.data[service], service);
}
}

@@ -246,7 +246,7 @@ class ServiceMainSelector extends MainSelector {

initSelector(service) {
if (service) {
super.initSelector(service.instances);
super.initSelector(service.instances, service.name);
this.generateTitle(service.name);
}
}
@@ -292,7 +292,7 @@ class ServiceMainSelector extends MainSelector {
resizeAll();
}

elementGenerator(instance) {
elementGenerator(instance, serviceName) {
var element = document.createElement("div");
element.setAttribute("class", "list-group-item service-instance");
var state = nodeState(instance.checks);
@@ -308,12 +308,12 @@ class ServiceMainSelector extends MainSelector {
element.appendChild(tagsGenerator(instance.tags));
element.appendChild(document.createElement("hr"));
}
element.appendChild(serviceMetaGenerator(instance));
element.appendChild(serviceMetaGenerator(instance, serviceName));
element.appendChild(connectGenerator(instance));
element.appendChild(checksStatusGenerator(instance, instance.name));
element.setAttribute("status", state);

return serviceInstanceDecorator(instance, element);
return serviceInstanceDecorator(instance, element, serviceName);
}

getStatus(instance) {
@@ -158,10 +158,10 @@ class MainSelector {
this.maxDisplayed = this.maxDisplayElement.val();
}

initSelector(data) {
initSelector(data, additionalInfo) {
this.data = data;
for (var key in this.data) {
this.data[key]["element"] = this.elementGenerator(this.data[key]);
this.data[key]["element"] = this.elementGenerator(this.data[key], additionalInfo);
}
this.refreshList();
}
@@ -175,7 +175,7 @@ function connectGenerator(instance) {
return connectItem
}

function serviceMetaGenerator(instance) {
function serviceMetaGenerator(instance, serviceName) {
var instanceMeta = instance.sMeta;
var top = document.createElement('div');
top.className = 'instance-meta';
@@ -190,7 +190,7 @@ function serviceMetaGenerator(instance) {
container.appendChild(metaH);
var metaVH = document.createElement('dd');
metaVH.className = 'col-sm-8 lookup';
metaVH.appendChild(serviceMetaDecorator(instance, meta, instanceMeta[meta]));
metaVH.appendChild(serviceMetaDecorator(instance, meta, instanceMeta[meta], serviceName));
container.appendChild(metaVH);
}
}

0 comments on commit 07f367e

Please sign in to comment.
You can’t perform that action at this time.