Disk Edition : Resize and Create attached disks

This commit is contained in:
root
2024-03-25 15:49:12 +01:00
parent 93f2a5379f
commit a2683789d1
22 changed files with 331 additions and 33 deletions

View File

@@ -66,5 +66,10 @@
</div>
</div>
</div>
<script>
var myDropzone = new Dropzone("#file-dropzone", {
maxFilesize: 10240, // 10Go in Mo
timeout: 0,
});
</script>
{% endblock %}

View File

@@ -12,18 +12,98 @@
<img src="data:image/png;base64,{{ screen_64 }}" class="img-thumbnail">
</div>
<div class="col-sm">
Vcpu : {{ actual_vCPU }}</br><br>
Memory: {{ actual_ram }} MB</br>
<i class="fa-solid fa-microchip"></i> vCPU : {{ actual_vCPU }}</br></br>
<i class="fa-solid fa-memory"></i> Memory: {{ actual_ram }} MB</br></br>
{% if actual_autostart == 1 %}
Autostart : <input type="checkbox" class="form-check-input" checked disabled/>
{% else %}
Autostart : <input type="checkbox" class="form-check-input" disabled/>
{% endif %}
</div>
<div class="col-sm">
<form action="/editressources" method="post">
<input type="hidden" name="vm_name" value="{{ vm_name }}"></input>
<input type="text" name="new_cpu" class="form-control form-control-sm" placeholder="{{ actual_vCPU }}" value="{{ actual_vCPU }}"></input> (Max : {{ max_vCPU }})<br>
<input type="text" name="new_mem" class="form-control form-control-sm" placeholder="{{ actual_ram }}" value="{{ actual_ram }}" ></input> MB (Max : {{ max_Mermory }} MB)<br><br>
<button type="submit" class="btn btn-outline-warning btn-hype">Set New Values</button>
</form>
</div>
<table><tr><td>CPU :</td><td><input type="text" name="new_cpu" class="form-control form-control-sm" placeholder="{{ actual_vCPU }}" value="{{ actual_vCPU }}" ></input></td><td><small> (Max : {{ max_vCPU }} )</small></td></tr></table><br>
<table><tr><td>Memory :</td><td><input type="text" name="new_mem" class="form-control form-control-sm" placeholder="{{ actual_ram }}" value="{{ actual_ram }}" ></input></td><td> MB <small> (Max : {{ max_Mermory }} MB)</small></td></tr></table><br>
{% if actual_autostart == 1 %}
<input type="checkbox" name="new_autostart" class="form-check-input" value="auto_check" checked/> Autostart
{% else %}
<input type="checkbox" name="new_autostart" class="form-check-input" value="auto_check"/> Autostart
{% endif %}
<br><br>
<br><small><i class="fa-solid fa-triangle-exclamation"></i> Changing vCPU and/or Memory will restart {{ vm_name }} <i class="fa-solid fa-triangle-exclamation"></i></small>
<br><br>
<button type="submit" class="btn btn-outline-warning btn-hype"><i class="fa-solid fa-pencil"></i></button>
</form>
</div>
</div>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Disk(s) of {{ vm_name }}
</div>
<div class="card-body">
<div class="row">
<div class="col-sm">
{% for disk in disks %}
<i class="fa-solid fa-hard-drive"></i>
<b>{{ disk[4] }}</b> ({{ disk[5] }} G) <br>
<small>System disk:<br>name: {{ disk[6] }} - Size : {{ disk[1] }} G (Used : {{ disk[2] }} G)</br></small><br>
<div class="progress">
<div id="diskbar" class="progress-bar bg-info progress-bar-striped" role="progressbar" style="width: {{ disk[3] }}%;" aria-valuenow={{ disk[3] }} aria-valuemin="0" aria-valuemax="100">{{ disk[3] }} %</div>
</div><br>
{% endfor %}
</div>
<div class="col-sm">
<small><i class="fa-solid fa-triangle-exclamation"></i> Shrinking a disk size, can corrupt or delete your data <i class="fa-solid fa-triangle-exclamation"></i></small><br><br>
<table style="width:100%;">
{% for disk in disks %}
<tr><td>{{ disk[4] }} </td><td>
<form action="/editdisks" method="post">
<input type="hidden" name="vm_name" value="{{vm_name }}" />
<input type="hidden" name="disk_id" value="{{ disk[6] }}">
<input type="hidden" name="actual_size" value="{{ disk[5] }}" />
<input type="hidden" name="diskfile" value="{{ disk[0] }}" />
<input type="text" name="new_size" class="form-control form-control-sm" placeholder="{{ disk[5] }}" value="{{ new_size }}" />
</td><td> G </td><td>
<button type="submit" class="btn btn-outline-info btn-hype">Resize</button>
</form>
</td><td>
<form action="/detachdisk" method="post">
<input type="hidden" name="vm_name" value="{{vm_name }}" />
<input type="hidden" name="diskfile" value="{{ disk[0] }}" />
<button type="submit" class="btn btn-outline-danger btn-hype"><i class="fa-solid fa-link-slash"></i></button>
</form>
</td>
</tr><tr></tr><tr></tr><tr></tr><tr>
{% endfor%}
</table>
</div>
</div>
<br>
Add a disk<hr>
<div class="row">
<div class="col-sm">
<form action="/adddisk" method="post">
<input type="hidden" name="vm_name" value="{{ vm_name }}">
Name </br></br></br>Size </br></br>Disk target<br>
</div>
<div class="col-sm">
<input type="text" name="disk_name" class="form-control form-control-sm" ><br>
<input type="text" name="disk_size" class="form-control form-control-smplaceholder="10"" > G<br>
<input type="text" name="disk_id" class="form-control form-control-sm" placeholder="vda"><br>
</div>
<div class="col-sm">
</div>
<button type="submit" class="btn btn-outline-info btn-hype"><i class="fa-solid fa-plus"></i> Add</button>
</form>
</div>
</div>
</div>

View File

@@ -10,7 +10,8 @@
</div>
<div class="card-body">
<h1 class="display-6">{{ host.hostname }}</h1>
Last boot : {{ host.boot_time }}
Last boot : {{ host.boot_time }}<br>
<b>LXC:</b> {{ vlxc }} - <b>Libvirt:</b> {{ vlibvirt }} - <b>Hype:</b> {{ vhype }}
</div>
</div>
</div>

View File

@@ -60,4 +60,12 @@
</div>
</div>
</div>
<!-- DropZone -->
<script>
var myDropzone = new Dropzone("#file-dropzone", {
maxFilesize: 10240, // 10Go in Mo
timeout: 0,
});
</script>
{% endblock %}

View File

@@ -16,7 +16,6 @@
<link href="{{url_for('static', filename = 'style.css')}}" rel="stylesheet">
<link href="{{url_for('static', filename = 'dropzone.min.css')}}" rel="stylesheet">
<script src="{{url_for('static', filename = 'popper.min.js')}}"></script>
<script src="{{url_for('static', filename = 'bootstrap.bundle.min.js')}}"></script>
<script src="{{url_for('static', filename = 'jquery.min.js')}}"></script>
@@ -73,8 +72,6 @@
{% block content %}{% endblock %}
<!-- Pour le fun -->
<div style="position:fixed;bottom:0;right:0">Version Beta 2.7</div>
<!-- Alerting -->
<script>
var opacity=0;
@@ -117,14 +114,14 @@ menu_btn.addEventListener("click", () => {
}
// ]]>
</script>
<!-- DropZone -->
<!-- DropZone
<script>
var myDropzone = new Dropzone("#file-dropzone", {
maxFilesize: 10240, // 10Go in Mo
timeout: 0,
});
</script>
-->
<!-- Alert JS -->
<script>
//Get the cookie related to theme

View File

@@ -20,6 +20,7 @@
</td><td>
<form action="/snaplxc" method="post"><button type="submit" class="btn btn-outline-secondary btn-hype disabled" value="{{ act_lxc[0] }}" name="snap" onclick="loading();"><i class="fa-solid fa-box-archive"></i></button></form>
</td><td>
</td><td>
</td><td>
{{act_lxc[1]}}
</td></tr>
@@ -42,7 +43,7 @@
<form action="/snaplxc" method="post"><button type="submit" class="btn btn-outline-secondary btn-hype" value="{{ inact_lxc }}" name="snap" onclick="loading();"><i class="fa-solid fa-box-archive"></i></button></form>
</td><td>
</td><td>
-
</td><td> -
</td></tr>
{% endfor %}
<!-- Activ VM -->

View File

@@ -1,8 +1,8 @@
{% extends 'layout.html' %}
{% block content %}
{% include 'menu.html' %}
<a href="/vnc" target="_blank"><i class="fa-solid fa-expand"></i></a></br>
<iframe src="/vnc" height=768px width=1024px class="embed-responsive-item" allowfullscreen></iframe>
<center><a href="/vnc" target="_blank" class="btn btn-outline-info"> Full screen <i class="fa-solid fa-expand"></i></a></br>
<br>
<iframe src="/vnc" height=768px width=1024px class="embed-responsive-item" allowfullscreen></iframe></center>
{% endblock %}