Statistics
| Branch: | Tag: | Revision:

root / templates / instance_actions.html @ 064ecc91

History | View | Annotate | Download (2.4 kB)

1
<script type="text/javascript">
2
        $(function(){
3
                $( "#start" )
4
                .button({
5
                        icons: {
6
                                secondary: "ui-icon-play"
7
                        }
8
                });
9
                        
10
                $( "#shutdown" )
11
                .button({
12
                        icons: {
13
                                secondary: "ui-icon-power"
14
                        }
15
                });
16
                        
17
                $( "#reboot" )
18
                .button({
19
                        icons: {
20
                                secondary: "ui-icon-arrowrefresh-1-s"
21
                        }
22
                });
23

24
                        
25
                $( "#console" )
26
                .button({
27
                        icons: {
28
                                secondary: "ui-icon-image"
29
                        }
30
                });
31
                $( "#update" )
32
                .button({
33
                        icons: {
34
                                secondary: "ui-icon-check"
35
                        }
36
                });
37
                
38
        $( "#start" )
39
        .click(function() {
40
                clearTimeout(polltimer);
41
                $.ajax({
42
        type: 'POST',
43
        url: "{% url instance-startup cluster.slug instance.name %}",
44
        dataType: 'json',
45
        success: function(data) {
46
                        $("#actions_container_inner").empty();
47
                        $("#actions_container_inner").html("<td>"+data.action+"<td>");
48
                        setTimeout(load_data, 0);
49

50
        }
51
    });         
52
                return false; });
53
                
54
        $( "#shutdown" )
55
        .click(function() {
56
                clearTimeout(polltimer);
57
                $.ajax({
58
        type: 'POST',
59
        url: "{% url instance-shutdown cluster.slug instance.name %}",
60
        dataType: 'json',
61
        success: function(data) {
62
                        $("#actions_container_inner").empty();
63
                        $("#actions_container_inner").html("<td>"+data.action+"<td>");
64
                        setTimeout(load_data, 0);
65
                        
66
        }
67
    });         
68
                return false; });
69
                
70
        $( "#reboot" )
71
        .click(function() {
72
                clearTimeout(polltimer);
73
                $.ajax({
74
        type: 'POST',
75
        url: "{% url instance-reboot cluster.slug instance.name %}",
76
        dataType: 'json',
77
        success: function(data) {
78
                        $("#actions_container_inner").empty();
79
                        $("#actions_container_inner").html("<td>"+data.action+"<td>");
80
                        setTimeout(load_data, 0);
81

82
        }
83
    });         
84
                return false; });        
85
                        
86
});
87
</script>
88
{% load i18n %}
89
<table>
90
{% if not instance.is_locked %}
91
        {% if instance.oper_state %}
92
                <tr id="actions_container_inner">
93
                        <td><a id="shutdown" href="#">{% trans "Shutdown" %}</a></td>
94
                        <td><a id="reboot" href="#">{% trans "Reboot" %}</a></td>
95
                        <td><a id="console" href="{% url instance-vnc cluster.slug instance.name %}">{% trans "Console" %}</a></td>
96
                </tr>
97
        {% else %}
98
                <tr id="actions_container_inner">
99
                <td colspan=3><a id="start" href="#">{% trans "Start" %}</a></td>
100
                </tr>
101
        {% endif %}
102
{% else %}
103
        <tr id="actions_container_inner">
104
                <td id="show_no_actions"><em>{{ instance.is_locked|capfirst }}</em></td>
105
        </tr>
106
{% endif %}
107

    
108
</table>
109

    
110
<div id="instance_status" style="display:none;">{{ instance.oper_state|yesno:"Running,Stopped" }}</div>