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

{% block js %}
<script type="text/javascript">
6
    {% if booting or state != 'ACTIVE' %}
7 8 9 10 11 12
    var timer=setInterval(function(){
        $.ajax({
            type: 'GET',
            dataType: 'json',
            url: '/ajax/vm/status/{{ id }}',
            success: function(data){
13
                if( !data.booting  && data.state == 'ACTIVE'){
14 15 16 17 18 19
                    window.location.reload();
                }
            }
        })
    },2000);
    {% endif %}
Dudás Ádám committed
20 21 22 23
</script>
{% endblock %}

{% block content %}
24 25 26

{% if i.template.state != "READY" %}
<div class="contentblock wide note big">
Dányi Bence committed
27 28 29 30 31
    <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 %}
32
        {% if i.template.state == "NEW" %}
Dányi Bence committed
33 34 35
        <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>
36 37 38
        {% endif %}
    </form>
    <ol>
39 40
        <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
41 42
            {% blocktrans %}Do all the needed installation/customization.{% endblocktrans %}
        </li>
43
        <li{% if i.template.state != "NEW" %} class="done"{%endif%}>
Dányi Bence committed
44 45
            {% blocktrans %}Log off (keep the machine running).{% endblocktrans %}
        </li>
46
        <li{% if i.template.state != "NEW" %} class="done"{%endif%}>
Dányi Bence committed
47 48
            {% blocktrans %}Click on the "save" button on the right.{% endblocktrans %}
        </li>
49
        <li{% if i.template.state == "READY" %} class="done"{%endif%}>
Dányi Bence committed
50 51 52 53 54
            {% 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>
55 56 57
    </ol>
</div>
{% endif %}
Dudás Ádám committed
58
<div class="boxes">
59
    <div class="contentblock wm" id="state">
Dányi Bence committed
60 61
        <h2>{{name}}</h2>
        <div class="content">
Dányi Bence committed
62
            {% if state == "PENDING" or state == "ACTIVE" and booting %}
Dányi Bence committed
63
            <p style="font-size:25px; line-height:2em;text-align:center;">
64
                <img src="/static/load.gif" />
65
                {% trans "Starting..." %}
Dányi Bence committed
66
            </p>
Dányi Bence committed
67
            {% elif state == "ACTIVE" and not booting %}
68
            <p id="connect" style="display:block; font-size:25px; line-height:2em;text-align:center;">
Dányi Bence committed
69
                <a href="{{uri}}" class="button" onclick="return connectbutton();">
70
                    <img src="/static/load.gif" id="connecting" style="display:none;" />
71
                    {% trans "Running" %}
Dányi Bence committed
72 73
                </a>
            </p>
Dányi Bence committed
74 75 76
            {% elif state == "STOPPED" %}
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Stopped" %}</p>
            {% endif %}
Dányi Bence committed
77
        {% if state == "DONE" %}
Dányi Bence committed
78 79
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Deleted" %}</p>
            {% endif %}
Dányi Bence committed
80
        {% if state == "FAILED" %}
Dányi Bence committed
81
            <p style="font-size:25px; line-height:2em;text-align:center;">{% trans "Unexpected error occured" %}</p>
Dányi Bence committed
82
            {% endif %}
Dudás Ádám committed
83
        </div>
Dányi Bence committed
84
    </div>
85
    <div class="contentblock" id="vm-credentials">
86
        <h2>{% trans "Login credentials" %}</h2>
Dányi Bence committed
87 88 89
        <div class="content">
            <table>
                <tr>
90
                    <th>{% trans "Protocol" %}:</th>
Dányi Bence committed
91 92 93
                    <td>{{i.template.access_type|upper}}</td>
                </tr>
                <tr>
94
                    <th>{% trans "IP" %}:</th>
95
                    <td>{{ i.firewall_host.pub_ipv4 }}</td>
Dányi Bence committed
96 97
                </tr>
                <tr>
98
                    <th>{% trans "Port" %}:</th>
Dányi Bence committed
99 100 101
                    <td>{{ i.get_port}}</td>
                </tr>
                <tr>
102
                    <th>{% trans "Username" %}:</th>
Dányi Bence committed
103 104 105
                    <td>cloud</td>
                </tr>
                <tr>
106
                    <th>{% trans "Password" %}:</th>
Dányi Bence committed
107 108 109
                    <td>{{ i.pw }}</td>
                </tr>
            </table>
Dudás Ádám committed
110
        </div>
Dányi Bence committed
111
    </div>
112
    {% if i.firewall_host %}
113
    <div class="contentblock" id="ports">
114
        <h2>{% trans "Port administration" %}</h2>
Dányi Bence committed
115 116 117 118 119
        <div class="content">
            <form action="{% url vm_port_add i.id %}" method="post">
                {% csrf_token %}
                <table>
                    <tr>
120 121 122
                        <th>{% trans "Protocol" %}</th>
                        <th>{% trans "Public port" %}</th>
                        <th colspan="2">{% trans "Private port" %}</th>
Dányi Bence committed
123 124 125 126 127 128 129
                    </tr>
                    {% for port in ports %}
                    <tr>
                        <td>{{port.proto}}</td>
                        <td>{{port.public}}</td>
                        <td>{{port.private}}</td>
                        <td>
130
                            <a href="/vm/port_del/{{i.id}}/{{port.proto}}/{{port.public}}/">{% trans "Delete" %}</a>
Dányi Bence committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
                        </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>
                        <td>
                            <input style="min-width:70px;width:70px;" type="text" name="private"/>
                        </td>
                        <td>
148
                            <input type="submit" style="min-width:3em" value="{% trans "Add" %}" />
Dányi Bence committed
149 150
                        </td>
                    </tr>
Őry Máté committed
151
                </table>
Dányi Bence committed
152
            </form>
Őry Máté committed
153
        </div>
Dányi Bence committed
154
    </div>
155
    {% endif %}
Dudás Ádám committed
156 157
</div>
<div class="boxes">
158
    <div class="contentblock" id="vm-list">
159
        <h2>{% trans "Virtual machines" %}</h2>
Dányi Bence committed
160 161
        <ul class="wm-list">{% include "box-vmlist.html" %}</ul>
    </div>
Dudás Ádám committed
162 163
</div>
{% endblock %}