Revision 038383b1 ui/static/synnefo.js
b/ui/static/synnefo.js | ||
---|---|---|
11 | 11 |
pad(d.getUTCMonth()+1) + '-' + |
12 | 12 |
pad(d.getUTCDate()) + 'T' + |
13 | 13 |
pad(d.getUTCHours()) + ':' + |
14 |
pad(d.getUTCMinutes())+ ':' + |
|
15 |
pad(d.getUTCSeconds()) |
|
14 |
pad(d.getUTCMinutes()) + ':' + |
|
15 |
pad(d.getUTCSeconds()) +'Z' |
|
16 |
} |
|
17 |
|
|
18 |
function parse_error(responseText){ |
|
19 |
var errors = []; |
|
20 |
responseObj = JSON.parse(responseText); |
|
21 |
//console.info(inp); |
|
22 |
for (var err in responseObj){ |
|
23 |
errors[errors.length] = responseObj[err]; |
|
24 |
} |
|
25 |
return errors; |
|
16 | 26 |
} |
17 | 27 |
|
18 | 28 |
// indexOf prototype for IE |
... | ... | |
221 | 231 |
} |
222 | 232 |
// as for now, just show an error message |
223 | 233 |
try { console.info('update_vms errback:' + jqXHR.status ) } catch(err) {} |
224 |
ajax_error(jqXHR.status); |
|
234 |
ajax_error(jqXHR.status, undefined, 'Update VMs', jqXHR.responseText);
|
|
225 | 235 |
return false; |
226 | 236 |
}, |
227 | 237 |
success: function(data, textStatus, jqXHR) { |
... | ... | |
239 | 249 |
if (jqXHR.status == 200 || jqXHR.status == 203) { |
240 | 250 |
try { |
241 | 251 |
servers = data.servers; |
242 |
} catch(err) { ajax_error('400');} |
|
252 |
} catch(err) { ajax_error('400', undefined, 'Update VMs', jqXHR.responseText);}
|
|
243 | 253 |
update_machines_view(data); |
244 | 254 |
} else if (jqXHR.status != 304){ |
245 | 255 |
try { console.info('update_vms callback:' + jqXHR.status ) } catch(err) {} |
246 |
//ajax_error();
|
|
256 |
//ajax_error(jqXHR.status, undefined, 'Update VMs', jqXHR.responseText);
|
|
247 | 257 |
} |
248 | 258 |
return false; |
249 | 259 |
} |
... | ... | |
260 | 270 |
dataType: "json", |
261 | 271 |
timeout: TIMEOUT, |
262 | 272 |
error: function(jqXHR, textStatus, errorThrown) { |
263 |
ajax_error(jqXHR.status); |
|
273 |
ajax_error(jqXHR.status, undefined, 'Update Images', jqXHR.responseText);
|
|
264 | 274 |
}, |
265 | 275 |
success: function(data, textStatus, jqXHR) { |
266 | 276 |
try { |
... | ... | |
365 | 375 |
timeout: TIMEOUT, |
366 | 376 |
error: function(jqXHR, textStatus, errorThrown) { |
367 | 377 |
try { |
368 |
ajax_error(jqXHR.status); |
|
378 |
ajax_error(jqXHR.status, undefined, 'Update Flavors', jqXHR.responseText);
|
|
369 | 379 |
} catch (err) { |
370 | 380 |
ajax_error(err); |
371 | 381 |
} |
... | ... | |
447 | 457 |
"flavorRef" : flavorRef, |
448 | 458 |
"metadata" : { |
449 | 459 |
"My Server Name" : machineName |
450 |
},
|
|
460 |
} |
|
451 | 461 |
} |
452 | 462 |
}; |
453 | 463 |
|
... | ... | |
459 | 469 |
data: JSON.stringify(payload), |
460 | 470 |
timeout: TIMEOUT, |
461 | 471 |
error: function(jqXHR, textStatus, errorThrown) { |
462 |
ajax_error(jqXHR.status); |
|
472 |
ajax_error(jqXHR.status, undefined, 'Create VM', jqXHR.responseText);
|
|
463 | 473 |
}, |
464 | 474 |
success: function(data, textStatus, jqXHR) { |
465 | 475 |
if ( jqXHR.status == '202') { |
466 | 476 |
ajax_success("CREATE_VM_SUCCESS", data.server.adminPass); |
467 | 477 |
} else { |
468 |
ajax_error(jqXHR.status); |
|
478 |
ajax_error(jqXHR.status, undefined, 'Create VM', jqXHR.responseText);
|
|
469 | 479 |
} |
470 | 480 |
} |
471 | 481 |
}); |
... | ... | |
490 | 500 |
data: JSON.stringify(payload), |
491 | 501 |
timeout: TIMEOUT, |
492 | 502 |
error: function(jqXHR, textStatus, errorThrown) { |
493 |
display_failure(serverID, jqXHR.status, 'Reboot')
|
|
503 |
display_failure(jqXHR.status, serverID, 'Reboot', jqXHR.responseText)
|
|
494 | 504 |
}, |
495 | 505 |
success: function(data, textStatus, jqXHR) { |
496 | 506 |
if ( jqXHR.status == '202') { |
... | ... | |
502 | 512 |
// continue with the rest of the servers |
503 | 513 |
reboot(serverIDs); |
504 | 514 |
} else { |
505 |
ajax_error(jqXHR.status, serverID); |
|
515 |
ajax_error(jqXHR.status, serverID, 'Reboot', jqXHR.responseText);
|
|
506 | 516 |
} |
507 | 517 |
} |
508 | 518 |
}); |
... | ... | |
529 | 539 |
data: JSON.stringify(payload), |
530 | 540 |
timeout: TIMEOUT, |
531 | 541 |
error: function(jqXHR, textStatus, errorThrown) { |
532 |
display_failure(serverID, jqXHR.status, 'Shutdown')
|
|
542 |
display_failure(jqXHR.status, serverID, 'Shutdown', jqXHR.responseText)
|
|
533 | 543 |
}, |
534 | 544 |
success: function(data, textStatus, jqXHR) { |
535 | 545 |
if ( jqXHR.status == '202') { |
... | ... | |
541 | 551 |
// continue with the rest of the servers |
542 | 552 |
shutdown(serverIDs); |
543 | 553 |
} else { |
544 |
ajax_error(jqXHR.status, serverID); |
|
554 |
ajax_error(jqXHR.status, serverID, 'Shutdown', jqXHR.responseText);
|
|
545 | 555 |
} |
546 | 556 |
} |
547 | 557 |
}); |
... | ... | |
566 | 576 |
data: JSON.stringify(payload), |
567 | 577 |
timeout: TIMEOUT, |
568 | 578 |
error: function(jqXHR, textStatus, errorThrown) { |
569 |
display_failure(serverID, jqXHR.status, 'Destroy')
|
|
579 |
display_failure(jqXHR.status, serverID, 'Destroy', jqXHR.responseText)
|
|
570 | 580 |
}, |
571 | 581 |
success: function(data, textStatus, jqXHR) { |
572 | 582 |
if ( jqXHR.status == '204') { |
... | ... | |
578 | 588 |
// continue with the rest of the servers |
579 | 589 |
destroy(serverIDs); |
580 | 590 |
} else { |
581 |
ajax_error(jqXHR.status, serverID); |
|
591 |
ajax_error(jqXHR.status, serverID, 'Destroy', jqXHR.responseText);
|
|
582 | 592 |
} |
583 | 593 |
} |
584 | 594 |
}); |
... | ... | |
605 | 615 |
data: JSON.stringify(payload), |
606 | 616 |
timeout: TIMEOUT, |
607 | 617 |
error: function(jqXHR, textStatus, errorThrown) { |
608 |
display_failure(serverID, jqXHR.status, 'Start')
|
|
618 |
display_failure(jqXHR.status, serverID, 'Start', jqXHR.responseText)
|
|
609 | 619 |
}, |
610 | 620 |
success: function(data, textStatus, jqXHR) { |
611 | 621 |
if ( jqXHR.status == '202') { |
... | ... | |
617 | 627 |
// continue with the rest of the servers |
618 | 628 |
start(serverIDs); |
619 | 629 |
} else { |
620 |
ajax_error(jqXHR.status, serverID); |
|
630 |
ajax_error(jqXHR.status, serverID, 'Start', jqXHR.responseText);
|
|
621 | 631 |
} |
622 | 632 |
} |
623 | 633 |
}); |
Also available in: Unified diff