mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following SonarQube issues:
- Refactor functions to not always return the same value. - Rename "cls" to "self" or add the missing "self" parameter. - Remove useless assignment to variables.
This commit is contained in:
committed by
Akshay Joshi
parent
dd7eb54e90
commit
56cf64ad22
@@ -953,28 +953,31 @@ define([
|
||||
this.$content.find('button.add').first().on('click',(e) => {
|
||||
e.preventDefault();
|
||||
// There should be only one empty row.
|
||||
let anyNew = false;
|
||||
for(const [idx, model] of userCollection.models.entries()) {
|
||||
if(model.isNew()) {
|
||||
let row = view.body.rows[idx].$el;
|
||||
row.addClass('new');
|
||||
$(row).pgMakeVisible('backgrid');
|
||||
$(row).find('.email').trigger('click');
|
||||
return false;
|
||||
anyNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
$(view.body.$el.find($('tr.new'))).removeClass('new');
|
||||
var m = new(UserModel)(null, {
|
||||
handler: userCollection,
|
||||
top: userCollection,
|
||||
collection: userCollection,
|
||||
});
|
||||
userCollection.add(m);
|
||||
if(!anyNew) {
|
||||
$(view.body.$el.find($('tr.new'))).removeClass('new');
|
||||
var m = new(UserModel)(null, {
|
||||
handler: userCollection,
|
||||
top: userCollection,
|
||||
collection: userCollection,
|
||||
});
|
||||
userCollection.add(m);
|
||||
|
||||
var newRow = view.body.rows[userCollection.indexOf(m)].$el;
|
||||
newRow.addClass('new');
|
||||
$(newRow).pgMakeVisible('backgrid');
|
||||
$(newRow).find('.email').trigger('click');
|
||||
var newRow = view.body.rows[userCollection.indexOf(m)].$el;
|
||||
newRow.addClass('new');
|
||||
$(newRow).pgMakeVisible('backgrid');
|
||||
$(newRow).find('.email').trigger('click');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user