mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Improvised the data clean up, in some cases, it was calling validation
due to internal 'set' function call from the internal 'reset' function. We will stop the session management, before doing any clean up for ignoring such events.
This commit is contained in:
parent
6e42e48244
commit
34ba5bef24
@ -200,8 +200,12 @@ function(_, pgAdmin, $, Backbone) {
|
||||
return self;
|
||||
},
|
||||
// Create a reset function, which allow us to remove the nested object.
|
||||
reset: function() {
|
||||
reset: function(opts) {
|
||||
var obj;
|
||||
|
||||
if (opts && opts.stop)
|
||||
this.stopSession();
|
||||
|
||||
for(id in this.objects) {
|
||||
obj = this.get(id);
|
||||
|
||||
@ -210,19 +214,19 @@ function(_, pgAdmin, $, Backbone) {
|
||||
obj.reset();
|
||||
delete obj;
|
||||
} else if (obj instanceof Backbone.Model) {
|
||||
obj.clear({silent: true});
|
||||
obj.clear(opts);
|
||||
delete obj;
|
||||
} else if (obj instanceof pgBrowser.DataCollection) {
|
||||
obj.reset({silent: true});
|
||||
obj.reset(opts);
|
||||
delete obj;
|
||||
} else if (obj instanceof Backbone.Collection) {
|
||||
obj.each(function(m) {
|
||||
if (m instanceof Bakbone.DataModel) {
|
||||
obj.reset();
|
||||
obj.clear({silent: true});
|
||||
obj.clear(opts);
|
||||
}
|
||||
});
|
||||
Backbone.Collection.prototype.reset.apply(obj, {silent: true});
|
||||
Backbone.Collection.prototype.reset.apply(obj, {opts});
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
@ -259,7 +263,7 @@ function(_, pgAdmin, $, Backbone) {
|
||||
var res = Backbone.Model.prototype.set.call(this, key, val, options);
|
||||
this._changing = false;
|
||||
|
||||
if ((opts&& opts.intenal) || !this.trackChanges) {
|
||||
if ((opts&& opts.internal) || !this.trackChanges) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -788,13 +792,15 @@ function(_, pgAdmin, $, Backbone) {
|
||||
// Override the reset function, so that - we can reset the model
|
||||
// properly.
|
||||
reset: function(opts) {
|
||||
if (opts && opts.stop)
|
||||
this.stopSession();
|
||||
this.each(function(m) {
|
||||
if (!m)
|
||||
return;
|
||||
if (m instanceof pgBrowser.DataModel) {
|
||||
m.reset();
|
||||
m.reset(opts);
|
||||
} else {
|
||||
m.clear({silent: true});
|
||||
m.clear(opts);
|
||||
}
|
||||
});
|
||||
Backbone.Collection.prototype.reset.apply(this, arguments);
|
||||
|
@ -80,7 +80,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
|
||||
|
||||
if (view) {
|
||||
// Release the view
|
||||
view.remove({data: true});
|
||||
view.remove({data: true, internal: true, silent: true});
|
||||
// Deallocate the view
|
||||
delete view;
|
||||
view = null;
|
||||
|
@ -652,7 +652,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
|
||||
// creating new view.
|
||||
if (view) {
|
||||
// Release the view
|
||||
view.remove({data: true});
|
||||
view.remove({data: true, internal: true, silent: true});
|
||||
// Deallocate the view
|
||||
delete view;
|
||||
view = null;
|
||||
@ -763,7 +763,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
|
||||
// creating the new view.
|
||||
if (view) {
|
||||
// Release the view
|
||||
view.remove({data: true});
|
||||
view.remove({data: true, internal: true, silent: true});
|
||||
// Deallocate the view
|
||||
delete view;
|
||||
view = null;
|
||||
@ -1157,7 +1157,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
|
||||
view = j && j.data('obj-view');
|
||||
|
||||
if (view) {
|
||||
view.remove({data: true});
|
||||
view.remove({data: true, internal: true, silent: true});
|
||||
}
|
||||
}.bind(panel);
|
||||
panel.on(wcDocker.EVENT.CLOSED, onCloseFunc);
|
||||
|
Loading…
Reference in New Issue
Block a user