Revision 66a292bd ui/templates/machines_single.html

b/ui/templates/machines_single.html
212 212
            action = pending_actions.splice(i,1)[0]; // extract action
213 213
            // change the status text in cases where no api state exists
214 214
            if (action[0] == start) {
215
                $(".column1 .state-label").text(TRANSITIONS['Starting']);
216
                $(".column1 .state").removeClass().addClass('state starting-state');
217
                $(".column1 .state").find('.spinner').show();
215
                $(this).closest(".single-container").find(".column1 .state-label").text(TRANSITIONS['Starting']);
216
                $(this).closest(".single-container").find(".column1 .state").removeClass().addClass('state starting-state');
217
                $(this).closest(".single-container").find(".column1 .state .spinner").show();
218 218
            } else if (action[0] == shutdown) {
219
                $(".column1 .state-label").text(TRANSITIONS['Shutting down']);
220
                $(".column1 .state").removeClass().addClass('state shutting-state');
221
                $(".column1 .state").find('.spinner').show();
219
                $(this).closest(".single-container").find(".column1 .state-label").text(TRANSITIONS['Shutting down']);
220
                $(this).closest(".single-container").find(".column1 .state").removeClass().addClass('state shutting-state');
221
                $(this).closest(".single-container").find(".column1 .state .spinner").show();
222 222
            } else if (action[0] == reboot) {
223
                $(".column1 .state-label").text(TRANSITIONS['Rebooting']);
224
                $(".column1 .state").removeClass().addClass('state rebooting-state');
225
                $(".column1 .state").find('.spinner').show();
223
                $(this).closest(".single-container").find(".column1 .state-label").text(TRANSITIONS['Rebooting']);
224
                $(this).closest(".single-container").find(".column1 .state").removeClass().addClass('state rebooting-state');
225
                $(this).closest(".single-container").find(".column1 .state .spinner").show();
226 226
            }  else if (action[0] == destroy) {
227
                $(".column1 .state-label").text(TRANSITIONS['Destroying']);
228
                $(".column1 .state").removeClass().addClass('state destroying-state');
229
                $(".column1 .state").find('.spinner').show();
227
                $(this).closest(".single-container").find(".column1 .state-label").text(TRANSITIONS['Destroying']);
228
                $(this).closest(".single-container").find(".column1 .state").removeClass().addClass('state destroying-state');
229
                $(this).closest(".single-container").find(".column1 .state .spinner").show();
230 230
            }
231 231
            action[0]([action[1]]); // execute action
232 232
        }
233 233
    }
234 234
    $(this).parent().hide();
235 235
    $(this).closest('div.action-container').children('div.single-action').removeClass('selected');
236
    $(this).parent().parent().children('.state').children('.spinner').show()
236
    $(this).parent().parent().find('.state').children('.spinner').show();
237 237
    update_confirmations();
238 238
    return false;
239 239
});
......
384 384
                    // from an active state to an inactive one
385 385
                    log_server_status_change(existing, server.status);
386 386
                    existing.find("img.single-image").attr("src","static/icons/machines/large/" + server_image + '-off.png');
387
                    $(".column1 .state-label").text(STATUSES[server.status]);
387
                    existing.find(".column1 .state-label").text(STATUSES[server.status]);
388 388
                    existing.find(".connect-border").hide();
389 389
                    existing.find(".connect-arrow").hide();
390
                    $(".column1 .state").find(".spinner").hide();
390
                    existing.find(".column1 .state .spinner").hide();
391 391
                    existing.find(' .wave').attr('src','static/icons/indicators/medium/wave.gif').show();
392
                    $(".column1 .state").removeClass().addClass("state terminated-state");
392
                    existing.find(".column1 .state").removeClass().addClass("state terminated-state");
393 393
                    setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
394 394
                }
395 395
                else if (INACTIVE_STATES.indexOf(current_message) >= 0 &&
......
397 397
                    // From an inactive state to an active one
398 398
                    log_server_status_change(existing, server.status);
399 399
                    existing.find("img.single-image").attr("src","static/icons/machines/large/" + server_image + '-on.png');
400
                    $(".column1 .state-label").text(STATUSES[server.status]);
400
                    existing.find(".column1 .state-label").text(STATUSES[server.status]);
401 401
                    existing.find(".connect-border").show();
402 402
                    existing.find(".connect-arrow").show();
403
                    $(".column1 .state").find(".spinner").hide();
403
                    existing.find(".column1 .state .spinner").hide();
404 404
                    existing.find(' .wave').attr('src','static/icons/indicators/medium/wave.gif').show();
405
                    $(".column1 .state").removeClass().addClass("state running-state");
405
                    existing.find(".column1 .state").removeClass().addClass("state running-state");
406 406
                    setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
407 407
                }
408 408
                else {
......
414 414
                             (STATUSES['BUILD'] == current_message && server.status == 'ACTIVE')) {
415 415
                        // if it has been rebooted or just created
416 416
                        log_server_status_change(existing, server.status);
417
                        $(".column1 .state-label").text(STATUSES[server.status]);
417
                        existing.find(".column1 .state-label").text(STATUSES[server.status]);
418 418
                        existing.find(".connect-border").show();
419 419
                        existing.find(".connect-arrow").show();
420
                        $(".column1 .state").find(".spinner").hide();
421
                        $(".column1 .state").attr('src','static/icons/indicators/medium/wave.gif').show();
422
                        $(".column1 .state").removeClass().addClass("state running-state");
420
                        existing.find(".column1 .state .spinner").hide();
421
                        existing.find(".column1 .state").attr('src','static/icons/indicators/medium/wave.gif').show();
422
                        existing.find(".column1 .state").removeClass().addClass("state running-state");
423 423
                        setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
424 424
                    }
425 425
                    else {
426 426
                        // in any other case just change the status and ignore spinners/waves
427
                        $(".column1 .state-label").text(STATUSES[server.status]);
427
                        existing.find(".column1 .state-label").text(STATUSES[server.status]);
428 428
                    }
429 429
                }
430 430
            }
......
451 451
            machine.find(".machine-details div.name").text(server.name.substring(0,100));
452 452
            machine.find("img.single-image").attr("src","static/icons/machines/large/"+server_image+'-on.png');
453 453
            machine.find("span.imagetag").text(server_image);
454
            $(".column1 .state-label").text(STATUSES[server.status]);
454
            machine.find(".column1 .state-label").text(STATUSES[server.status]);
455 455
            // find and display flavor parameters
456 456
            var flavor_params = get_flavor_params(server.flavorRef);
457 457
            machine.find(".machine-details div.cpus").text(flavor_params['cpus']);
......
470 470
                    machine.find("img.single-image").attr("src","static/icons/machines/large/"+server_image+'-off.png');
471 471
                    machine.find(".connect-border").hide();
472 472
                    machine.find(".connect-arrow").hide();
473
                    $(".column1 .state").removeClass().addClass("state terminated-state");
473
                    machine.find(".column1 .state").removeClass().addClass("state terminated-state");
474 474
            }
475 475
            //show spinner while machine is building or rebooting
476 476
            if (server.status == 'BUILD' ||
477 477
                [TRANSITIONS['Starting'], TRANSITIONS['Shutting down']].indexOf(existing.find(".status").text()) >= 0 ) {
478
                $(".column1 .state").find('.spinner').show();
478
                machine.find(".column1 .state .spinner").show();
479 479
                machine.find(".connect-border").hide();
480 480
                machine.find(".connect-arrow").hide();
481
                $(".column1 .state").removeClass().addClass('state build-state');
481
                machine.find(".column1 .state").removeClass().addClass('state build-state');
482 482
            }
483 483
            if (server.status == 'REBOOT') {
484
                $(".column1 .state").find('.spinner').show();
484
                machine.find(".column1 .state").find('.spinner').show();
485 485
                machine.find(".connect-border").hide();
486 486
                machine.find(".connect-arrow").hide();
487
                $(".column1 .state").removeClass().addClass('state rebooting-state');
487
                machine.find(".column1 .state").removeClass().addClass('state rebooting-state');
488 488
            }
489 489
            machine.appendTo("#machinesview-single.single");
490 490
            //disable reboot and shutdown actions while machine is building

Also available in: Unified diff