mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
Make domain creation work with XML. Fix typo
This commit is contained in:
parent
be6c1e91f8
commit
0d90e4bb46
3 changed files with 11 additions and 5 deletions
|
@ -279,7 +279,8 @@
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
<div class="col-sm-12" id="xmlheight">
|
<div class="col-sm-12" id="xmlheight">
|
||||||
<textarea id="editor" name="from_xml"></textarea>
|
<input type="hidden" name="dom_xml"/>
|
||||||
|
<textarea id="editor"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary" name="create_xml" onclick="showPleaseWaitDialog()">
|
<button type="submit" class="btn btn-primary" name="create_xml" onclick="showPleaseWaitDialog()">
|
||||||
{% trans "Create" %}
|
{% trans "Create" %}
|
||||||
|
@ -536,5 +537,10 @@
|
||||||
<script>
|
<script>
|
||||||
var editor = ace.edit("editor");
|
var editor = ace.edit("editor");
|
||||||
editor.getSession().setMode("ace/mode/xml");
|
editor.getSession().setMode("ace/mode/xml");
|
||||||
|
|
||||||
|
var input = $('input[name="dom_xml"]');
|
||||||
|
editor.getSession().on("change",function () {
|
||||||
|
input.val(editor.getSession().getValue());
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -74,10 +74,10 @@ def create_instance(request, compute_id):
|
||||||
delete_flavor.delete()
|
delete_flavor.delete()
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
if 'create_xml' in request.POST:
|
if 'create_xml' in request.POST:
|
||||||
xml = request.POST.get('from_xml', '')
|
xml = request.POST.get('dom_xml', '')
|
||||||
try:
|
try:
|
||||||
name = util.get_xml_path(xml, '/domain/name')
|
name = util.get_xml_path(xml, '/domain/name')
|
||||||
except util.etree.ParserError:
|
except util.etree.Error as err:
|
||||||
name = None
|
name = None
|
||||||
if name in instances:
|
if name in instances:
|
||||||
error_msg = _("A virtual machine with this name already exists")
|
error_msg = _("A virtual machine with this name already exists")
|
||||||
|
|
|
@ -451,7 +451,7 @@ def instance(request, compute_id, vname):
|
||||||
else:
|
else:
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
else:
|
else:
|
||||||
msg = _("Please shutdow down your instance and then try again")
|
msg = _("Please shutdown down your instance and then try again")
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
|
|
||||||
if 'addpublickey' in request.POST:
|
if 'addpublickey' in request.POST:
|
||||||
|
@ -473,7 +473,7 @@ def instance(request, compute_id, vname):
|
||||||
else:
|
else:
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
else:
|
else:
|
||||||
msg = _("Please shutdow down your instance and then try again")
|
msg = _("Please shutdown down your instance and then try again")
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
|
|
||||||
if 'resize' in request.POST and (request.user.is_superuser or request.user.is_staff or userinstance.is_change):
|
if 'resize' in request.POST and (request.user.is_superuser or request.user.is_staff or userinstance.is_change):
|
||||||
|
|
Loading…
Reference in a new issue