Revision 146b6003 ui/templates/machines.html
b/ui/templates/machines.html | ||
---|---|---|
199 | 199 |
|
200 | 200 |
// launch VM creation wizard |
201 | 201 |
$("a#create").click(function(){ |
202 |
|
|
203 |
//do not launch wizard if no images or flavors are found |
|
204 |
if (images.length == 0) |
|
205 |
{ |
|
206 |
function fake_jqXHR() { |
|
207 |
this.status = 'no_images'; |
|
208 |
} |
|
209 |
var jqXHR = new fake_jqXHR(); |
|
210 |
ajax_error(jqXHR); |
|
211 |
return false; |
|
212 |
} |
|
213 |
else if (flavors.length == 0) |
|
214 |
{ |
|
215 |
function fake_jqXHR() { |
|
216 |
this.status = 'no_flavors'; |
|
217 |
} |
|
218 |
var jqXHR = new fake_jqXHR(); |
|
219 |
ajax_error(jqXHR); |
|
220 |
return false; |
|
221 |
} |
|
222 |
else |
|
223 |
{ |
|
202 |
// launch wizard only if images and flavors are found |
|
203 |
if (images.length > 0 && flavors.length > 0) { |
|
224 | 204 |
$("#wizard").scrollable().begin(); |
225 | 205 |
$("#wizard").show(); |
226 |
$('a#create').data('overlay').load() |
|
227 |
} |
|
206 |
$('a#create').data('overlay').load() |
|
207 |
} else if (images.length == 0 ) { |
|
208 |
ajax_error('NO_IMAGES'); |
|
209 |
return false; |
|
210 |
} else if (flavors.length == 0) { |
|
211 |
ajax_error('NO_FLAVORS'); |
|
212 |
return false; |
|
213 |
} |
|
228 | 214 |
}); |
229 | 215 |
|
230 | 216 |
// create wizard overlay |
... | ... | |
365 | 351 |
data: JSON.stringify(payload), |
366 | 352 |
timeout: TIMEOUT, |
367 | 353 |
error: function(jqXHR, textStatus, errorThrown) { |
368 |
ajax_error(jqXHR); |
|
354 |
ajax_error(jqXHR.status);
|
|
369 | 355 |
}, |
370 | 356 |
success: function(data, textStatus, jqXHR) { |
371 | 357 |
if ( jqXHR.status == '202') { |
372 |
ajax_success(jqXHR); |
|
358 |
ajax_success(jqXHR.status);
|
|
373 | 359 |
} else { |
374 |
ajax_error(jqXHR); |
|
360 |
ajax_error(jqXHR.status);
|
|
375 | 361 |
} |
376 | 362 |
} |
377 | 363 |
}); |
... | ... | |
385 | 371 |
// create tabs for main menu |
386 | 372 |
$("ul.tabs").tabs("div.panes ul"); |
387 | 373 |
|
388 |
// populate image list |
|
389 |
update_images(); |
|
390 |
// configure flavors |
|
391 |
update_flavors(); |
|
392 | 374 |
</script> |
Also available in: Unified diff