1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00
webvirtcloud/storages/templates/create_stg_block.html
2023-08-11 09:40:38 +03:00

258 lines
18 KiB
HTML

{% load i18n %}
{% load bootstrap_icons %}
{% if request.user.is_superuser %}
<a href="#AddStgPool" type="button" class="btn btn-success float-end" data-bs-toggle="modal">
<span aria-hidden="true">{% bs_icon 'plus-circle-fill' %} </span>
</a>
<!-- Modal Storage pool -->
<div class="modal fade" id="AddStgPool" tabindex="-1" role="dialog" aria-labelledby="AddStgPoolLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Create Storage Pool" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" aria-label="Storage create types">
<li class="nav-item" role="presentation">
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#dirtab" type="button" role="tab" aria-controls="dirtab" aria-selected="true">
{% trans "DIR" %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#lvmtab" type="button" role="tab" aria-controls="lvmtab" aria-selected="false">
{% trans "LVM" %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#cephtab" type="button" role="tab" aria-controls="cephtab" aria-selected="false">
{% trans "CEPH" %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#netfstab" type="button" role="tab" aria-controls="netfstab" aria-selected="false">
{% trans "NETFS" %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#isotab" type="button" role="tab" aria-controls="isotab" aria-selected="false">
{% trans "ISO" %}
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="dirtab">
<div class="modal-body">
<form method="post" action="" role="form" aria-label="Create storage with pool dir path form">{% csrf_token %}
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="dir" disabled>
<input type="hidden" name="stg_type" value="dir">
</div>
</div>
<div class="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 "default" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Path" %}</label>
<div class="col-sm-6">
<input type="text" name="target" class="form-control" value="/var/lib/libvirt/images" required pattern="[a-zA-Z0-9\/\-_]+">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary" name="create">{% trans "Create" %}</button>
</div>
</form>
</div>
<div class="tab-pane" id="lvmtab">
<div class="modal-body">
<form method="post" action="" role="form" aria-label="Create storage pool with LVM pool">{% csrf_token %}
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="logical" disabled>
<input type="hidden" name="stg_type" value="logical">
</div>
</div>
<div class="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 "default" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Device" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="source" value="/dev/sdb" required pattern="[a-z0-9\/]+">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary" name="create">{% trans "Create" %}</button>
</div>
</form>
</div>
<div class="tab-pane" id="cephtab">
<div class="modal-body">
<form method="post" action="" role="form" aria-label="Create storage pool with ceph form">{% csrf_token %}
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="rbd" disabled>
<input type="hidden" name="stg_type" value="rbd">
</div>
</div>
<div class="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="rbdpool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Ceph User" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ceph_user" placeholder="libvirt" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Ceph Pool" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ceph_pool" placeholder="libvirt-pool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Ceph Host" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ceph_host" placeholder="mon0.ceph.host" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Secrets" %}</label>
<div class="col-sm-6">
<select name="secret" class="form-control">
{% if secrets %}
{% for secret in secrets %}
<option value="{{ secret }}">{{ secret }}</option>
{% endfor %}
{% else %}
<option value="None">{% trans "None" %}</option>
{% endif %}
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
{% trans "Close" %}
</button>
{% if secrets %}
<button type="submit" class="btn btn-primary" name="create">
{% trans "Create" %}
</button>
{% else %}
<button class="btn btn-primary disabled" name="create">
{% trans "Create" %}
</button>
{% endif %}
</div>
</form>
</div>
<div class="tab-pane" id="netfstab">
<div class="modal-body">
<form method="post" action="" role="form" aria-label="Create storage pool with net filesystem form">{% csrf_token %}
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="netfs" disabled>
<input type="hidden" name="stg_type" value="netfs">
</div>
</div>
<div class="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="netfspool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Hostname" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="netfs_host" placeholder="nfs.example.com" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Remote Path" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="source" placeholder="/srv/storage/" maxlength="40" required pattern="[a-zA-Z0-9\/\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Format" %}</label>
<div class="col-sm-6">
<select name="source_format" class="form-control" id="source_format">
<option value="auto">{% trans "auto" %}</option>
<option value="nfs">{% trans "nfs" %}</option>
<option value="glusterfs">{% trans "glusterfs" %}</option>
<option value="cifs">{% trans "cifs" %}</option>
</select>
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Local Path" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="target" placeholder="/srv/storage/" maxlength="40" required pattern="[a-zA-Z0-9\/\-_]+">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
{% trans "Close" %}
</button>
<button type="submit" class="btn btn-primary" name="create">
{% trans "Create" %}
</button>
</div>
</form>
</div>
<div class="tab-pane" id="isotab">
<div class="modal-body">
<form method="post" action="" role="form" aria-label="Create iso pool form">{% csrf_token %}
<div class="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" value="iso" disabled>
<input type="hidden" name="name" value="iso">
<input type="hidden" name="stg_type" value="dir">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Path" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="target" value="/var/lib/libvirt/iso" required pattern="[a-zA-Z0-9\/\-_]+">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
{% trans "Close" %}
</button>
<button type="submit" class="btn btn-primary" name="create">
{% trans "Create" %}
</button>
</div>
</form>
</div>
</div>
</div> <!-- /.modal-body -->
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
{% endif %}