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

url fix for clone

This commit is contained in:
catborise 2018-10-01 15:09:04 +03:00
parent 358f9ae28a
commit 93a8625aca
4 changed files with 11 additions and 8 deletions

View file

@ -177,7 +177,7 @@
<script> <script>
function goto_compute() { function goto_compute() {
var compute = $("#compute_select").val(); var compute = $("#compute_select").val();
window.location = "/compute/" + compute + "/create/"; window.location.href = "{% url 'create_instance' 1 %}".replace(1, compute);
} }
</script> </script>
{% endif %} {% endif %}

View file

@ -1261,7 +1261,7 @@
</script> </script>
<script> <script>
function random_mac(net) { function random_mac(net) {
$.getJSON('/instance/random_mac_address/', function(data) { $.getJSON('{% url 'random_mac_address' %}', function (data) {
$('input[name="'+net+'"]').val(data['mac']); $('input[name="'+net+'"]').val(data['mac']);
}); });
}; };
@ -1278,14 +1278,15 @@
<script> <script>
function guess_mac_address(src_elem, net) { function guess_mac_address(src_elem, net) {
new_vname = $(src_elem).val(); new_vname = $(src_elem).val();
$.getJSON('/instance/guess_mac_address/' + new_vname + '/', function(data) { guess_mac_address_url = "{% url 'guess_mac_address' 1 %}".replace(1, new_vname);
$.getJSON(guess_mac_address_url, function(data) {
$('input[name="clone-net-mac-'+net+'"]').val(data['mac']); $('input[name="clone-net-mac-'+net+'"]').val(data['mac']);
}); });
} }
</script> </script>
<script> <script>
function guess_clone_name() { function guess_clone_name() {
$.getJSON('/instance/guess_clone_name/', function(data) { $.getJSON('{% url 'guess_clone_name' %}', function(data) {
guessed_name = data['name'].split(".")[0]; guessed_name = data['name'].split(".")[0];
$('#clone_name').val(guessed_name); $('#clone_name').val(guessed_name);
update_clone_disk_name(guessed_name); update_clone_disk_name(guessed_name);
@ -1363,7 +1364,8 @@
}); });
$(document).ready(function () { $(document).ready(function () {
// set vdi url // set vdi url
$.get("/datasource/vdi/{{ vname }}/", function(data) {
$.get("{% url 'vdi_url' vname %}", function(data) {
$("#vdi_url_input").attr("value", data); $("#vdi_url_input").attr("value", data);
$("#vdi_url").attr("href", data); $("#vdi_url").attr("href", data);
}); });
@ -1592,7 +1594,8 @@
</script> </script>
<script> <script>
function update_logs_table(vname) { function update_logs_table(vname) {
$.getJSON('/logs/vm_logs/'+vname+'/', function(data) { logurl = "{% url 'vm_logs' 1 %}".replace(1, vname);
$.getJSON(logurl, function(data) {
var logs = ""; var logs = "";
$.each(data, function(id) { $.each(data, function(id) {
row = data[id]; row = data[id];

View file

@ -192,7 +192,7 @@
<script> <script>
function goto_compute() { function goto_compute() {
var compute = $("#compute_select").val(); var compute = $("#compute_select").val();
window.location = "/compute/" + compute + "/create/"; window.location.href = "{% url 'create_instance' 1 %}".replace(1, compute);
} }
</script> </script>
{% endif %} {% endif %}

View file

@ -359,7 +359,7 @@ def instance(request, compute_id, vname):
msg = _("Destroy") msg = _("Destroy")
addlogmsg(request.user.username, instance_name, msg) addlogmsg(request.user.username, instance_name, msg)
return HttpResponseRedirect(reverse('instances')) return HttpResponseRedirect(reverse('allinstances'))
if 'rootpasswd' in request.POST: if 'rootpasswd' in request.POST:
passwd = request.POST.get('passwd', '') passwd = request.POST.get('passwd', '')