Fix for networks changes cancelling

This commit is contained in:
Julia Kirnosova 2013-02-08 16:43:24 +04:00 committed by default
parent 4e5144d069
commit 672f41a834

View File

@ -194,14 +194,12 @@ function(models, commonViews, dialogViews, networkTabTemplate, networkTabViewMod
_.defaults(this, options); _.defaults(this, options);
this.model.bind('change:tasks', this.bindEvents, this); this.model.bind('change:tasks', this.bindEvents, this);
this.bindEvents(); this.bindEvents();
if (!this.model.get('networks')) { var complete = _.after(2, _.bind(this.render, this));
this.networks = new models.Networks(); this.model.fetch().done(complete);
this.networks.deferred = this.networks.fetch({data: {cluster_id: this.model.id}}); this.networks = new models.Networks();
this.networks.deferred.done(_.bind(this.render, this)); this.networks.deferred = this.networks.fetch({data: {cluster_id: this.model.id}});
this.model.set({'networks': this.networks}, {silent: true}); this.networks.deferred.done(complete);
} else { this.model.set({'networks': this.networks}, {silent: true});
this.networks = this.model.get('networks');
}
}, },
renderVerificationControl: function() { renderVerificationControl: function() {
var verificationView = new NetworkTabVerificationControl({model: this.model, networks: this.networks}); var verificationView = new NetworkTabVerificationControl({model: this.model, networks: this.networks});