Revision a3e418b1

b/ui/static/synnefo.js
141 141
                    ajax_error(jqXHR);
142 142
                    },
143 143
        success: function(data, textStatus, jqXHR) {
144
            images = data.images;
144 145
            if ($("ul#standard-images li").toArray().length + $("ul#custom-images li").toArray().length == 0) {
145 146
                $.each(data.images, function(i,image){
146 147
                    var img = $('#image-template').clone().attr("id","img-"+image.id).fadeIn("slow");
......
163 164
    return false;
164 165
}
165 166

  
166
var flavors = {}, disks = [], cpus = [], ram = [];
167
var flavors = {}, images = {}, disks = [], cpus = [], ram = [];
167 168

  
168 169
Array.prototype.unique = function () {
169 170
	var r = new Array();
b/ui/templates/machines.html
195 195

  
196 196
// launch VM creation wizard
197 197
$("a#create").click(function(){
198
    // populate image list
199
    update_images();
200
    // configure flavors
201
    update_flavors(); 
202
    // launch the wizard
203
    $("#wizard").scrollable().begin();
204
    $("#wizard").show();
205
    $('a#create').data('overlay').load()    
198

  
199
    //do not launch wizard if no images or flavors are found
200
    if (images.length == 0 || flavors.length == 0){
201
        ajax_error(503);
202
        return false;
203
    } else {
204
        $("#wizard").scrollable().begin();
205
        $("#wizard").show();
206
        $('a#create').data('overlay').load()    
207
    }
206 208
});
207 209

  
208 210
// create wizard overlay
......
369 371
$("ul.tabs").tabs("div.panes ul");
370 372

  
371 373

  
372

  
374
// populate image list
375
update_images();
376
// configure flavors
377
update_flavors(); 
373 378
</script>

Also available in: Unified diff