Statistics
| Branch: | Tag: | Revision:

root / ui / templates / networks.html @ 2b837adf

History | View | Annotate | Download (52.6 kB)

1
<!--
2
Copyright 2011 GRNET S.A. All rights reserved.
3

4
Redistribution and use in source and binary forms, with or
5
without modification, are permitted provided that the following
6
conditions are met:
7

8
  1. Redistributions of source code must retain the above
9
     copyright notice, this list of conditions and the following
10
     disclaimer.
11

12
  2. Redistributions in binary form must reproduce the above
13
     copyright notice, this list of conditions and the following
14
     disclaimer in the documentation and/or other materials
15
     provided with the distribution.
16

17
THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
POSSIBILITY OF SUCH DAMAGE.
29

30
The views and conclusions contained in the software and
31
documentation are those of the authors and should not be
32
interpreted as representing official policies, either expressed
33
or implied, of GRNET S.A.
34
-->
35

    
36
{% load i18n %}
37

    
38
<!-- the create button -->
39
<div id="networks-createcontainer">
40
    <div id="beforecreate"></div>
41
    <a id="networkscreate" rel="#networks-wizard" href="#">{% trans "Create New +" %}</a>
42
</div>
43

    
44
<!-- add new network overlay -->
45
<div>
46
    <div class="modal" id="networks-wizard">
47
        <div class="header">
48
        </div>
49
        <h2>{% trans "Name your network" %}</h2>
50
        <hr class="topruler" />
51
        <div class="container">
52
            <div class="name-input">
53
                <label>{% trans "Name" %}:</label>
54
                <input type="text" class="text" name="machine_name"></input>
55
                <span class="help">{% trans "(* Required field)" %}</span>
56
            </div>
57
        </div>
58
        <hr class="bottomruler" />
59
        <button type="button" id="add-network-cancel" class="cancel">{% trans "Cancel" %}</button>
60
        <button type="button" id="add-network-create" class="create">{% trans "Create Network" %}</button>
61
        <hr class="separator-end"></hr>
62
    </div>
63
</div>
64

    
65
<!-- networks list -->
66
<div id="networks-container">
67
    <!-- spinner while loading list -->
68
    <div class = "large-spinner"></div>
69

    
70
    <!-- public network template -->
71
    <div class="network" id="public-template">
72
        <img class="network-logos" src="static/internet.png" />
73
        <div href="#" class="name-div">
74
            <h5 class="namecontainer">
75
                <span class="name">{% trans "Internet" %}</span>
76
            </h5>
77
        </div>
78
        <div class="network-machines">
79
            <div class="machines-header">
80
                <div class="machines-label">{% trans "machines" %}
81
                    (<span class="machines-count">0</span>)
82
                </div>
83
                <div class="toggler down"></div>
84
            </div>
85
        </div>
86
        <div class="network-contents">
87
            <div class="network-placeholder">
88
                <div class="machines-list">
89
                <!-- append machines here -->
90
                </div>
91
                <!-- Adding servers to public network is not supported in 0.5
92
                <div class="empty-network-slot" id="machine-template">
93
                    <div class='network-add-machine'>
94
                        <span class="add-icon">+</span>
95
                    </div>
96
                </div>
97
                -->
98
            </div>
99
        </div>
100
        <div class="state">
101
            <div class="status">{% trans "Public Network" %}</div>
102
            <div class="indicators network-indicator">
103
                <div class="indicator1"></div>
104
                <div class="indicator2"></div>
105
                <div class="indicator3"></div>
106
                <div class="indicator4"></div>
107
            </div>
108
        </div>
109
        <div class="actions">
110
             <!-- Adding servers to public network is not supported in 0.5
111
            <a href="#" class="action-add">{% trans "Add Machine" %}</a>
112
            -->
113
        </div>
114
        <div class="confirm_single">
115
            <button class="yes">{% trans "Confirm" %}</button>
116
            <button class="no">{% trans "Cancel" %}</button>
117
        </div>
118
        <div class="action_error" align="center">
119
            {% trans "<span>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
120
            <span class="code"></span>
121
            <span class="message"></span>
122
            <button class="details">{% trans "Details" %}</button>
123
        </div>
124
    </div>
125

    
126
    <!-- template for machines in public network -->
127
    <div class="network-machine" id="public-machine-template">
128
        <div class="network-cable"></div>
129
        <div class="machine-actions">
130
            <a href="#" class="action-details">{% trans "Details" %}</a>
131
        </div>
132
        <div class="confirm_single">
133
            <button class="yes">{% trans "Confirm" %}</button>
134
            <button class="no">{% trans "Cancel" %}</button>
135
        </div>
136
        <div class="action_error" align="center">
137
            {% trans "<span>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
138
            <span class="code"></span>
139
            <span class="message"></span>
140
            <button class="details">{% trans "Details" %}</button>
141
        </div>
142
        <div class="ips">
143
            <div class="ip4-container status">
144
                {% trans "IPv4" %}:
145
                <span class="ip4">192.94.73.15</span>
146
            </div>
147
            <div class="ip6-container status">
148
                {% trans "IPv6" %}:
149
                <span class="ip6">vv</span>
150
            </div>
151
        </div>
152
        <img class="logo" src="static/icons/machines/medium/debian-on.png" />
153
        <div class='network-remove-machine'>
154
            <!-- Removing servers from public network is not supported in 0.5
155
            <span class="remove-icon">X</span>
156
            -->
157
            <span>&nbsp;</span>
158
        </div>
159
        <div href="#" class="machine-name-div">
160
            <h5 class="namecontainer">
161
                <span class="name">my desktop1</span>
162
            </h5>
163
        </div>
164
        <div class="firewall">
165
            <div class="firewall-header">
166
                <div class="firewall-label">{% trans "Firewall" %}
167
                    (<span class="firewall-off">{% trans "Off" %}</span>)
168
                </div>
169
                <div class="toggler down"></div>
170
            </div>
171
        </div>
172
        <div class="firewall-content">
173
            <div class="firewall-cable"></div>
174
            <input type="radio" class="checkboxes" value="DISABLED" name="firewall" />
175
            <span class="checkbox-legends">{% trans "Unprotected mode (Firewall off)" %}</span>
176
            <br />
177
            <input type="radio" class="checkboxes" value="ENABLED" name="firewall" />
178
            <span class="checkbox-legends">{% trans "Fully protected mode (Firewall on)" %}</span>
179
            <br />
180
            <input type="radio" class="checkboxes" value="PROTECTED" name="firewall" />
181
            <span class="checkbox-legends">{% trans "Basically protected mode (Firewall on)" %}</span>
182
            <button type="submit" class="firewall-apply">{% trans "Apply" %}</button>
183
        </div>
184
        <div class="network-separator machines"></div>
185
    </div>
186

    
187
    <div class="separator" style="display:none;"></div>
188

    
189
    <!-- private network template -->
190
    <div class="network" id="private-template">
191
        <div class="actions">
192
            <a href="#" class="action-add">{% trans "Add Machine" %}</a>
193
            <a href="#" class="action-network-destroy">{% trans "Destroy" %}</a>
194
        </div>
195
        <div class="action_error" align="center">
196
            {% trans "<span>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
197
            <span class="code"></span>
198
            <span class="message"></span>
199
            <button class="details">{% trans "Details" %}</button>
200
        </div>
201
        <div class="confirm_single">
202
            <button class="yes">{% trans "Confirm" %}</button>
203
            <button class="no">X</button>
204
        </div>
205
        <div class="action_error" align="center">
206
            {% trans "<span>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
207
            <span class="code"></span>
208
            <span class="message"></span>
209
            <button class="details">{% trans "Details" %}</button>
210
        </div>
211
        <div class="state">
212
            <div class="status">{% trans "Private Network" %}</div>
213
            <div class="indicators network-indicator">
214
                <div class="indicator1"></div>
215
                <div class="indicator2"></div>
216
                <div class="indicator3"></div>
217
                <div class="indicator4"></div>
218
            </div>
219
            <img class="spinner" style="display:none" src="static/icons/indicators/medium/progress.gif" />
220
            <img class="wave" style="display:none" src="static/icons/indicators/medium/wave.gif" />
221
        </div>
222
        <img class="network-logos" src="static/network.png" />
223
        <div href="#" class="name-div">
224
            <h5 class="namecontainer editable">
225
                <span class="name">{% trans "My Network 1" %}</span>
226
                <span class="rename-network"></span>
227
                <div class="editbuttons" style="display:none">
228
                    <span class="save"></span>
229
                    <span class="cancel"></span>
230
                </div>
231
            </h5>
232
        </div>
233
        <div class="network-machines">
234
            <div class="machines-header">
235
                <div class="machines-label">{% trans "machines" %}
236
                    (<span class="machines-count">0</span>)
237
                </div>
238
                <div class="toggler down"></div>
239
            </div>
240
        </div>
241
        <div class="network-contents">
242
            <div class="network-placeholder">
243
                <div class="machines-list">
244
                <!-- append machines here -->
245
                </div>
246
                <div class="empty-network-slot" id="machine-template">
247
                    <div class='network-add-machine'><div class="add-icon">+</div></div>
248
                </div>
249
            </div>
250
        </div>
251
    </div>
252

    
253
    <!-- template for machines in private network -->
254
    <div class="network-machine" id="private-machine-template">
255
        <div class="machine-actions">
256
            <a href="#" class="action-disconnect">{% trans "Disconnect" %}</a>
257
            <a href="#" class="action-details">{% trans "Details" %}</a>
258
        </div>
259
        <div class="confirm_single">
260
            <button class="yes">{% trans "Confirm" %}</button>
261
            <button class="no">X</button>
262
        </div>
263
        <div class="action_error" align="center">
264
            {% trans "<span>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
265
            <span class="code"></span>
266
            <span class="message"></span>
267
            <button class="details">{% trans "Details" %}</button>
268
        </div>
269
        <img class="logo" src="static/icons/machines/medium/debian-on.png" />
270
        <div class='network-remove-machine'><span class="remove-icon">X</span></div>
271
        <div href="#" class="machine-name-div">
272
            <h5 class="namecontainer editable">
273
                <span class="name">my desktop1</span>
274
            </h5>
275
        </div>
276
        <h5 class='machine-connect'>
277
            <span>{% trans "Connect" %}</span> {% trans "to manage private IPs" %}
278
        </h5>
279
        <div class="network-separator machines"></div>
280
    </div>
281

    
282
    <!-- the actual structure to be populated -->
283
    <div class="public-networks"></div>
284
    <div class="private-networks" style="display:none;"></div>
285
</div>
286

    
287
<!-- add servers to network overlay -->
288
<div>
289
    <div id="add-machines-wizard" class="modal">
290
        <h3 class="popup-header">{% trans "Add machine" %}</h3>
291
        <p style='display:none;'>hidden network id</p>
292
        <div class="popup-body">
293
            <div class="popup-body-inner">
294
                <div class="popup-title">{% trans "Select machines to add to:" %}</div>
295
                <div class="network-name"></div>
296
                <div class="popup-separator"></div>
297
                <div class="machines-container">
298
                    <div class="large-spinner"></div>
299
                    <div id='machine-entry-template' style="display:none;">
300
                        <input type="checkbox" />
301
                        <img class=list-logo src="static/icons/machines/small/debian-on.png" title="debian"></img>
302
                        <span class="machine-name">kati</span>
303
                    </div>
304
                </div>
305
            </div>
306
        </div>
307
        <div class="buttons">
308
            <button type="button" class="cancel" id="add-server-cancel">{% trans "Cancel" %}</button>
309
            <button type="button" class="add" id="add-server-add">{% trans "Add" %}</button>
310
        </div>
311
    </div>
312
</div>
313

    
314
<a id="add-machines-overlay" href="#" rel="#add-machines-wizard"></a>
315

    
316
<!-- reboot dialog -->
317
<div class="reboot-dialog">
318
    <p>{% trans "For the network changes to take effect you need to reboot all affected machines:" %}</p>
319
    <button class="reboot-all">{% trans "Reboot All" %}</button>
320
    <div id="reboot-machine-template" class='reboot-machine-entry'>
321
        <div class="name">my debian server</div>
322
        <button class="reboot-single">{% trans "Reboot" %}</button>
323
        <div class="reboot-error">
324
            <div class="code"></div>
325
            <div class="action"></div>
326
            <div class="message"></div>
327
            <button class="details">{% trans "Error!" %}</button>
328
        </div>
329
    </div>
330
    <div class="reboot-list"></div>
331
</div>
332

    
333
<!-- multiple confirmation dialog -->
334
<div class="confirm_multiple">
335
    <p>{% trans "Your actions will affect" %} <span class="actionLen">XX</span> {% trans "networks or machines" %}</p>
336
    <button class="yes">{% trans "Confirm All" %}</button>
337
    <button class="no">{% trans "Cancel All" %}</button>
338
</div>
339

    
340
<script>
341
// add network wizard initialization
342
$(function() {
343
    // create wizard overlay
344
    $("a#networkscreate").overlay({
345
        mask: '#666',
346
        effect: 'default',
347
        top: '10%',
348
        closeOnClick: false,
349
        oneInstance: false,
350
        closeOnEsc: true,
351
        load: false
352
    });
353
});
354

355
// intercept click to create new private network
356
$("#networkscreate").click(function() {
357
    // reset and load wizard
358
    $('#networks-wizard span.help').removeClass('red');
359
    $('#networks-wizard input').val('');
360
    $('#networks-wizard #add-network-create').text('{% trans 'Create Network' %}');
361
    $("#networks-wizard").show();
362
    $('#networks-wizard input').focus();
363
    $("a#networkscreate").data('overlay').load();
364
    // enable submit button
365
    $("#networks-wizard #add-network-create").removeAttr('disabled');
366
    return false;
367
});
368

369
// exit the add machine to network wizard
370
$("#add-network-cancel").live('click', function() {
371
    $("a#networkscreate").overlay().close();
372
});
373

374
// add selected machines to network
375
$("#add-network-create").live('click', function() {
376
    if ($('#networks-wizard input').val() == '') {
377
        $('#networks-wizard input').focus();
378
        $('#networks-wizard span.help').addClass('red');
379
    } else {
380
        // disable submit button to prevent multiple calls
381
        $(this).attr("disabled", true);
382
        // load progress bar
383
        $(this).text('');
384
        $(this).html('<img src="static/icons/indicators/medium/horizontal-progress.gif"></img>');
385
        // make the call
386
        networkName = $('#networks-wizard input').val();
387
        create_network(networkName);
388
    }
389
    return false;
390
});
391

392
// toggle component with class network-contents
393
$("#networks-pane div.machines-header").live('click', function() {
394
    if ($(this).find('.toggler').hasClass('up')) {
395
        $(this).find('.toggler').removeClass('up');
396
        $(this).find('.toggler').addClass('down');
397
        $(this).find('.machines-label').removeClass('darker');
398
        $(this).closest('div.network').removeClass('light-background');
399
    } else {
400
        $(this).find('.toggler').removeClass('down');
401
        $(this).find('.toggler').addClass('up');
402
        $(this).find('.machines-label').addClass('darker');
403
        $(this).closest('div.network').addClass('light-background');
404
    }
405
    $(this).parent().next("#networks-pane .network-contents").slideToggle(600);
406
    return false;
407
});
408

409
// toggle component with class network-contents
410
$("#networks-pane .network-logos").live('click', function() {
411
    $(this).closest('div.network').find('div.machines-header').click();
412
    return false;
413
});
414

415
//initiate network renaming
416
$("#networks-pane .name-div .rename-network, #networks-pane .name-div h5.editable span.name").live('click', function() {
417
    $(this).parent().find('.name').html("<input id=\"txtEdit\" type=\"text\" class=\"nametextbox\" value=\"" +
418
                                        $(this).parent().find('.name').text() +
419
                                        "\" / ><span class=\"oldValue\">" +
420
                                        $(this).parent().find('.name').text() + "</span>");
421
    $(this).parent().find('.rename-network').hide();
422
    $(this).parent().find(".editbuttons").fadeIn();
423
    $(this).parent().find(".nametextbox").focus().select();
424
    $(this).parent().removeClass('editable');
425

426
    //submit wizard by pressing enter on the name textbox
427
    $("#txtEdit").keydown(function (e) {
428
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
429
            $(this).parent().parent().find('div.editbuttons span.save').click();
430
            return false;
431
        } else if ((e.which && e.which == 27) || (e.keyCode && e.keyCode == 27)) {
432
            $(this).parent().parent().find('div.editbuttons span.cancel').click();
433
            return true;
434
        }
435
    });
436
    return false;
437
});
438

439
//rename machine
440
$("#networks-pane .name-div .editbuttons .save").live('click', function() {
441
    networkID = $(this).closest('.network').attr("id").split('-').pop();
442
    networkName = $(this).parent().parent().find('.nametextbox').val();
443
    if (networkName.trim() == ''){
444
        return false;
445
    }
446
    $(this).parent().parent().find('.name').html($(this).parent().parent().find('.nametextbox').val());
447
    $(this).parent().parent().find(".editbuttons").fadeOut("fast");
448
    $(this).parent().parent().find(".rename-network").fadeIn("slow");
449
    rename_network(networkID, networkName);
450
    return false;
451
});
452

453
//cancel renaming
454
$("#networks-pane .name-div .editbuttons .cancel").live('click', function() {
455
    $(this).parent().parent().find('.name').html($(this).parent().parent().find('.oldValue').text());
456
    $(this).parent().parent().find(".editbuttons").hide();
457
    $(this).parent().parent().find(".rename-network").fadeIn();
458
    $(this).parent().parent().addClass('editable');
459
    return false;
460
});
461

462
// intercept click to delete network
463
$("#networks-pane .action-network-destroy").live('click', function() {
464
    var networkID = $(this).parent().parent().attr('id').split('-').pop();
465
    var networkName = $(this).parent().parent().find(".name-div span.name").text();
466
    var found = false;
467
    $(this).parent().children('a').removeClass('selected');
468
    $(this).addClass('selected');
469
    $(this).parent().addClass('display')
470
    $(this).parent().parent().find('.action_error').hide();
471
    for (i=0; i < pending_actions.length; i++){ // if there is already a pending action for this network replace it
472
        if (pending_actions[i][0] == delete_network && pending_actions[i][1] == networkID){
473
            pending_actions[i][0] = delete_network;
474
            found = true
475
        }
476
    }
477
    if (!found) {
478
        // no pending action for this network was found, so let's just add it to the list
479
        pending_actions.push([delete_network, networkID, networkName]);
480
    }
481
    update_network_confirmations();
482
    return false;
483
});
484

485
// intercept click to remove machine from network
486
$("#networks-pane .remove-icon").live('click', function() {
487
    $(this).closest('.network-machine').find('.action-disconnect').click();
488
    return false;
489
});
490

491
// intercept click to remove machine from network
492
$("#networks-pane .action-disconnect").live('click', function() {
493
    var serverID = $(this).parent().parent().attr('id').split('-').pop();
494
    var serverName = $(this).closest('.network-machine').find('span.name').text();
495
    var networkID = $(this).closest('.network').attr('id').split('-').pop();
496
    var serverState = $(this).closest('.network-machine').find('img.logo').attr('src').split('-')[1];
497
    serverState = serverState.split('.')[0];
498
    var found = false;
499
    $(this).parent().children('a').removeClass('selected');
500
    $(this).addClass('selected');
501
    $(this).parent().addClass('display')
502
    $(this).parent().parent().find('.action_error').hide();
503
    for (i=0; i < pending_actions.length; i++){
504
        // if there is already a pending action for this network replace it
505
        if (pending_actions[i][0] == remove_server_from_network &&
506
            pending_actions[i][1] == networkID &&
507
            pending_actions[i][2] == serverID) {
508
                pending_actions[i][0] = remove_server_from_network;
509
                found = true
510
        }
511
    }
512
    if (!found) {
513
        // no pending action for this network was found, so let's just add it to the list
514
        pending_actions.push([remove_server_from_network, networkID, serverID, serverName, serverState]);
515
    }
516
    update_network_confirmations();
517
    return false;
518
});
519

520
$("#networks-pane .action-details").live('click', function() {
521
    var serverID = $(this).parent().parent().attr('id').split('-').pop();
522
    $.cookie('view', '2');
523
    $.cookie('server', serverID);
524
    $('a#machines').click();
525
    return false;
526
});
527

528
// add machines wizard initialization
529
$(function() {
530
    // create wizard overlay
531
    $("a#add-machines-overlay").overlay({
532
        mask: '#666',
533
        effect: 'default',
534
        top: '10%',
535
        closeOnClick: false,
536
        oneInstance: false,
537
        closeOnEsc: true,
538
        load: false
539
    });
540
});
541

542
// intercept click to add machine to  network
543
$("#networks-pane .action-add").live('click', function() {
544
    // reset pre-existing values
545
    $('#add-server-add').text('{% trans 'Add' %}');
546
    $("#add-machines-wizard .network-name").text($(this).closest('.network').find('.name-div span.name').text());
547
    $("#add-machines-wizard p").text($(this).closest('.network').attr('id').split('-').pop());
548
    $("#add-machines-wizard .large-spinner").show();
549
    $('[id^="list-entry-server-"]').remove();
550
    // list new values
551
    list_machines();
552
    // load wizard
553
    $("#add-machines-wizard").show();
554
    $("a#add-machines-overlay").data('overlay').load();
555
    // enable submit button
556
    $("#add-machines-wizard #add-server-add").removeAttr('disabled');
557
    return false;
558
});
559

560
//submit wizard by pressing enter on the name textbox
561
$("#networks-wizard div.name-input input.text").keypress(function (e) {
562
    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
563
        $('#add-network-create').click();
564
        return false;
565
    } else {
566
        return true;
567
    }
568
});
569

570
// intercept click to bring up the add machine to network wizard
571
$("#networks-pane .add-icon").live('click', function() {
572
    $(this).closest('.network').find('.action-add').click();
573
});
574

575
// get machines in public network and list them in add server to network wizard
576
function list_machines() {
577
    var networkID = $("#add-machines-wizard p").text();
578
    // get the list of servers from the UI
579
    var all_machines = $("#networks-pane .public-networks .network-machine");
580

581
    $.each(all_machines, function(i, machine) {
582
        var currentID = machine.id.split('-').pop();
583
        // if machine already exists in private network
584
        if ( $('#net-' + networkID + '-server-' + currentID).length > 0 ) {
585
            // do nothing
586
        } else {
587
            // put it in the list
588
            var entry = $("#add-machines-wizard #machine-entry-template").clone().attr("id", "list-entry-server-" + currentID);
589
            entry.find('input').attr("name", currentID);
590
            entry.find('img').attr('src', 'static/icons/machines/small/' + $(machine).find('img.logo').attr('src').split('/').pop());
591
            entry.find('.machine-name').text($(machine).find('span.name').text());
592
            entry.appendTo("#add-machines-wizard .machines-container");
593
        }
594
    });
595
    $("#add-machines-wizard .large-spinner").hide();
596
    $('[id^="list-entry-server-"]').fadeIn("slow");
597
    return false;
598
}
599

600
// exit the add machine to network wizard
601
$("#add-server-cancel").live('click', function() {
602
    $("a#add-machines-overlay").overlay().close();
603
});
604

605
// add selected machines to network
606
$("#add-server-add").live('click', function() {
607
    var selections = $("#add-machines-wizard :checkbox:checked");
608
    // if there are no selections simply close the wizard
609
    if (selections.length == 0 ) {
610
        $("a#add-machines-overlay").overlay().close();
611
    }
612
    // if there are servers selected make the proper call
613
    else {
614
        var networkID = $("#add-machines-wizard p").text();
615
        var serverIDs = [];
616
        var serverNames = [];
617
        var serverState = [];
618
        var serverStates = [];
619
        $.each(selections, function(i, selection) {
620
            serverIDs.push(selection.name);
621
            serverNames.push($("#list-entry-server-" + selection.name + " span.machine-name").text());
622
            serverState = $("#list-entry-server-" + selection.name + " img.list-logo").attr('src').split('-')[1];
623
            serverState = serverState.split('.')[0];
624
            serverStates.push(serverState);
625
        });
626
        // disable submit button to prevent multiple calls
627
        $(this).attr("disabled", true);
628
        // load progress bar
629
        $(this).text('');
630
        $(this).html('<img src="static/icons/indicators/medium/horizontal-progress.gif"></img>');
631
        // show the proper spinner
632
        $('#net-' + networkID + '.network div.status').text(NET_STATES['Connecting']);
633
        $('#net-' + networkID + '.network img.spinner').show();
634
        // make the calls
635
        add_server_to_network(networkID, serverIDs, serverNames, serverStates);
636
    }
637
    return false;
638
});
639

640
// toggle component with class firewall-contents
641
$("#networks-pane div.firewall-header").live('click', function() {
642
    if ($(this).find('.toggler').hasClass('up')) {
643
        $(this).find('.toggler').removeClass('up');
644
        $(this).find('.toggler').addClass('down');
645
        $(this).find('.firewall-label').removeClass('darker');
646
    } else {
647
        $(this).find('.toggler').removeClass('down');
648
        $(this).find('.toggler').addClass('up');
649
        $(this).find('.firewall-label').addClass('darker');
650
    }
651
    $(this).parent().next(".firewall-content").slideToggle(600);
652
    return false;
653
});
654

655
//hide firewall content on apply click
656
$("#networks-pane .firewall-apply").live('click', function() {
657
    var serverID = $(this).closest('.network-machine').attr("id").split('-').pop();
658
    var networkID = $(this).closest('.network-machine').attr("id").split('-')[1];
659
    var profile = $(this).parent().find('input:checked').attr('value');
660
    if (profile != undefined) {
661
        set_firewall(networkID, serverID, profile);
662
        $(this).attr("disabled", true);
663
        $(this).html('<img src="static/icons/indicators/medium/horizontal-progress.gif"></img>');
664
    }
665
    return false;
666
});
667

668
function display_reboot_dialog(networkID, serverID, serverName, serverState) {
669
    // check if the server already exists in the list
670
    var existing_reboot = $("div.reboot-list div#server-" + serverID);
671
    if ( !existing_reboot.length && serverState != 'off') {
672
        $('div.reboot-dialog').fadeIn("slow");
673
        var reboot_entry = $('div#reboot-machine-template').clone().attr("id", "server-" + serverID);
674
        reboot_entry.find('div.name').text(serverName);
675
        reboot_entry.appendTo('div.reboot-list').show();
676
    }
677
    return false;
678
}
679

680
// intercept single reboot click
681
$("div.reboot-dialog button.reboot-single").live('click', function() {
682
    var serverID = $(this).parent().attr('id').split('-')[1];
683
    reboot([serverID]);
684
    // load progress bar
685
    $(this).text('');
686
    $(this).html('<img src="static/icons/indicators/medium/horizontal-progress.gif"></img>');
687
    // disable submit button to prevent multiple calls
688
    $(this).attr("disabled", true);
689
    return false;
690
});
691

692
// intercept multiple reboot click
693
$("div.reboot-dialog button.reboot-all").live('click', function() {
694
    $(this).parent().find('div.reboot-list button.reboot-single').click();
695
    // load progress bar for all buttons
696
    $(this).parent().find('button').text('');
697
    $(this).parent().find('button').html('<img src="static/icons/indicators/medium/horizontal-progress.gif"></img>');
698
    // disable submit button to prevent multiple calls
699
    $(this).attr("disabled", true);
700
    return false;
701
});
702

703
// intercept error on reboot click
704
$("div.reboot-dialog button.details").live('click', function() {
705
    $(this).closest('.reboot-machine-entry').remove();
706
    ajax_error( $(this).parent().children('.code').text(),
707
                undefined,
708
                $(this).parent().children('.action').text(),
709
                $(this).parent().children('.message').text());
710
    if ( !$('div.reboot-list').children().length ) {
711
        $('div.reboot-dialog').hide();
712
    }
713
    return false;
714
});
715

716
// after reboot success
717
function display_reboot_success(serverID) {
718
    // remove server from the list
719
    $('div.reboot-list #server-' + serverID).remove();
720
    // if there are no other servers on the list, hide the reboot dialog
721
    if ( !$('div.reboot-list').children().length ) {
722
        $('div.reboot-dialog').hide();
723
        // reset all buttons
724
        $("div.reboot-dialog button.reboot-all").html('');
725
        $("div.reboot-dialog button.reboot-all").text('{% trans 'Reboot All' %}');
726
        $("div.reboot-dialog button.reboot-single").html('');
727
        $("div.reboot-dialog button.reboot-single").text('{% trans 'Reboot' %}');
728
        // enable submit button
729
        $("#div.reboot-dialog button.reboot-all").removeAttr('disabled');
730
    }
731
    return false;
732
}
733

734
// after reboot error
735
function display_reboot_failure(status, serverID, responseText) {
736
    $('div.reboot-list #server-' + serverID + ' button.reboot-single').hide();
737
    $('div.reboot-list #server-' + serverID + ' div.code').text(status);
738
    $('div.reboot-list #server-' + serverID + ' div.action').text('Reboot');
739
    $('div.reboot-list #server-' + serverID + ' div.message').text(responseText);
740
    $('div.reboot-list #server-' + serverID + ' button.details').show();
741
    return false;
742
}
743

744
// confirm single action
745
$("#networks-pane div.confirm_single .yes").live('click', function() {
746
    // this works both for server and network actions
747
    var serverID = [];
748
    if ($(this).closest('.network-machine').attr('id')) {
749
        serverID = $(this).closest('.network-machine').attr('id').split('-').pop();
750
    }
751
    var networkID = $(this).closest('.network').attr("id").split('-').pop();
752
    // execute actions
753
    for (i=0;i<pending_actions.length;i++){
754
        // if there is a pending action for this server execute it
755
        if (pending_actions[i][0] == delete_network &&
756
            pending_actions[i][1] == networkID) {
757
                action = pending_actions.splice(i,1)[0];
758
                $(this).closest('div.network').find('div.status').text(NET_STATES['Destroying']);
759
                $(this).closest("div.network").find('div.state').addClass('destroying-state');
760
                $(this).closest('div.network').find('img.spinner').show();
761
                action[0]([action[1]]); // execute action
762
        } else if ( pending_actions[i][0] == remove_server_from_network &&
763
                    pending_actions[i][1] == networkID ) {
764
                        $(this).closest('div.network').find('div.status').text(NET_STATES['Disconnecting']);
765
                        $(this).closest('div.network').find('img.spinner').show();
766
                        action = pending_actions.splice(i,1)[0];
767
                        action[0]([action[1]], [action[2]], [action[3]], [action[4]]); // execute action
768
        } // for adding servers to a network look in $("#add-server-add").live('click', function() {...});
769
    }
770
    $(this).parent().hide();
771
    $(this).parent().parent().find('a.selected').removeClass('selected');
772
    $(this).parent().parent().children('div.actions').removeClass('display');
773
    update_network_confirmations();
774
    return false;
775
});
776

777
// cancel single action
778
$("#networks-pane div.confirm_single .no").live('click', function(){
779
    // this works both for server and network actions
780
    var serverID = [];
781
    if ($(this).closest('.network-machine').attr('id')) {
782
        serverID = $(this).closest('.network-machine').attr('id').split('-').pop();
783
    }
784
    var networkID = $(this).closest('.network').attr("id").split('-').pop();
785
    // remove the action from the pending list
786
    $(this).parent().parent().children('div.machine-actions').children('a').removeClass('selected');
787
    $(this).parent().parent().children('div.machine-actions').removeClass('display');
788

789
    for (i=0; i < pending_actions.length; i++) { // if there is a pending action for this network remove it
790
        if (pending_actions[i][0] == delete_network && pending_actions[i][1] == networkID) {
791
                pending_actions.splice(i,1);
792
        } else if ( pending_actions[i][0] == remove_server_from_network &&
793
                    pending_actions[i][1] == networkID &&
794
                    pending_actions[i][2] == serverID) {
795
                        pending_actions.splice(i,1);
796
        }
797
    }
798
    $(this).parent().hide();
799
    $(this).parent().parent().find('a.selected').removeClass('selected');
800
    $(this).parent().parent().children('div.actions').removeClass('display');
801
    update_network_confirmations();
802
    return false;
803
});
804

805
// after single action call error
806
function display_net_failure(status, networkID, action, responseText) {
807
    return false;
808
}
809

810
// show, single action, error details
811
$("#networks-pane div.action_error .details").live('click', function(){
812
    $(this).parent().hide();
813
    ajax_error($(this).parent().children('.code').text(),
814
                 undefined,
815
                 $(this).parent().children('.action').text(),
816
                 $(this).parent().children('.message').text());
817
    return false;
818
});
819

820
// confirm all actions
821
$("#networks-pane div.confirm_multiple .yes").live('click', function(){
822
    while(pending_actions.length > 0){ // if there is a pending action for this network execute it
823
        action = pending_actions.pop(); // extract action
824
        var networkID = action[1];
825
        $('#networks-pane .selected').removeClass('selected');
826
        $('#networks-pane .display').removeClass('display');
827
        $('#networks-pane .confirm_single').hide();
828
        if (action[0] == delete_network) {
829
            $('#networks-pane #net-' + networkID + ' .status').text(NET_STATES['Destroying']);
830
            $('#networks-pane #net-' + networkID + ' .state').addClass('destroying-state');
831
            $('#networks-pane #net-' + networkID + ' .spinner').show();
832
            action[0]([networkID]); // execute action
833
        } else if (action[0] == remove_server_from_network) {
834
            $('div.network#net-'+networkID).find('div.status').text(NET_STATES['Disconnecting']);
835
            $('div.network#net-'+networkID).find('img.spinner').show();
836
            action[0]([action[1]], [action[2]], [action[3]], [action[4]]); // execute action
837
        }
838
    }
839
    update_network_confirmations();
840
    return false;
841
});
842

843
// cancel all actions
844
$("#networks-pane div.confirm_multiple .no").live('click', function(){
845
    pending_actions = [];
846
    $('#networks-pane .selected').removeClass('selected');
847
    $('#networks-pane .display').removeClass('display');
848
    $('#networks-pane .confirm_single').hide();
849
    update_network_confirmations();
850
    return false;
851
});
852

853
// update the networks list
854
function update_networks_view(servers_data, networks_data){
855
    /*
856
    Go through the input data. Update existing entries, add
857
    new ones to the list
858
    */
859

860
    // check for changes in networks
861
    if (networks_data){
862
        /*
863
        Here we are interested in private networks only
864
        and for servers disconnected from them
865
        */
866

867
        // if we wait for a new network to be created
868
        if ($('#add-network-create').children().length > 0) {
869
            var response_objects = networks_data.networks.values;
870
            // check all objects in the response
871
            for (i=0; i < response_objects.length; i++) {
872
                // if it contains the network we want to create
873
                var networkName = $('#networks-wizard input').val();
874
                if ( response_objects[i]['name'] == networkName) {
875
                    // close the wizard
876
                    $("a#networkscreate").overlay().close();
877
                    // and the network will be inserted in the DOM
878
                    // during this update loop
879
                }
880
            }
881
        }
882

883
        // update private networks
884
        $.each(networks_data.networks.values, function(i,network) {
885
            // search DOM for this network
886
            existing = $('#networks-pane #net-' + network.id);
887

888
            // If in the DOM exist multiple networks with the same id,
889
            // delete all but one.
890
            // Defensive coding - that shouldn't happen normally
891
            while (existing.length > 1) {
892
                existing.remove();
893
            }
894

895
            // If network already exists in DOM, update it
896
            if (existing.length) {
897
                // network was deleted
898
                if (network.status == 'DELETED') {
899
                    existing.next().remove(); // to delete its separator
900
                    existing.remove();
901
                }
902
                // network was renamed
903
                if (existing.find('.name-div span.name').text() != network.name) {
904
                    // set the new name
905
                    existing.find('.name-div span.name').text(network.name);
906
                }
907
                // a server was disconnected
908
                // search DOM for all machines
909
                existing_machines = $('div.private-networks div.network-machine');
910
                // check if the machines in the DOM exist in the response
911
                for (i=0; i<existing_machines.length; i++) {
912
                    // get the existing server id
913
                    var serverID = existing_machines[i].id.split('-')[3];
914
                    // if a server exists in DOM, but not in the response it has
915
                    // been disconnected
916
                    if ( network.servers.values.indexOf( parseInt(serverID) ) == -1 ) {
917
                        // remove it from DOM and reset all spinners
918
                        $('#' + existing_machines[i].id).remove();
919
                        $('#net-' + network.id + '.network div.status').text(NET_STATES['ACTIVE']);
920
                        $('#net-' + network.id + '.network img.spinner').hide();
921
                    }
922
                }
923
            }
924
            // If network does not exist in DOM, create it, do not take into account public network
925
            else if (network.id != 'public'){
926
                var privNet = $("#networks-pane #private-template").clone().attr("id", "net-" + network.id);
927
                privNet.find(".name-div span.name").text(network.name).fadeIn("slow");
928
                privNet.appendTo("#networks-pane .private-networks");
929
                $('div.separator:last').clone().appendTo("#networks-pane .private-networks");
930
            }
931
        });
932
    }
933

934
    // check for changes in servers
935
    if (servers_data) {
936
        /*
937
        Here we are interested in any server contained
938
        either in a public network or a private one
939
        */
940
        $.each(servers_data.servers.values, function(i,server) {
941
            /*
942
            First update the public network
943
            */
944

945
            // search public network's DOM for this server
946
            existing_public = $('#networks-pane #net-pub-server-' + server.id);
947

948
            // get the server's OS icon
949
            var server_image = os_icon(server.metadata);
950
            if (!(server.metadata == undefined)) {
951
                var server_image = os_icon(server.metadata);
952
            } else {
953
                var server_image = "unknown"
954
            }
955

956
            // server was deleted
957
            if (server.status == 'DELETED') {
958
                existing_public.remove();
959
            }
960

961
            // If server already exists in public network, update it
962
            if (existing_public.length){
963
                // server was renamed
964
                if (server.name != existing_public.find('span.name').text()) {
965
                    existing_public.find('span.name').text(server.name.substring(0,30));
966
                }
967
                // server has changed state
968
                if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') {
969
                    existing_public.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png');
970
                } else {
971
                    existing_public.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png');
972
                }
973
                // server has new ips
974
                var old_ip4 = existing_public.find('span.ip4').text();
975
                var old_ip6 = existing_public.find('span.ip6').text();
976
                var new_ips = get_public_ips(server);
977
                var new_ip4 = new_ips['ip4'];
978
                var new_ip6 = new_ips['ip6'];
979
                if (old_ip4 != new_ip4) {
980
                    if (new_ips['ip4'] == undefined) {
981
                        existing_public.find(".ip4-container").hide();
982
                    } else {
983
                        existing_public.find('span.ip4').text(new_ip4);
984
                    }
985
                }
986
                if (old_ip6 != new_ip6) {
987
                    if (new_ip6 == undefined) {
988
                        existing_public.find(".ip6-container").hide();
989
                    } else {
990
                        existing_public.find('span.ip6').text(new_ip6);
991
                    }
992
                }
993
                //update firewall setting
994
                try {
995
                    if (server.addresses.values[0].firewallProfile) {
996
                        existing_public.find("input[value=" + server.addresses.values[0].firewallProfile + "]").attr('checked',true);
997
                        existing_public.find(".firewall-label span").removeClass('firewall-off firewall-on');
998
                        if (server.addresses.values[0].firewallProfile == 'DISABLED') {
999
                            existing_public.find('.firewall-label span').addClass('firewall-off');
1000
                            existing_public.find('.firewall-label span').html(VARIOUS["OFF"]);
1001
                        } else {
1002
                            existing_public.find('.firewall-label span').addClass('firewall-on');
1003
                            existing_public.find('.firewall-label span').html(VARIOUS["ON"]);
1004
                        }
1005
                     }
1006
                } catch (err) {
1007
                    try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){};
1008
                }
1009
                //TODO: server has changed OS
1010
            }
1011
            // If server does not exist in public network, create it
1012
            else {
1013
                var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow");
1014
                machine.find('span.name').text(server.name.substring(0,30));
1015
                // find and display ips
1016
                var ips = get_public_ips(server);
1017
                if (ips['ip4'] == undefined) {
1018
                    machine.find(".ip4-container").hide();
1019
                } else {
1020
                    machine.find("span.ip4").text(ips['ip4']);
1021
                }
1022
                if (ips['ip6'] == undefined) {
1023
                    machine.find(".ip6-container").hide();
1024
                } else {
1025
                    machine.find("span.ip6").text(ips['ip6']);
1026
                }
1027
                // add the proper icon
1028
                if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') {
1029
                    machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png');
1030
                } else {
1031
                    machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png');
1032
                }
1033
                machine.appendTo("#networks-pane .public-networks .machines-list");
1034
                //update firewall setting
1035
                try {
1036
                    if (server.addresses.values[0].firewallProfile) {
1037
                        machine.find("input[value=" + server.addresses.values[0].firewallProfile + "]").attr('checked',true);
1038
                        machine.find(".firewall-label span").removeClass('firewall-off firewall-on');
1039
                        if (server.addresses.values[0].firewallProfile == 'DISABLED') {
1040
                            machine.find('.firewall-label span').addClass('firewall-off');
1041
                            machine.find('.firewall-label span').html(VARIOUS["OFF"]);
1042
                        } else {
1043
                            machine.find('.firewall-label span').addClass('firewall-on');
1044
                            machine.find('.firewall-label span').html(VARIOUS["ON"]);
1045
                        }
1046
                     }
1047
                } catch (err) {
1048
                    try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){};
1049
                }
1050
            }
1051

1052
            /*
1053
            Now update all private networks, this does NOT check for
1054
            disconnected servers (see above in updating private networks).
1055
            Since one server may belong to more than one private networks,
1056
            we follow a different approach.
1057
            We check each server and add, update or leave it as it is accordingly
1058
            */
1059
            try {
1060
                $.each(server.addresses.values, function(i,server_net) {
1061
                    // find in which private networks it belongs
1062
                    if (server_net.id != "public") {
1063
                        var existing_private = $("#networks-pane .private-networks #net-" + server_net.id + "-server-" + server.id);
1064
                        // add new server
1065
                        if (!existing_private.length) {
1066
                            var machine = $("#networks-pane #private-machine-template").clone().attr("id", "net-" + server_net.id + "-server-" + server.id).fadeIn("slow");
1067
                            machine.find('span.name').text(server.name.substring(0,30));
1068
                            if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') {
1069
                                machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png');
1070
                            } else {
1071
                                machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png');
1072
                            }
1073
                            machine.appendTo("#networks-pane .private-networks #net-" + server_net.id + " .machines-list");
1074
                        // hide spinners
1075
                        $('#net-' + server_net.id + '.network div.status').text(NET_STATES['ACTIVE']);
1076
                        $('#net-' + server_net.id + '.network img.spinner').hide();
1077
                        }
1078
                        // server was deleted
1079
                        if (server.status == 'DELETED') {
1080
                            existing_private.remove();
1081
                        }
1082
                        // server was renamed
1083
                        if (server.name != existing_private.find('span.name').text()) {
1084
                            existing_private.find('span.name').text(server.name.substring(0,30));
1085
                        }
1086
                        // server has changed state
1087
                        if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') {
1088
                            existing_private.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png');
1089
                        } else {
1090
                            existing_private.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png');
1091
                        }
1092
                        //TODO: server has changed OS
1093
                    }
1094
                });
1095
            } catch (err) {
1096
                try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){};
1097
            }
1098
        });
1099
    }
1100
    $("#networks-pane #networks-container > .large-spinner").hide();
1101

1102
    // show all separators and hide the last one
1103
    $("div.private-networks div.separator").show();
1104
    $("div.private-networks div.separator:last").hide();
1105
    // update the counters of servers in each network
1106
    var nets = $('#networks-pane .network');
1107
    $.each(nets, function(i,net) {
1108
        $(net).find('span.machines-count').text($(net).find('.network-machine').length);
1109
    });
1110

1111
    // the private div shows only when private networks are available
1112
    if ($("div.private-networks div.network").length > 0) {
1113
        $("div.private-networks").fadeIn("slow");
1114
    } else {
1115
        $("div.private-networks").fadeOut("slow");
1116
    }
1117

1118
    // tag the first and last seperators for better styling
1119
    $("#pub .network-machine").removeClass('first');
1120
    $("#pub .network-machine").first().addClass('first');
1121
    $("#pub .network-machine").removeClass('last');
1122
    $("#pub .network-machine").last().addClass('last');
1123

1124
    if ($("div.public-networks div.network-machine").length == 1) {
1125
        $("div.public-networks div.network-machine div.network-cable").css('height','60px');
1126
    }
1127

1128
    //remove top margin from the first machine of each private network
1129
    $(".private-networks").find(".network-contents .network-machine:first-child").css("margin-top","0");
1130
}
1131

1132
// indicate that the requested action was not completed
1133
function display_failure(status, networkID, action, responseText) {
1134
    $('#networks-container #net-'+networkID+ ' .spinner').hide();
1135
    $('#networks-container #net-'+networkID+ ' .action_error .action').text(action);
1136
    $('#networks-container #net-'+networkID+ ' .action_error .code').text(status);
1137
    $('#networks-container #net-'+networkID+ ' .action_error .message').text(responseText);
1138
    $('#networks-container #net-'+networkID+ ' .action_error').show();
1139
}
1140

1141
// reposition multiple confirmation box on window resize
1142
$(window).resize(function(){
1143
    if (this.innerHeight - 220 < $('#networks-pane #networks-container').height()) {
1144
        $('#networks-pane .confirm_multiple').addClass('fixed');
1145
        $('div.reboot-dialog').addClass('fixed');
1146
    } else {
1147
        $('#networks-pane .confirm_multiple').removeClass('fixed');
1148
        $('div.reboot-dialog').removeClass('fixed');
1149
    }
1150
});
1151

1152
// basic functions executed on page load
1153
// hide the all of the networks contents
1154
$("#networks-pane .network-contents").hide();
1155
// hide the all of the firewall contents
1156
$("#networks-pane .firewall-content").hide();
1157
changes_since = 0; // to reload full list of servers
1158
networks_changes_since= 0; // to reload full list of networks
1159
// there is always one public network to render
1160
var pubNet = $("#networks-pane #public-template").clone().attr("id", "pub").fadeIn("slow");
1161
pubNet.appendTo("#networks-pane .public-networks");
1162
update_networks(UPDATE_INTERVAL);
1163

1164
//fix ie z-index bug by moving the overlays to the bottom
1165
$(document).ready(function() {
1166
    if ($.browser.msie) {
1167
        $("body").append($("#networks-wizard"));
1168
        $("body").append($("#add-machines-wizard"));
1169
    }
1170
});
1171

1172
//IE specific fixes
1173
if ($.browser.msie) {
1174
    //IE fix for network div hover
1175
    $("div.network").live("mouseenter", function () {
1176
        $(this).css("background-color","#A1C8DB");
1177
        $(this).find(".actions a").css("visibility","visible");
1178
    });
1179
    $("div.network").live("mouseleave", function () {
1180
        $(this).css("background-color","transparent");
1181
        $(this).find(".actions a").css("visibility","hidden");
1182
    });
1183
    $("div.machine-actions").live("mouseenter", function () {
1184
        $(this).find("a").css("visibility","visible");
1185
    });
1186
    $("div.machine-actions").live("mouseleave", function () {
1187
        $(this).find("a").css("visibility","hidden");
1188
    });
1189
    //IE fix for network machine hover
1190
    $("div.network-machine").live("mouseenter", function () {
1191
        $(this).css("background-color","#84B7D0");
1192
        $(this).find("div.machine-actions a").css("visibility","visible");
1193
    });
1194
    $("div.network-machine").live("mouseleave", function () {
1195
        $(this).css("background-color","transparent");
1196
        $(this).find("div.machine-actions a").css("visibility","hidden");
1197
    });
1198
    //IE fix for network machine hover
1199
    $("button.reboot-single").live("mouseenter", function () {
1200
        $(this).css("background-color","#FF7F2A");
1201
    });
1202
    $("button.reboot-single").live("mouseleave", function () {
1203
        $(this).css("background-color","transparent");
1204
    });
1205
}
1206
</script>