Fixes sidebar menu

main
Yasen Pramatarov 2024-10-31 15:02:28 +02:00
parent 0120abf246
commit 1bc6313e98
2 changed files with 34 additions and 31 deletions

View File

@ -102,7 +102,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
]; ];
$result = $hostObject->editHost($platform_id, $updatedHost); $result = $hostObject->editHost($platform_id, $updatedHost);
if ($result === true) { if ($result === true) {
$_SESSION['notice'] = "Host id \"{$_REQUEST['host']}\" edited."; $_SESSION['notice'] = "Host \"{$_REQUEST['address']}:{$_REQUEST['port']}\" edited.";
} else { } else {
$_SESSION['error'] = "Editing the host failed. Error: $result"; $_SESSION['error'] = "Editing the host failed. Error: $result";
} }
@ -220,29 +220,32 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
} }
break; break;
// if there is no $item, we work on the local config DB
default: default:
switch ($action) { // the default config page is the platforms page
case 'add-agent': header("Location: $app_root?page=config&item=platform");
$jilo_agent_types = $agentObject->getAgentTypes(); exit();
$jilo_agents_in_platform = $agentObject->getPlatformAgentTypes($platform_id);
$jilo_agent_types_in_platform = array_column($jilo_agents_in_platform, 'agent_type_id'); // switch ($action) {
include '../app/templates/config-add-agent.php'; // case 'add-agent':
break; // $jilo_agent_types = $agentObject->getAgentTypes();
case 'edit': // $jilo_agents_in_platform = $agentObject->getPlatformAgentTypes($platform_id);
if (isset($_GET['agent'])) { // $jilo_agent_types_in_platform = array_column($jilo_agents_in_platform, 'agent_type_id');
$agentDetails = $agentObject->getAgentDetails($platform_id, $agent); // include '../app/templates/config-add-agent.php';
$jilo_agent_types = $agentObject->getAgentTypes(); // break;
include '../app/templates/config-edit-agent.php'; // case 'edit':
} // if (isset($_GET['agent'])) {
break; // $agentDetails = $agentObject->getAgentDetails($platform_id, $agent);
case 'delete': // $jilo_agent_types = $agentObject->getAgentTypes();
if (isset($_GET['agent'])) { // include '../app/templates/config-edit-agent.php';
$agentDetails = $agentObject->getAgentDetails($platform_id, $agent); // }
include '../app/templates/config-delete-agent.php'; // break;
} // case 'delete':
break; // if (isset($_GET['agent'])) {
} // $agentDetails = $agentObject->getAgentDetails($platform_id, $agent);
// include '../app/templates/config-delete-agent.php';
// }
// break;
// }
} }
} }

View File

@ -41,22 +41,22 @@ $timeNow = new DateTime('now', new DateTimeZone($userTimezone));
<li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>live data</small></p></li> <li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>live data</small></p></li>
<a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=graphs"> <a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=graphs">
<li class="list-group-item<?php if ($page === 'graphs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'data' && $item === 'graphs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-chart-bar" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="combined graphs"></i>combined graphs <i class="fas fa-chart-bar" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="combined graphs"></i>combined graphs
</li> </li>
</a> </a>
<a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=latest"> <a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=latest">
<li class="list-group-item<?php if ($page === 'latest') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'data' && $item === 'latest') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-list" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="latest data"></i>latest data <i class="fas fa-list" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="latest data"></i>latest data
</li> </li>
</a> </a>
<a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=configjs"> <a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=configjs">
<li class="list-group-item<?php if ($page === 'config' && $item === 'configjs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'data' && $item === 'configjs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-tv" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="config.js"></i>config.js <i class="fas fa-tv" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="config.js"></i>config.js
</li> </li>
</a> </a>
<a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=interfaceconfigjs"> <a href="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=data&item=interfaceconfigjs">
<li class="list-group-item<?php if ($page === 'config' && $item === 'interfaceconfigjs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'data' && $item === 'interfaceconfigjs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-th" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="interface_config.js"></i>interface_config.js <i class="fas fa-th" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="interface_config.js"></i>interface_config.js
</li> </li>
</a> </a>
@ -69,17 +69,17 @@ $timeNow = new DateTime('now', new DateTimeZone($userTimezone));
<li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>jitsi platforms config</small></p></li> <li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>jitsi platforms config</small></p></li>
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=platform"> <a href="<?= htmlspecialchars($app_root) ?>?page=config&item=platform">
<li class="list-group-item<?php if ($page === 'config' && $item === '') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'config' && $item === 'platform') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-sitemap" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>platforms <i class="fas fa-sitemap" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>platforms
</li> </li>
</a> </a>
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=host"> <a href="<?= htmlspecialchars($app_root) ?>?page=config&item=host">
<li class="list-group-item<?php if ($page === 'config' && $item === '') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'config' && $item === 'host') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-laptop" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>hosts <i class="fas fa-laptop" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>hosts
</li> </li>
</a> </a>
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=endpoint"> <a href="<?= htmlspecialchars($app_root) ?>?page=config&item=endpoint">
<li class="list-group-item<?php if ($page === 'config' && $item === '') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'config' && $item === 'endpoint') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-stethoscope" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>endpoints <i class="fas fa-stethoscope" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>endpoints
</li> </li>
</a> </a>
@ -88,7 +88,7 @@ $timeNow = new DateTime('now', new DateTimeZone($userTimezone));
<?php if ($userObject->hasRight($user_id, 'view config file')) {?> <?php if ($userObject->hasRight($user_id, 'view config file')) {?>
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=config_file"> <a href="<?= htmlspecialchars($app_root) ?>?page=config&item=config_file">
<li class="list-group-item<?php if ($page === 'config' && $item === '') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>"> <li class="list-group-item<?php if ($page === 'config' && $item === 'config_file') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
<i class="fas fa-wrench" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>config file <i class="fas fa-wrench" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>config file
</li> </li>
</a> </a>