1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

Merge remote-tracking branch 'andrem/master'

This commit is contained in:
Jan Krcmar 2016-03-23 10:54:25 +01:00
commit 027bbbc776
9 changed files with 44 additions and 5 deletions

View file

@ -149,6 +149,8 @@ class ComputeEditHostForm(forms.Form):
class ComputeAddSocketForm(forms.Form): class ComputeAddSocketForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20) max_length=20)
details = forms.CharField(error_messages={'required': _('No details has been entred')},
max_length=50)
def clean_name(self): def clean_name(self):
name = self.cleaned_data['name'] name = self.cleaned_data['name']

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('computes', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='Compute',
name='details',
field=models.CharField(max_length=50, null=True, blank=True),
),
]

View file

@ -6,6 +6,7 @@ class Compute(models.Model):
hostname = models.CharField(max_length=20) hostname = models.CharField(max_length=20)
login = models.CharField(max_length=20) login = models.CharField(max_length=20)
password = models.CharField(max_length=14, blank=True, null=True) password = models.CharField(max_length=14, blank=True, null=True)
details = models.CharField(max_length=50, null=True, blank=True)
type = models.IntegerField() type = models.IntegerField()
def __unicode__(self): def __unicode__(self):

View file

@ -45,6 +45,11 @@
{% else %} {% else %}
<p>{% trans "Not Connected" %}</p> <p>{% trans "Not Connected" %}</p>
{% endif %} {% endif %}
{% if compute.details %}
<p>{% trans compute.details %}</p>
{% else %}
<p>{% trans "No details available" %}</p>
{% endif %}
</div> </div>
</div> </div>

View file

@ -141,6 +141,14 @@
<input type="text" name="name" class="form-control" placeholder="Label Name" maxlength="20" required pattern="[a-z0-9\.\-_]+"> <input type="text" name="name" class="form-control" placeholder="Label Name" maxlength="20" required pattern="[a-z0-9\.\-_]+">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Details" %}</label>
<div class="col-sm-6">
<input type="text" name="details" class="form-control" placeholder="{% trans "Details" %}">
</div>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"> <button type="button" class="btn btn-default" data-dismiss="modal">

View file

@ -40,6 +40,7 @@
<p>{% trans "Logical CPUs" %}</p> <p>{% trans "Logical CPUs" %}</p>
<p>{% trans "Processor" %}</p> <p>{% trans "Processor" %}</p>
<p>{% trans "Connection" %}</p> <p>{% trans "Connection" %}</p>
<p>{% trans "Details" %}</p>
</div> </div>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<p>{{ hostname }}</p> <p>{{ hostname }}</p>
@ -49,6 +50,7 @@
<p>{{ logical_cpu }}</p> <p>{{ logical_cpu }}</p>
<p>{{ model_cpu }}</p> <p>{{ model_cpu }}</p>
<p>{{ uri_conn }}</p> <p>{{ uri_conn }}</p>
<p>{{ compute.details }}</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View file

@ -35,7 +35,8 @@ def computes(request):
'status': connection_manager.host_is_up(compute.type, compute.hostname), 'status': connection_manager.host_is_up(compute.type, compute.hostname),
'type': compute.type, 'type': compute.type,
'login': compute.login, 'login': compute.login,
'password': compute.password 'password': compute.password,
'details': compute.details
}) })
return compute_data return compute_data
@ -103,6 +104,7 @@ def computes(request):
if form.is_valid(): if form.is_valid():
data = form.cleaned_data data = form.cleaned_data
new_socket_host = Compute(name=data['name'], new_socket_host = Compute(name=data['name'],
details=data['details'],
hostname='localhost', hostname='localhost',
type=CONN_SOCKET, type=CONN_SOCKET,
login='', login='',
@ -121,6 +123,7 @@ def computes(request):
compute_edit.hostname = data['hostname'] compute_edit.hostname = data['hostname']
compute_edit.login = data['login'] compute_edit.login = data['login']
compute_edit.password = data['password'] compute_edit.password = data['password']
compute.edit_details = data['details']
compute_edit.save() compute_edit.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
else: else:

View file

@ -8,7 +8,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '4y(f4rfqc6f2!i8_vfuu)kav6tdv5#sc=n%o451dm+th0&3uci' SECRET_KEY = '4y(f4rfqc6f2!i8_vfuu)kav6tdv5#sc=n%o451dm+th0&3uci'
DEBUG = False DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG

View file

@ -12,7 +12,7 @@ urlpatterns = patterns('',
url(r'^compute/(?P<compute_id>[0-9]+)/storages/$', url(r'^compute/(?P<compute_id>[0-9]+)/storages/$',
'storages.views.storages', name='storages'), 'storages.views.storages', name='storages'),
url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.]+)/$', url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.\/]+)/$',
'storages.views.storage', name='storage'), 'storages.views.storage', name='storage'),
url(r'^compute/(?P<compute_id>[0-9]+)/networks/$', url(r'^compute/(?P<compute_id>[0-9]+)/networks/$',
'networks.views.networks', name='networks'), 'networks.views.networks', name='networks'),