mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix a couple of issues with the unique-collection control:
- Pass the data to evaluation functions like canEdit, canAdd - Properly honour the canAdd option.
This commit is contained in:
committed by
Dave Page
parent
d21e60cc60
commit
2f334673a3
@@ -528,21 +528,26 @@
|
||||
checkVars.push('role');
|
||||
}
|
||||
|
||||
self.collection.each(function(m) {
|
||||
if (!inSelected) {
|
||||
var has = true;
|
||||
_.each(checkVars, function(v) {
|
||||
val = m.get(v);
|
||||
has = has && ((
|
||||
(_.isUndefined(val) || _.isNull(val)) &&
|
||||
(_.isUndefined(data[v]) || _.isNull(data[v]))
|
||||
) ||
|
||||
(val == data[v]));
|
||||
});
|
||||
if (self.control_data.canAdd) {
|
||||
self.collection.each(function(m) {
|
||||
if (!inSelected) {
|
||||
var has = true;
|
||||
_.each(checkVars, function(v) {
|
||||
val = m.get(v);
|
||||
has = has && ((
|
||||
(_.isUndefined(val) || _.isNull(val)) &&
|
||||
(_.isUndefined(data[v]) || _.isNull(data[v]))
|
||||
) ||
|
||||
(val == data[v]));
|
||||
});
|
||||
|
||||
inSelected = has;
|
||||
}
|
||||
});
|
||||
inSelected = has;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
inSelected = true;
|
||||
}
|
||||
|
||||
self.$header.find('button.add').prop('disabled', inSelected);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user