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

broken compute details info is fixed.

This commit is contained in:
catborise 2018-07-31 10:15:59 +03:00
parent 17c619606d
commit eb621ef2c6
5 changed files with 117 additions and 66 deletions

View file

@ -13,6 +13,7 @@ class ComputeAddTcpForm(forms.Form):
max_length=100) max_length=100)
password = forms.CharField(error_messages={'required': _('No password has been entered')}, password = forms.CharField(error_messages={'required': _('No password has been entered')},
max_length=100) max_length=100)
details = forms.CharField(max_length=50, required=False)
def clean_name(self): def clean_name(self):
name = self.cleaned_data['name'] name = self.cleaned_data['name']
@ -49,6 +50,7 @@ class ComputeAddSshForm(forms.Form):
max_length=100) max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')}, login = forms.CharField(error_messages={'required': _('No login has been entered')},
max_length=20) max_length=20)
details = forms.CharField(max_length=50, required=False)
def clean_name(self): def clean_name(self):
name = self.cleaned_data['name'] name = self.cleaned_data['name']
@ -87,6 +89,7 @@ class ComputeAddTlsForm(forms.Form):
max_length=100) max_length=100)
password = forms.CharField(error_messages={'required': _('No password has been entered')}, password = forms.CharField(error_messages={'required': _('No password has been entered')},
max_length=100) max_length=100)
details = forms.CharField(max_length=50, required=False)
def clean_name(self): def clean_name(self):
name = self.cleaned_data['name'] name = self.cleaned_data['name']
@ -125,6 +128,7 @@ class ComputeEditHostForm(forms.Form):
login = forms.CharField(error_messages={'required': _('No login has been entered')}, login = forms.CharField(error_messages={'required': _('No login has been entered')},
max_length=100) max_length=100)
password = forms.CharField(max_length=100) password = forms.CharField(max_length=100)
details = forms.CharField(max_length=50, required=False)
def clean_name(self): def clean_name(self):
name = self.cleaned_data['name'] name = self.cleaned_data['name']

View file

@ -62,8 +62,9 @@
<h4 class="modal-title">{% trans "Edit connection" %}</h4> <h4 class="modal-title">{% trans "Edit connection" %}</h4>
</div> </div>
{% ifequal compute.type 1 %} {% ifequal compute.type 1 %}
<div class="modal-body"> <form class="form-horizontal" method="post" role="form">{% csrf_token %}
<form class="form-horizontal" method="post" role="form">{% csrf_token %} <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label> <label class="col-sm-4 control-label">{% trans "Label" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
@ -89,23 +90,28 @@
<input type="password" name="password" class="form-control" value="{{ compute.password }}"> <input type="password" name="password" class="form-control" value="{{ compute.password }}">
</div> </div>
</div> </div>
</div> <div class="form-group">
<div class="modal-footer"> <label class="col-sm-4 control-label">{% trans "Details" %}</label>
<button type="submit" class="pull-left btn btn-danger" name="host_del"> <div class="col-sm-6">
{% trans "Delete" %} <input type="text" name="details" class="form-control" placeholder="Details" value="{{ compute.details }}">
</button> </div>
<button type="button" class="btn btn-default" data-dismiss="modal"> </div></div>
{% trans "Close" %} <div class="modal-footer">
</button> <button type="submit" class="pull-left btn btn-danger" name="host_del">
<button type="submit" class="btn btn-primary" name="host_edit"> {% trans "Delete" %}
{% trans "Change" %} </button>
</button> <button type="button" class="btn btn-default" data-dismiss="modal">
</form> {% trans "Close" %}
</div> </button>
<button type="submit" class="btn btn-primary" name="host_edit">
{% trans "Change" %}
</button>
</div>
</form>
{% endifequal %} {% endifequal %}
{% ifequal compute.type 2 %} {% ifequal compute.type 2 %}
<div class="modal-body"> <form class="form-horizontal" method="post" role="form">{% csrf_token %}
<form class="form-horizontal" method="post" role="form">{% csrf_token %} <div class="modal-body">
<p class="modal-body">{% trans "Need create ssh <a href='https://github.com/retspen/webvirtmgr/wiki/Setup-SSH-Authorization'>authorization key</a>. If you have another SSH port on your server, you can add IP:PORT like '192.168.1.1:2222'." %}</p> <p class="modal-body">{% trans "Need create ssh <a href='https://github.com/retspen/webvirtmgr/wiki/Setup-SSH-Authorization'>authorization key</a>. If you have another SSH port on your server, you can add IP:PORT like '192.168.1.1:2222'." %}</p>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label> <label class="col-sm-4 control-label">{% trans "Label" %}</label>
@ -124,25 +130,33 @@
<label class="col-sm-4 control-label">{% trans "Username" %}</label> <label class="col-sm-4 control-label">{% trans "Username" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" name="login" class="form-control" value="{{ compute.login }}"> <input type="text" name="login" class="form-control" value="{{ compute.login }}">
<input type="hidden" name="password" value="{{ compute.password }}">
</div> </div>
</div> </div>
</div> <div class="form-group">
<div class="modal-footer"> <label class="col-sm-4 control-label">{% trans "Details" %}</label>
<button type="submit" class="pull-left btn btn-danger" name="host_del"> <div class="col-sm-6">
{% trans "Delete" %} <input type="text" name="details" class="form-control" placeholder="Details" value="{{ compute.details }}">
</button> </div>
<button type="button" class="btn btn-default" data-dismiss="modal"> </div>
{% trans "Close" %} </div>
</button> <div class="modal-footer">
<button type="submit" class="btn btn-primary" name="host_edit"> <button type="submit" class="pull-left btn btn-danger" name="host_del">
{% trans "Change" %} {% trans "Delete" %}
</button> </button>
</form> <button type="button" class="btn btn-default" data-dismiss="modal">
</div> {% trans "Close" %}
</button>
<button type="submit" class="btn btn-primary" name="host_edit">
{% trans "Change" %}
</button>
</div>
</form>
{% endifequal %} {% endifequal %}
{% ifequal compute.type 3 %} {% ifequal compute.type 3 %}
<div class="modal-body"> <form class="form-horizontal" method="post" role="form">{% csrf_token %}
<form class="form-horizontal" method="post" role="form">{% csrf_token %} <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label> <label class="col-sm-4 control-label">{% trans "Label" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
@ -168,23 +182,29 @@
<input type="password" name="password" class="form-control" value="{{ compute.password }}"> <input type="password" name="password" class="form-control" value="{{ compute.password }}">
</div> </div>
</div> </div>
</div> <div class="form-group">
<div class="modal-footer"> <label class="col-sm-4 control-label">{% trans "Details" %}</label>
<button type="submit" class="pull-left btn btn-danger" name="host_del"> <div class="col-sm-6">
{% trans "Delete" %} <input type="text" name="details" class="form-control" placeholder="Details" value="{{ compute.details }}">
</button> </div>
<button type="button" class="btn btn-default" data-dismiss="modal"> </div>
{% trans "Close" %} </div>
</button> <div class="modal-footer">
<button type="submit" class="btn btn-primary" name="host_edit"> <button type="submit" class="pull-left btn btn-danger" name="host_del">
{% trans "Change" %} {% trans "Delete" %}
</button> </button>
</form> <button type="button" class="btn btn-default" data-dismiss="modal">
</div> {% trans "Close" %}
</button>
<button type="submit" class="btn btn-primary" name="host_edit">
{% trans "Change" %}
</button>
</div>
</form>
{% endifequal %} {% endifequal %}
{% ifequal compute.type 4 %} {% ifequal compute.type 4 %}
<div class="modal-body"> <form class="form-horizontal" method="post" role="form">{% csrf_token %}
<form class="form-horizontal" method="post" role="form">{% csrf_token %} <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label> <label class="col-sm-4 control-label">{% trans "Label" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
@ -192,19 +212,25 @@
<input type="text" name="name" class="form-control" value="{{ compute.name }}" maxlength="20" required pattern="[a-z0-9\.\-_]+"> <input type="text" name="name" class="form-control" value="{{ compute.name }}" maxlength="20" required pattern="[a-z0-9\.\-_]+">
</div> </div>
</div> </div>
</div> <div class="form-group">
<div class="modal-footer"> <label class="col-sm-4 control-label">{% trans "Details" %}</label>
<button type="submit" class="pull-left btn btn-danger" name="host_del"> <div class="col-sm-6">
{% trans "Delete" %} <input type="text" name="details" class="form-control" placeholder="Details" value="{{ compute.details }}">
</button> </div>
<button type="button" class="btn btn-default" data-dismiss="modal"> </div>
{% trans "Close" %} </div>
</button> <div class="modal-footer">
<button type="submit" class="btn btn-primary" name="host_edit"> <button type="submit" class="pull-left btn btn-danger" name="host_del">
{% trans "Change" %} {% trans "Delete" %}
</button> </button>
</form> <button type="button" class="btn btn-default" data-dismiss="modal">
</div> {% trans "Close" %}
</button>
<button type="submit" class="btn btn-primary" name="host_edit">
{% trans "Change" %}
</button>
</div>
</form>
{% endifequal %} {% endifequal %}
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->

View file

@ -9,7 +9,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>
<h4 class="modal-title">{% trans "Add Connection" %}</h4> <h4 class="modal-title">{% trans "Add Connection" %}</h4>
</div> </div>
<div class="tabbable"> <div class="tabbable">
@ -50,6 +50,12 @@
<input type="password" name="password" class="form-control" placeholder="{% trans "Password" %}"> <input type="password" name="password" class="form-control" placeholder="{% trans "Password" %}">
</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">
@ -83,6 +89,12 @@
<input type="text" name="login" class="form-control" placeholder="{% trans "Username" %}"> <input type="text" name="login" class="form-control" placeholder="{% trans "Username" %}">
</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">
@ -121,6 +133,12 @@
<input type="password" name="password" class="form-control" placeholder="{% trans "Password" %}"> <input type="password" name="password" class="form-control" placeholder="{% trans "Password" %}">
</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

@ -66,7 +66,8 @@ def computes(request):
hostname=data['hostname'], hostname=data['hostname'],
type=CONN_TCP, type=CONN_TCP,
login=data['login'], login=data['login'],
password=data['password']) password=data['password'],
details=data['details'])
new_tcp_host.save() new_tcp_host.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
else: else:
@ -79,7 +80,8 @@ def computes(request):
new_ssh_host = Compute(name=data['name'], new_ssh_host = Compute(name=data['name'],
hostname=data['hostname'], hostname=data['hostname'],
type=CONN_SSH, type=CONN_SSH,
login=data['login']) login=data['login'],
details=data['details'])
new_ssh_host.save() new_ssh_host.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
else: else:
@ -93,7 +95,8 @@ def computes(request):
hostname=data['hostname'], hostname=data['hostname'],
type=CONN_TLS, type=CONN_TLS,
login=data['login'], login=data['login'],
password=data['password']) password=data['password'],
details=data['details'])
new_tls_host.save() new_tls_host.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
else: else:
@ -123,7 +126,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.details = data['details']
compute_edit.save() compute_edit.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
else: else: