mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-25 00:50:29 +00:00
Add sidebar item, template stubs + page actions
This commit is contained in:
parent
bf41d88340
commit
4e258b3981
7 changed files with 74 additions and 0 deletions
|
@ -45,6 +45,9 @@
|
|||
case "/system_info":
|
||||
DisplaySystem($extraFooterScripts);
|
||||
break;
|
||||
case "/restapi_conf":
|
||||
DisplayRestAPI();
|
||||
break;
|
||||
case "/about":
|
||||
DisplayAbout();
|
||||
break;
|
||||
|
|
18
includes/restapi.php
Normal file
18
includes/restapi.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
require_once 'includes/functions.php';
|
||||
require_once 'config.php';
|
||||
|
||||
/**
|
||||
* Handler for RaspAP's RestAPI settings
|
||||
*/
|
||||
function DisplayRestAPI()
|
||||
{
|
||||
$status = new \RaspAP\Messages\StatusMessage;
|
||||
|
||||
|
||||
echo renderTemplate("restapi", compact(
|
||||
"status",
|
||||
"apiKey",
|
||||
));
|
||||
}
|
|
@ -85,6 +85,12 @@
|
|||
<a class="nav-link" href="system_info"><i class="fas fa-cube fa-fw mr-2"></i><span class="nav-label"><?php echo _("System"); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (RASPI_RESTAPI_ENABLED) : ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="restapi_conf"><i class="fas fa-puzzle-piece mr-2"></i><span class="nav-label"><?php echo _("RestAPI"); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="about"><i class="fas fa-info-circle fa-fw mr-2"></i><span class="nav-label"><?php echo _("About RaspAP"); ?></a>
|
||||
</li>
|
||||
|
|
|
@ -47,6 +47,7 @@ require_once 'includes/about.php';
|
|||
require_once 'includes/openvpn.php';
|
||||
require_once 'includes/wireguard.php';
|
||||
require_once 'includes/provider.php';
|
||||
require_once 'includes/restapi.php';
|
||||
require_once 'includes/torproxy.php';
|
||||
|
||||
initializeApp();
|
||||
|
|
46
templates/restapi.php
Normal file
46
templates/restapi.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php ob_start() ?>
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<input type="submit" class="btn btn-outline btn-primary" name="SaveAPIsettings" value="<?php echo _("Save settings"); ?>" />
|
||||
<?php if ($serviceStatus == 'down') : ?>
|
||||
<input type="submit" <?php echo $svcState; ?> class="btn btn-success <?php echo $svcState; ?>" name="StartRestAPIservice" value="<?php echo _("Start RestAPI service"); ?>" />
|
||||
<?php else : ?>
|
||||
<input type="submit" <?php echo $ctlState; ?> class="btn btn-warning <?php echo $svcState; ?>" name="StopRestAPIservice" value="<?php echo _("Stop RestAPI service"); ?>" />
|
||||
<?php endif; ?>
|
||||
<?php endif ?>
|
||||
<?php $buttons = ob_get_clean(); ob_end_clean() ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<i class="fas fa-puzzle-piece mr-2"></i><?php echo _("RestAPI"); ?>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<?php $status->showMessages(); ?>
|
||||
<form role="form" action="restapi_conf" enctype="multipart/form-data" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item"><a class="nav-link active" id="settingstab" href="#restapisettings" data-toggle="tab"><?php echo _("Settings"); ?></a></li>
|
||||
<li class="nav-item"><a class="nav-link" id="loggingtab" href="#restapistatus" data-toggle="tab"><?php echo _("Status"); ?></a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<?php echo renderTemplate("restapi/general", $__template_data) ?>
|
||||
<?php echo renderTemplate("restapi/status", $__template_data) ?>
|
||||
</div><!-- /.tab-content -->
|
||||
|
||||
<?php echo $buttons ?>
|
||||
</form>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"></div>
|
||||
</div><!-- /.card -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.row -->
|
||||
|
||||
|
0
templates/restapi/general.php
Normal file
0
templates/restapi/general.php
Normal file
0
templates/restapi/status.php
Normal file
0
templates/restapi/status.php
Normal file
Loading…
Reference in a new issue