{% extends "base.html" %}
{% load i18n %}
-{% block title %}{% trans "Create new Virtual Machine" %}{% endblock %}
-{% block breadcrumbs %}:: {% trans "Create Instance" %}{% endblock %}
+
+{% block title %}
+ {% if edit %}
+ {% trans "Edit Route" %} {{form.data.name}}
+ {% else %}
+ {% trans "Create new Route" %}
+ {% endif %}
+{% endblock %}
+
+{% block breadcrumbs %}::
+ {% if edit %}
+ {% trans "Edit route" %} {{form.data.name}}
+ {% else %}
+ {% trans "Create route" %}
+ {% endif %}
+ {% endblock %}
+{% block extrahead %}
+<script>
+ $(document).ready( function(){
+
+ $("#id_sourceport").css('width', '100px').attr('size', '5');
+ $("#id_port").css('width', '100px').attr('size', '5');
+ $("#id_destinationport").css('width', '100px').attr('size', '5');
+ $('#id_then').attr("multiple", "");
+ $('#then_diag').dialog({
+ height: 220,
+ width: 340,
+ modal: true,
+ autoOpen: false,
+ buttons: {
+ 'Add': function() {
+ console.log($("#add_rl_form").serialize());
+ $.ajax({
+ url:"{% url add-rate-limit %}",
+ data:$("#add_rl_form").serialize(),
+ type: "POST",
+ cache: false,
+ success:function(data){
+ try {
+ value = data.pk;
+ text = data.value;
+ $('#id_then').append($("<option></option>").attr("value",value).text(text));
+ $('#then_diag').dialog('close');
+ }
+ catch (exception) {
+ $('#then_diag').html(data);
+ }
+ }
+ });
+ },
+ Cancel: function() {
+ $('#then_diag').dialog('close');
+ }
+ }
+ });
+
+ $('#port_diag').dialog({
+ height: 220,
+ width: 340,
+ modal: true,
+ autoOpen: false,
+ buttons: {
+ 'Add': function() {
+ console.log($("#add_port_form").serialize());
+ $.ajax({
+ url:"{% url add-port %}",
+ data:$("#add_port_form").serialize(),
+ type: "POST",
+ cache: false,
+ success:function(data){
+ try {
+ value = data.value;
+ text = data.text;
+ $('#id_port').append($("<option></option>").attr("value",value).text(text));
+ $('#id_destinationport').append($("<option></option>").attr("value",value).text(text));
+ $('#id_sourceport').append($("<option></option>").attr("value",value).text(text));
+ $('#port_diag').dialog('close');
+ }
+ catch (exception) {
+ $('#port_diag').html(data);
+ }
+ }
+ });
+ },
+ Cancel: function() {
+ $('#port_diag').dialog('close');
+ }
+ }
+ });
+
+
+ $("#new_then_actions").button({
+ icons: {
+ primary: "ui-icon-plusthick"
+ },
+ })
+ .click(function(){
+ $.ajax({
+ url: "{% url add-rate-limit %}",
+ cache: false,
+ success: function(data){
+ $("#then_diag").html(data);
+ }
+ });
+ $('#then_diag').dialog('open');
+ return false;
+ });
+
+
+ $(".new_port").button({
+ icons: {
+ primary: "ui-icon-plusthick"
+ },
+ })
+ .click(function(){
+ $.ajax({
+ url: "{% url add-port %}",
+ cache: false,
+ success: function(data){
+ $("#port_diag").html(data);
+ }
+ });
+ $('#port_diag').dialog('open');
+ return false;
+ });
+ });
+
+</script>
+{% endblock %}
{% block content %}
<style type="text/css">
th {
}
</style>
-
<div align="center">
-<h3>{% trans "Apply for a new instance" %}</h3>
+ {% if edit %}
+ <h3>{% trans "Edit route" %}: {{form.data.name}}</h3>
+ {% else %}
+<h3>{% trans "Apply for a new route" %}</h3>
+{% endif %}
<form method="POST">
{% csrf_token %}
-<fieldset>
-<legend>{% trans "Instance information" %}</legend>
-<table>
-<tr><th>{{ form.hostname.label_tag }}</th><td>{{ form.hostname }}<span class="error">{{ form.hostname.errors|join:", " }}</span></td></tr>
-<tr class="help"><td></td><td>{{ form.hostname.help_text }}</td></tr>
-<tr><th>{{ form.memory.label_tag }}</th><td>{{ form.memory }}<span class="error">{{ form.memory.errors|join:", " }}</span></td></tr>
-<tr><th>{{ form.vcpus.label_tag }}</th><td>{{ form.vcpus }}<span class="error">{{ form.vcpus.errors|join:", " }}</span></td></tr>
-<tr><th>{{ form.disk_size.label_tag }}</th><td>{{ form.disk_size }}<span class="error">{{ form.disk_size.errors|join:", " }}</span></td></tr>
-<tr class="help"><td></td><td>{{ form.disk_size.help_text }}</td></tr>
-<tr><th>{{ form.hosts_mail_server.label_tag }}</th><td>{{ form.hosts_mail_server }}<span class="error">{{ form.hosts_mail_server.errors|join:", " }}</span></td></tr>
-<tr class="help"><td></td><td>{{ form.hosts_mail_server.help_text }}</td></tr>
-<tr><th>{{ form.operating_system.label_tag }}</th><td>{{ form.operating_system }}<span class="error">{{ form.operating_system.errors|join:", " }}</span></td></tr>
-{% if form.network %}
-<tr><th>{{ form.network.label_tag }}</th><td>{{ form.network }}<span class="error">{{ form.network.errors|join:", " }}</span></td></tr>
-<tr class="help"><td></td><td>{{ form.network.help_text|linebreaks }}</td></tr>
+{% if form.non_field_errors %}
+<p class="error">{{ form.non_field_errors|join:", "}}</p>
{% endif %}
+
+<fieldset {% if edit %} style="display:none;" {% endif %}>
+ <legend>{% trans "Route Basic Info" %}</legend>
+<table>
+<tr><th>{{ form.name.label_tag }}</th><td>{{ form.name }}<span class="error">{{ form.name.errors|join:", " }}</span></td></tr>
+<tr class="help"><td></td><td>A unique identifier will be added as a name_suffix</td></tr>
</table>
</fieldset>
<fieldset>
-<legend>{% trans "Use/Comments" %}</legend>
-{% blocktrans %}
-<p>Give a short description of the intended use of this virtual machine, that justifies the parameter selection above. Feel free to include any additional comments.</p>
-{% endblocktrans %}
-<p>{{ form.comments }}
-{% if form.errors %}<br /><span class="error">{{ form.comments.errors|join:", " }}</span>{% endif %}
-</p>
+<legend>{% trans "Route Match Conditions" %}</legend>
+<table>
+<input type="hidden" id="id_applier" name="applier" value="{{applier}}"/>
+<tr><th>{{ form.source.label_tag }}</th><td>{{ form.source }}<span class="error">{{ form.source.errors|join:", " }}</span></td></tr>
+<tr class="help"><td></td><td>{{ form.source.help_text }}</td></tr>
+<tr><th>{{ form.sourceport.label_tag }}</th><td>{{ form.sourceport }} <button class="new_port">Port</button><span class="error">{{ form.sourceport.errors|join:", " }}</span></td></tr>
+<tr class="help"><td></td><td>{{ form.sourceport.help_text }}</td></tr>
+<tr><th>{{ form.destination.label_tag }}</th><td>{{ form.destination }}<span class="error">{{ form.destination.errors|join:", " }}</span></td></tr>
+<tr class="help"><td></td><td>{{ form.destination.help_text }}</td></tr>
+<tr><th>{{ form.destinationport.label_tag }}</th><td>{{ form.destinationport }} <button class="new_port">Port</button><span class="error">{{ form.destinationport.errors|join:", " }}</span></td></tr>
+<tr class="help"><td></td><td>{{ form.destinationport.help_text }}</td></tr>
+<tr><th>{{ form.port.label_tag }}</th><td>{{ form.port }} <button class="new_port">Port</button><span class="error">{{ form.port.errors|join:", " }}</span></td></tr>
+<tr class="help"><td></td><td>{{ form.port.help_text }}</td></tr>
+</table>
</fieldset>
-
<fieldset>
-<legend>{% trans "Administrative contact" %}</legend>
-{% blocktrans %}
-<p>If you are applying on behalf of a NOC under GRNET's constituency, please select the appropriate organization. Otherwise, fill-in the admin contact information below.</p>
-{% endblocktrans %}
-
-{% if form.non_field_errors %}
-<p class="error">{{ form.non_field_errors|join:", "}}</p>
-{% endif %}
-
+<legend>{% trans "Route Actions" %}</legend>
<table>
-<tr><th>{{ form.organization.label_tag }}</th><td>{{ form.organization }}<span class="error">{{ form.organization.errors|join:", " }}</span></td></tr>
-
-
-<tr><td colspan="3"><div align="center">{% trans "OR" %}</div></td></tr>
-
-
-<tr><th colspan="3"><div align="center">{% trans "Administrative contact" %}</div></th></tr>
-<tr><th>{% trans "Name" %}</th><td>{{ form.admin_contact_name }}<span class="error">{{ form.admin_contact_name.errors|join:", " }}</span></td></tr>
-<tr><th>E-mail</th><td>{{ form.admin_contact_email }}<span class="error">{{ form.admin_contact_email.errors|join:", " }}</span></td></tr>
-<tr><th>{% trans "Phone" %}</th><td>{{ form.admin_contact_phone }}<span class="error">{{ form.admin_contact_phone.errors|join:", " }}</span></td></tr>
+<tr><th>{{ form.then.label_tag }}</th><td>{{ form.then }} <button id="new_then_actions">Rate-limit</button><span class="error">{{ form.then.errors|join:", " }}</span></td></tr>
</table>
</fieldset>
-
<fieldset>
-<legend>{% trans "Miscellaneous" %}</legend>
+<legend>{% trans "Use/Comments" %}</legend>
{% blocktrans %}
-<p>We kindly remind you of the following:</p>
-<ul align="left">
-<li>You are solely responsible for the data on your VM. You have to take care of back-ups etc.</li>
-<li>We reserve the right to temporarily suspend the operation of your VM in case it causes malfunctions to our infrastructure</li>
-</ul>
+<p>Give a short description of the intended use of this route, that justifies the parameter selection above. Feel free to include any additional comments.</p>
{% endblocktrans %}
-<p>{{ form.accept_tos }} {% trans "I have read the above and accept them, along with the" %} <a href="/about/terms-of-service/" target="_blank">{% trans "Terms of Service" %}</a></p>
-{% if form.accept_tos.errors %}
-<p class="error">
-{% trans "You must accept the terms of service before continuing." %}
+<p>{{ form.comments }}
+{% if form.errors %}<br /><span class="error">{{ form.comments.errors|join:", " }}</span>{% endif %}
</p>
-{% endif %}
</fieldset>
<p><input type="submit" value="{% trans "Apply" %}" /></p>
</form>
</div>
+
+<div id="then_diag" title="Add new rate-limit value">
+</div>
+
+<div id="port_diag" title="Add new port">
+</div>
+
{% endblock %}