From 82ca7da20a217f5922db8c03471cbad61108cae1 Mon Sep 17 00:00:00 2001 From: Levi Date: Tue, 7 Jun 2016 00:29:22 -0500 Subject: [PATCH] As an admin I can change the VM ip using admin panel ,Fixed notification view count label, Fixed hosting company name on payment view, Added configuration in VM hosting page, Admin can changes the VM configuration using admin panel --- .../migrations/0022_virtualmachineplan_ip.py | 21 ++++++++++++++++ .../0023_virtualmachineplan_configutarion.py | 21 ++++++++++++++++ hosting/migrations/0024_auto_20160607_0231.py | 20 ++++++++++++++++ hosting/mixins.py | 4 +++- hosting/models.py | 15 +++++++++++- .../static/hosting/css/virtual-machine.css | 4 ++++ hosting/static/hosting/js/gen-ssh-key.js | 2 +- hosting/static/hosting/js/initial.js | 16 +++++++++++++ hosting/templates/hosting/base_short.html | 5 +++- .../templates/hosting/includes/_navbar.html | 2 +- .../templates/hosting/includes/_pricing.html | 13 +++++++++- hosting/templates/hosting/notifications.html | 7 +++++- hosting/templates/hosting/order_detail.html | 2 ++ hosting/templates/hosting/payment.html | 4 +++- .../hosting/virtual_machine_detail.html | 20 +++++++++++++++- hosting/urls.py | 1 - hosting/views.py | 24 +++++++++++++------ ungleich_page/urls.py | 2 +- 18 files changed, 165 insertions(+), 18 deletions(-) create mode 100644 hosting/migrations/0022_virtualmachineplan_ip.py create mode 100644 hosting/migrations/0023_virtualmachineplan_configutarion.py create mode 100644 hosting/migrations/0024_auto_20160607_0231.py create mode 100644 hosting/static/hosting/js/initial.js diff --git a/hosting/migrations/0022_virtualmachineplan_ip.py b/hosting/migrations/0022_virtualmachineplan_ip.py new file mode 100644 index 00000000..e426ddc8 --- /dev/null +++ b/hosting/migrations/0022_virtualmachineplan_ip.py @@ -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, + ), + ] diff --git a/hosting/migrations/0023_virtualmachineplan_configutarion.py b/hosting/migrations/0023_virtualmachineplan_configutarion.py new file mode 100644 index 00000000..97b82bd0 --- /dev/null +++ b/hosting/migrations/0023_virtualmachineplan_configutarion.py @@ -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, + ), + ] diff --git a/hosting/migrations/0024_auto_20160607_0231.py b/hosting/migrations/0024_auto_20160607_0231.py new file mode 100644 index 00000000..aedc3430 --- /dev/null +++ b/hosting/migrations/0024_auto_20160607_0231.py @@ -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', + ), + ] diff --git a/hosting/mixins.py b/hosting/mixins.py index 1f6366ab..e8a2b7b4 100644 --- a/hosting/mixins.py +++ b/hosting/mixins.py @@ -10,7 +10,9 @@ class ProcessVMSelectionMixin(object): 'memory': request.POST.get('memory'), 'disk_size': request.POST.get('disk_space'), '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') } request.session['vm_specs'] = vm_specs diff --git a/hosting/models.py b/hosting/models.py index a8237f3a..e9f59478 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -35,6 +35,7 @@ class VirtualMachineType(models.Model): (DE_LOCATION, 'Germany'), (CH_LOCATION, 'Switzerland'), ) + description = models.TextField() base_price = models.FloatField() memory_price = models.FloatField() @@ -93,13 +94,25 @@ class VirtualMachinePlan(models.Model): (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() memory = models.IntegerField() disk_size = models.IntegerField() vm_type = models.ForeignKey(VirtualMachineType) 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) + ip = models.CharField(max_length=50, blank=True) + configuration = models.CharField(max_length=20, choices=VM_CONFIGURATION) objects = VMPlansManager() diff --git a/hosting/static/hosting/css/virtual-machine.css b/hosting/static/hosting/css/virtual-machine.css index 570d5118..b5cd27f4 100644 --- a/hosting/static/hosting/css/virtual-machine.css +++ b/hosting/static/hosting/css/virtual-machine.css @@ -39,4 +39,8 @@ .virtual-machine-container .tabs-right>li>a { border-radius: 0 4px 4px 0; margin-right: 0; +} + +.virtual-machine-container .right-place{ + margin-top: 15px; } \ No newline at end of file diff --git a/hosting/static/hosting/js/gen-ssh-key.js b/hosting/static/hosting/js/gen-ssh-key.js index 46e701d7..23897c01 100644 --- a/hosting/static/hosting/js/gen-ssh-key.js +++ b/hosting/static/hosting/js/gen-ssh-key.js @@ -29,7 +29,7 @@ $( document ).ready(function() { $('[data-toggle="tooltip"]').tooltip(); - var clipboard = new Clipboard('#copy_to_clipboard'); + var clipboard = new Clipboard('.to_copy'); clipboard.on('success', function(e) { var selector = "#"; diff --git a/hosting/static/hosting/js/initial.js b/hosting/static/hosting/js/initial.js new file mode 100644 index 00000000..da2887c6 --- /dev/null +++ b/hosting/static/hosting/js/initial.js @@ -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); + }); + +}); \ No newline at end of file diff --git a/hosting/templates/hosting/base_short.html b/hosting/templates/hosting/base_short.html index df6f5c37..64c93781 100644 --- a/hosting/templates/hosting/base_short.html +++ b/hosting/templates/hosting/base_short.html @@ -53,7 +53,7 @@ - + +
  • + +
    +
    + + {{configuration_detail}} +
    +
    +
  • diff --git a/hosting/templates/hosting/notifications.html b/hosting/templates/hosting/notifications.html index 959dfe4f..8bd140c7 100644 --- a/hosting/templates/hosting/notifications.html +++ b/hosting/templates/hosting/notifications.html @@ -13,7 +13,12 @@