Skip to content

Commit

Permalink
nInput_EndPoints: support for attrTemplate using chUrls/chPorts
Browse files Browse the repository at this point in the history
  • Loading branch information
nmsaguiar committed Aug 10, 2023
1 parent 2a6a57e commit 30f977d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions config/objects/nInput_EndPoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,22 @@ nInput_EndPoints.prototype.input = function(scope, args) {
if (isDef(this.params.chUrls)) {
$ch(this.params.chUrls).forEach((k, v) => {
var attr;
if (isUnDef(this.params.attribute)) {
// For legacy compatibility
if (isDef(this.params.attribute)) this.params.attrTemplate = this.params.attribute
if (isUnDef(this.params.attrTemplate)) {
if (isDef(k.key)) attr = k.key;
if (isString(k)) attr = k;
if (isDef(k.attribute)) attr = k.attribute;
} else {
if (isDef(k.attribute))
attr = k.attribute
else
attr = this.params.attribute
attr = this.params.attrTemplate
}

if (isDef(attr)) {
ret[templify(attr, k)] = this.testURL(v);
if (isUnDef(ret[templify(attr, k)])) ret[templify(attr, k)] = []
ret[templify(attr, k)].push(this.testURL(v))
}
});
}
Expand All @@ -134,21 +137,24 @@ nInput_EndPoints.prototype.input = function(scope, args) {
if (isDef(this.params.chPorts)) {
$ch(this.params.chPorts).forEach((k, v) => {
var attr;
if (isUnDef(this.params.attribute)) {
// For legacy compatibility
if (isDef(this.params.attribute)) this.params.attrTemplate = this.params.attribute
if (isUnDef(this.params.attrTemplate)) {
if (isDef(k.key)) attr = k.key;
if (isString(k)) attr = k;
if (isDef(k.attribute)) attr = k.attribute;
} else {
if (isDef(k.attribute))
attr = k.attribute
else
attr = this.params.attribute
attr = this.params.attrTemplate
}

if (isDef(attr)) {
ret[templify(attr, k)] = this.testPort(v);
if (isUnDef(ret[templify(attr, k)])) ret[templify(attr, k)] = []
ret[templify(attr, k)].push(this.testPort(v))
}
});
})
}

return ret;
Expand Down

0 comments on commit 30f977d

Please sign in to comment.