Progress commit: templates/openvpn

This commit is contained in:
billz 2021-02-07 11:52:58 +00:00
parent 9bc9f2d3d7
commit f1b1e96df3
2 changed files with 64 additions and 6 deletions

View file

@ -33,7 +33,7 @@
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" id="clienttab" href="#openvpnclient" data-toggle="tab"><?php echo _("Client settings"); ?></a></li> <li class="nav-item"><a class="nav-link active" id="clienttab" href="#openvpnclient" data-toggle="tab"><?php echo _("Client settings"); ?></a></li>
<li class="nav-item"><a class="nav-link" id="configstab" href="#openvpnconfigs" data-toggle="tab"><?php echo _("Manage configs"); ?></a></li> <li class="nav-item"><a class="nav-link" id="configstab" href="#openvpnconfigs" data-toggle="tab"><?php echo _("Configurations"); ?></a></li>
<li class="nav-item"><a class="nav-link" id="loggingtab" href="#openvpnlogging" data-toggle="tab"><?php echo _("Logging"); ?></a></li> <li class="nav-item"><a class="nav-link" id="loggingtab" href="#openvpnlogging" data-toggle="tab"><?php echo _("Logging"); ?></a></li>
</ul> </ul>
@ -53,3 +53,39 @@
</div><!-- /.col-lg-12 --> </div><!-- /.col-lg-12 -->
</div><!-- /.row --> </div><!-- /.row -->
<!-- modal confirm-delete-->
<div class="modal fade" id="ovpn-confirm-delete" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title" id="ModalLabel"><i class="far fa-trash-alt mr-2"></i><?php echo _("Delete OpenVPN client"); ?></div>
</div>
<div class="modal-body">
<div class="col-md-12 mb-3 mt-1"><?php echo _("Delete client configuration? This cannot be undone."); ?></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal"><?php echo _("Cancel"); ?></button>
<button type="button" class="btn btn-outline-danger btn-delete"><?php echo _("Delete"); ?></button>
</div>
</div>
</div>
</div>
<!-- modal confirm-enable -->
<div class="modal fade" id="ovpn-confirm-activate" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title" id="ModalLabel"><i class="far fa-check-circle mr-2"></i><?php echo _("Activate OpenVPN client"); ?></div>
</div>
<div class="modal-body">
<div class="col-md-12 mb-3 mt-1"><?php echo _("Activate client configuration? This will restart the openvpn-client service."); ?></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal"><?php echo _("Cancel"); ?></button>
<button type="button" class="btn btn-outline-success btn-activate"><?php echo _("Activate"); ?></button>
</div>
</div>
</div>
</div>

View file

@ -1,9 +1,31 @@
<div class="tab-pane fade" id="openvpnconfigs"> <div class="tab-pane fade" id="openvpnconfigs">
<h4 class="mt-3"><?php echo _("Manage configs"); ?></h4> <h4 class="mt-3 mb-3"><?php echo _("Configurations"); ?></h4>
<div class="row"> <div class="openvpn-configs js-openvpn-configs-container">
<div class="form-group col-md-8"> <?php foreach ($clients as $client) :
</div> if ($client == "login.conf") {
</div><!-- /.row --> $label = file_get_meta(RASPI_OPENVPN_CLIENT_LOGIN,'#\sfilename\s(.*)');
$btn_class = "active";
} else {
$label = trim(pathinfo($client, PATHINFO_FILENAME), "_login");
$client = $label;
$btn_class = "disabled";
}
?>
<div class="row openvpn-client-row js-openvpn-client-row mt-2">
<div class="col-md-5 col-xs-5">
<label><?php echo htmlspecialchars($label, ENT_QUOTES); ?></label>
</div>
<div class="col-md-2 col-xs-2">
<button type="button" class="btn btn-outline-success <?php echo $btn_class; ?> js-activate-openvpn-client" data-record-id="<?php echo htmlspecialchars($client, ENT_QUOTES); ?>" data-toggle="modal" data-target="#ovpn-confirm-activate" /><i class="far fa-check-circle"></i></button>
</div>
<div class="col-md-2 col-xs-3">
<button type="button" class="btn btn-outline-danger js-remove-openvpn-client" data-record-id="<?php echo htmlspecialchars($client, ENT_QUOTES); ?>" data-toggle="modal" data-target="#ovpn-confirm-delete" /><i class="far fa-trash-alt"></i></button>
</div>
</div><!-- ./row openvpn -->
<?php endforeach ?>
</div><!-- /.openvpn-configs -->
<div class="mb-3">
</div>
</div><!-- /.tab-pane | manage configs tab --> </div><!-- /.tab-pane | manage configs tab -->