1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-26 08:05:22 +00:00
webvirtcloud/storages/templates/storage.html

235 lines
13 KiB
HTML
Raw Normal View History

2015-03-05 14:56:22 +00:00
{% extends "base.html" %}
{% load i18n %}
2015-04-06 07:51:50 +00:00
{% load staticfiles %}
2015-03-05 14:56:22 +00:00
{% block title %}{% trans "Storage" %} - {{ pool }}{% endblock %}
2015-03-10 14:46:52 +00:00
{% block style %}
2018-08-01 13:52:29 +00:00
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}"/>
2015-03-10 14:46:52 +00:00
{% endblock %}
2015-03-05 14:56:22 +00:00
{% block content %}
2018-07-31 13:25:12 +00:00
2019-07-31 08:03:48 +00:00
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
{% include 'create_stg_vol_block.html' %}
2020-05-19 16:53:54 +00:00
<h2 class="page-header">{% trans "Storage" %}: {{ pool }}</h2>
<ol class="breadcrumb bg-light shadow-sm">
<li class="breadcrumb-item active">
<a href="{% url 'overview' compute.id %}"><i class="fa fa-dashboard"></i> {% trans "Overview" %}</a>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'instances' compute.id %}"><i class="fa fa-server"></i> {% trans "Instances" %}</a>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'storages' compute.id %}"><i class="fa fa-hdd-o"></i> {% trans "Storages" %}</a>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'networks' compute.id %}"><i class="fa fa-sitemap"></i> {% trans "Networks" %}</a>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'interfaces' compute.id %}"><i class="fa fa-wifi"></i> {% trans "Interfaces" %}</a>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
2019-07-31 08:03:48 +00:00
</li>
</ol>
</div>
</div>
2019-07-31 08:03:48 +00:00
<!-- /.row -->
2015-03-05 14:56:22 +00:00
2019-07-31 08:03:48 +00:00
{% include 'errors_block.html' %}
{% include 'messages_block.html' %}
2015-03-05 14:56:22 +00:00
2020-05-19 16:53:54 +00:00
<dl class="ml-3 row">
<dt class="col-6">{% trans "Pool name" %}</dt>
<dd class="col-6">{{ pool }}</dd>
<dt class="col-6">{% trans "Pool type" %}</dt>
<dd class="col-6">{% if not type %}{% trans "None" %}{% else %}{{ type }}{% endif %}</dd>
<dt class="col-6">{% trans "Pool path" %}</dt>
<dd class="col-6">{% if not path %}{% trans "None" %}{% else %}{{ path }}{% endif %}</dd>
<dt class="col-6">{% trans "Pool status" %}</dt>
<dd class="col-6">{% if not status %}{% trans "None" %}{% else %}{{ status }}{% endif %}</dd>
<dt class="col-6">{% trans "Size" %} </dt>
<dd class="col-6">{{size|filesizeformat }}</dd>
<dt class="col-6">{% trans "Usage" %} ({{ percent }}%)</dt>
<dd class="col-6">{{ used|filesizeformat }}</dd>
<dt class="col-6">{% trans "State" %}</dt>
<dd class="col-6">
2020-05-26 13:18:38 +00:00
<form action="" method="post" role="form" aria-label="Storage start/stop form">{% csrf_token %}
{% if state == 0 %}
2020-05-19 16:53:54 +00:00
<input type="submit" class="btn btn-sm btn-secondary" name="start" value="{% trans "Start" %}">
<input type="submit" class="btn btn-sm btn-danger" name="delete" value="{% trans "Delete" %}"
onclick="return confirm('{% trans "Are you sure?" %}')">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="stop" value="{% trans "Stop" %}"
onclick="return confirm('{% trans "Are you sure?" %}')">
{% endif %}
2019-07-31 08:03:48 +00:00
</form>
2020-05-19 16:53:54 +00:00
</dd>
<dt class="col-6">{% trans "Autostart" %}</dt>
<dd class="col-6">
2020-05-26 13:18:38 +00:00
<form action="" method="post" role="form" aria-label="Storage disable/enable autostart form">{% csrf_token %}
{% if autostart == 0 %}
2020-05-19 16:53:54 +00:00
<input type="submit" class="btn btn-sm btn-secondary" name="set_autostart"
value="{% trans "Enable" %}">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="unset_autostart"
onclick="return confirm('{% trans "Are you sure?" %}')" value="{% trans "Disable" %}">
{% endif %}
2020-05-19 16:53:54 +00:00
</form>
</dd>
</dl>
{% if state %}
<div class="row">
<h5 class="page-header mr-auto">{% trans "Volumes" %}</h5>
<div class="col-3 ">
<input id="filter" class="form-control" type="text" placeholder="Search">
</div>
</div>
{% if volumes %}
<table class="table table-hover sortable-theme-bootstrap" data-sortable>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">{% trans "Name" %}</th>
<th scope="col">{% trans "Allocated" %}</th>
<th scope="col">{% trans "Size" %}</th>
<th scope="col">{% trans "Format" %}</th>
<th scope="colgroup" data-sortable="false" colspan="2">{% trans "Action" %}</th>
</tr>
</thead>
<tbody class="searchable">
{% for volume in volumes %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ volume.name|truncatechars:55 }}</td>
<td>{{ volume.allocation|filesizeformat }}</td>
<td>{{ volume.size|filesizeformat }}</td>
<td>{{ volume.type }}</td>
<td>
<!-- Modal Clone -->
<div class="modal fade" id="Clone{{ forloop.counter }}" tabindex="-1" role="dialog"
aria-labelledby="addHostLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Clone image" %} <span class="text-danger">{{ volume.name }}</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
2020-05-26 13:18:38 +00:00
<form method="post" role="form" aria-label="Clone image file form">{% csrf_token %}
<div class="modal-body">
<div class="form-group row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" required pattern="[a-zA-Z0-9\.\-_]+">
<input type="hidden" name="image" value="{{ volume.name }}">
</div>
</div>
<div class="form-group row" id="image_format">
<label class="col-sm-3 col-form-label">{% trans "Convert" %}</label>
<div class="col-sm-6">
<input class="volume-convert" type="checkbox" name="convert" value="true">
</div>
</div>
<div class="form-group row format-convert">
<label class="col-sm-3 col-form-label">{% trans "Format" %}</label>
<div class="col-sm-6">
<select name="format" class="custom-select image-format">
<option value="raw">{% trans "raw" %}</option>
<option value="qcow">{% trans "qcow" %}</option>
<option value="qcow2">{% trans "qcow2" %}</option>
</select>
</div>
</div>
<div class="form-group row meta-prealloc" style="display: none;">
<label class="col-sm-3 col-form-label">{% trans "Metadata" %}</label>
<div class="col-sm-6">
<input type="checkbox" name="meta_prealloc" value="true">
</div>
2019-07-31 08:03:48 +00:00
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary" name="cln_volume" onclick="showPleaseWaitDialog();">{% trans "Clone" %}</button>
</div>
</form>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
{% ifnotequal volume.type "iso" %}
<button class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#Clone{{ forloop.counter }}" title="{% trans "Clone" %}">
<i class="fa fa-files-o"></i>
</button>
{% else %}
<button class="btn btn-sm btn-secondary disabled">
<i class="fa fa-files-o"></i>
</button>
{% endifnotequal %}
</td>
<td>
2020-05-26 13:18:38 +00:00
<form action="" method="post" role="form" aria-label="Delete volume form">{% csrf_token %}
<input type="hidden" name="volname" value="{{ volume.name }}">
<button type="submit" class="btn btn-sm btn-secondary" name="del_volume" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
<i class="fa fa-trash"></i>
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
2019-07-31 08:03:48 +00:00
<div class="col-lg-12">
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning" %}:</strong> {% trans "Hypervisor doesn't have any Volumes" %}
</div>
2015-03-05 14:56:22 +00:00
</div>
{% endif %}
{% endif %}
</div>
2020-05-19 16:53:54 +00:00
2019-07-31 08:03:48 +00:00
{% include 'pleasewaitdialog.html' %}
2015-03-05 14:56:22 +00:00
{% endblock %}
{% block script %}
<script src="{% static "js/sortable.min.js" %}"></script>
<script>
$('.format-convert').hide();
$(document).on('change', '.volume-convert', function () {
if ($(this).prop('checked')) {
$('.format-convert').show();
if ($('.image-format').val() == 'qcow2') {
$('.meta-prealloc').show();
}
} else {
$('.format-convert').hide();
$('.meta-prealloc').hide();
}
});
$(document).on('change', '.image-format', function () {
if ($(this).val() == "qcow2") {
2015-03-05 14:56:22 +00:00
$('.meta-prealloc').show();
} else {
$('.meta-prealloc').hide();
2015-03-05 14:56:22 +00:00
}
});
</script>
<script>
$(document).ready(function () {
(function ($) {
$('#filter').keyup(function () {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery));
});
</script>
2015-03-05 14:56:22 +00:00
{% endblock %}