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

add details for local socket

This commit is contained in:
andrem 2016-03-18 15:21:44 -03:00
parent fc56e66555
commit b6350e134e
6 changed files with 24 additions and 4 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

@ -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">
@ -156,4 +164,4 @@
</div> <!-- /.modal-content --> </div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog --> </div> <!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
{% endif %} {% endif %}

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

@ -36,14 +36,15 @@ 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
error_messages = [] error_messages = []
computes = Compute.objects.filter() computes = Compute.objects.filter()
computes_info = get_hosts_status(computes) computes_info = get_hosts_status(computes)
if request.method == 'POST': if request.method == 'POST':
if 'host_del' in request.POST: if 'host_del' in request.POST:
compute_id = request.POST.get('host_id', '') compute_id = request.POST.get('host_id', '')
@ -104,6 +105,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='',
@ -122,6 +124,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