Skip to content

Commit

Permalink
Closes-Bug:#1610713
Browse files Browse the repository at this point in the history
Triming the operand1, operand2, variables in config alarms & pattern in userdefind counters.

Change-Id: I5863e70168d0814260619c6182c6e3597237dd0c
  • Loading branch information
vishnuvv committed Aug 9, 2016
1 parent 510d059 commit a33839d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion webroot/config/alarm/common/ui/js/models/AlarmModel.js
Expand Up @@ -78,13 +78,16 @@ define([
var vars = andRuleObj.variables()();
if (vars != null && vars != "" && typeof vars == 'string') {
vars = vars.split(',')
vars = $.map(vars, $.trim);
} else if (vars == "") {
vars = [];
}
var operation = andRuleObj.operation()();
operationArr = operation.split(cowc.DROPDOWN_VALUE_SEPARATOR),
operand2 = andRuleObj.operand2()(),
operand1 = andRuleObj.operand1()(),
operand2Obj = {};
operand2 = operand2.toString().trim();
if (operationArr[1] == 'uve_attribute') {
operand2Obj = {
uve_attribute: operand2
Expand All @@ -95,7 +98,7 @@ define([
}
}
andRulePostObjArr.push({
operand1: andRuleObj.operand1()(),
operand1: operand1.toString().trim(),
operand2: operand2Obj,
operation: operationArr[0],
variables: vars
Expand Down
Expand Up @@ -133,6 +133,7 @@ define([
if(self.model().isValid(true, "userDefinedCounterValidation")) {
newUserDefinedCounterConfig =
$.extend({}, true, self.model().attributes);
newUserDefinedCounterConfig['pattern'] = newUserDefinedCounterConfig['pattern'].toString().trim();
ctwu.deleteCGridData(newUserDefinedCounterConfig);
//Fetch the current global-system-config
var deferredObj = $.Deferred();
Expand All @@ -147,16 +148,19 @@ define([
currentUserDefinedCounterList.push(newUserDefinedCounterConfig);
}
else{
var found = false;
for (var i = 0; i < currentUserDefinedCounterList.length; i++) {
if (currentUserDefinedCounterList[i]['name'] ==
newUserDefinedCounterConfig['name']) {
found = true;
currentUserDefinedCounterList[i]['pattern'] =
newUserDefinedCounterConfig['pattern'];
} else {
currentUserDefinedCounterList.
push(newUserDefinedCounterConfig);
}
}
if (!found) {
currentUserDefinedCounterList.
push(newUserDefinedCounterConfig);
}
}
self.configureUserDefinedCounter(callbackObj,
currentGlobalSystemConfigData,
Expand Down

0 comments on commit a33839d

Please sign in to comment.