show.html 7.97 KB
Newer Older
Dudás Ádám committed
1 2
{% extends "base.html" %}
{% load i18n %}
3
{% load staticfiles %}
Dudás Ádám committed
4 5 6

{% block js %}
<script type="text/javascript">
7
    {% if booting or state == 'PENDING' or i.waiting %}
8 9 10 11
    var timer=setInterval(function(){
        $.ajax({
            type: 'GET',
            dataType: 'json',
12
            url: '{% url one.views.vm_ajax_instance_status id %}',
13
            success: function(data){
14
                if (!data.waiting && !data.booting  && data.state != 'PENDING'){
Bence Dányi committed
15 16
                    window.location.reload();
                } else if (!data.waiting) {
17
                   // window.location.reload();
18 19
                }
            }
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
        });
    }, 5000);
    {% endif %}
    {% if i.template.state == 'SAVING' %}
    var savingTimer=setInterval(function(){
        $.ajax({
            type: 'GET',
            dataType: 'json',
            url: '{% url one.views.vm_ajax_instance_status id %}',
            success: function(data){
                if(data.template.state == 'READY'){
                    window.location.href='{% url one.views.home %}';
                }
            }
        });
    }, 10000);
36
    {% endif %}
Dudás Ádám committed
37 38 39
</script>
{% endblock %}

40 41 42 43
{% block title %}
{% blocktrans with name=i.name %}Details of {{name}}{% endblocktrans %}
- {{block.super}}
{% endblock %}
Dudás Ádám committed
44
{% block content %}
45 46 47

{% if i.template.state != "READY" %}
<div class="contentblock wide note big">
Dányi Bence committed
48 49 50 51 52
    <p>
        {% blocktrans %}This is a master image for your new template.{% endblocktrans %}
    </p>
    <form action="{% url one.views.vm_saveas id %}" method="POST">
        {% csrf_token %}
53
        {% if i.template.state == "NEW" %}
Dányi Bence committed
54 55 56
        <p style="float: right; margin-top:2em;margin-right:1em;">
            <input type="submit" value="{% trans "Save" %}" class="big" style="background-color:rgba(102, 255, 0, 0.4)" />
        </p>
57 58 59
        {% endif %}
    </form>
    <ol>
60 61
        <li{% if i.template.state != "NEW" %} class="done"{%endif%}>{% blocktrans %}Connect to the machine.{% endblocktrans %}</li>
        <li{% if i.template.state != "NEW" %} class="done"{%endif%}>
Dányi Bence committed
62 63
            {% blocktrans %}Do all the needed installation/customization.{% endblocktrans %}
        </li>
64
        <li{% if i.template.state != "NEW" %} class="done"{%endif%}>
Dányi Bence committed
65 66
            {% blocktrans %}Log off (keep the machine running).{% endblocktrans %}
        </li>
67
        <li{% if i.template.state != "NEW" %} class="done"{%endif%}>
Dányi Bence committed
68 69
            {% blocktrans %}Click on the "save" button on the right.{% endblocktrans %}
        </li>
70
        <li{% if i.template.state == "READY" %} class="done"{%endif%}>
Dányi Bence committed
71 72 73 74 75
            {% blocktrans %}The machine will be shut down and its disk saved.{% endblocktrans %}
        </li>
        <li>
            {% blocktrans %}You can share the template with your groups.{% endblocktrans %}
        </li>
76 77 78
    </ol>
</div>
{% endif %}
Dudás Ádám committed
79
<div class="boxes">
80
    <div class="contentblock wm" id="state">
Dányi Bence committed
81 82
        <h2>{{name}}</h2>
        <div class="content">
Dányi Bence committed
83
            {% if state == "PENDING" or state == "ACTIVE" and booting %}
Dányi Bence committed
84
            <p style="font-size:25px; line-height:2em;text-align:center;">
85
            <img src="{% static "image/load.gif" %}" />
86
                {% trans "Starting..." %}
Dányi Bence committed
87
            </p>
88 89 90 91 92
            {% elif i.template.state == "SAVING" %}
            <p style="font-size:25px; line-height:2em;text-align:center;">
            <img src="{% static "image/load.gif" %}" />
                {% trans "Saving..." %}
            </p>
93
            {% elif state == "ACTIVE" and not booting and not i.waiting %}
94
            <p id="connect" style="display:block; font-size:25px; line-height:2em;text-align:center;">
Dányi Bence committed
95
                <a href="{{uri}}" class="button" onclick="return connectbutton();">
96
                    <img src="{% static "image/load.gif" %}" id="connecting" style="display:none;" />
97
                    {% trans "Running" %}
Dányi Bence committed
98 99
                </a>
            </p>
100 101 102 103 104 105 106
            {% elif state == "ACTIVE" and not booting and i.waiting %}
            <p style="display:block; font-size:25px; line-height:2em;text-align:center;">
                {% trans "Stopping..." %}
            </p>
            {% elif state == "STOPPED" and i.waiting %}
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Starting..." %}</p>
            {% elif state == "STOPPED"%}
Dányi Bence committed
107 108
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Stopped" %}</p>
            {% endif %}
Dányi Bence committed
109
        {% if state == "DONE" %}
Dányi Bence committed
110 111
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Deleted" %}</p>
            {% endif %}
Dányi Bence committed
112
        {% if state == "FAILED" %}
Dányi Bence committed
113
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Unexpected error occured" %}</p>
Dányi Bence committed
114
            {% endif %}
Dudás Ádám committed
115
        </div>
Dányi Bence committed
116
    </div>
117
    <div class="contentblock" id="vm-credentials">
118
        <h2>{% trans "Login credentials" %}</h2>
119
        {% include "vm-credentials.html" %}
Dányi Bence committed
120
    </div>
121
    {% if i.firewall_host %}
122
    <div class="contentblock" id="ports">
123 124
        <h2>
            <div class="boxhelp">
Bence Dányi committed
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
                <div class="help">
                    <div class="icon">
                        <img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
                    </div>
                    <div class="boxhelp-box">
                        <p>{% blocktrans %}This is a list about the network ports
                        forwarded to the public internet.{% endblocktrans %}</p>
                        <p>{% blocktrans %}You can access the given private port of
                        the VM trough the public address of the network.
                        {% endblocktrans %}</p>
                        <p>{% blocktrans %}On the IPV6 network you can access the
                        listed private ports direcly using the VM's global IPV6
                        address (connections to other ports are dropped).
                        {% endblocktrans %}</p>
                    </div>
140 141 142
                </div>
            </div>
            {% trans "Port administration" %}</h2>
Dányi Bence committed
143
        <div class="content">
144
            <form action="{% url one.views.vm_port_add i.id %}" method="post">
Dányi Bence committed
145 146 147
                {% csrf_token %}
                <table>
                    <tr>
148 149
                        <th>{% trans "Protocol" %}</th>
                        <th>{% trans "Public port" %}</th>
150
                        {% if i.template.network.nat %}<th colspan="2">{% trans "Private port" %}</th>{%endif%}
Dányi Bence committed
151 152 153 154 155
                    </tr>
                    {% for port in ports %}
                    <tr>
                        <td>{{port.proto}}</td>
                        <td>{{port.public}}</td>
156
                        {% if i.template.network.nat %}<td>{{port.private}}</td>{%endif%}
Dányi Bence committed
157
                        <td>
158
                            <a href="{% url one.views.vm_port_del i.id port.proto port.public %}">{% trans "Delete" %}</a>
Dányi Bence committed
159 160 161 162 163 164 165 166 167 168 169 170 171
                        </td>
                    </tr>
                    {% endfor %}
                    <tr>
                        <td>
                            <select style="min-width:50px;" name=proto>
                                <option value="tcp">tcp</option>
                                <option value="udp">udp</option>
                            </select>
                        </td>
                        <td>
                            <input style="min-width:70px;width:70px;" type="text" name="public"/>
                        </td>
172
                        {% if i.template.network.nat %}
Dányi Bence committed
173 174 175
                        <td>
                            <input style="min-width:70px;width:70px;" type="text" name="private"/>
                        </td>
176
                        {% endif %}
Dányi Bence committed
177
                        <td>
178
                            <input type="submit" style="min-width:3em" value="{% trans "Add" %}" />
Dányi Bence committed
179 180
                        </td>
                    </tr>
Őry Máté committed
181
                </table>
Dányi Bence committed
182
            </form>
Őry Máté committed
183
        </div>
Dányi Bence committed
184
    </div>
185
    {% endif %}
Dudás Ádám committed
186 187
</div>
<div class="boxes">
188
    {% include "box/vm/box.html" with just_list_vms=1 %}
Dudás Ádám committed
189 190
</div>
{% endblock %}