merged master
This commit is contained in:
commit
9bd9ec5971
17 changed files with 819 additions and 536 deletions
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-07-13 23:55+0530\n"
|
||||
"POT-Creation-Date: 2017-07-24 18:51+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -103,9 +103,8 @@ msgid "Please enter a valid email address."
|
|||
msgstr "Bitte gib eine gültige E-Mailadresse ein."
|
||||
|
||||
#: templates/datacenterlight/calculator_form.html:88
|
||||
#: templates/datacenterlight/pricing.html:79
|
||||
msgid "Order Now!"
|
||||
msgstr "Bestelle jetzt!"
|
||||
msgid "Continue"
|
||||
msgstr "Weiter"
|
||||
|
||||
#: templates/datacenterlight/emails/request_access_confirmation.html:99
|
||||
#: templates/datacenterlight/emails/request_access_confirmation.txt:99
|
||||
|
@ -325,46 +324,46 @@ msgid "Confirm Order"
|
|||
msgstr "Bestellung Bestätigen"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:30
|
||||
msgid "Billed To:"
|
||||
msgstr "Rechnungsadresse"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:39
|
||||
msgid "Date"
|
||||
msgstr "Datum"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:48
|
||||
#: templates/datacenterlight/order_detail.html:36
|
||||
msgid "Billed To:"
|
||||
msgstr "Rechnungsadresse"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:47
|
||||
msgid "Payment Method:"
|
||||
msgstr "Bezahlmethode"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:49
|
||||
#: templates/datacenterlight/order_detail.html:48
|
||||
msgid "ending"
|
||||
msgstr "endend in"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:59
|
||||
#: templates/datacenterlight/order_detail.html:58
|
||||
msgid "Order summary"
|
||||
msgstr "Bestellungsübersicht"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:63
|
||||
#: templates/datacenterlight/order_detail.html:62
|
||||
msgid "Cores"
|
||||
msgstr "Prozessorkerne"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:65
|
||||
#: templates/datacenterlight/order_detail.html:64
|
||||
msgid "Memory"
|
||||
msgstr "Arbeitsspeicher"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:67
|
||||
#: templates/datacenterlight/order_detail.html:66
|
||||
msgid "Disk space"
|
||||
msgstr "Festplattenkapazität"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:69
|
||||
#: templates/datacenterlight/order_detail.html:68
|
||||
msgid "Configuration"
|
||||
msgstr "Konfiguration"
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:71
|
||||
#: templates/datacenterlight/order_detail.html:70
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
|
||||
#: templates/datacenterlight/order_detail.html:78
|
||||
#: templates/datacenterlight/order_detail.html:77
|
||||
msgid "Place order"
|
||||
msgstr "Bestellen"
|
||||
|
||||
|
@ -372,6 +371,10 @@ msgstr "Bestellen"
|
|||
msgid "We are cutting down the costs significantly!"
|
||||
msgstr "Wir sorgen dafür, dass die Kosten für Dich signifikant abnehmen"
|
||||
|
||||
#: templates/datacenterlight/pricing.html:79
|
||||
msgid "Order Now!"
|
||||
msgstr "Bestelle jetzt!"
|
||||
|
||||
#: templates/datacenterlight/pricing.html:89
|
||||
msgid ""
|
||||
"Our VMs are hosted in Glarus, Switzerland, and our website is currently "
|
||||
|
|
29
datacenterlight/management/commands/fetchvmtemplates.py
Normal file
29
datacenterlight/management/commands/fetchvmtemplates.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from opennebula_api.models import OpenNebulaManager
|
||||
from datacenterlight.models import VMTemplate
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Fetches the VM templates from OpenNebula and populates the dcl VMTemplate model'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
try:
|
||||
manager = OpenNebulaManager()
|
||||
templates = manager.get_templates()
|
||||
dcl_vm_templates = []
|
||||
for template in templates:
|
||||
template_name = template.name.strip('public-')
|
||||
template_id = template.id
|
||||
dcl_vm_template = VMTemplate.create(template_name, template_id)
|
||||
dcl_vm_templates.append(dcl_vm_template)
|
||||
|
||||
old_vm_templates = VMTemplate.objects.all()
|
||||
old_vm_templates.delete()
|
||||
|
||||
for dcl_vm_template in dcl_vm_templates:
|
||||
dcl_vm_template.save()
|
||||
except Exception as e:
|
||||
logger.error('Error connecting to OpenNebula. Error Details: {err}'.format(err=str(e)))
|
|
@ -15,6 +15,7 @@ class BetaAccessVMType(models.Model):
|
|||
class BetaAccess(models.Model):
|
||||
email = models.CharField(max_length=250)
|
||||
name = models.CharField(max_length=250)
|
||||
|
||||
# vm = models.ForeignKey(BetaAccessVM)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -48,3 +49,13 @@ class BetaAccessVM(models.Model):
|
|||
amount=vm[VM_AMOUNT], type=vm_type))
|
||||
|
||||
return created_vms
|
||||
|
||||
|
||||
class VMTemplate(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
opennebula_vm_template_id = models.IntegerField()
|
||||
|
||||
@classmethod
|
||||
def create(cls, name, opennebula_vm_template_id):
|
||||
vm_template = cls(name=name, opennebula_vm_template_id=opennebula_vm_template_id)
|
||||
return vm_template
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -69,7 +69,6 @@
|
|||
$(window).scroll(function() {
|
||||
_navScroll();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function _navScroll() {
|
||||
|
@ -85,20 +84,30 @@
|
|||
$(".dropdown-menu > li > a").css("color", "#fff");
|
||||
}
|
||||
}
|
||||
|
||||
function _initNavUrl() {
|
||||
$('.url').click(function(){
|
||||
$('.url').click(function(event) {
|
||||
event.preventDefault();
|
||||
var href = $(this).attr('data-url');
|
||||
$('.navbar-collapse').removeClass('in');
|
||||
$('.navbar-collapse').addClass('collapsing');
|
||||
var url = window.location.pathname;
|
||||
var urlSplit = url.split('/');
|
||||
if (urlSplit.length === 3 && urlSplit[2] === 'datacenterlight') {
|
||||
$('html, body').animate({
|
||||
scrollTop: $(href).offset().top
|
||||
}, 1000);
|
||||
} else {
|
||||
var allUrl = window.location.href;
|
||||
var redirect = allUrl.split('whydatacenterlight')
|
||||
window.location.href = '/en-us/datacenterlight' + href;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function verifiedUrl() {
|
||||
if (window.location.href.indexOf('#success') > -1) {
|
||||
form_success();
|
||||
console.log('epa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +136,7 @@
|
|||
_fetchPricing();
|
||||
});
|
||||
}
|
||||
|
||||
function _fetchPricing() {
|
||||
Object.keys(cardPricing).map(function(element) {
|
||||
//$('#'+cardPricing[element].id).val(cardPricing[element].value);
|
||||
|
@ -142,13 +152,13 @@
|
|||
$("#total").text(total);
|
||||
$('input[name=total]').val(total);
|
||||
}
|
||||
|
||||
function form_success() {
|
||||
$('#sucessModal').modal('show');
|
||||
}
|
||||
|
||||
function _calculate(numbers, price) {
|
||||
$('#valueTotal').text(numbers * price * 31);
|
||||
}
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
@ -18,35 +18,62 @@
|
|||
<div class="form-group">
|
||||
<div class="description input">
|
||||
<i class="fa fa-minus-circle left" data-minus="cpu" aria-hidden="true"></i>
|
||||
<input class="input-price select-number" type="number" min="1" max="48" id="coreValue" name="cpu" data-error="{% trans 'Please enter a value in range 1 - 48.' %}" required>
|
||||
<input class="input-price select-number" type="number" min="1" max="48" id="coreValue" name="cpu"
|
||||
data-error="{% trans 'Please enter a value in range 1 - 48.' %}" required>
|
||||
<span> Core</span>
|
||||
<i class="fa fa-plus-circle right" data-plus="cpu" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="help-block with-errors"></div>
|
||||
<div class="help-block with-errors">
|
||||
{% for message in messages %}
|
||||
{% if 'cores' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
{{ message|safe }}
|
||||
</li></ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="description input">
|
||||
<i class="fa fa-minus-circle left" data-minus="ram" aria-hidden="true"></i>
|
||||
<input id="ramValue" class="input-price select-number" type="number" min="2" max="200" name="ram" data-error="{% trans 'Please enter a value in range 2 - 200.' %}" required>
|
||||
<input id="ramValue" class="input-price select-number" type="number" min="2" max="200" name="ram"
|
||||
data-error="{% trans 'Please enter a value in range 2 - 200.' %}" required>
|
||||
<span> GB RAM</span>
|
||||
<i class="fa fa-plus-circle right" data-plus="ram" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="help-block with-errors"></div>
|
||||
<div class="help-block with-errors">
|
||||
{% for message in messages %}
|
||||
{% if 'memory' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
{{ message|safe }}
|
||||
</li></ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="description input">
|
||||
<i class="fa fa-minus-circle left" data-minus="storage" aria-hidden="true"></i>
|
||||
<input id="storageValue" class="input-price select-number" type="number" min="10" max="2000" step="10" name="storage" data-error="{% trans 'Please enter a value in range 10 - 2000.' %}" required>
|
||||
<input id="storageValue" class="input-price select-number" type="number" min="10" max="2000" step="10"
|
||||
name="storage" data-error="{% trans 'Please enter a value in range 10 - 2000.' %}" required>
|
||||
<span>{% trans "GB Storage (SSD)" %}</span>
|
||||
<i class="fa fa-plus-circle right" data-plus="storage" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="help-block with-errors"></div>
|
||||
<div class="help-block with-errors">
|
||||
{% for message in messages %}
|
||||
{% if 'storage' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
{{ message|safe }}
|
||||
</li></ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="description select-configuration input form-group justify-center">
|
||||
<label for="config">OS</label>
|
||||
<select name="config" id="">
|
||||
{% for template in templates %}
|
||||
<option value="{{template.id}}">{{template.name}} </option>
|
||||
<option value="{{template.opennebula_vm_template_id}}">{{template.name}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -57,14 +84,17 @@
|
|||
<div class="form-group">
|
||||
<div class="description input justify-center">
|
||||
<label for="name" class="control-label">{% trans "Name"%}</label>
|
||||
<input type="text" name="name" class="form-control" placeholder="{% trans 'Your Name'%}" data-minlength="3" data-error="{% trans 'Please enter your name.' %}" required>
|
||||
<input type="text" name="name" class="form-control" placeholder="{% trans 'Your Name'%}"
|
||||
data-minlength="3" data-error="{% trans 'Please enter your name.' %}" required>
|
||||
</div>
|
||||
<div class="help-block with-errors">
|
||||
{% for message in messages %}
|
||||
{% if 'name' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
<ul class="list-unstyled">
|
||||
<li>
|
||||
{{ message|safe }}
|
||||
</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -72,18 +102,22 @@
|
|||
<div class="form-group">
|
||||
<div class="description input justify-center">
|
||||
<label for="email" class="control-label">{% trans "Email"%}</label>
|
||||
<input name="email" type="email" pattern="^[^@\s]+@([^@\s]+\.)+[^@\s]+$" class="form-control" placeholder="{% trans 'Your Email' %}" data-error="{% trans 'Please enter a valid email address.' %}" required>
|
||||
<input name="email" type="email" pattern="^[^@\s]+@([^@\s]+\.)+[^@\s]+$" class="form-control"
|
||||
placeholder="{% trans 'Your Email' %}"
|
||||
data-error="{% trans 'Please enter a valid email address.' %}" required>
|
||||
</div>
|
||||
<div class="help-block with-errors">
|
||||
{% for message in messages %}
|
||||
{% if 'email' in message.tags %}
|
||||
<ul class="list-unstyled"><li>
|
||||
<ul class="list-unstyled">
|
||||
<li>
|
||||
{{ message|safe }}
|
||||
</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary disabled" value="{% trans 'Order Now!' %}"></input>
|
||||
<input type="submit" class="btn btn-primary disabled" value="{% trans 'Continue' %}"></input>
|
||||
</form>
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
{% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %}
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav url" data-url="#home"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav url" data-url="#home"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav" data-url="#home"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav" data-url="#home"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
|
||||
{% else %}
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav url"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav url"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
|
||||
<a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
@ -25,15 +25,15 @@
|
|||
{% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %}
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle visible-mobile" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a>
|
||||
<a class="dropdown-toggle url disabled visible-desktop" href="{% url 'datacenterlight:index' %}#how" data-url="#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a>
|
||||
<a class="dropdown-toggle url disabled visible-desktop menu-url" data-url="#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="url" href="{% url 'datacenterlight:index' %}#your" data-url="#your" >{% trans "Scale out" %}</a></li>
|
||||
<li><a class="url" href="{% url 'datacenterlight:index' %}#our" data-url="#our">{% trans "Reliable and light" %}</a></li>
|
||||
<li> <a class="url" href="{% url 'datacenterlight:index' %}#price" data-url="#price" >{% trans "Order VM" %}</a></li>
|
||||
<li><a class="url menu-url" data-url="#your" href="#your">{% trans "Scale out" %}</a></li>
|
||||
<li><a class="url menu-url" data-url="#our" href="#our">{% trans "Reliable and light" %}</a></li>
|
||||
<li> <a class="url menu-url" data-url="#price" href="#price">{% trans "Order VM" %}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class="url" href="{% url 'datacenterlight:index' %}/whydatacenterlight" >{% trans "Why Data Center Light?" %}</a>
|
||||
<a href="{% url 'datacenterlight:index' %}/whydatacenterlight" >{% trans "Why Data Center Light?" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="url" href="{% url 'datacenterlight:index' %}#contact" data-url="#contact" >{% trans "Contact" %}</a>
|
||||
|
@ -48,11 +48,12 @@
|
|||
{% endif %}
|
||||
<i class="fa fa-globe" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div onclick="return true" class="drop-language">
|
||||
|
||||
<div class="drop-language">
|
||||
{% if LANGUAGE_CODE == 'en-us'%}
|
||||
<a class="url" href="{% change_lang 'de' %}">Deutsch</a>
|
||||
<a href="{% change_lang 'de' %}">Deutsch</a>
|
||||
{% else %}
|
||||
<a class="url" href="{% change_lang 'en-us' %}" >English</a>
|
||||
<a href="{% change_lang 'en-us' %}" >English</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -166,15 +166,9 @@
|
|||
<p>{% trans "Switzerland " %}</p>
|
||||
</div>
|
||||
<div class="social">
|
||||
<a target="_blank" class="" href="https://twitter.com/datacenterlight">
|
||||
<i class="fa fa-twitter fa-fw"></i>
|
||||
</a>
|
||||
<a target="_blank" class="" href="https://github.com/ungleich">
|
||||
<i class="fa fa-github fa-fw"></i>
|
||||
</a>
|
||||
<a target="_blank" class="" href="https://www.facebook.com/ungleich.ch/">
|
||||
<i class="fa fa-facebook fa-fw"></i>
|
||||
</a>
|
||||
<a target="_blank" class="" href="https://twitter.com/datacenterlight"><i class="fa fa-twitter fa-fw"></i></a>
|
||||
<a target="_blank" class="" href="https://github.com/ungleich"><i class="fa fa-github fa-fw"></i></a>
|
||||
<a target="_blank" class="" href="https://www.facebook.com/ungleich.ch/"><i class="fa fa-facebook fa-fw"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.views.generic import FormView, CreateView, TemplateView, DetailView
|
||||
from django.http import HttpResponseRedirect
|
||||
from .forms import BetaAccessForm
|
||||
from .models import BetaAccess, BetaAccessVMType, BetaAccessVM
|
||||
from .models import BetaAccess, BetaAccessVMType, BetaAccessVM, VMTemplate
|
||||
from django.contrib import messages
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.mail import EmailMessage
|
||||
|
@ -21,7 +21,7 @@ from datetime import datetime
|
|||
from membership.models import CustomUser, StripeCustomer
|
||||
|
||||
from opennebula_api.models import OpenNebulaManager
|
||||
from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer
|
||||
from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer, VMTemplateSerializer
|
||||
|
||||
|
||||
class LandingProgramView(TemplateView):
|
||||
|
@ -194,41 +194,68 @@ class IndexView(CreateView):
|
|||
success_url = "/datacenterlight#requestform"
|
||||
success_message = "Thank you, we will contact you as soon as possible"
|
||||
|
||||
def validate_cores(self, value):
|
||||
if (value > 48) or (value < 1):
|
||||
raise ValidationError(_('Not a proper cores number'))
|
||||
|
||||
def validate_memory(self, value):
|
||||
if (value > 200) or (value < 2):
|
||||
raise ValidationError(_('Not a proper ram number'))
|
||||
|
||||
def validate_storage(self, value):
|
||||
if (value > 2000) or (value < 10):
|
||||
raise ValidationError(_('Not a proper storage number'))
|
||||
|
||||
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
|
||||
def get(self, request, *args, **kwargs):
|
||||
for session_var in ['specs', 'user', 'billing_address_data']:
|
||||
if session_var in request.session:
|
||||
del request.session[session_var]
|
||||
try:
|
||||
manager = OpenNebulaManager()
|
||||
templates = manager.get_templates()
|
||||
|
||||
vm_templates = VMTemplate.objects.all()
|
||||
context = {
|
||||
'templates': VirtualMachineTemplateSerializer(templates, many=True).data
|
||||
}
|
||||
except:
|
||||
messages.error(request,
|
||||
'We have a temporary problem to connect to our backend. \
|
||||
Please try again in a few minutes'
|
||||
)
|
||||
context = {
|
||||
'error': 'connection'
|
||||
'templates': vm_templates
|
||||
}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
def post(self, request):
|
||||
cores = request.POST.get('cpu')
|
||||
cores_field = forms.IntegerField(validators=[self.validate_cores])
|
||||
memory = request.POST.get('ram')
|
||||
memory_field = forms.IntegerField(validators=[self.validate_memory])
|
||||
storage = request.POST.get('storage')
|
||||
storage_field = forms.IntegerField(validators=[self.validate_storage])
|
||||
price = request.POST.get('total')
|
||||
template_id = int(request.POST.get('config'))
|
||||
manager = OpenNebulaManager()
|
||||
template = manager.get_template(template_id)
|
||||
template_data = VirtualMachineTemplateSerializer(template).data
|
||||
template = VMTemplate.objects.filter(opennebula_vm_template_id=template_id).first()
|
||||
template_data = VMTemplateSerializer(template).data
|
||||
|
||||
name = request.POST.get('name')
|
||||
email = request.POST.get('email')
|
||||
name_field = forms.CharField()
|
||||
email_field = forms.EmailField()
|
||||
|
||||
try:
|
||||
cores = cores_field.clean(cores)
|
||||
except ValidationError as err:
|
||||
msg = '{} : {}.'.format(cores, str(err))
|
||||
messages.add_message(self.request, messages.ERROR, msg, extra_tags='cores')
|
||||
return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form")
|
||||
|
||||
try:
|
||||
memory = memory_field.clean(memory)
|
||||
except ValidationError as err:
|
||||
msg = '{} : {}.'.format(memory, str(err))
|
||||
messages.add_message(self.request, messages.ERROR, msg, extra_tags='memory')
|
||||
return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form")
|
||||
|
||||
try:
|
||||
storage = storage_field.clean(storage)
|
||||
except ValidationError as err:
|
||||
msg = '{} : {}.'.format(storage, str(err))
|
||||
messages.add_message(self.request, messages.ERROR, msg, extra_tags='storage')
|
||||
return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form")
|
||||
|
||||
try:
|
||||
name = name_field.clean(name)
|
||||
except ValidationError as err:
|
||||
|
@ -313,25 +340,6 @@ class WhyDataCenterLightView(IndexView):
|
|||
template_name = "datacenterlight/whydatacenterlight.html"
|
||||
model = BetaAccess
|
||||
|
||||
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
|
||||
def get(self, request, *args, **kwargs):
|
||||
try:
|
||||
manager = OpenNebulaManager()
|
||||
templates = manager.get_templates()
|
||||
context = {
|
||||
'templates': VirtualMachineTemplateSerializer(templates, many=True).data,
|
||||
}
|
||||
except:
|
||||
messages.error(
|
||||
request,
|
||||
'We have a temporary problem to connect to our backend. \
|
||||
Please try again in a few minutes'
|
||||
)
|
||||
context = {
|
||||
'error': 'connection'
|
||||
}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class PaymentOrderView(FormView):
|
||||
template_name = 'hosting/payment.html'
|
||||
|
|
|
@ -39,6 +39,30 @@ h6 {
|
|||
font-size: 14px;
|
||||
}
|
||||
|
||||
.navbar-transparent {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.navbar-transparent .navbar-nav>li>a {
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-family: 'Lato-Regular', sans-serif;
|
||||
}
|
||||
.navbar-transparent .navbar-nav>li>a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.navbar-transparent .navbar-nav>li>a:focus, .navbar-transparent .navbar-nav>li>a:hover {
|
||||
color: #fff;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.navbar-transparent #logoWhite{
|
||||
display: block;
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.lead {
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
<!-- Custom CSS -->
|
||||
<link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'hosting/css/user_keys.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'hosting/css/payment.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'hosting/css/order.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'hosting/css/orders.css' %}" rel="stylesheet">
|
||||
|
@ -27,7 +28,7 @@
|
|||
<!-- Custom Fonts -->
|
||||
<link href='//fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
<link href="//fonts.googleapis.com/css?family=Lato:100,300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
|
||||
<link href="//fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
|
||||
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="{% static 'hosting/css/owl.carousel.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'hosting/css/owl.theme.default.min.css' %}">
|
||||
|
@ -48,6 +49,8 @@
|
|||
<body>
|
||||
|
||||
|
||||
{% block navbar %}
|
||||
|
||||
<!-- Navigation -->
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
|
||||
|
@ -93,25 +96,6 @@
|
|||
<li><a href="{% url 'hosting:logout' %}"><i class="glyphicon glyphicon-lock"></i>{% trans "Logout"%} </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<!--
|
||||
<li>
|
||||
<a href="{{ request.session.hosting_url}}#how">{% trans "How it works"%}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ request.session.hosting_url }}#your">{% trans "Your infrastructure"%}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ request.session.hosting_url }}#our">{% trans "Our inftrastructure"%}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ request.session.hosting_url }}#price">{% trans "Pricing" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ request.session.hosting_url }}#contact">{% trans "Contact"%}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'hosting:login' %}?next={{request.current_path}}">{% trans "Login"%}</a>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -119,7 +103,7 @@
|
|||
</div>
|
||||
<!-- /.container -->
|
||||
</nav>
|
||||
|
||||
{% endblock navbar %}
|
||||
|
||||
|
||||
<div class="content-dashboard">
|
||||
|
|
11
hosting/templates/hosting/includes/_navbar_transparent.html
Normal file
11
hosting/templates/hosting/includes/_navbar_transparent.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% load static i18n %}
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-top topnav navbar-transparent" role="navigation">
|
||||
<div class="container topnav">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
<a id="logoWhite" class="navbar-brand topnav" href="{% if site_url %}{{site_url}}{% else %}{{ request.session.hosting_url}}{% endif %}"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.container -->
|
||||
</nav>
|
|
@ -1,6 +1,11 @@
|
|||
{% extends "hosting/base_short.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles bootstrap3%}
|
||||
|
||||
{% block navbar %}
|
||||
{% include 'hosting/includes/_navbar_transparent.html' %}
|
||||
{% endblock navbar %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="auth-container">
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
{% load staticfiles bootstrap3%}
|
||||
{% load i18n %}
|
||||
|
||||
{% block navbar %}
|
||||
{% include 'hosting/includes/_navbar_transparent.html' %}
|
||||
{% endblock navbar %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div class="auth-container">
|
||||
<div class="auth-bg"></div>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{% extends "hosting/base_short.html" %}
|
||||
{% load staticfiles bootstrap3 i18n %}
|
||||
|
||||
{% block navbar %}
|
||||
{% include 'hosting/includes/_navbar_transparent.html' %}
|
||||
{% endblock navbar %}
|
||||
|
||||
{% block content %}
|
||||
<div class="auth-container auth-signup">
|
||||
<div class="auth-bg"></div>
|
||||
|
|
|
@ -325,7 +325,7 @@ class OpenNebulaManager():
|
|||
public_templates = [
|
||||
template
|
||||
for template in self._get_template_pool()
|
||||
if 'public-' in template.name
|
||||
if template.name.startswith('public-')
|
||||
]
|
||||
return public_templates
|
||||
except ConnectionRefusedError:
|
||||
|
|
|
@ -129,6 +129,12 @@ class VirtualMachineSerializer(serializers.Serializer):
|
|||
return obj.name.strip('public-')
|
||||
|
||||
|
||||
class VMTemplateSerializer(serializers.Serializer):
|
||||
"""Serializer to map the VMTemplate instance into JSON format."""
|
||||
id = serializers.IntegerField(read_only=True, source='opennebula_vm_template_id')
|
||||
name = serializers.CharField(read_only=True)
|
||||
|
||||
|
||||
def hexstr2int(string):
|
||||
return int(string.replace(':', ''), 16)
|
||||
|
||||
|
|
Loading…
Reference in a new issue