show.html 9.57 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>
Bence Dányi committed
148
                        <th>{% trans "Port" %}</th>
149
                        <th colspan="2">{% trans "Access" %}</th>
Dányi Bence committed
150 151
                    </tr>
                    {% for port in ports %}
152
                    <tr{% if i.is_ipv6 %} class="faded"{% endif %}>
153 154 155 156 157 158 159 160 161 162 163 164
                        <td>{{port.private}}/{{port.proto}}</td>
                        <td style="white-space: nowrap;">
                            {% if port.private == 80 or port.private == 8080 or port.private == 8000 %}
                            <a href="http://{{port.ipv4.host}}:{{port.ipv4.port}}">
                                {{port.ipv4.host}}:{{port.ipv4.port}}
                            </a>
                            {% elif port.private == 443 %}
                            <a href="https://{{port.ipv4.host}}:{{port.ipv4.port}}">{{port.ipv4.host}}:{{port.ipv4.port}}</a>
                            {% else %}
                            {{port.ipv4.host}}:{{port.ipv4.port}}
                            {% endif %}
                        </td>
165
                        {% if not i.is_ipv6 %}
166
                        <td>
Bach Dániel committed
167
                            <a href="{% url one.views.vm_port_del i.id port.proto port.private %}">{% trans "Delete" %}</a>
168
                        </td>
169
                        {% endif %}
170
                    </tr>
171
                    <tr{% if not i.is_ipv6 %} style="display: none"{% endif %}>
172 173 174 175 176 177 178 179 180 181 182 183 184 185
                        <td>{{port.private}}/{{port.proto}}6</td>
                        <td style="white-space: nowrap;">
                            {% if port.private == 80 or port.private == 8080 or port.private == 8000 %}
                            <a href="http://{{port.ipv6.host}}:{{port.ipv6.port}}">
                                {{port.ipv6.host}}:{{port.ipv6.port}}
                            </a>
                            {% elif port.private == 443 %}
                            <a href="https://{{port.ipv6.host}}:{{port.ipv6.port}}">
                                {{port.ipv6.host}}:{{port.ipv6.port}}
                            </a>
                            {% else %}
                            {{port.ipv6.host}}:{{port.ipv6.port}}
                            {% endif %}
                        </td>
186
                        {% if i.is_ipv6 %}
Dányi Bence committed
187
                        <td>
Bach Dániel committed
188
                            <a href="{% url one.views.vm_port_del i.id port.proto port.private %}">{% trans "Delete" %}</a>
Dányi Bence committed
189
                        </td>
190
                        {% endif %}
Dányi Bence committed
191 192 193
                    </tr>
                    {% endfor %}
                    <tr>
194
                        <th colspan="3">{% trans "Port/Protocol" %}</th>
195 196
                    </tr>
                    <tr>
197 198
                        <td colspan="2">
                            <input style="min-width:50px;width:50px;" type="text" name="port"/>/
Bence Dányi committed
199
                            <select style="min-width:50px;" name="proto">
Dányi Bence committed
200 201 202 203 204
                                <option value="tcp">tcp</option>
                                <option value="udp">udp</option>
                            </select>
                        </td>
                        <td>
205
                            <input type="submit" style="min-width:3em" value="{% trans "Add" %}" />
Dányi Bence committed
206 207
                        </td>
                    </tr>
Őry Máté committed
208
                </table>
Dányi Bence committed
209
            </form>
Őry Máté committed
210
        </div>
Dányi Bence committed
211
    </div>
212
    {% endif %}
Dudás Ádám committed
213 214
</div>
<div class="boxes">
215
    {% include "box/vm/box.html" with just_list_vms=1 %}
Dudás Ádám committed
216 217
</div>
{% endblock %}