Statistics
| Branch: | Tag: | Revision:

root / ui / templates / machines_icon.html @ 68bfcb73

History | View | Annotate | Download (26.6 kB)

1
{% load i18n %}
2

    
3
<!-- the standard view -->
4
<div id="machinesview-icon" class="standard">
5
    <div class="large-spinner"></div>
6
    <div class="machine-container" id="machine-container-template" style="display:none">
7
        <div class="machine" id="machine-template" \>
8
            <div class="actions">
9
                <a href="#" class="action-start">{% trans "Start" %}</a>
10
                <a href="#" class="action-reboot">{% trans "Reboot" %}</a>
11
                <a href="#" class="action-shutdown">{% trans "Shutdown" %}</a>
12
                <a href="#" class="action-console">{% trans "Console" %}</a>
13
                <a href="#" class="action-destroy">{% trans "Destroy" %}</a>
14
            </div>
15
            <div class="confirm_single">
16
                <button class="yes">{% trans "Confirm" %}</button>
17
                <button class="no">{% trans "Cancel" %}</button>
18
            </div>
19
            <div class="action_error" align="center">
20
                {% trans "<span class='orange'>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
21
                <span class="code"></span>
22
                <span class="message"></span>
23
                <button class="details">{% trans "Details" %}</button>
24
            </div>
25
            <div class="state">
26
                <div class="status">{% trans "Running" %}</div>
27
                <div class="indicator"></div>
28
                <div class="indicator"></div>
29
                <div class="indicator"></div>
30
                <div class="indicator"></div>
31
                <img class="spinner" style="display:none" src="/static/icons/indicators/medium/progress.gif" />
32
                <img class="wave" style="display:none" src="/static/icons/indicators/medium/wave.gif" />
33
            </div>
34
            <img class="logo" src="" />
35
            <div href="#" class="name">
36
                <h5 class="namecontainer editable">
37
                    {% trans "Name" %}: <span class="name">node.name</span><span class="rename"></span>
38
                    <div class="editbuttons" style="display:none">
39
                        <span class="save" />
40
                        <span class="cancel" />
41
                    </div>
42
                </h5>
43
            </div>
44
            <a href="#" class="ip">
45
                <h5>{% trans "IP" %}: <span class="public">node.public_ip</span></h5>
46
            </a>
47
            <h5 class="settings">
48
                {% trans "Show" %}:
49
                <a class="show-disks" href="#">{% trans "disks" %}</a> |
50
                <a class="show-networks" href="#">{% trans "networks" %}</a> |
51
                <a class="show-info" href="#">{% trans "more info" %}</a>
52
            </h5>
53
            <div class="info-content">
54
                <div class="metadata-separator"></div>
55
                <div class="metadata-container">
56
                    <div class="vm-details metadata-column">
57
                        {% trans "CPUs" %}: <span class="cpu-data">1</span><br />
58
                        {% trans "RAM" %}: <span class="ram-data">2048</span> (MB)<br />
59
                        {% trans "System Disk" %}: <span class="disk-data">20</span> (GB) <br /><br />
60
                        {% trans "Image" %}: <span class="image-data">Debian</span><br />
61
                        {% trans "Image Size" %}: <span class="image-size-data">2.3</span> (GB)
62
                    </div>
63
                    <div class="vm-stats metadata-column">
64
                        {% trans "CPU" %} <img src="/static/cpu-bar.png" class="metadata-bar" /><br />
65
                        {% trans "RAM" %} <img src="/static/ram-bar.png" class="metadata-bar" /><br />
66
                        {% trans "S.Disk" %} <img src="/static/cpu-bar.png" class="metadata-bar" /><br />
67
                        {% trans "Net" %} <img src="/static/net-bar.png" class="metadata-bar" /><br /><br />
68
                        {% trans "details" %}
69
                    </div>
70
                    <div class="vm-metadata metadata-column">
71
                        <div class="metadata-left">
72
                            {% trans "Metadata" %}: <br />
73
                            (<span class="metadata-count">0</span>)
74
                        </div>
75
                        <div class="metadata-keys-container">
76
                            <div class="scrollable vertical">
77
                                <div class="items">
78

    
79
                                </div>
80
                            </div>
81
                            <div class="metadata-actions">
82
                                <div class="prev"></div>
83
                                <div class="next"></div>
84
                            </div>
85
                        </div>
86
                        <a href="#" class="manage-metadata">{% trans "Manage Tags" %}</a>
87
                    </div>
88
                </div>
89
                <div class="metadata-separator"></div>
90
            </div>
91
        </div>
92
        <div class="separator"></div>
93
    </div>
94
    <div class="running"></div>
95
    <div class="terminated" style="display:none;"></div>
96
</div>
97

    
98
<script>
99

100
//hide the all of the info contents
101
$("#machinesview-icon.standard .info-content").hide();
102
//toggle the component with class info-content
103
$("a.show-info").live('click', function() {
104
    $(this).parent().parent().find(".info-content").slideToggle(600);
105
    return false;
106
});
107

108
// intercept manage metadata click
109
$("#machinesview-icon.standard a.manage-metadata").live('click', function() {
110
    // get server name and server ID
111
    var serverID = $(this).parent().parent().parent().parent().parent().attr("id");
112
    var serverName = $(this).parent().parent().parent().parent().parent().find("span.name").text();
113
    // set server name to all related metadata dialogs
114
    $("#metadata-wizard div.machine-name").text(serverName);
115
    if ($(this).parent().parent().parent().parent().parent().parent().hasClass('terminated')) {
116
        $("#metadata-wizard div#on-off").text('off');
117
    } else {
118
        $("#metadata-wizard div#on-off").text('on');
119
    }
120
    // set server id to all related metadata dialogs
121
    $("#metadata-wizard p").text(serverID);
122
    show_metadata_wizard();
123
    return false;
124
});
125

126
//initiate machine renaming
127
$("#machinesview-icon.standard .rename, #machinesview-icon.standard h5.editable span.name").live('click', function() {
128
    $(this).parent().find('.name').html("<input id=\"txtEdit\" type=\"text\" class=\"nametextbox\" value=\"" +
129
                                        $(this).parent().find('.name').text() +
130
                                        "\" / ><span class=\"oldValue\">" +
131
                                        $(this).parent().find('.name').text() + "</span>");
132
    $(this).parent().find('.rename').hide();
133
    $(this).parent().find(".editbuttons").fadeIn();
134
    $(this).parent().find(".nametextbox").focus().select();
135
    $(this).parent().removeClass('editable');
136

137
    //submit wizard by pressing enter on the name textbox
138
    $("#txtEdit").keydown(function (e) {
139
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
140
            $(this).parent().parent().find('div.editbuttons span.save').click();
141
            return false;
142
        } else if ((e.which && e.which == 27) || (e.keyCode && e.keyCode == 27)) {
143
            $(this).parent().parent().find('div.editbuttons span.cancel').click();
144
            return true;
145
        }
146
    });
147
    return false;
148
});
149

150
//rename machine
151
$("#machinesview-icon.standard .editbuttons .save").live('click', function() {
152
    serverID = $(this).closest('.machine-container').attr("id");
153
    serverName = $(this).parent().parent().find('.name').find('.nametextbox').val();
154
    if (serverName.trim() == ''){
155
        return false;
156
    }
157
    $(this).parent().parent().find('.name').html($(this).parent().parent().find('.nametextbox').val());
158
    $(this).parent().parent().find(".editbuttons").fadeOut("fast");
159
    $(this).parent().parent().find(".rename").fadeIn("slow");
160
    rename(serverID, serverName);
161
    return false;
162
});
163

164
//cancel renaming
165
$("#machinesview-icon.standard .editbuttons .cancel").live('click', function() {
166
    $(this).parent().parent().find('.name').html($(this).parent().parent().find('.oldValue').text());
167
    $(this).parent().parent().find(".editbuttons").hide();
168
    $(this).parent().parent().find(".rename").fadeIn();
169
    $(this).parent().parent().addClass('editable');
170
    return false;
171
});
172

173
// intercept reboot click
174
$("#machinesview-icon.standard div.actions a.action-reboot").live('click', function(){
175
    var serverID = $(this).parent().parent().parent().attr("id");
176
    var serverName = $(this).parent().prevAll("div.name").find("span.name").text();
177
    var found = false;
178

179
    $(this).parent().children('a').removeClass('selected');
180
    $(this).addClass('selected');
181
    $(this).parent().addClass('display');
182
    $(this).parent().parent().find('.action_error').hide();
183
    for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
184
        if (pending_actions[i][1]==serverID){
185
            pending_actions[i][0] = reboot;
186
            found = true
187
        }
188
    }
189
    if (!found) // no pending action for this server was found, so let's just add it to the list
190
        pending_actions.push([reboot, serverID, serverName])
191
    update_confirmations();
192
    return false;
193
});
194

195
// intercept shutdown click
196
$("#machinesview-icon.standard div.actions a.action-shutdown").live('click', function(){
197
    var serverID = $(this).parent().parent().parent().attr("id");
198
    var serverName = $(this).parent().prevAll("div.name").find("span.name").text();
199
    var found = false;
200
    $(this).parent().children('a').removeClass('selected');
201
    $(this).addClass('selected');
202
    $(this).parent().addClass('display')
203
    $(this).parent().parent().find('.action_error').hide();
204

205
    for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
206
        if (pending_actions[i][1]==serverID){
207
            pending_actions[i][0] = shutdown;
208
            found = true
209
        }
210
    }
211
    if (!found) // no pending action for this server was found, so let's just add it to the list
212
        pending_actions.push([shutdown, serverID, serverName])
213
    update_confirmations();
214
    return false;
215
});
216

217
// intercept start click
218
$("#machinesview-icon.standard div.actions a.action-start").live('click', function(){
219
    var serverID = $(this).parent().parent().parent().attr("id");
220
    var serverName = $(this).parent().prevAll("div.name").find("span.name").text();
221
    var found = false;
222
    $(this).parent().children('a').removeClass('selected');
223
    $(this).addClass('selected');
224
    $(this).parent().addClass('display')
225
    $(this).parent().parent().find('.action_error').hide();
226

227
    for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
228
        if (pending_actions[i][1]==serverID){
229
            pending_actions[i][0] = start;
230
            found = true
231
        }
232
    }
233
    if (!found) // no pending action for this server was found, so let's just add it to the list
234
        pending_actions.push([start, serverID, serverName])
235
    update_confirmations();
236
    return false;
237
});
238

239
// intercept console click
240
$("#machinesview-icon.standard div.actions a.action-console").live('click', function(){
241
    var serverID = $(this).parent().parent().parent().attr("id");
242
    var serverName = $(this).parent().prevAll("div.name").find("span.name").text();
243
    var found = false;
244
    $(this).parent().children('a').removeClass('selected');
245
    $(this).addClass('selected');
246
    $(this).parent().addClass('display')
247
    $(this).parent().parent().find('.action_error').hide();
248

249
    for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
250
        if (pending_actions[i][1]==serverID){
251
            pending_actions[i][0] = open_console;
252
            found = true
253
        }
254
    }
255
    if (!found) // no pending action for this server was found, so let's just add it to the list
256
        pending_actions.push([open_console, serverID, serverName])
257
    update_confirmations();
258
    return false;
259
});
260

261

262
// intercept destroy click
263
$("#machinesview-icon.standard div.actions a.action-destroy").live('click', function(){
264
    var serverID = $(this).parent().parent().parent().attr("id");
265
    var serverName = $(this).parent().prevAll("div.name").find("span.name").text();
266
    var found = false;
267
    $(this).parent().children('a').removeClass('selected');
268
    $(this).addClass('selected');
269
    $(this).parent().addClass('display')
270
    $(this).parent().parent().find('.action_error').hide();
271

272
    for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
273
        if (pending_actions[i][1]==serverID){
274
            pending_actions[i][0] = destroy;
275
            found = true
276
        }
277
    }
278
    if (!found) // no pending action for this server was found, so let's just add it to the list
279
        pending_actions.push([destroy, serverID, serverName])
280
    update_confirmations();
281
    return false;
282
});
283

284
$("#machinesview-icon.standard div.confirm_single .yes").live('click', function(){
285
    var serverID = $(this).parent().parent().parent().attr("id");
286
    for (i=0;i<pending_actions.length;i++){ // if there is a pending action for this server execute it
287
        if (pending_actions[i][1]==serverID){
288
            action = pending_actions.splice(i,1)[0]; // extract action
289
            // change the status text in cases where no api state exists
290
            if (action[0] == start) {
291
                $(this).parent().parent().find('.status').text(TRANSITIONS['Starting']);
292
                $(this).parent().parent().find('.spinner').show();
293
            } else if (action[0] == shutdown) {
294
                $(this).parent().parent().find('.status').text(TRANSITIONS['Shutting down']);
295
                $(this).parent().parent().find('.spinner').show();
296
            } else if (action[0] == reboot) {
297
                $(this).parent().parent().find('.status').text(TRANSITIONS['Rebooting']);
298
                $(this).parent().parent().find('.spinner').show();
299
            }  else if (action[0] == destroy) {
300
                $(this).parent().parent().find('.status').text(TRANSITIONS['Destroying']);
301
                $(this).parent().parent().find('.spinner').show();
302
            }
303
            action[0]([action[1]]); // execute action
304
        }
305
    }
306
    $(this).parent().hide();
307
    $(this).parent().parent().children('div.actions').children('a').removeClass('selected');
308
    $(this).parent().parent().children('.state').children('.spinner').show()
309
    $(this).parent().parent().children('div.actions').removeClass('display');
310
    update_confirmations();
311
    return false;
312
});
313

314
$("#machinesview-icon.standard div.confirm_single .no").live('click', function(){
315
    // remove the action from the pending list
316
    var serverID = $(this).parent().parent().parent().attr("id");
317

318
    $(this).parent().parent().children('div.actions').children('a').removeClass('selected');
319
    $(this).parent().parent().children('div.actions').removeClass('display');
320
    for (i=0;i<pending_actions.length;i++){ // if there is a pending action for this server remove it
321
        if (pending_actions[i][1]==serverID){
322
            pending_actions.splice(i,1);
323
        }
324
    }
325
    $(this).parent().hide();
326
    update_confirmations();
327
    return false;
328
});
329

330
$("#machinesview-icon.standard div.action_error .details").live('click', function(){
331
    // remove the action from the pending list
332
    ajax_error($(this).parent().children('.code').text(), undefined, $(this).parent().children('.action').text(), $(this).parent().children('.message').text());
333
    $(this).parent().hide();
334
});
335

336
// TODO: This should be populated with more rules for all available states
337
var actions = { 'reboot':        ['UNKOWN', 'ACTIVE', 'REBOOT'],
338
                'shutdown':      ['UNKOWN', 'ACTIVE', 'REBOOT'],
339
                'console':       ['ACTIVE'],
340
                'start':         ['UNKOWN', 'STOPPED'],
341
                'destroy':       ['UNKOWN', 'ACTIVE', 'STOPPED', 'REBOOT', 'ERROR', 'BUILD']
342
               };
343

344
// update the servers list
345
function update_machines_view(data) {
346
    /*
347
    Go through the servers in the input data. Update existing entries, add
348
    new ones to the list
349
    */
350
    $.each(data.servers.values, function(i,server) {
351
        // get DOM element, if it exists
352
        existing = $('#machinesview-icon.standard #' + server.id);
353
        // get server OS, if it exists
354
        if (!(server.metadata == undefined)) {
355
            var server_image = os_icon(server.metadata);
356
        } else {
357
            var server_image = "unknown"
358
        }
359
        // get server status message, if it exists
360
        var current_message = existing.find(".status").text();
361
        // if multiple machines exist in the DOM, delete all but one
362
        // defensive coding - that shouldn't happen normally
363
        while (existing.length > 1){
364
            existing.remove();
365
        }
366
        // if server already exists in DOM, update its values
367
        if (existing.length){
368
            //  if the status is deleted
369
            if (server.status == 'DELETED') {
370
                // delete server entry from the DOM
371
                log_server_status_change(existing, 'DELETED');
372
                existing.remove();
373
            }
374
            // if the status has changed
375
            else if ( current_message != STATUSES[server.status]) {
376
                /*
377
                Here there are 4 possibilities:
378
                    1. From an active state to an inactive one
379
                    2. From an inactive state to an active one
380
                    3. From an active state to a different active one
381
                    4. From an inactive state to a different inactive one
382
                The last two (3, 4) can be dealt with the same way
383
                */
384
                if (ACTIVE_STATES.indexOf(current_message) >= 0 &&
385
                    INACTIVE_STATES.indexOf(STATUSES[server.status]) >= 0) {
386
                    // from an active state to an inactive one
387
                    log_server_status_change(existing, server.status);
388
                    moved = existing.clone().appendTo("#machinesview-icon.standard .terminated");
389
                    moved.find("img.logo").attr("src",'static/icons/machines/medium/' + server_image + '-off.png');
390
                    existing.remove();
391
                    existing = moved;
392
                    existing.find(".status").text(STATUSES[server.status]);
393
                    existing.find('.spinner').hide();
394
                    existing.find(' .wave').attr('src','static/icons/indicators/medium/wave.gif').show();
395
                    setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
396
                }
397
                else if (INACTIVE_STATES.indexOf(current_message) >= 0 &&
398
                         ACTIVE_STATES.indexOf(STATUSES[server.status]) >= 0) {
399
                    // From an inactive state to an active one
400
                    log_server_status_change(existing, server.status);
401
                    moved = existing.clone().appendTo("#machinesview-icon.standard .running");
402
                    moved.find("img.logo").attr('src','static/icons/machines/medium/' + server_image + '-on.png');
403
                    existing.remove();
404
                    existing = moved;
405
                    existing.find(".status").text(STATUSES[server.status]);
406
                    existing.find('.spinner').hide();
407
                    existing.find(' .wave').attr('src','static/icons/indicators/medium/wave.gif').show();
408
                    setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
409
                }
410
                else {
411
                    // handling active to active or inactive to inactive changes
412
                    if (TRANSITIONS[current_message] && TRANSITIONS[current_message] != 'Rebooting') {
413
                        // don't do anything if it is still in transition
414
                    }
415
                    else if ((TRANSITIONS[current_message] == 'Rebooting' && server.status == 'ACTIVE') ||
416
                             (STATUSES['BUILD'] == current_message && server.status == 'ACTIVE')) {
417
                        // if it has been rebooted or just created
418
                        log_server_status_change(existing, server.status);
419
                        existing.find(".status").text(STATUSES[server.status]);
420
                        existing.find('.spinner').hide();
421
                        existing.find(' .wave').attr('src','static/icons/indicators/medium/wave.gif').show();
422
                        setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
423
                    }
424
                    else {
425
                        // in any other case just change the status and ignore spinners/waves
426
                        existing.find(".status").text(STATUSES[server.status]);
427
                    }
428
                }
429
            }
430
            // find and display ips
431
            var ips = get_public_ips(server);
432
            existing.find("a.ip span.public").text(ips['ip4']);
433
        }
434
        // if it doesn't exist and the server is not DELETED, make a new entry
435
        else if ( server.status != 'DELETED') {
436
            // clone the proper template and put basic values in
437
            var machine = $("#machinesview-icon.standard #machine-container-template").clone().attr("id", server.id).fadeIn("slow");
438
            machine.find(".scrollable").scrollable({vertical: true});
439
            machine.find("div.name span.name").text(server.name.substring(0,100));
440
            machine.find("span.imagetag").text(server_image);
441
            machine.find(".status").text(STATUSES[server.status]);
442
            // check server status to select where to append the new server to
443
            if (ACTIVE_STATES.indexOf(STATUSES[server.status]) >= 0 ) {
444
                // append to running
445
                machine.find("img.logo").attr("src","static/icons/machines/medium/"+server_image+'-on.png');
446
                machine.appendTo("#machinesview-icon.standard .running");
447
            } else {
448
                // append to terminated
449
                machine.find("img.logo").attr("src","static/icons/machines/medium/"+server_image+'-off.png');
450
                machine.appendTo("#machinesview-icon.standard .terminated");
451
            }
452
            //show spinner if server is still building or rebooting
453
            if (server.status == 'BUILD' || server.status == 'REBOOT' ) {
454
                machine.find('.spinner').show();
455
            }
456
            // find and display flavor parameters
457
            var flavor_params = get_flavor_params(server.flavorRef);
458
            machine.find(".cpu-data").text(flavor_params['cpus']);
459
            machine.find(".ram-data").text(flavor_params['ram']);
460
            machine.find(".disk-data").text(flavor_params['disk']);
461
            // find and display image parameters
462
            var image_params = get_image_params(server.imageRef);
463
            machine.find(".image-data").text(image_params['name'].substring(0,15));
464
            machine.find(".image-size-data").text(image_params['size']);
465
            // find and display ips
466
            var ips = get_public_ips(server);
467
            machine.find("a.ip span.public").text(ips['ip4']);
468
        }
469
        /*
470
        Do some repeated actions that include:
471
            1. Update actions
472
            2. Metadata list updating
473
        */
474
        update_iconview_actions(server.id, server.status);
475
        if (!(server.metadata == undefined)) {
476
                list_metadata_keys(server.id, server.metadata.values);
477
        }
478
    });
479
    /*
480
    Do some standard stuff, repeated each time
481
    FIXME: Can these be moved to a new function?
482
    */
483
    $("#machinesview-icon.standard > div.large-spinner").hide();
484
    // show all separators and hide the last one
485
    $("#machinesview-icon.standard div.machine-container div.separator").show();
486
    $("#machinesview-icon.standard div.machine-container:last-child").find("div.separator").hide();
487
    // the terminated div shows only when terminated machines are available
488
    if ($("#machinesview-icon.standard .terminated div.name").length > 0) {
489
        $("div.terminated").fadeIn("slow");
490
    } else {
491
        $("div.terminated").fadeOut("slow");
492
    }
493
    // show message in case user has no servers!
494
    if ($('#machinesview-icon .machine-container').length < 2) {
495
        showWelcome();
496
    } else {
497
        hideWelcome();
498
    }
499
    // set confirm box position
500
    if (window.innerHeight - 335 < $('#machinesview-icon.standard').height())
501
        $('.confirm_multiple').addClass('fixed');
502
    else
503
        $('.confirm_multiple').removeClass('fixed');
504
}
505

506
// update metadata list
507
function list_metadata_keys(serverID, keys) {
508
    // empty the list if it already exists
509
    $("#machinesview-icon.standard div.#" +serverID).find("div.items").empty();
510
    //start counter
511
    var i=0;
512
    // show values
513
    for (var key in keys) {
514
        $("#machinesview-icon.standard div.#" +serverID).find(".items").append("<div class='item'>" + key + "</div>");
515
        i++;
516
    }
517
    //hide the metadata controls if we have less than 3 metadata
518
    if (i <= 3) {
519
        $("#machinesview-icon.standard div.#" +serverID).find(".metadata-actions").hide();
520
    }
521
    //show the metadata controls if we have more than 3 metadata
522
    if (i > 3) {
523
        $("#machinesview-icon.standard div.#" +serverID).find(".metadata-actions").show();
524
    }
525
    $("#machinesview-icon.standard div.#" +serverID).find(".metadata-count").text(i);
526
}
527

528
// indicate that the requested action was succesfully completed
529
function display_success(serverID) {
530

531
}
532

533
// indicate that the requested action was not completed
534
function display_failure(status, serverID, action, responseText) {
535
    $('#machinesview-icon.standard #'+serverID+ ' .spinner').hide();
536
    $('#machinesview-icon.standard #'+serverID+ ' .action_error .action').text(action);
537
    $('#machinesview-icon.standard #'+serverID+ ' .action_error .code').text(status);
538
    $('#machinesview-icon.standard #'+serverID+ ' .action_error .message').text(responseText);
539
    $('#machinesview-icon.standard #'+serverID+ ' .action_error').show();
540
}
541

542
// basic functions executed on page load
543
if ( flavors.length == 0 && images.length == 0 ) {
544
    // configure flavors, this also calls update_vms(UPDATE_INTERVAL)
545
    update_flavors();
546
    // populate image list
547
    update_images();
548
} else if ( flavors.length == 0 && images.length != 0 ) {
549
    // configure flavors, this also calls update_vms(UPDATE_INTERVAL)
550
    update_flavors();
551
} else if ( flavors.length != 0 && images.length == 0 ) {
552
    // populate image list
553
    update_images();
554
    update_vms(UPDATE_INTERVAL);
555
} else {
556
    // start updating vm list
557
    update_vms(UPDATE_INTERVAL);
558
}
559

560
// reposition multiple confirmation box on window resize
561
$(window).resize(function(){
562
    if (this.innerHeight - 335 < $('#machinesview-icon').height())
563
        $('.confirm_multiple').addClass('fixed');
564
    else
565
        $('.confirm_multiple').removeClass('fixed');
566
});
567

568
// set the label of the multiple buttons
569
$('.confirm_multiple button.yes').text('Confirm All');
570
$('.confirm_multiple button.no').text('Cancel All');
571

    
572
</script>