Revision 338495b1

/dev/null
1
{% extends "base.html" %}
2
{% load i18n %}
3
{% block title %}{% trans "Application submitted" %}{% endblock %}
4
{% block content %}
5
<div align="center">
6
{% if pending %}
7
<h2>{% trans "Pending applications" %}</h2>
8
<table>
9
<tr><th>{% trans "Hostname" %}</th><th>{% trans "User" %}</th><th>{% trans "Memory" %}</th><th>{% trans "vCPUs" %}</th><th>{% trans "Network" %}</th><th>{% trans "Filed" %}</th></tr>
10
{% for app in pending %}
11
<tr><td><a href="{% url application-review app.pk %}">{{ app.hostname }}</a></td><td>{{ app.applicant }}</td><td>{{ app.memory }}</td><td>{{ app.vcpus }}</td><td>{{ app.network|default_if_none:"&mdash;" }}</td><td>{{ app.filed|date }}</td></tr>
12
{% endfor %}
13
</table>
14
{% endif %}
15

  
16
<h2>{% trans "Completed applications" %}</h2>
17
<table>
18
<tr><th>{% trans "Hostname" %}</th><th>{% trans "User" %}</th><th>{% trans "Memory" %}</th><th>{% trans "vCPUs" %}</th><th>{% trans "Network" %}</th><th>{% trans "Filed" %}</th></tr>
19
{% for app in completed %}
20
<tr><td><a href="{% url application-review app.pk %}">{{ app.hostname }}</a></td><td>{{ app.applicant }}</td><td>{{ app.memory }}</td><td>{{ app.vcpus }}</td><td>{{ app.network|default_if_none:"&mdash;" }}</td><td>{{ app.filed|date }}</td></tr>
21
{% endfor %}
22
</table>
23
</div>
24
{% endblock %}
/dev/null
1
{% extends "base.html" %}
2
{% load i18n %}
3
{% block title %}{% trans "Review application" %} #{{ application.pk }}{% endblock %}
4
{% block content %}
5
<style type="text/css">
6
.comments {
7
	font-style: italic;
8
	max-width: 40em;
9
}
10
.notice {
11
	text-align: center;
12
	font-style: italic;
13
}
14

  
15
#review {
16
	max-width: 50em;
17
	margin-left: auto;
18
	margin-right: auto;
19
}
20
</style>
21
<script>
22
	function set_network(net){
23
		$("#id_network").val(net);
24
	}
25
</script>
26
<div align="center" id="review">
27
<h2>{% trans "Review application" %} #{{ application.pk }} {% trans "by" %} {{ application.applicant }}</h2>
28
<p>{% trans "Submitted" %} {{ application.filed|date }}</p>
29
{% if application.is_pending %}
30
<form method="POST" id="appform">
31
{% csrf_token %}
32
<fieldset>
33
<legend>{% trans "Instance information" %}</legend>
34
<table>
35
<tr><th>{{ appform.hostname.label_tag }}</th><td>{{ appform.hostname }}<span class="error">{{ appform.hostname.errors|join:", " }}</span></td></tr>
36
<tr><th>{{ appform.memory.label_tag }}</th><td>{{ appform.memory }}<span class="error">{{ appform.memory.errors|join:", " }}</span></td></tr>
37
<tr><th>{{ appform.vcpus.label_tag }}</th><td>{{ appform.vcpus }}<span class="error">{{ appform.vcpus.errors|join:", " }}</span></td></tr>
38
<tr><th>{{ appform.disk_size.label_tag }}</th><td>{{ appform.disk_size }}<span class="error">{{ appform.disk_size.errors|join:", " }}</span></td></tr>
39
<tr><th>{{ appform.organization.label_tag }}</th><td>{{ appform.organization }}<span class="error">{{ appform.organization.errors|join:", " }}</span></td></tr>
40
<tr><th>{{ appform.hosts_mail_server.label_tag }}</th><td>{{ appform.hosts_mail_server }}<span class="error">{{ appform.hosts_mail_server.errors|join:", " }}</span></td></tr>
41
<tr><th>{{ appform.operating_system.label_tag }}</th><td>{{ appform.operating_system }}<span class="error">{{ appform.operating_system.errors|join:", " }}</span></td></tr>
42
</table>
43
</fieldset>
44

  
45
{% if application.admin_contact_name %}
46
<fieldset>
47
<legend>{% trans "Administrative contact" %}</legend>
48
<table>
49
<tr><th>{% trans "Name" %}</th><td>{{ application.admin_contact_name }}</td></tr>
50
<tr><th>{% trans "Email" %}</th><td>{{ application.admin_contact_email }}</td></tr>
51
<tr><th>{% trans "Phone" %}</th><td>{{ application.admin_contact_phone }}</td></tr>
52
</table>
53
</fieldset>
54
{% endif %}
55

  
56
<fieldset>
57
<legend>{% trans "Comments" %}</legend>
58
<div class="comments">
59
{{ application.comments }}
60
</div>
61
</fieldset>
62

  
63
<fieldset>
64
<legend>{% trans "Placement" %}</legend>
65
{% if application.network %}
66
<div class="notice">
67
{% trans "The user has requested explicit network placement on" %} {{ application.network }} ({{ application.network.cluster.description }})
68
</div>
69
{% endif %}
70

  
71
<p>{% trans "Choose either a network, or a cluster from the quick list to use the cluster's default network." %}</p>
72
<p>{% trans "Network" %}: {{ appform.network }}</p>
73
{% if appform.network.errors %}
74
<p class="error">{{ appform.network.errors|join:", " }}</p>
75
{% endif %}
76
<p>{% for cl in fast_clusters %}<a href="#" onclick="set_network('{{ cl.get_default_network.pk }}');">{{ cl.description }} ({{ cl.slug }})</a> {% if not forloop.last %}| {% endif %}{% endfor %}</p>
77
</fieldset>
78

  
79
<fieldset>
80
<legend>{% trans "Decision" %}</legend>
81
<p>{% trans "Comments to the user" %}:</p>
82
{% if appform.admin_comments.errors %}
83
<p><span class="error">{{ appform.admin_comments.errors }}</span></p>
84
{% endif %}
85
<p>{{ appform.admin_comments }}</p>
86
<p><input type="submit" value="Accept" name="accept"/> <input type="submit" value="Reject" name="reject" /></p>
87
</legend>
88
</form>
89
{% else %}
90
<fieldset>
91
<legend>{% trans "Instance information" %}</legend>
92
<table>
93
<tr><th>{{ appform.hostname.label_tag }}</th><td>{{ application.hostname }}</td></tr>
94
<tr><th>{{ appform.memory.label_tag }}</th><td>{{ application.memory }}</td></tr>
95
<tr><th>{{ appform.vcpus.label_tag }}</th><td>{{ application.vcpus }}</td></tr>
96
<tr><th>{{ appform.disk_size.label_tag }}</th><td>{{ application.disk_size }}</td></tr>
97
<tr><th>{{ appform.organization.label_tag }}</th><td>{{ application.organization }}</td></tr>
98
<tr><th>{{ appform.hosts_mail_server.label_tag }}</th><td>{{ application.hosts_mail_server }}</td></tr>
99
<tr><th>{{ appform.operating_system.label_tag }}</th><td>{{ application.operating_system }}</td></tr>
100
</table>
101
</fieldset>
102

  
103
{% if application.admin_contact_name %}
104
<fieldset>
105
<legend>{% trans "Administrative contact" %}</legend>
106
<table>
107
<tr><th>{% trans "Name" %}</th><td>{{ application.admin_contact_name }}</td></tr>
108
<tr><th>{% trans "Email" %}</th><td>{{ application.admin_contact_email }}</td></tr>
109
<tr><th>{% trans "Phone" %}</th><td>{{ application.admin_contact_phone }}</td></tr>
110
</table>
111
</fieldset>
112
{% endif %}
113

  
114
<fieldset>
115
<legend>{% trans "Comments" %}</legend>
116
<div class="comments">
117
{{ application.comments }}
118
</div>
119
</fieldset>
120

  
121
<fieldset>
122
<legend>{% trans "Placement" %}</legend>
123
<p>{% trans "The instance has been placed on" %} {{ application.network }} ({{ application.cluster.description }})</p>
124
</fieldset>
125
{% endif %}
126

  
127
</div>
128
{% endblock %}
/dev/null
1
<div id="sshkeys_placeholder">
2
<script>
3
	$(document).ajaxSend(function(event, xhr, settings) {
4
    function getCookie(name) {
5
        var cookieValue = null;
6
        if (document.cookie && document.cookie != '') {
7
            var cookies = document.cookie.split(';');
8
            for (var i = 0; i < cookies.length; i++) {
9
                var cookie = jQuery.trim(cookies[i]);
10
                // Does this cookie string begin with the name we want?
11
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
12
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
13
                    break;
14
                }
15
            }
16
        }
17
        return cookieValue;
18
    }
19
    function sameOrigin(url) {
20
        // url could be relative or scheme relative or absolute
21
        var host = document.location.host; // host + port
22
        var protocol = document.location.protocol;
23
        var sr_origin = '//' + host;
24
        var origin = protocol + sr_origin;
25
        // Allow absolute or scheme relative URLs to same origin
26
        return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
27
            (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
28
            // or any other URL that isn't scheme relative or absolute i.e relative.
29
            !(/^(\/\/|http:|https:).*/.test(url));
30
    }
31
    function safeMethod(method) {
32
        return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
33
    }
34

  
35
    if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
36
        xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
37
    }
38
});
39

  
40
	$(function() {
41
	$('.remove_btn').button({
42
            icons: {
43
                primary: "ui-icon-circle-close"
44
            },
45
            text: false
46
        })
47
	$('#add_ssh_key_btn').button();
48
	$('#add_ssh_key_btn').click(function() {
49
			str = $('#sshkeyform').serialize();
50
            $.ajax({
51
                type: "POST",
52
                url: "{% url user-keys %}",
53
                data: str,
54
                success: function(response){
55
//					var $response=$(response);
56
//					var resdata =  $response.filter("#sshkeys_placeholder").html();
57
                	$("#sshkeys_placeholder").html(response);
58
                        }
59
        });
60
    return false;
61
        });
62
		$('a[id^="remove_key_"]').click(function() {
63
			var $this = $(this);
64
			var id = $this.attr("id");
65
			var key_id = id.replace("remove_key_", "")
66
            $.ajax({
67
                type: "GET",
68
                url: "{% url delete-key %}"+key_id,
69
                success: function(response){
70
//					var $response=$(response);
71
//					var resdata =  $response.filter("#sshkeys_placeholder").html();
72
                	$("#sshkeys_placeholder").html(response);
73
                        }
74
        });
75
    return false;
76
        });
77
	});
78
	</script>
79

  
80
<style type="text/css">
81
.fingerprint {
82
	font-family: monospace;
83
}
84
</style>
85
{% load i18n %}
86
<p>{% trans "Upload your SSH public keys and have them automatically installed on all newly-created instances. Keys must be in OpenSSH format, either RSA, or DSA, with or without a trailing comment." %}</p>
87

  
88
{% if keys %}
89
<table>
90
<tr><th>{% trans "Fingerprint" %}</th><th>{% trans "Comment" %}</th></tr>
91
{% for key in keys %}
92
<tr><td class="fingerprint">{{ key.fingerprint }}</td><td>{{ key.comment|default:"&mdash;" }}</td><td><a class="remove_btn" id="remove_key_{{key.id}}" href="#">{% trans "Delete" %}</a></tr>
93
{% endfor %}
94
</table>
95
{% endif %}
96
<h2>{% trans "Add new key" %}</h2>
97
{% if msg %}
98
<div class="error">{{msg}}</div>
99
{% endif %}
100
<form method="POST" id="sshkeyform">
101
{% csrf_token %}
102
{% if form.ssh_pubkey.errors %}
103
<div class="error">{{ form.ssh_pubkey.errors }}</div>
104
{% endif %}
105
{{ form.ssh_pubkey }}<br />
106
<button id="add_ssh_key_btn">{% trans "Add key" %}</button>
107
</form>
108
</div>
109

  

Also available in: Unified diff