mirror of
https://github.com/retspen/webvirtcloud
synced 2024-10-31 19:44:16 +00:00
broken compute details info is fixed.
This commit is contained in:
parent
17c619606d
commit
eb621ef2c6
5 changed files with 117 additions and 66 deletions
|
@ -13,6 +13,7 @@ class ComputeAddTcpForm(forms.Form):
|
|||
max_length=100)
|
||||
password = forms.CharField(error_messages={'required': _('No password has been entered')},
|
||||
max_length=100)
|
||||
details = forms.CharField(max_length=50, required=False)
|
||||
|
||||
def clean_name(self):
|
||||
name = self.cleaned_data['name']
|
||||
|
@ -49,6 +50,7 @@ class ComputeAddSshForm(forms.Form):
|
|||
max_length=100)
|
||||
login = forms.CharField(error_messages={'required': _('No login has been entered')},
|
||||
max_length=20)
|
||||
details = forms.CharField(max_length=50, required=False)
|
||||
|
||||
def clean_name(self):
|
||||
name = self.cleaned_data['name']
|
||||
|
@ -87,6 +89,7 @@ class ComputeAddTlsForm(forms.Form):
|
|||
max_length=100)
|
||||
password = forms.CharField(error_messages={'required': _('No password has been entered')},
|
||||
max_length=100)
|
||||
details = forms.CharField(max_length=50, required=False)
|
||||
|
||||
def clean_name(self):
|
||||
name = self.cleaned_data['name']
|
||||
|
@ -125,6 +128,7 @@ class ComputeEditHostForm(forms.Form):
|
|||
login = forms.CharField(error_messages={'required': _('No login has been entered')},
|
||||
max_length=100)
|
||||
password = forms.CharField(max_length=100)
|
||||
details = forms.CharField(max_length=50, required=False)
|
||||
|
||||
def clean_name(self):
|
||||
name = self.cleaned_data['name']
|
||||
|
|
|
@ -6,7 +6,7 @@ class Compute(models.Model):
|
|||
hostname = models.CharField(max_length=20)
|
||||
login = models.CharField(max_length=20)
|
||||
password = models.CharField(max_length=14, blank=True, null=True)
|
||||
details = models.CharField(max_length=50, null=True, blank=True)
|
||||
details = models.CharField(max_length=50, null=True, blank=True)
|
||||
type = models.IntegerField()
|
||||
|
||||
def __unicode__(self):
|
||||
|
|
|
@ -62,8 +62,9 @@
|
|||
<h4 class="modal-title">{% trans "Edit connection" %}</h4>
|
||||
</div>
|
||||
{% 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">
|
||||
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
|
||||
<div class="col-sm-6">
|
||||
|
@ -89,23 +90,28 @@
|
|||
<input type="password" name="password" class="form-control" value="{{ compute.password }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</form>
|
||||
</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="Details" value="{{ compute.details }}">
|
||||
</div>
|
||||
</div></div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endifequal %}
|
||||
{% 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>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
|
||||
|
@ -124,25 +130,33 @@
|
|||
<label class="col-sm-4 control-label">{% trans "Username" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="login" class="form-control" value="{{ compute.login }}">
|
||||
<input type="hidden" name="password" value="{{ compute.password }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</form>
|
||||
</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="Details" value="{{ compute.details }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
{% endifequal %}
|
||||
{% 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">
|
||||
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
|
||||
<div class="col-sm-6">
|
||||
|
@ -168,23 +182,29 @@
|
|||
<input type="password" name="password" class="form-control" value="{{ compute.password }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</form>
|
||||
</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="Details" value="{{ compute.details }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endifequal %}
|
||||
{% 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">
|
||||
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
|
||||
<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\.\-_]+">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</form>
|
||||
</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="Details" value="{{ compute.details }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="pull-left btn btn-danger" name="host_del">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
{% trans "Close" %}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" name="host_edit">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endifequal %}
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">{% trans "Add Connection" %}</h4>
|
||||
</div>
|
||||
<div class="tabbable">
|
||||
|
@ -50,6 +50,12 @@
|
|||
<input type="password" name="password" class="form-control" placeholder="{% trans "Password" %}">
|
||||
</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 class="modal-footer">
|
||||
<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" %}">
|
||||
</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 class="modal-footer">
|
||||
<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" %}">
|
||||
</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 class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
|
|
|
@ -66,7 +66,8 @@ def computes(request):
|
|||
hostname=data['hostname'],
|
||||
type=CONN_TCP,
|
||||
login=data['login'],
|
||||
password=data['password'])
|
||||
password=data['password'],
|
||||
details=data['details'])
|
||||
new_tcp_host.save()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
else:
|
||||
|
@ -79,7 +80,8 @@ def computes(request):
|
|||
new_ssh_host = Compute(name=data['name'],
|
||||
hostname=data['hostname'],
|
||||
type=CONN_SSH,
|
||||
login=data['login'])
|
||||
login=data['login'],
|
||||
details=data['details'])
|
||||
new_ssh_host.save()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
else:
|
||||
|
@ -93,7 +95,8 @@ def computes(request):
|
|||
hostname=data['hostname'],
|
||||
type=CONN_TLS,
|
||||
login=data['login'],
|
||||
password=data['password'])
|
||||
password=data['password'],
|
||||
details=data['details'])
|
||||
new_tls_host.save()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
else:
|
||||
|
@ -123,7 +126,7 @@ def computes(request):
|
|||
compute_edit.hostname = data['hostname']
|
||||
compute_edit.login = data['login']
|
||||
compute_edit.password = data['password']
|
||||
#compute_edit.details = data['details']
|
||||
compute_edit.details = data['details']
|
||||
compute_edit.save()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue