Merge pull request #85 from levivm/develop
As an admin I can change the VM ip using admin panel ,Fixed notificat…
This commit is contained in:
commit
b76c015cec
18 changed files with 165 additions and 18 deletions
21
hosting/migrations/0022_virtualmachineplan_ip.py
Normal file
21
hosting/migrations/0022_virtualmachineplan_ip.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.4 on 2016-06-07 00:52
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('hosting', '0021_auto_20160526_0445'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='virtualmachineplan',
|
||||||
|
name='ip',
|
||||||
|
field=models.CharField(default='127.0.0.1', max_length=50),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
21
hosting/migrations/0023_virtualmachineplan_configutarion.py
Normal file
21
hosting/migrations/0023_virtualmachineplan_configutarion.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.4 on 2016-06-07 02:13
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('hosting', '0022_virtualmachineplan_ip'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='virtualmachineplan',
|
||||||
|
name='configutarion',
|
||||||
|
field=models.CharField(choices=[('django', 'Ubuntu 14.04, Django'), ('rails', 'Ubuntu 14.04, Rails'), ('nodejs', 'Debian, NodeJS')], default='django', max_length=20),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
20
hosting/migrations/0024_auto_20160607_0231.py
Normal file
20
hosting/migrations/0024_auto_20160607_0231.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.4 on 2016-06-07 02:31
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('hosting', '0023_virtualmachineplan_configutarion'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='virtualmachineplan',
|
||||||
|
old_name='configutarion',
|
||||||
|
new_name='configuration',
|
||||||
|
),
|
||||||
|
]
|
|
@ -10,7 +10,9 @@ class ProcessVMSelectionMixin(object):
|
||||||
'memory': request.POST.get('memory'),
|
'memory': request.POST.get('memory'),
|
||||||
'disk_size': request.POST.get('disk_space'),
|
'disk_size': request.POST.get('disk_space'),
|
||||||
'hosting_company': request.POST.get('hosting_company'),
|
'hosting_company': request.POST.get('hosting_company'),
|
||||||
'hosting_company_name': request.POST.get('hosting_company_name'),
|
'location_code': request.POST.get('location_code'),
|
||||||
|
'configuration': request.POST.get('configuration'),
|
||||||
|
'configuration_detail': request.POST.get('configuration_detail'),
|
||||||
'final_price': request.POST.get('final_price')
|
'final_price': request.POST.get('final_price')
|
||||||
}
|
}
|
||||||
request.session['vm_specs'] = vm_specs
|
request.session['vm_specs'] = vm_specs
|
||||||
|
|
|
@ -35,6 +35,7 @@ class VirtualMachineType(models.Model):
|
||||||
(DE_LOCATION, 'Germany'),
|
(DE_LOCATION, 'Germany'),
|
||||||
(CH_LOCATION, 'Switzerland'),
|
(CH_LOCATION, 'Switzerland'),
|
||||||
)
|
)
|
||||||
|
|
||||||
description = models.TextField()
|
description = models.TextField()
|
||||||
base_price = models.FloatField()
|
base_price = models.FloatField()
|
||||||
memory_price = models.FloatField()
|
memory_price = models.FloatField()
|
||||||
|
@ -93,13 +94,25 @@ class VirtualMachinePlan(models.Model):
|
||||||
(CANCELED_STATUS, 'Canceled')
|
(CANCELED_STATUS, 'Canceled')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DJANGO = 'django'
|
||||||
|
RAILS = 'rails'
|
||||||
|
NODEJS = 'nodejs'
|
||||||
|
|
||||||
|
VM_CONFIGURATION = (
|
||||||
|
(DJANGO, 'Ubuntu 14.04, Django'),
|
||||||
|
(RAILS, 'Ubuntu 14.04, Rails'),
|
||||||
|
(NODEJS, 'Debian, NodeJS'),
|
||||||
|
)
|
||||||
|
|
||||||
cores = models.IntegerField()
|
cores = models.IntegerField()
|
||||||
memory = models.IntegerField()
|
memory = models.IntegerField()
|
||||||
disk_size = models.IntegerField()
|
disk_size = models.IntegerField()
|
||||||
vm_type = models.ForeignKey(VirtualMachineType)
|
vm_type = models.ForeignKey(VirtualMachineType)
|
||||||
price = models.FloatField()
|
price = models.FloatField()
|
||||||
public_key = models.TextField()
|
public_key = models.TextField(blank=True)
|
||||||
status = models.CharField(max_length=20, choices=VM_STATUS_CHOICES, default=PENDING_STATUS)
|
status = models.CharField(max_length=20, choices=VM_STATUS_CHOICES, default=PENDING_STATUS)
|
||||||
|
ip = models.CharField(max_length=50, blank=True)
|
||||||
|
configuration = models.CharField(max_length=20, choices=VM_CONFIGURATION)
|
||||||
|
|
||||||
objects = VMPlansManager()
|
objects = VMPlansManager()
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,7 @@
|
||||||
border-radius: 0 4px 4px 0;
|
border-radius: 0 4px 4px 0;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.virtual-machine-container .right-place{
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ $( document ).ready(function() {
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
||||||
var clipboard = new Clipboard('#copy_to_clipboard');
|
var clipboard = new Clipboard('.to_copy');
|
||||||
|
|
||||||
clipboard.on('success', function(e) {
|
clipboard.on('success', function(e) {
|
||||||
var selector = "#";
|
var selector = "#";
|
||||||
|
|
16
hosting/static/hosting/js/initial.js
Normal file
16
hosting/static/hosting/js/initial.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
$( document ).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
||||||
|
var clipboard = new Clipboard('.to_copy');
|
||||||
|
|
||||||
|
clipboard.on('success', function(e) {
|
||||||
|
var selector = "#";
|
||||||
|
var copy_button_id = selector.concat(e.trigger.id);
|
||||||
|
setTimeout(function(){
|
||||||
|
$(copy_button_id).tooltip('hide');
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -53,7 +53,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand topnav" href="#"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
|
<a class="navbar-brand topnav" href="{% url 'ungleich_page:landing' %}"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
|
||||||
</div>
|
</div>
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
|
@ -161,6 +161,9 @@
|
||||||
<!-- Bootstrap Core JavaScript -->
|
<!-- Bootstrap Core JavaScript -->
|
||||||
<script src="{% static 'hosting/js/bootstrap.min.js' %}"></script>
|
<script src="{% static 'hosting/js/bootstrap.min.js' %}"></script>
|
||||||
|
|
||||||
|
<!-- Init JavaScript -->
|
||||||
|
<script src="{% static 'hosting/js/initial.js' %}"></script>
|
||||||
|
|
||||||
<!-- Stripe Lib -->
|
<!-- Stripe Lib -->
|
||||||
<script type="text/javascript" src="//js.stripe.com/v2/"></script>
|
<script type="text/javascript" src="//js.stripe.com/v2/"></script>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand topnav" href="#"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
|
<a class="navbar-brand topnav" href="{% url 'ungleich_page:landing' %}"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
|
||||||
</div>
|
</div>
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
<form class="form-inline" method="POST" action="{{request.path}}">
|
<form class="form-inline" method="POST" action="{{request.path}}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="hosting_company" value="{{vm.hosting_company}}">
|
<input type="hidden" name="hosting_company" value="{{vm.hosting_company}}">
|
||||||
<input type="hidden" name="hosting_company_name" value="{{vm.hosting_company_name}}">
|
<input type="hidden" name="location_code" value="{{vm.location_code}}">
|
||||||
|
<input type="hidden" name="configuration_detail" value="{{configuration_detail}}">
|
||||||
|
<input type="hidden" name="configuration" value="{{hosting}}">
|
||||||
|
|
||||||
|
|
||||||
<ul class="pricing {% cycle 'p-red' 'p-black' 'p-red' 'p-yel' %}">
|
<ul class="pricing {% cycle 'p-red' 'p-black' 'p-red' 'p-yel' %}">
|
||||||
|
@ -43,6 +45,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<!-- Single button -->
|
||||||
|
<div class="btn-group">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="cores">Configuration: </label>
|
||||||
|
{{configuration_detail}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<!-- Single button -->
|
<!-- Single button -->
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|
|
@ -13,7 +13,12 @@
|
||||||
<ul class="nav nav-tabs tabs-left sideways">
|
<ul class="nav nav-tabs tabs-left sideways">
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="#unread-v" data-toggle="tab">
|
<a href="#unread-v" data-toggle="tab">
|
||||||
Unread <span class="badge">{{unread_notifications|length}}</span>
|
Unread
|
||||||
|
{% if unread_notifications|length > 0%}
|
||||||
|
<span class="badge">
|
||||||
|
{{unread_notifications|length}}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p><b>Type</b> <span class="pull-right">{{order.vm_plan.hosting_company_name}}</span></p>
|
<p><b>Type</b> <span class="pull-right">{{order.vm_plan.hosting_company_name}}</span></p>
|
||||||
<hr>
|
<hr>
|
||||||
|
<p><b>Configuration</b> <span class="pull-right">{{order.vm_plan.get_configuration_display}}</span></p>
|
||||||
|
<hr>
|
||||||
<p><b>Cores</b> <span class="pull-right">{{order.vm_plan.cores}}</span></p>
|
<p><b>Cores</b> <span class="pull-right">{{order.vm_plan.cores}}</span></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p><b>Memory</b> <span class="pull-right">{{order.vm_plan.memory}} GiB</span></p>
|
<p><b>Memory</b> <span class="pull-right">{{order.vm_plan.memory}} GiB</span></p>
|
||||||
|
|
|
@ -86,10 +86,12 @@
|
||||||
<h3><b>Billing Amount</b></h3>
|
<h3><b>Billing Amount</b></h3>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p><b>Type</b> <span class="pull-right">{{request.session.vm_specs.hosting_company_name}}</span></p>
|
<p><b>Type</b> <span class="pull-right">{{request.session.vm_specs.location_code}}</span></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p><b>Cores</b> <span class="pull-right">{{request.session.vm_specs.cores}}</span></p>
|
<p><b>Cores</b> <span class="pull-right">{{request.session.vm_specs.cores}}</span></p>
|
||||||
<hr>
|
<hr>
|
||||||
|
<p><b>Configuration</b> <span class="pull-right">{{request.session.vm_specs.configuration_detail}}</span></p>
|
||||||
|
<hr>
|
||||||
<p><b>Memory</b> <span class="pull-right">{{request.session.vm_specs.memory}} GiB</span></p>
|
<p><b>Memory</b> <span class="pull-right">{{request.session.vm_specs.memory}} GiB</span></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p><b>Disk space</b> <span class="pull-right">{{request.session.vm_specs.disk_size}} GiB</span></p>
|
<p><b>Disk space</b> <span class="pull-right">{{request.session.vm_specs.disk_size}} GiB</span></p>
|
||||||
|
|
|
@ -42,9 +42,27 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="settings-v">
|
<div class="tab-pane active" id="settings-v">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12 inline-headers">
|
||||||
<h3>{{virtual_machine.hosting_company_name}}</h3>
|
<h3>{{virtual_machine.hosting_company_name}}</h3>
|
||||||
|
|
||||||
|
{% if virtual_machine.ip %}
|
||||||
|
<div class="pull-right right-place">
|
||||||
|
<button type="link" data-clipboard-text="{{virtual_machine.ip}}" id="copy_vm_id" class="to_copy btn btn-link"
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="Copied" data-trigger="click">
|
||||||
|
Ip: {{virtual_machine.ip}} <i class="fa fa-files-o" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<div class="pull-right right-place">
|
||||||
|
<span class="label label-warning"><strong>Ip not assigned yet</strong></span>
|
||||||
|
<i data-toggle="tooltip" title="Your ip will be assigned soon" class="fa fa-info-circle" aria-hidden="true"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -7,7 +7,6 @@ from .views import DjangoHostingView, RailsHostingView, PaymentVMView,\
|
||||||
MarkAsReadNotificationView
|
MarkAsReadNotificationView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# url(r'pricing/?$', VMPricingView.as_view(), name='pricing'),
|
|
||||||
url(r'index/?$', IndexView.as_view(), name='index'),
|
url(r'index/?$', IndexView.as_view(), name='index'),
|
||||||
url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'),
|
url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'),
|
||||||
url(r'nodejs/?$', NodeJSHostingView.as_view(), name='nodejshosting'),
|
url(r'nodejs/?$', NodeJSHostingView.as_view(), name='nodejshosting'),
|
||||||
|
|
|
@ -27,9 +27,12 @@ class DjangoHostingView(ProcessVMSelectionMixin, View):
|
||||||
template_name = "hosting/django.html"
|
template_name = "hosting/django.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
HOSTING = 'django'
|
||||||
|
configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||||
context = {
|
context = {
|
||||||
'hosting': "django",
|
'hosting': HOSTING,
|
||||||
'hosting_long': "Django",
|
'hosting_long': "Django",
|
||||||
|
'configuration_detail': configuration_detail,
|
||||||
'domain': "django-hosting.ch",
|
'domain': "django-hosting.ch",
|
||||||
'google_analytics': "UA-62285904-6",
|
'google_analytics': "UA-62285904-6",
|
||||||
'email': "info@django-hosting.ch",
|
'email': "info@django-hosting.ch",
|
||||||
|
@ -49,8 +52,11 @@ class RailsHostingView(ProcessVMSelectionMixin, View):
|
||||||
template_name = "hosting/rails.html"
|
template_name = "hosting/rails.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
HOSTING = 'rails'
|
||||||
|
configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||||
context = {
|
context = {
|
||||||
'hosting': "rails",
|
'hosting': HOSTING,
|
||||||
|
'configuration_detail': configuration_detail,
|
||||||
'hosting_long': "Ruby On Rails",
|
'hosting_long': "Ruby On Rails",
|
||||||
'domain': "rails-hosting.ch",
|
'domain': "rails-hosting.ch",
|
||||||
'google_analytics': "UA-62285904-5",
|
'google_analytics': "UA-62285904-5",
|
||||||
|
@ -69,9 +75,12 @@ class NodeJSHostingView(ProcessVMSelectionMixin, View):
|
||||||
template_name = "hosting/nodejs.html"
|
template_name = "hosting/nodejs.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
HOSTING = 'nodejs'
|
||||||
|
configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||||
context = {
|
context = {
|
||||||
'hosting': "nodejs",
|
'hosting': "nodejs",
|
||||||
'hosting_long': "NodeJS",
|
'hosting_long': "NodeJS",
|
||||||
|
'configuration_detail': configuration_detail,
|
||||||
'domain': "node-hosting.ch",
|
'domain': "node-hosting.ch",
|
||||||
'google_analytics': "UA-62285904-7",
|
'google_analytics': "UA-62285904-7",
|
||||||
'email': "info@node-hosting.ch",
|
'email': "info@node-hosting.ch",
|
||||||
|
@ -230,6 +239,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
||||||
'cores': specifications.get('cores'),
|
'cores': specifications.get('cores'),
|
||||||
'memory': specifications.get('memory'),
|
'memory': specifications.get('memory'),
|
||||||
'disk_size': specifications.get('disk_size'),
|
'disk_size': specifications.get('disk_size'),
|
||||||
|
'configuration': specifications.get('configuration'),
|
||||||
'price': final_price
|
'price': final_price
|
||||||
}
|
}
|
||||||
token = form.cleaned_data.get('token')
|
token = form.cleaned_data.get('token')
|
||||||
|
@ -289,11 +299,11 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
||||||
email = BaseEmail(**email_data)
|
email = BaseEmail(**email_data)
|
||||||
email.send()
|
email.send()
|
||||||
|
|
||||||
request.session.update({
|
# request.session.update({
|
||||||
'charge': charge,
|
# 'charge': charge,
|
||||||
'order': order.id,
|
# 'order': order.id,
|
||||||
'billing_address': billing_address.id
|
# 'billing_address': billing_address.id
|
||||||
})
|
# })
|
||||||
return HttpResponseRedirect(reverse('hosting:orders', kwargs={'pk': order.id}))
|
return HttpResponseRedirect(reverse('hosting:orders', kwargs={'pk': order.id}))
|
||||||
else:
|
else:
|
||||||
return self.form_invalid(form)
|
return self.form_invalid(form)
|
||||||
|
|
|
@ -4,6 +4,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', LandingView.as_view(), name='landing'),
|
url(r'^$', LandingView.as_view(), name='landing'),
|
||||||
url(r'^ungleich_page/?$', LandingView.as_view(), name='landing'),
|
# url(r'^ungleich_page/?$', LandingView.as_view(), name='landing'),
|
||||||
url(_(r'contact/$'), ContactView.as_view(), name='contact'),
|
url(_(r'contact/$'), ContactView.as_view(), name='contact'),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue