Commit a2e36f86 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

cyclades ui: Fix resolving of missing image ids

- Start resloving once the images have been loaded.
- Continue loading view progress only once all missing ids have been resolved.
parent 7561efb7
......@@ -2140,17 +2140,29 @@
load_missing_images: function(callback) {
var missing_ids = [];
var resolved = 0;
// fill missing_ids
this.each(function(el) {
var imgid = el.get("imageRef");
var existing = synnefo.storage.images.get(imgid);
if (!existing && missing_ids.indexOf(imgid) == -1) {
missing_ids.push(imgid);
synnefo.storage.images.update_unknown_id(imgid, function(){});
missing_ids.push(imgid);
}
});
callback(missing_ids);
var check = function() {
// once all missing ids where resolved continue calling the
// callback
resolved++;
if (resolved == missing_ids.length) {
callback(missing_ids)
}
}
// start resolving missing image ids
_(missing_ids).each(function(imgid){
synnefo.storage.images.update_unknown_id(imgid, check);
});
}
})
models.NIC = models.Model.extend({
......
......@@ -601,9 +601,6 @@
check_status: function(loaded) {
this.completed_items++;
// images, flavors loaded
if (this.completed_items == 2) {
this.load_nets_and_vms();
}
if (this.completed_items == this.items_to_load) {
this.update_status("layout", 1);
var self = this;
......@@ -738,7 +735,8 @@
this.update_status("images", 0);
storage.images.fetch({refresh:true, update:false, success: function(){
self.update_status("images", 1);
self.check_status()
self.check_status();
self.load_nets_and_vms();
}});
this.update_status("flavors", 0);
storage.flavors.fetch({refresh:true, update:false, success:function(){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment