Fixed an issue where the validation error message is shown twice. Fixes #5736

This commit is contained in:
Rahul Shirsat authored and Akshay Joshi committed 2020-10-30 14:59:22 +05:30
1 parent df31fe7dc4
commit 183c83f0d2
4 files changed
+90 -16

No files matched your search

+9 -15
View File
@@ -1170,6 +1170,7 @@ define([
var uniqueCol = this.field.get('uniqueCol') || [],
uniqueChangedAttr = [],
self = this;
// Check if changed model attributes are also in unique columns. And then only check for uniqueness.
if (newModel.attributes) {
_.each(uniqueCol, function(col) {
@@ -1386,6 +1387,10 @@ define([
},
});
for(let i = 0; i < (collection.length); i++) {
collection.at(i).parentTr = self.grid.body.rows[i].$el;
}
// Render subNode grid
var subNodeGrid = self.grid.render().$el;
@@ -1461,6 +1466,9 @@ define([
var idx = collection.indexOf(m),
newRow = self.grid.body.rows[idx].$el;
collection.get(m).parentTr = newRow;
m.parentTr = newRow;
newRow.addClass('new');
if(!$(newRow).pgMakeBackgridVisible('.backform-tab')){
// We can have subnode controls in Panels
@@ -1480,25 +1488,11 @@ define([
},
updateInvalid: function() {
var self = this,
errorModel = this.model.errorModel;
errorModel = self.model.errorModel;
if (!(errorModel instanceof Backbone.Model)) return this;
this.clearInvalid();
this.$el.find('.subnode-body').each(function() {
var error = self.keyPathAccessor(
errorModel.toJSON(), self.field.get('name')
);
if (_.isEmpty(error)) return;
self.$el.addClass('subnode-error').append(
$('<div></div>').addClass(
'pgadmin-control-error-message pg-el-offset-4 pg-el-8 help-block'
).text(error)
);
});
},
});
+6
View File
@@ -95,6 +95,12 @@
z-index: 1;
}
.error-in-grid {
border-radius: $border-radius !important;
background: $alert-danger-bg !important;
color: $alert-danger-color !important;
}
.pg-prop-status-bar {
padding: 5px;