2015-03-02 15:31:25 +00:00
|
|
|
{% extends "base.html" %}
|
2021-06-15 06:42:55 +00:00
|
|
|
{% load static %}
|
2015-03-02 15:31:25 +00:00
|
|
|
{% load i18n %}
|
2023-08-09 06:20:18 +00:00
|
|
|
{% load bootstrap_icons %}
|
2020-10-15 14:18:45 +00:00
|
|
|
|
2020-07-13 09:33:09 +00:00
|
|
|
{% block title %}{% trans "Instance" %} - {{ instance.name }}{% endblock %}
|
2020-10-15 14:18:45 +00:00
|
|
|
|
|
|
|
{% block page_heading %}
|
|
|
|
{{ instance.name }}{% if instance.title %} ({{ instance.title }}){% endif %}
|
|
|
|
{% endblock page_heading %}
|
|
|
|
|
2015-03-02 15:31:25 +00:00
|
|
|
{% block content %}
|
2019-07-31 08:03:48 +00:00
|
|
|
{% include 'pleasewaitdialog.html' %}
|
2020-01-20 12:47:14 +00:00
|
|
|
<div>
|
2019-07-31 08:03:48 +00:00
|
|
|
<div>
|
2020-07-13 09:33:09 +00:00
|
|
|
{% if instance.status == 5 %}
|
2021-07-07 11:12:38 +00:00
|
|
|
<span class="badge bg-danger">{% trans "Off" %}</span>
|
2020-01-20 12:47:14 +00:00
|
|
|
{% endif %}
|
2020-07-13 09:33:09 +00:00
|
|
|
{% if instance.status == 1 %}
|
2021-07-07 11:12:38 +00:00
|
|
|
<span class="badge bg-success">{% trans "Active" %}</span>
|
2020-01-20 12:47:14 +00:00
|
|
|
{% endif %}
|
2020-07-13 09:33:09 +00:00
|
|
|
{% if instance.status == 3 %}
|
2021-07-07 11:12:38 +00:00
|
|
|
<span class="badge bg-warning">{% trans "Suspend" %}</span>
|
2020-01-20 12:47:14 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
2023-08-11 06:40:38 +00:00
|
|
|
<span
|
|
|
|
{%if instance.guest_agent %}
|
2020-07-13 09:33:09 +00:00
|
|
|
{% if instance.guest_agent_ready %}
|
2021-07-07 11:12:38 +00:00
|
|
|
class="badge bg-success"
|
2020-05-20 13:18:27 +00:00
|
|
|
title="{% trans "Guest Agent Enabled & Connected" %}"
|
2019-12-25 11:36:43 +00:00
|
|
|
{% else %}
|
2021-07-07 11:12:38 +00:00
|
|
|
class="badge bg-warning"
|
2020-05-20 13:18:27 +00:00
|
|
|
title="{% trans "Guest Agent Enabled but not Connected" %}"
|
2020-01-20 12:47:14 +00:00
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2021-07-07 11:12:38 +00:00
|
|
|
class="badge bg-danger"
|
2020-05-20 13:18:27 +00:00
|
|
|
title="{% trans "Guest Agent Not Enabled & Not Connected" %}"
|
2023-08-11 06:40:38 +00:00
|
|
|
{% endif %}>{% bs_icon 'broadcast' size='1em' %}
|
|
|
|
</span>
|
2020-01-20 12:47:14 +00:00
|
|
|
|
|
2020-07-13 09:33:09 +00:00
|
|
|
{% if instance.snapshots %}
|
2023-08-09 06:20:18 +00:00
|
|
|
{% bs_icon 'camera'%} <i title="There are {{ instance.snapshots|length }} snapshot(s)"></i>
|
2021-12-10 11:39:56 +00:00
|
|
|
|
|
2020-01-20 12:47:14 +00:00
|
|
|
{% endif %}
|
2020-07-13 09:33:09 +00:00
|
|
|
{% if instance.cur_vcpu %}
|
|
|
|
{{ instance.cur_vcpu }} {% trans "VCPU" %}
|
2020-01-20 12:47:14 +00:00
|
|
|
{% else %}
|
2020-07-13 09:33:09 +00:00
|
|
|
{{ instance.vcpu }} {% trans "VCPU" %}
|
2020-01-20 12:47:14 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
2020-07-13 09:33:09 +00:00
|
|
|
{{ instance.cur_memory }} {% trans "MB" %} {% trans "RAM" %}
|
2020-01-20 12:47:14 +00:00
|
|
|
|
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for disk in instance.disks %}
|
2020-01-20 12:47:14 +00:00
|
|
|
{{ disk.size|filesizeformat }} {% trans "Disk" %} |
|
|
|
|
{% endfor %}
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for net in instance.networks %}
|
2020-01-20 12:47:14 +00:00
|
|
|
{% for ipv4 in net.ipv4 %}
|
|
|
|
{{ ipv4 }} |
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
2020-12-17 11:29:07 +00:00
|
|
|
{% if instance.guest_agent_ready %}
|
2023-08-11 06:40:38 +00:00
|
|
|
<a class="link-warning" title="{% trans 'Show Instance OS details' %}" onclick="get_osinfo();">
|
|
|
|
<span>{% bs_icon 'info-circle' %} </span>
|
2020-12-17 11:29:07 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
2023-08-11 06:40:38 +00:00
|
|
|
<a class="link-success" href="{% url 'instances:instance' instance.id %}" title="{% trans 'Refresh instance info' %}">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span>{% bs_icon 'repeat'%} </span>
|
2020-12-17 11:29:07 +00:00
|
|
|
</a>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
{% if user_quota_msg %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<div class="alert alert-warning fade show">
|
|
|
|
{{ user_quota_msg|capfirst }} {% trans "quota reached" %}.
|
2020-07-13 09:33:09 +00:00
|
|
|
</div>
|
2019-07-31 08:03:48 +00:00
|
|
|
{% endif %}
|
|
|
|
<hr>
|
|
|
|
</div>
|
2015-05-20 13:44:30 +00:00
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
<div id="mainTabMenu">
|
|
|
|
<!-- Nav tabs -->
|
2022-11-04 15:49:41 +00:00
|
|
|
<ul class="nav nav-pills nav-fill" id="navbtn" role="tablist" aria-label="Instance actions">
|
2021-07-07 11:12:38 +00:00
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button active" id="power-tab" aria-controls="power" data-bs-toggle="pill" data-bs-target="#power" type="button" role="tab" aria-selected="true">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'power' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Power" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button" id="access-tab" aria-controls="access" data-bs-toggle="pill" data-bs-target="#access" type="button" role="tab" aria-selected="false">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'lock' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Access" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button" id="resize-tab" aria-controls="resize" data-bs-toggle="pill" data-bs-target="#resize" type="button" role="tab" aria-selected="false">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'arrows-angle-expand' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Resize" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
2022-06-16 12:55:08 +00:00
|
|
|
{% if allow_admin_or_not_template and 'instances.snapshot_instances' in perms %}
|
2021-07-07 11:12:38 +00:00
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button" id="snapshots-tab" aria-controls="snapshots" data-bs-toggle="pill" data-bs-target="#snapshots" type="button" role="tab" aria-selected="false">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'camera' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Snapshot" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button" id="settings-tab" aria-controls="settings" data-bs-toggle="pill" data-bs-target="#settings" type="button" role="tab" aria-selected="false">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'gear-wide-connected' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Settings" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button" id="graphics-tab" aria-controls="graphics" data-bs-toggle="pill" data-bs-target="#graphics" type="button" role="tab" aria-selected="false">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'bar-chart-line' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Stats" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link action-button" id="undefine-tab" aria-controls="undefine" data-bs-toggle="pill" data-bs-target="#undefine" type="button" role="tab" aria-selected="false">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span id="action-block" aria-hidden="true">{% bs_icon 'trash' size='2em'%} </span>
|
2021-07-07 11:12:38 +00:00
|
|
|
{% trans "Destroy" %}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<!-- Tab panes -->
|
|
|
|
<div class="tab-content" id=mainTabMenuContent>
|
|
|
|
{% include 'instances/power_tab.html' %}
|
|
|
|
{% include 'instances/access_tab.html' %}
|
|
|
|
{% include 'instances/resize_tab.html' %}
|
|
|
|
{% include 'instances/snapshots_tab.html' %}
|
|
|
|
{% include 'instances/settings_tab.html' %}
|
|
|
|
{% include 'instances/stats_tab.html' %}
|
|
|
|
{% include 'instances/destroy_tab.html' %}
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-25 11:32:36 +00:00
|
|
|
|
2020-06-17 09:23:44 +00:00
|
|
|
{% if app_settings.VIEW_INSTANCE_DETAIL_BOTTOM_BAR == 'True' %}
|
2020-05-25 11:32:36 +00:00
|
|
|
{% include 'bottom_bar.html' %}
|
|
|
|
{% endif %}
|
|
|
|
|
2015-03-12 15:35:51 +00:00
|
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
2021-07-07 11:12:38 +00:00
|
|
|
<script src="{% static 'js/ace/ace.js' %}" type="text/javascript" charset="utf-8"></script>
|
2018-10-24 09:04:05 +00:00
|
|
|
<script>
|
2018-11-23 12:18:32 +00:00
|
|
|
function get_volumes(compute_id, pool) {
|
|
|
|
get_vol_url = "/computes/" + compute_id + "/storage/" + pool + "/volumes";
|
|
|
|
$.getJSON(get_vol_url, function (data) {
|
|
|
|
$("#vols").find('option').remove();
|
|
|
|
$("#vols").removeAttr("disabled");
|
|
|
|
|
|
|
|
$.each(data['vols'], function(i, item) {
|
|
|
|
$("#vols").append('<option value=' + item +'>' + item + '</option>');
|
2019-01-15 12:55:05 +00:00
|
|
|
})
|
2018-11-23 12:18:32 +00:00
|
|
|
});
|
2018-10-24 09:04:05 +00:00
|
|
|
|
2018-10-25 06:57:41 +00:00
|
|
|
var sto_drop = document.getElementById('select_storage');
|
|
|
|
sto_drop.value = pool;
|
|
|
|
sto_drop.innerHTML = pool + "<span class=\"caret\"></span>";
|
|
|
|
|
|
|
|
var sto_input = document.getElementById('selected_storage');
|
2020-07-13 09:33:09 +00:00
|
|
|
sto_input.setAttribute('value', pool);
|
|
|
|
//sto_input.innerHTML = pool;
|
2018-10-24 09:04:05 +00:00
|
|
|
}
|
|
|
|
</script>
|
2015-03-13 12:06:51 +00:00
|
|
|
<script>
|
|
|
|
var editor = ace.edit("editor");
|
|
|
|
editor.getSession().setMode("ace/mode/xml");
|
|
|
|
|
|
|
|
var input = $('input[name="inst_xml"]');
|
|
|
|
editor.getSession().on("change", function () {
|
|
|
|
input.val(editor.getSession().getValue());
|
|
|
|
});
|
|
|
|
</script>
|
2015-03-13 09:06:34 +00:00
|
|
|
<script>
|
|
|
|
function random_mac(net) {
|
2021-07-07 11:12:38 +00:00
|
|
|
$.getJSON("{% url 'instances:random_mac_address' %}", function (data) {
|
2018-10-24 09:04:05 +00:00
|
|
|
$('input[name="' + net + '"]').val(data['mac']);
|
2018-07-26 09:35:37 +00:00
|
|
|
});
|
2020-03-16 13:59:45 +00:00
|
|
|
}
|
2015-03-13 09:06:34 +00:00
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function show_console() {
|
|
|
|
if ($('#console_show_pass').attr('type') == 'password') {
|
|
|
|
$('#console_show_pass').attr('type', 'text');
|
|
|
|
} else {
|
|
|
|
$('#console_show_pass').attr('type', 'password');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2016-02-08 11:28:52 +00:00
|
|
|
<script>
|
2016-03-23 08:00:42 +00:00
|
|
|
function guess_mac_address(src_elem, net) {
|
|
|
|
new_vname = $(src_elem).val();
|
2020-06-16 12:57:50 +00:00
|
|
|
guess_mac_address_url = "{% url 'instances:guess_mac_address' 1 %}".replace(1, new_vname);
|
2018-10-01 12:09:04 +00:00
|
|
|
$.getJSON(guess_mac_address_url, function(data) {
|
2016-02-10 16:52:50 +00:00
|
|
|
$('input[name="clone-net-mac-'+net+'"]').val(data['mac']);
|
2016-02-08 11:28:52 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2016-05-27 12:13:24 +00:00
|
|
|
<script>
|
|
|
|
function guess_clone_name() {
|
2021-07-07 11:12:38 +00:00
|
|
|
$.getJSON("{% url 'instances:guess_clone_name' %}", function(data) {
|
2016-05-27 12:13:24 +00:00
|
|
|
guessed_name = data['name'].split(".")[0];
|
|
|
|
$('#clone_name').val(guessed_name);
|
|
|
|
update_clone_disk_name(guessed_name);
|
2016-06-08 11:37:26 +00:00
|
|
|
guess_mac_address('#clone_name', 0);
|
2016-05-27 12:13:24 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2016-02-08 09:17:01 +00:00
|
|
|
<script>
|
|
|
|
function update_clone_disk_name(new_vname) {
|
2020-07-13 09:33:09 +00:00
|
|
|
vname = '{{ instance.name }}';
|
|
|
|
{% for disk in instance.disks %}
|
2019-03-19 11:39:34 +00:00
|
|
|
disk_name = '{{ disk.image }}';
|
2020-03-16 13:59:45 +00:00
|
|
|
disk_dot = disk_name.split('.');
|
2019-03-19 11:39:34 +00:00
|
|
|
disk_dot_suffix = disk_dot[disk_dot.length-1];
|
|
|
|
if (disk_name.startsWith(vname)) {
|
|
|
|
image = disk_name.replace(vname, new_vname);
|
|
|
|
} else if (disk_name.lastIndexOf('.') > -1 && disk_dot_suffix.length <= 7) {
|
|
|
|
disk_dot.pop();
|
2020-03-16 13:59:45 +00:00
|
|
|
disk_name_only = disk_dot.join('-');
|
2019-03-19 11:39:34 +00:00
|
|
|
image = new_vname + "-" + disk_name_only + "." + disk_dot_suffix
|
|
|
|
} else if (new_vname != disk_name) {
|
|
|
|
image = new_vname
|
|
|
|
} else {
|
|
|
|
image = new_vname + '-clone';
|
|
|
|
}
|
|
|
|
$('#disk_name-{{ disk.dev }}').val(image);
|
2020-04-17 12:37:34 +00:00
|
|
|
{% endfor %}
|
2016-02-08 09:17:01 +00:00
|
|
|
}
|
|
|
|
</script>
|
2015-03-13 09:06:34 +00:00
|
|
|
<script>
|
|
|
|
$(document).on('change', '#console_passwd_gen', function () {
|
|
|
|
if ($(this).prop('checked')) {
|
|
|
|
$('#console_passwd_manual').hide();
|
|
|
|
$('#console_passwd_clear').prop('checked', false);
|
|
|
|
} else {
|
|
|
|
$('#console_passwd_manual').show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(document).on('change', '#console_passwd_clear', function () {
|
|
|
|
if ($(this).prop('checked')) {
|
|
|
|
$('#console_passwd_manual').hide();
|
|
|
|
$('#console_passwd_gen').prop('checked', false);
|
|
|
|
} else {
|
|
|
|
$('#console_passwd_manual').show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(document).on('change', '#console_keymap_clear', function () {
|
|
|
|
if ($(this).prop('checked')) {
|
|
|
|
$('#console_keymap_selection').hide();
|
|
|
|
} else {
|
|
|
|
$('#console_keymap_selection').show();
|
|
|
|
}
|
|
|
|
});
|
2016-02-08 09:17:01 +00:00
|
|
|
$('#clone_name').on('input', function () {
|
|
|
|
update_clone_disk_name($(this).val());
|
|
|
|
});
|
2015-03-13 09:06:34 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
// set current console keymap or fall back to default
|
2022-08-23 05:40:36 +00:00
|
|
|
var keymap = "{{ instance.console_keymap }}";
|
2015-03-13 09:06:34 +00:00
|
|
|
if (keymap != '') {
|
|
|
|
$("#console_select_keymap option[value='" + keymap + "']").prop('selected', true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
|
|
// set current console type or fall back to default
|
2022-08-23 05:40:36 +00:00
|
|
|
var console_type = "{{ instance.console_type }}";
|
2015-03-13 09:06:34 +00:00
|
|
|
if (console_type != '') {
|
|
|
|
$("#console_select_type option[value='" + console_type + "']").prop('selected', true);
|
|
|
|
}
|
|
|
|
});
|
2018-06-15 12:13:50 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
// set current console listen address or fall back to default
|
2022-08-23 05:40:36 +00:00
|
|
|
var console_listener_address = "{{ instance.console_listener_address }}";
|
2022-08-22 12:12:33 +00:00
|
|
|
if (console_listener_address != '') {
|
|
|
|
$("#console_select_listener_address option[value='" + console_listener_address + "']").prop('selected', true);
|
2019-11-20 13:24:01 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
|
|
// get video model or fall back to default
|
2020-07-13 09:33:09 +00:00
|
|
|
let video_model = "{{ instance.video_model }}";
|
2019-11-20 13:24:01 +00:00
|
|
|
if (video_model != '') {
|
|
|
|
$("#video_model_select option[value='" + video_model + "']").prop('selected', true);
|
2018-06-15 12:13:50 +00:00
|
|
|
}
|
|
|
|
});
|
2018-06-21 12:53:35 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
// set vdi url
|
2020-07-13 09:33:09 +00:00
|
|
|
$.get("{% url 'vdi_url' compute.id instance.name %}", function(data) {
|
2018-09-05 06:30:08 +00:00
|
|
|
$("#vdi_url_input").attr("value", data);
|
2018-06-21 12:53:35 +00:00
|
|
|
$("#vdi_url").attr("href", data);
|
|
|
|
});
|
|
|
|
});
|
2018-07-26 09:35:37 +00:00
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
$(document).ready(function () {
|
2018-08-28 08:55:27 +00:00
|
|
|
random_mac('clone-net-mac-0');
|
|
|
|
random_mac('add-net-mac');
|
2018-09-11 13:11:13 +00:00
|
|
|
update_clone_disk_name($('#clone_name').val());
|
2018-07-26 09:35:37 +00:00
|
|
|
});
|
|
|
|
{% else %}
|
2016-03-23 08:00:42 +00:00
|
|
|
$('#select_clone_name').on('change', function () {
|
|
|
|
update_clone_disk_name($(this).val());
|
|
|
|
guess_mac_address('#select_clone_name', 0);
|
|
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
|
|
update_clone_disk_name($('#select_clone_name').val());
|
|
|
|
guess_mac_address('#select_clone_name', 0);
|
|
|
|
});
|
|
|
|
{% endif %}
|
2015-03-13 09:06:34 +00:00
|
|
|
</script>
|
2018-11-07 11:29:36 +00:00
|
|
|
<script>
|
2019-07-31 08:03:48 +00:00
|
|
|
$(document).ready(function(){
|
2021-07-07 11:12:38 +00:00
|
|
|
$('[data-bs-toggle="popover"]').popover({
|
2019-07-31 08:03:48 +00:00
|
|
|
placement : 'top'
|
|
|
|
});
|
2018-11-07 11:29:36 +00:00
|
|
|
});
|
2019-01-15 12:55:05 +00:00
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function set_orderlist(obj){
|
|
|
|
var result = '';
|
|
|
|
$('#b_order label input:checked').each(function () {
|
|
|
|
if (result != '') result += ',';
|
|
|
|
result += $(this).val();
|
|
|
|
});
|
|
|
|
obj.val(result);
|
|
|
|
}
|
2019-07-31 08:03:48 +00:00
|
|
|
$(document).ready(function () {
|
2019-01-15 12:55:05 +00:00
|
|
|
{# Boot Order Arragements #}
|
|
|
|
jQuery.fn.multiselect = function() {
|
|
|
|
$(this).each(function() {
|
|
|
|
var checkboxes = $(this).find("input:checkbox");
|
|
|
|
checkboxes.each(function() {
|
|
|
|
var checkbox = $(this);
|
|
|
|
// Highlight pre-selected checkboxes
|
|
|
|
if (checkbox.prop("checked"))
|
|
|
|
checkbox.parent().addClass("multiselect-on");
|
|
|
|
// Highlight checkboxes that the user selects
|
|
|
|
checkbox.click(function() {
|
|
|
|
if (checkbox.prop("checked"))
|
|
|
|
checkbox.parent().addClass("multiselect-on");
|
|
|
|
else
|
|
|
|
checkbox.parent().removeClass("multiselect-on");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
$(function() {
|
|
|
|
$(".multiselect").multiselect();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#boot_order_up').bind('click', function() {
|
|
|
|
$('#b_order label input:checked').each( function() {
|
|
|
|
var label = $(this).parent();
|
|
|
|
var newPos = label.index() - 1;
|
|
|
|
if (newPos > -1) {
|
|
|
|
$('#b_order label').eq(newPos).before("<label><input type='checkbox' value='"+$(this).val()+"' name='"+$(this).val()+"' checked>"+$(this).parent().text()+"</label>");
|
|
|
|
label.remove();
|
|
|
|
}
|
|
|
|
$(".multiselect").multiselect();
|
|
|
|
});
|
|
|
|
set_orderlist($("#bootorder"));
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#boot_order_down').bind('click', function() {
|
2020-05-20 13:18:27 +00:00
|
|
|
var countOptions = $('#b_order label').length;
|
|
|
|
var countSelected = $('#b_order label input:checked').length;
|
2019-01-15 12:55:05 +00:00
|
|
|
$('#b_order label input:checked').each( function() {
|
|
|
|
var label = $(this).parent();
|
|
|
|
var newPos = label.index() + countSelected;
|
|
|
|
if (newPos < countOptions) {
|
|
|
|
$('#b_order label').eq(newPos).after("<label><input type='checkbox' value='"+$(this).val()+"' name='"+$(this).val()+"' checked>"+$(this).parent().text()+"</label>");
|
|
|
|
label.remove();
|
|
|
|
}
|
|
|
|
$(".multiselect").multiselect();
|
|
|
|
});
|
|
|
|
set_orderlist($("#bootorder"));
|
|
|
|
});
|
|
|
|
});
|
2018-11-07 11:29:36 +00:00
|
|
|
</script>
|
2015-03-13 09:06:34 +00:00
|
|
|
<script>
|
|
|
|
$(function () {
|
|
|
|
$('.js-custom__checkbox').change(function () {
|
|
|
|
var container = $(this).closest('.js-custom__container');
|
2021-07-07 11:12:38 +00:00
|
|
|
var toggles = container.find('.js-custom__toggle');
|
2015-03-13 09:06:34 +00:00
|
|
|
toggles.toggle();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2021-07-07 11:12:38 +00:00
|
|
|
<script src="{% static 'js/Chart.bundle.min.js' %}"></script>
|
2015-03-20 10:06:32 +00:00
|
|
|
<script>
|
2021-07-07 11:12:38 +00:00
|
|
|
var stats_tab = document.querySelector('#graphics-tab');
|
|
|
|
stats_tab.addEventListener('shown.bs.tab', function (event) {
|
2019-05-21 06:12:28 +00:00
|
|
|
var cpu_ctx = $("#cpuChart").get(0).getContext("2d");
|
|
|
|
var cpuChart = new Chart(cpu_ctx, {
|
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets : [{
|
|
|
|
backgroundColor: "rgba(44,127,184,0.5)",
|
|
|
|
label: "Usage"
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
responsive: true,
|
|
|
|
legend: {
|
|
|
|
display: false
|
2015-03-20 10:06:32 +00:00
|
|
|
},
|
2019-05-21 06:12:28 +00:00
|
|
|
scales: {
|
|
|
|
xAxes:[{
|
|
|
|
offset: false,
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: false,
|
|
|
|
autoSkip: true,
|
|
|
|
maxTicksLimit: 10,
|
|
|
|
maxRotation: 0,
|
|
|
|
minRotation: 0,
|
|
|
|
stepSize: 10,
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
suggestedMax: 100,
|
|
|
|
suggestedMin: 0,
|
|
|
|
stepSize: 20,
|
|
|
|
callback: function(value, index, values) {
|
|
|
|
return value + ' %';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}],
|
2015-03-20 10:06:32 +00:00
|
|
|
},
|
2019-05-21 06:12:28 +00:00
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: function (tooltipItem, chart) {
|
|
|
|
var label = chart.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
if (label) {
|
|
|
|
label += ': ';
|
|
|
|
}
|
|
|
|
return label += tooltipItem.yLabel + ' %';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-03-20 10:06:32 +00:00
|
|
|
|
2019-05-21 06:12:28 +00:00
|
|
|
var mem_ctx = $("#memChart").get(0).getContext("2d");
|
|
|
|
var memChart = new Chart(mem_ctx, {
|
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets : [{
|
|
|
|
label: "Usage"
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
responsive: true,
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
xAxes:[{
|
|
|
|
offset: false,
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: false,
|
|
|
|
autoSkip: true,
|
|
|
|
maxTicksLimit: 10,
|
|
|
|
maxRotation: 0,
|
|
|
|
minRotation: 0,
|
|
|
|
stepSize: 10,
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
suggestedMax: 100,
|
|
|
|
suggestedMin: 0,
|
|
|
|
stepSize: 20,
|
|
|
|
callback: function(value, index, values) {
|
|
|
|
return value + ' MB';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: function (tooltipItem, chart) {
|
|
|
|
var label = chart.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
if (label) {
|
|
|
|
label += '(RSS): ';
|
|
|
|
}
|
|
|
|
return label += tooltipItem.yLabel + ' MB';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-03-20 10:06:32 +00:00
|
|
|
|
|
|
|
var diskChart = {};
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for disk in instance.disks %}
|
2015-03-20 10:06:32 +00:00
|
|
|
var disk_ctx_{{ disk.dev }} = $("#blk{{ disk.dev }}Chart").get(0).getContext("2d");
|
2019-05-21 06:12:28 +00:00
|
|
|
diskChart['{{ disk.dev }}'] = new Chart(disk_ctx_{{ disk.dev }}, {
|
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets : [{
|
|
|
|
backgroundColor: "rgba(127,205,187,0.5)",
|
|
|
|
label: "Read"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
backgroundColor: "rgba(44,127,184,0.5)",
|
|
|
|
label: "Write"
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
responsive: true,
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
xAxes:[{
|
|
|
|
offset: false,
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: false,
|
|
|
|
autoSkip: true,
|
|
|
|
maxTicksLimit: 10,
|
|
|
|
maxRotation: 0,
|
|
|
|
minRotation: 0,
|
|
|
|
stepSize: 10,
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
suggestedmax: 100,
|
|
|
|
suggestedMin: 0,
|
|
|
|
callback: function(value, index, values) {
|
|
|
|
return value + ' Mb/s';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: function (tooltipItem, chart) {
|
|
|
|
var label = chart.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
if (label) {
|
|
|
|
label += ': ';
|
|
|
|
}
|
|
|
|
return label += tooltipItem.yLabel + ' Mb/s';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-03-20 10:06:32 +00:00
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
var netChart = {};
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for net in instance.networks %}
|
2015-03-20 10:06:32 +00:00
|
|
|
var net_ctx_{{ forloop.counter0 }} = $("#netEth{{ forloop.counter0 }}Chart").get(0).getContext("2d");
|
2020-03-16 13:59:45 +00:00
|
|
|
netChart[{{ forloop.counter0 }}] = new Chart(net_ctx_{{ forloop.counter0 }}, {
|
2019-05-21 06:12:28 +00:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets : [
|
|
|
|
{
|
|
|
|
backgroundColor: "rgba(127,205,187,0.5)",
|
|
|
|
label: "Inbound"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
backgroundColor: "rgba(44,127,184,0.5)",
|
|
|
|
label: "Outbound"
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
responsive: true,
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
xAxes:[{
|
|
|
|
offset: false,
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: false,
|
|
|
|
autoSkip: true,
|
|
|
|
maxTicksLimit: 10,
|
|
|
|
maxRotation: 0,
|
|
|
|
minRotation: 0,
|
|
|
|
stepSize: 10,
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
suggestedMax: 100,
|
|
|
|
suggestedMin: 0,
|
|
|
|
callback: function(value, index, values) {
|
|
|
|
return value + ' Mbps';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: function (tooltipItem, chart) {
|
|
|
|
var label = chart.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
if (label) {
|
|
|
|
label += ': ';
|
|
|
|
}
|
|
|
|
return label += tooltipItem.yLabel + ' Mbps';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-03-20 10:06:32 +00:00
|
|
|
{% endfor %}
|
|
|
|
|
2020-05-14 16:34:28 +00:00
|
|
|
var graph_interval = window.setInterval(function graph_usage() {
|
2021-07-07 11:12:38 +00:00
|
|
|
$.getJSON("{% url 'instances:stats' instance.id %}", function (data) {
|
2019-05-21 06:12:28 +00:00
|
|
|
cpuChart.data.labels.push(data.timeline);
|
|
|
|
cpuChart.data.datasets[0].data.push(data.cpudata);
|
|
|
|
if (cpuChart.data.datasets[0].data.length > 10){
|
|
|
|
cpuChart.data.labels.shift();
|
|
|
|
cpuChart.data.datasets[0].data.shift();
|
2015-03-20 10:06:32 +00:00
|
|
|
}
|
|
|
|
cpuChart.update();
|
|
|
|
|
2019-05-21 06:12:28 +00:00
|
|
|
memChart.data.labels.push(data.timeline);
|
|
|
|
memChart.options.scales.yAxes[0].ticks.max = parseInt(data.memdata.total / 1024);
|
|
|
|
memChart.options.scales.yAxes[0].ticks.stepSize = parseInt(data.memdata.total / (1024 * 5));
|
|
|
|
memChart.data.datasets[0].data.push(data.memdata.used / 1024);
|
|
|
|
if (memChart.data.datasets[0].data.length > 10){
|
|
|
|
memChart.data.labels.shift();
|
|
|
|
memChart.data.datasets[0].data.shift();
|
2015-03-23 09:23:17 +00:00
|
|
|
}
|
2019-05-21 06:12:28 +00:00
|
|
|
memChart.update();
|
|
|
|
|
|
|
|
for (let j = 0; j < data.blkdata.length; j++) {
|
|
|
|
diskChart[data.blkdata[j].dev].data.labels.push(data.timeline);
|
2015-03-20 10:06:32 +00:00
|
|
|
|
2020-03-16 13:59:45 +00:00
|
|
|
diskChart[data.blkdata[j].dev].data.datasets[0].data.push(data.blkdata[j].data[0]);
|
|
|
|
diskChart[data.blkdata[j].dev].data.datasets[1].data.push(data.blkdata[j].data[1]);
|
2019-05-21 06:12:28 +00:00
|
|
|
if (diskChart[data.blkdata[j].dev].data.datasets[0].data.length > 10){
|
|
|
|
diskChart[data.blkdata[j].dev].data.labels.shift();
|
|
|
|
diskChart[data.blkdata[j].dev].data.datasets[0].data.shift();
|
|
|
|
diskChart[data.blkdata[j].dev].data.datasets[1].data.shift();
|
2015-03-23 09:23:17 +00:00
|
|
|
}
|
2019-05-21 06:12:28 +00:00
|
|
|
diskChart[data.blkdata[j].dev].update();
|
|
|
|
}
|
2015-03-20 10:06:32 +00:00
|
|
|
|
2019-05-21 06:12:28 +00:00
|
|
|
for (let j = 0; j < data.netdata.length; j++) {
|
|
|
|
netChart[data.netdata[j].dev].data.labels.push(data.timeline);
|
|
|
|
|
2020-03-16 13:59:45 +00:00
|
|
|
netChart[data.netdata[j].dev].data.datasets[0].data.push(data.netdata[j].data[0]);
|
|
|
|
netChart[data.netdata[j].dev].data.datasets[1].data.push(data.netdata[j].data[1]);
|
2019-05-21 06:12:28 +00:00
|
|
|
if (netChart[data.netdata[j].dev].data.datasets[0].data.length > 10){
|
|
|
|
netChart[data.netdata[j].dev].data.labels.shift();
|
|
|
|
netChart[data.netdata[j].dev].data.datasets[0].data.shift();
|
|
|
|
netChart[data.netdata[j].dev].data.datasets[1].data.shift();
|
|
|
|
}
|
2015-03-23 09:23:17 +00:00
|
|
|
netChart[data.netdata[j].dev].update();
|
|
|
|
}
|
|
|
|
});
|
2015-03-23 13:47:47 +00:00
|
|
|
}, 10000);
|
2015-03-23 09:23:17 +00:00
|
|
|
});
|
2015-03-24 07:22:30 +00:00
|
|
|
</script>
|
|
|
|
<script>
|
2020-05-14 16:34:28 +00:00
|
|
|
backgroundJobRunning = false;
|
|
|
|
var status_interval = window.setInterval(function get_status() {
|
2020-07-13 09:33:09 +00:00
|
|
|
var status = {{ instance.status|lower }};
|
2021-07-07 11:12:38 +00:00
|
|
|
$.getJSON("{% url 'instances:status' instance.id %}", function (data) {
|
2020-05-14 16:34:28 +00:00
|
|
|
if (data['status'] != status && !backgroundJobRunning) {
|
|
|
|
window.location.reload()
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
// Stop getting status info before delete instance
|
|
|
|
$('#delete_form').submit(function(){
|
|
|
|
window.clearInterval(status_interval);
|
|
|
|
return true;
|
|
|
|
});
|
2015-03-24 07:22:30 +00:00
|
|
|
</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');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-04-13 09:24:13 +00:00
|
|
|
if (~$.inArray(hash, ['#resize', "#resizevm_cpu", "#resizevm_mem", "#resizevm_disk"])) {
|
2015-03-24 07:22:30 +00:00
|
|
|
var btnsect = $('#navbtn>li>a');
|
|
|
|
$(btnsect).each(function () {
|
|
|
|
if ($(this).attr('href') === '#resize') {
|
|
|
|
$(this).trigger('click');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-12-17 11:29:07 +00:00
|
|
|
if (~$.inArray(hash, ['#osinfo', '#boot_opt', "#disks", '#network', '#clone', '#xmledit', '#vncsettings', '#migrate', '#options', '#users'])) {
|
2015-03-24 07:22:30 +00:00
|
|
|
var btnsect = $('#navbtn>li>a');
|
|
|
|
$(btnsect).each(function () {
|
|
|
|
if ($(this).attr('href') === '#settings') {
|
|
|
|
$(this).trigger('click');
|
|
|
|
}
|
|
|
|
});
|
2015-04-21 12:40:18 +00:00
|
|
|
|
|
|
|
var btn = $('#settings>div>ul>li>a');
|
|
|
|
$(btn).each(function () {
|
|
|
|
if ($(this).attr('href') === hash) {
|
|
|
|
$(this).trigger('click');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-04-13 09:24:13 +00:00
|
|
|
if (~$.inArray(hash, ['#takesnapshot', "#takeextsnapshot", "#managesnapshot"])) {
|
2015-04-21 12:40:18 +00:00
|
|
|
var btnsect = $('#navbtn>li>a');
|
|
|
|
$(btnsect).each(function () {
|
|
|
|
if ($(this).attr('href') === '#snapshots') {
|
|
|
|
$(this).trigger('click');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var btn = $('#snapshots>div>ul>li>a');
|
|
|
|
$(btn).each(function () {
|
|
|
|
if ($(this).attr('href') === hash) {
|
|
|
|
$(this).trigger('click');
|
|
|
|
}
|
|
|
|
});
|
2015-03-24 07:22:30 +00:00
|
|
|
}
|
|
|
|
</script>
|
2020-12-17 11:29:07 +00:00
|
|
|
<script>
|
|
|
|
function get_osinfo() {
|
2021-07-07 11:12:38 +00:00
|
|
|
document.querySelector("#settings-tab").click();
|
|
|
|
document.querySelector("#osinfo-tab").click();
|
2020-12-17 11:29:07 +00:00
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
$.getJSON("{% url 'instances:osinfo' instance.id %}", function (data) {
|
2020-12-17 11:29:07 +00:00
|
|
|
$.each(data, function() {
|
|
|
|
$('#oshostname').text(data['host-name']);
|
|
|
|
$('#osname').text(data.id);
|
|
|
|
$('#osprettyname').text(data['pretty-name']);
|
|
|
|
$('#oskernelrelease').text(data['kernel-release']);
|
|
|
|
$('#oskernelversion').text(data['kernel-version']);
|
|
|
|
$('#osversion').text(data.version);
|
|
|
|
$('#ostimezone').text(data.zone + " / " + data.offset);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2015-07-09 07:41:56 +00:00
|
|
|
{% endblock %}
|