Revision 363538b2 snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_public_keys_view.js
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_public_keys_view.js | ||
---|---|---|
259 | 259 |
var error = _.bind(function() { |
260 | 260 |
this.generating = false; |
261 | 261 |
this.generate_action.removeClass("in-progress"); |
262 |
this.generate_progress.hide(); |
|
263 | 262 |
this.private_key = undefined; |
264 | 263 |
this.show_error(); |
265 | 264 |
}, this); |
... | ... | |
316 | 315 |
collection: storage.keys, |
317 | 316 |
collection_name: 'keys', |
318 | 317 |
model_view_cls: views.PublicKeyView, |
319 |
create_view_cls: views.PublicKeyCreateView |
|
318 |
create_view_cls: views.PublicKeyCreateView, |
|
319 |
initialize: function() { |
|
320 |
views.PublicKeysCollectionView.__super__.initialize.apply(this, arguments); |
|
321 |
this.collection.bind("add", _.bind(this.update_quota, this)); |
|
322 |
this.collection.bind("remove", _.bind(this.update_quota, this)); |
|
323 |
this.collection.bind("reset", _.bind(this.update_quota, this)); |
|
324 |
}, |
|
325 |
|
|
326 |
update_quota: function() { |
|
327 |
var quota = synnefo.config.userdata_keys_limit; |
|
328 |
var available = quota - this.collection.length; |
|
329 |
if (available > 0) { |
|
330 |
this.create_button.removeClass("disabled"); |
|
331 |
this.create_button.attr("title", this.quota_limit_message || "Quota limit reached") |
|
332 |
} else { |
|
333 |
this.create_button.addClass("disabled"); |
|
334 |
this.create_button.attr("title", ""); |
|
335 |
} |
|
336 |
} |
|
320 | 337 |
}); |
321 | 338 |
|
322 | 339 |
views.PublicKeysPaneView = views.ext.PaneView.extend({ |
Also available in: Unified diff