js: Utilize `utils.objectsEqual()` in `actiontable.select()`

This commit is contained in:
Johannes Meyer 2019-11-20 13:51:14 +01:00
parent 2dbf9ca8ab
commit 47c2a8bdc1
2 changed files with 8 additions and 13 deletions

View File

@ -189,17 +189,7 @@
this.rowActions()
.filter(
function (i, el) {
var params = _this.getRowData($(el));
if (_this.icinga.utils.objectKeys(params).length !== _this.icinga.utils.objectKeys(filter).length) {
return false;
}
var equal = true;
$.each(params, function(key, value) {
if (filter[key] !== value) {
equal = false;
}
});
return equal;
return _this.icinga.utils.objectsEqual(_this.getRowData($(el)), filter);
}
)
.closest('tr')

View File

@ -365,8 +365,13 @@
},
objectsEqual: function equals(obj1, obj2) {
return Object.keys(obj1)
.concat(Object.keys(obj2))
var obj1Keys = Object.keys(obj1);
var obj2Keys = Object.keys(obj2);
if (obj1Keys.length !== obj2Keys.length) {
return false;
}
return obj1Keys.concat(obj2Keys)
.every(function (key) {
return obj1[key] === obj2[key];
});