mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
Fixed hash in URL
This commit is contained in:
parent
a4fffee182
commit
a2b1fc499e
2 changed files with 62 additions and 36 deletions
|
@ -246,12 +246,21 @@ def instance(request, compute_id, vname):
|
||||||
conn.delete()
|
conn.delete()
|
||||||
return HttpResponseRedirect(reverse('instances'))
|
return HttpResponseRedirect(reverse('instances'))
|
||||||
|
|
||||||
if 'snapshot' in request.POST:
|
if 'resize' in request.POST:
|
||||||
msg = _("New snapshot")
|
msg = _("Resize")
|
||||||
addlogmsg(request.user.id, instance.id, msg)
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
name = request.POST.get('name', '')
|
vcpu = request.POST.get('vcpu', '')
|
||||||
conn.create_snapshot(name)
|
cur_vcpu = request.POST.get('cur_vcpu', '')
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#istaceshapshosts')
|
memory = request.POST.get('memory', '')
|
||||||
|
memory_custom = request.POST.get('memory_custom', '')
|
||||||
|
if memory_custom:
|
||||||
|
memory = memory_custom
|
||||||
|
cur_memory = request.POST.get('cur_memory', '')
|
||||||
|
cur_memory_custom = request.POST.get('cur_memory_custom', '')
|
||||||
|
if cur_memory_custom:
|
||||||
|
cur_memory = cur_memory_custom
|
||||||
|
conn.resize(cur_memory, memory, cur_vcpu, vcpu)
|
||||||
|
return HttpResponseRedirect(request.get_full_path() + '#resize')
|
||||||
|
|
||||||
if 'umount_iso' in request.POST:
|
if 'umount_iso' in request.POST:
|
||||||
msg = _("Mount media")
|
msg = _("Mount media")
|
||||||
|
@ -259,7 +268,7 @@ def instance(request, compute_id, vname):
|
||||||
image = request.POST.get('path', '')
|
image = request.POST.get('path', '')
|
||||||
dev = request.POST.get('umount_iso', '')
|
dev = request.POST.get('umount_iso', '')
|
||||||
conn.umount_iso(dev, image)
|
conn.umount_iso(dev, image)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancemedia')
|
return HttpResponseRedirect(request.get_full_path() + '#media')
|
||||||
|
|
||||||
if 'mount_iso' in request.POST:
|
if 'mount_iso' in request.POST:
|
||||||
msg = _("Umount media")
|
msg = _("Umount media")
|
||||||
|
@ -267,14 +276,21 @@ def instance(request, compute_id, vname):
|
||||||
image = request.POST.get('media', '')
|
image = request.POST.get('media', '')
|
||||||
dev = request.POST.get('mount_iso', '')
|
dev = request.POST.get('mount_iso', '')
|
||||||
conn.mount_iso(dev, image)
|
conn.mount_iso(dev, image)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancemedia')
|
return HttpResponseRedirect(request.get_full_path() + '#media')
|
||||||
|
|
||||||
|
if 'snapshot' in request.POST:
|
||||||
|
msg = _("New snapshot")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
|
name = request.POST.get('name', '')
|
||||||
|
conn.create_snapshot(name)
|
||||||
|
return HttpResponseRedirect(request.get_full_path() + '#snapshot')
|
||||||
|
|
||||||
if 'delete_snapshot' in request.POST:
|
if 'delete_snapshot' in request.POST:
|
||||||
msg = _("Delete snapshot")
|
msg = _("Delete snapshot")
|
||||||
addlogmsg(request.user.id, instance.id, msg)
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
snap_name = request.POST.get('name', '')
|
snap_name = request.POST.get('name', '')
|
||||||
conn.snapshot_delete(snap_name)
|
conn.snapshot_delete(snap_name)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#istaceshapshosts')
|
return HttpResponseRedirect(request.get_full_path() + '#snapshot')
|
||||||
|
|
||||||
if 'revert_snapshot' in request.POST:
|
if 'revert_snapshot' in request.POST:
|
||||||
msg = _("Revert snapshot")
|
msg = _("Revert snapshot")
|
||||||
|
@ -302,30 +318,13 @@ def instance(request, compute_id, vname):
|
||||||
msg = _("Set autostart")
|
msg = _("Set autostart")
|
||||||
addlogmsg(request.user.id, instance.id, msg)
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.set_autostart(1)
|
conn.set_autostart(1)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
return HttpResponseRedirect(request.get_full_path() + '#autostart')
|
||||||
|
|
||||||
if 'unset_autostart' in request.POST:
|
if 'unset_autostart' in request.POST:
|
||||||
msg = _("Unset autostart")
|
msg = _("Unset autostart")
|
||||||
addlogmsg(request.user.id, instance.id, msg)
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.set_autostart(0)
|
conn.set_autostart(0)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
return HttpResponseRedirect(request.get_full_path() + '#autostart')
|
||||||
|
|
||||||
if 'resize' in request.POST:
|
|
||||||
msg = _("Resize")
|
|
||||||
addlogmsg(request.user.id, instance.id, msg)
|
|
||||||
description = request.POST.get('description', '')
|
|
||||||
vcpu = request.POST.get('vcpu', '')
|
|
||||||
cur_vcpu = request.POST.get('cur_vcpu', '')
|
|
||||||
memory = request.POST.get('memory', '')
|
|
||||||
memory_custom = request.POST.get('memory_custom', '')
|
|
||||||
if memory_custom:
|
|
||||||
memory = memory_custom
|
|
||||||
cur_memory = request.POST.get('cur_memory', '')
|
|
||||||
cur_memory_custom = request.POST.get('cur_memory_custom', '')
|
|
||||||
if cur_memory_custom:
|
|
||||||
cur_memory = cur_memory_custom
|
|
||||||
conn.resize(cur_memory, memory, cur_vcpu, vcpu)
|
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
|
||||||
|
|
||||||
if 'change_xml' in request.POST:
|
if 'change_xml' in request.POST:
|
||||||
msg = _("Edit XML")
|
msg = _("Edit XML")
|
||||||
|
@ -333,7 +332,7 @@ def instance(request, compute_id, vname):
|
||||||
exit_xml = request.POST.get('inst_xml', '')
|
exit_xml = request.POST.get('inst_xml', '')
|
||||||
if exit_xml:
|
if exit_xml:
|
||||||
conn._defineXML(exit_xml)
|
conn._defineXML(exit_xml)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancexml')
|
return HttpResponseRedirect(request.get_full_path() + '#xmledit')
|
||||||
|
|
||||||
if 'set_console_passwd' in request.POST:
|
if 'set_console_passwd' in request.POST:
|
||||||
msg = _("Set VNC password")
|
msg = _("Set VNC password")
|
||||||
|
@ -353,7 +352,7 @@ def instance(request, compute_id, vname):
|
||||||
msg = _("Error setting console password. You should check that your instance have an graphic device.")
|
msg = _("Error setting console password. You should check that your instance have an graphic device.")
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#console_pass')
|
return HttpResponseRedirect(request.get_full_path() + '#vncedit')
|
||||||
|
|
||||||
if 'set_console_keymap' in request.POST:
|
if 'set_console_keymap' in request.POST:
|
||||||
msg = _("Set VNC keymap")
|
msg = _("Set VNC keymap")
|
||||||
|
@ -364,14 +363,14 @@ def instance(request, compute_id, vname):
|
||||||
conn.set_console_keymap('')
|
conn.set_console_keymap('')
|
||||||
else:
|
else:
|
||||||
conn.set_console_keymap(keymap)
|
conn.set_console_keymap(keymap)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#console_keymap')
|
return HttpResponseRedirect(request.get_full_path() + '#vncedit')
|
||||||
|
|
||||||
if 'set_console_type' in request.POST:
|
if 'set_console_type' in request.POST:
|
||||||
msg = _("Set VNC type")
|
msg = _("Set VNC type")
|
||||||
addlogmsg(request.user.id, instance.id, msg)
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
console_type = request.POST.get('console_type', '')
|
console_type = request.POST.get('console_type', '')
|
||||||
conn.set_console_type(console_type)
|
conn.set_console_type(console_type)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#console_type')
|
return HttpResponseRedirect(request.get_full_path() + '#vncedit')
|
||||||
|
|
||||||
if 'migrate' in request.POST:
|
if 'migrate' in request.POST:
|
||||||
msg = _("Migrate")
|
msg = _("Migrate")
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div role="tabpanel">
|
<div role="tabpanel">
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-pills" role="tablist">
|
<ul class="nav nav-pills" role="tablist" id="navbtn">
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="#power" class="action-button" aria-controls="power" role="tab" data-toggle="tab">
|
<a href="#power" class="action-button" aria-controls="power" role="tab" data-toggle="tab">
|
||||||
<span id="action-block" class="glyphicon glyphicon-off" aria-hidden="true"></span>
|
<span id="action-block" class="glyphicon glyphicon-off" aria-hidden="true"></span>
|
||||||
|
@ -1013,4 +1013,31 @@
|
||||||
})
|
})
|
||||||
}, 2000);
|
}, 2000);
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
var hash = location.hash;
|
||||||
|
if (~$.inArray(hash, ['#poweron', '#poweroff', '#powercycle', '#suspend', '#resume'])) {
|
||||||
|
var btnsect = $('#navbtn>li>a');
|
||||||
|
$(btnsect).each(function () {
|
||||||
|
if ($(this).attr('href') === '#power') {
|
||||||
|
$(this).trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (~$.inArray(hash, ['#resize'])) {
|
||||||
|
var btnsect = $('#navbtn>li>a');
|
||||||
|
$(btnsect).each(function () {
|
||||||
|
if ($(this).attr('href') === '#resize') {
|
||||||
|
$(this).trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (~$.inArray(hash, ['#media', '#autostart', '#xmledit', '#vncedit'])) {
|
||||||
|
var btnsect = $('#navbtn>li>a');
|
||||||
|
$(btnsect).each(function () {
|
||||||
|
if ($(this).attr('href') === '#settings') {
|
||||||
|
$(this).trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in a new issue