Puts all jilo config in one page with ajax
parent
d45ba62805
commit
e3f839bc56
|
@ -25,7 +25,7 @@ $agentObject = new Agent($dbWeb);
|
|||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
/**
|
||||
* Handles form submissions from editing page
|
||||
* Handles form submissions from editing
|
||||
*/
|
||||
|
||||
// editing the config file
|
||||
|
@ -42,200 +42,126 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
}
|
||||
}
|
||||
|
||||
// new host adding
|
||||
} elseif (isset($_POST['new']) && isset($_POST['item']) && $_POST['new'] === 'true' && $_POST['item'] === 'host') {
|
||||
$newHost = [
|
||||
'address' => $address,
|
||||
'port' => $port,
|
||||
'platform_id' => $platform_id,
|
||||
'name' => $name,
|
||||
];
|
||||
$result = $hostObject->addHost($newHost);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "New Jilo host added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the host failed. Error: $result";
|
||||
}
|
||||
|
||||
// new agent adding
|
||||
} elseif (isset($_POST['new']) && isset($_POST['item']) && $_POST['new'] === 'true' && $_POST['item'] === 'agent') {
|
||||
$newAgent = [
|
||||
'type_id' => $type,
|
||||
'url' => $url,
|
||||
'secret_key' => $secret_key,
|
||||
'check_period' => $check_period,
|
||||
];
|
||||
$result = $agentObject->addAgent($platform_id, $newAgent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "New Jilo Agent added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the agent failed. Error: $result";
|
||||
}
|
||||
|
||||
// new platform adding
|
||||
} elseif (isset($_POST['new']) && $_POST['new'] === 'true') {
|
||||
$newPlatform = [
|
||||
'name' => $name,
|
||||
'jitsi_url' => $_POST['jitsi_url'],
|
||||
'jilo_database' => $_POST['jilo_database'],
|
||||
];
|
||||
$result = $platformObject->addPlatform($newPlatform);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "New Jitsi platform added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the platform failed. Error: $result";
|
||||
}
|
||||
|
||||
// deleting a host
|
||||
} elseif (isset($_POST['delete']) && isset($_POST['host']) && $_POST['delete'] === 'true') {
|
||||
$result = $hostObject->deleteHost($host);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Host id \"{$_REQUEST['host']}\" deleted.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Deleting the host failed. Error: $result";
|
||||
}
|
||||
|
||||
// deleting an agent
|
||||
} elseif (isset($_POST['delete']) && isset($_POST['agent']) && $_POST['delete'] === 'true') {
|
||||
$result = $agentObject->deleteAgent($agent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Agent id \"{$_REQUEST['agent']}\" deleted.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Deleting the agent failed. Error: $result";
|
||||
}
|
||||
|
||||
// deleting a platform
|
||||
} elseif (isset($_POST['delete']) && $_POST['delete'] === 'true') {
|
||||
$platform = $_POST['platform'];
|
||||
$result = $platformObject->deletePlatform($platform);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Platform \"{$platformObject['name']}\" added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the platform failed. Error: $result";
|
||||
}
|
||||
|
||||
// an update to an existing host
|
||||
// host operations
|
||||
} elseif (isset($_POST['item']) && $_POST['item'] === 'host') {
|
||||
$host_id = $_POST['host'];
|
||||
$platform_id = $_POST['platform'];
|
||||
$updatedHost = [
|
||||
'id' => $host_id,
|
||||
'address' => $_POST['address'],
|
||||
'name' => $_POST['name']
|
||||
];
|
||||
$result = $hostObject->editHost($platform_id, $updatedHost);
|
||||
|
||||
// Check if it's an AJAX request
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
|
||||
// Clear any output buffers to ensure clean JSON
|
||||
while (ob_get_level()) ob_end_clean();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
if (isset($_POST['delete']) && $_POST['delete'] === 'true') { // This is a host delete
|
||||
$host_id = $_POST['host'];
|
||||
$result = $hostObject->deleteHost($host_id);
|
||||
if ($result === true) {
|
||||
echo json_encode(['success' => true]);
|
||||
$_SESSION['notice'] = "Host deleted successfully.";
|
||||
} else {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => "Editing the host failed. Error: $result"
|
||||
]);
|
||||
$_SESSION['error'] = "Deleting the host failed. Error: $result";
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
// Regular form submission
|
||||
} else if (!isset($_POST['host'])) { // This is a new host
|
||||
$newHost = [
|
||||
'address' => $_POST['address'],
|
||||
'platform_id' => $_POST['platform'],
|
||||
'name' => $_POST['name'],
|
||||
];
|
||||
$result = $hostObject->addHost($newHost);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "New Jilo host added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the host failed. Error: $result";
|
||||
}
|
||||
} else { // This is an edit of existing host
|
||||
$host_id = $_POST['host'];
|
||||
$platform_id = $_POST['platform'];
|
||||
$updatedHost = [
|
||||
'id' => $host_id,
|
||||
'address' => $_POST['address'],
|
||||
'name' => $_POST['name'],
|
||||
];
|
||||
$result = $hostObject->editHost($platform_id, $updatedHost);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Host edited.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Editing the host failed. Error: $result";
|
||||
}
|
||||
header("Location: $app_root?page=config&item=$item");
|
||||
exit();
|
||||
}
|
||||
|
||||
// an update to an existing agent
|
||||
// agent operations
|
||||
} elseif (isset($_POST['item']) && $_POST['item'] === 'agent') {
|
||||
$agent_id = $_POST['agent'];
|
||||
$platform_id = $_POST['platform'];
|
||||
$updatedAgent = [
|
||||
'id' => $agent_id,
|
||||
'agent_type_id' => $_POST['agent_type_id'],
|
||||
'url' => $_POST['url'],
|
||||
'secret_key' => $_POST['secret_key'],
|
||||
'check_period' => $_POST['check_period']
|
||||
];
|
||||
$result = $agentObject->editAgent($platform_id, $updatedAgent);
|
||||
|
||||
// Check if it's an AJAX request
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
|
||||
// Clear any output buffers to ensure clean JSON
|
||||
while (ob_get_level()) ob_end_clean();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
if (isset($_POST['delete']) && $_POST['delete'] === 'true') { // This is an agent delete
|
||||
$agent_id = $_POST['agent'];
|
||||
$result = $agentObject->deleteAgent($agent_id);
|
||||
if ($result === true) {
|
||||
echo json_encode(['success' => true]);
|
||||
$_SESSION['notice'] = "Agent deleted successfully.";
|
||||
} else {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => "Editing the agent failed. Error: $result"
|
||||
]);
|
||||
$_SESSION['error'] = "Deleting the agent failed. Error: $result";
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
// Regular form submission
|
||||
} else if (isset($_POST['new']) && $_POST['new'] === 'true') { // This is a new agent
|
||||
$newAgent = [
|
||||
'type_id' => $_POST['type'],
|
||||
'url' => $_POST['url'],
|
||||
'secret_key' => $_POST['secret_key'],
|
||||
'check_period' => $_POST['check_period'],
|
||||
];
|
||||
$result = $agentObject->addAgent($_POST['platform'], $newAgent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "New Jilo Agent added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the agent failed. Error: $result";
|
||||
}
|
||||
} else { // This is an edit of existing agent
|
||||
$agent_id = $_POST['agent'];
|
||||
$platform_id = $_POST['platform'];
|
||||
$updatedAgent = [
|
||||
'id' => $agent_id,
|
||||
'agent_type_id' => $_POST['agent_type_id'],
|
||||
'url' => $_POST['url'],
|
||||
'secret_key' => $_POST['secret_key'],
|
||||
'check_period' => $_POST['check_period']
|
||||
];
|
||||
$result = $agentObject->editAgent($platform_id, $updatedAgent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Agent edited.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Editing the agent failed. Error: $result";
|
||||
}
|
||||
header("Location: $app_root?page=config&item=$item");
|
||||
exit();
|
||||
}
|
||||
|
||||
// an update to an existing platform
|
||||
} else {
|
||||
$platform = $_POST['platform_id'];
|
||||
$updatedPlatform = [
|
||||
'name' => $_POST['name'],
|
||||
'jitsi_url' => $_POST['jitsi_url'],
|
||||
'jilo_database' => $_POST['jilo_database']
|
||||
];
|
||||
$result = $platformObject->editPlatform($platform, $updatedPlatform);
|
||||
|
||||
// Check if it's an AJAX request
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
|
||||
// Clear any output buffers to ensure clean JSON
|
||||
while (ob_get_level()) ob_end_clean();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
// platform operations
|
||||
} elseif (isset($_POST['item']) && $_POST['item'] === 'platform') {
|
||||
if (isset($_POST['delete']) && $_POST['delete'] === 'true') { // This is a platform delete
|
||||
$platform_id = $_POST['platform'];
|
||||
$result = $platformObject->deletePlatform($platform_id);
|
||||
if ($result === true) {
|
||||
echo json_encode(['success' => true]);
|
||||
$_SESSION['notice'] = "Platform deleted successfully.";
|
||||
} else {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => "Editing the platform failed. Error: $result"
|
||||
]);
|
||||
$_SESSION['error'] = "Deleting the platform failed. Error: $result";
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
// Regular form submission
|
||||
} else if (!isset($_POST['platform'])) { // This is a new platform
|
||||
$newPlatform = [
|
||||
'name' => $_POST['name'],
|
||||
'jitsi_url' => $_POST['jitsi_url'],
|
||||
'jilo_database' => $_POST['jilo_database'],
|
||||
];
|
||||
$result = $platformObject->addPlatform($newPlatform);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "New Jitsi platform added.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Adding the platform failed. Error: $result";
|
||||
}
|
||||
} else { // This is an edit of existing platform
|
||||
$platform_id = $_POST['platform'];
|
||||
$updatedPlatform = [
|
||||
'id' => $platform_id,
|
||||
'name' => $_POST['name'],
|
||||
'jitsi_url' => $_POST['jitsi_url'],
|
||||
'jilo_database' => $_POST['jilo_database'],
|
||||
];
|
||||
$result = $platformObject->editPlatform($updatedPlatform);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Platform edited.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Editing the platform failed. Error: $result";
|
||||
}
|
||||
header("Location: $app_root?page=config&item=$item");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME the new file is not loaded on first page load
|
||||
unset($config);
|
||||
header("Location: $app_root?page=config&item=$item");
|
||||
// After any POST operation, redirect back to the main config page
|
||||
header("Location: $app_root?page=config");
|
||||
exit();
|
||||
|
||||
} else {
|
||||
|
@ -245,76 +171,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
|
||||
switch ($item) {
|
||||
|
||||
case 'platform':
|
||||
if (isset($action) && $action === 'add') {
|
||||
include '../app/templates/config-platform-add.php';
|
||||
} elseif (isset($action) && $action === 'edit') {
|
||||
include '../app/templates/config-platform-edit.php';
|
||||
} elseif (isset($action) && $action === 'delete') {
|
||||
include '../app/templates/config-platform-delete.php';
|
||||
} else {
|
||||
if ($userObject->hasRight($user_id, 'view config file')) {
|
||||
include '../app/templates/config-platform.php';
|
||||
} else {
|
||||
include '../app/templates/error-unauthorized.php';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'host':
|
||||
if (isset($action) && $action === 'add') {
|
||||
include '../app/templates/config-host-add.php';
|
||||
} elseif (isset($action) && $action === 'edit') {
|
||||
$hostDetails = $hostObject->getHostDetails($platform_id, $agent);
|
||||
include '../app/templates/config-host-edit.php';
|
||||
} elseif (isset($action) && $action === 'delete') {
|
||||
$hostDetails = $hostObject->getHostDetails($platform_id, $agent);
|
||||
include '../app/templates/config-host-delete.php';
|
||||
} else {
|
||||
if ($userObject->hasRight($user_id, 'view config file')) {
|
||||
$hostDetails = $hostObject->getHostDetails();
|
||||
include '../app/templates/config-host.php';
|
||||
} else {
|
||||
include '../app/templates/error-unauthorized.php';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'agent':
|
||||
if (isset($action) && $action === 'add') {
|
||||
$jilo_agent_types = $agentObject->getAgentTypes();
|
||||
$platform_id = $_REQUEST['platform'] ?? '';
|
||||
if (!empty($platform_id)) {
|
||||
$jilo_agents_in_platform = $agentObject->getPlatformAgentTypes($platform_id);
|
||||
$jilo_agent_types_in_platform = array_column($jilo_agents_in_platform, 'agent_type_id');
|
||||
include '../app/templates/config-agent-add.php';
|
||||
} else {
|
||||
$_SESSION['error'] = "Platform ID is required to add an agent.";
|
||||
header("Location: $app_root?page=config&item=agent");
|
||||
exit();
|
||||
}
|
||||
} elseif (isset($action) && $action === 'edit') {
|
||||
if (isset($_REQUEST['agent'])) {
|
||||
$platform_id = $_REQUEST['platform'] ?? '';
|
||||
$agentDetails = $agentObject->getAgentDetails($platform_id, $agent)['0'];
|
||||
$jilo_agent_types = $agentObject->getAgentTypes();
|
||||
include '../app/templates/config-agent-edit.php';
|
||||
}
|
||||
} elseif (isset($action) && $action === 'delete') {
|
||||
if (isset($_REQUEST['agent'])) {
|
||||
$platform_id = $_REQUEST['platform'] ?? '';
|
||||
$agentDetails = $agentObject->getAgentDetails($platform_id, $agent)['0'];
|
||||
include '../app/templates/config-agent-delete.php';
|
||||
}
|
||||
} else {
|
||||
if ($userObject->hasRight($user_id, 'view config file')) {
|
||||
include '../app/templates/config-agent.php';
|
||||
} else {
|
||||
include '../app/templates/error-unauthorized.php';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'config_file':
|
||||
if (isset($action) && $action === 'edit') {
|
||||
include '../app/templates/config-configfile-edit.php';
|
||||
|
@ -328,9 +184,11 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
break;
|
||||
|
||||
default:
|
||||
// the default config page is the platforms page
|
||||
header("Location: $app_root?page=config&item=platform");
|
||||
exit();
|
||||
if ($userObject->hasRight($user_id, 'view config file')) {
|
||||
include '../app/templates/config-jilo.php';
|
||||
} else {
|
||||
include '../app/templates/error-unauthorized.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
<!-- widget "agents" -->
|
||||
<div class="card text-center w-50 mx-auto">
|
||||
<p class="h4 card-header">Add new Jilo Agent to Jitsi platform "<strong><?= htmlspecialchars($platformDetails[0]['name']) ?></strong>"</p>
|
||||
<div class="card-body">
|
||||
<!--p class="card-text">add new agent:</p-->
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="type" class="form-label">type</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control" type="text" name="type" id="agent_type_id" required>
|
||||
<option></option>
|
||||
<?php foreach ($jilo_agent_types as $agent_type) { ?>
|
||||
<option value="<?= htmlspecialchars($agent_type['id']) ?>"<?php
|
||||
if (in_array($agent_type['id'], $jilo_agent_types_in_platform)) {
|
||||
echo 'disabled="disabled"';
|
||||
} ?>>
|
||||
<?= htmlspecialchars($agent_type['description']) ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<p class="text-start"><small>type of agent (meet, jvb, jibri, etc.)<br />if a type has already been aded, it's disabled here</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="url" class="form-label">URL</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="url" value="https://" required />
|
||||
<p class="text-start"><small>URL of the Jilo Agent API (https://example.com:8081)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="secret_key" class="form-label">secret key</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="secret_key" value="" required />
|
||||
<p class="text-start"><small>secret key for generating the access JWT token</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="check_period" class="form-label">check period</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="check_period" value="0" required />
|
||||
<p class="text-start"><small>period in minutes for the automatic agent check (0 disables it)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="new" value="true" />
|
||||
<input type="hidden" name="item" value="agent" />
|
||||
|
||||
<br />
|
||||
<a class="btn btn-secondary" href="<?= htmlspecialchars($app_root) ?>?page=config" />Cancel</a>
|
||||
<input type="submit" class="btn btn-primary" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "agents" -->
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
// Get available agent types that are not yet in the platform
|
||||
$available_agent_types = array_filter($jilo_agent_types, function($type) use ($jilo_agent_types_in_platform) {
|
||||
return !in_array($type['id'], $jilo_agent_types_in_platform);
|
||||
});
|
||||
?>
|
||||
|
||||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Add new Jilo agent</p>
|
||||
<div class="card-body">
|
||||
<form method="post" action="<?= htmlspecialchars($app_root) ?>">
|
||||
<input type="hidden" name="platform" value="<?= htmlspecialchars($platform_id) ?>">
|
||||
<input type="hidden" name="item" value="agent">
|
||||
<input type="hidden" name="new" value="true">
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="type" class="col-sm-2 col-form-label">Agent Type:</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-select" id="type" name="type" required>
|
||||
<option value="">Select agent type</option>
|
||||
<?php foreach ($available_agent_types as $type): ?>
|
||||
<option value="<?= htmlspecialchars($type['id']) ?>">
|
||||
<?= htmlspecialchars($type['description']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="url" class="col-sm-2 col-form-label">URL:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="url" name="url" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="secret_key" class="col-sm-2 col-form-label">Secret Key:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="secret_key" name="secret_key" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="check_period" class="col-sm-2 col-form-label">Check Period (minutes):</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="number" class="form-control" id="check_period" name="check_period" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-sm-10 offset-sm-2">
|
||||
<button type="submit" class="btn btn-primary">Add Agent</button>
|
||||
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=agent" class="btn btn-secondary">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -1,31 +0,0 @@
|
|||
<?php if (!empty($agentDetails)): ?>
|
||||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Delete Jilo agent</p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">Are you sure you want to delete this agent?</p>
|
||||
|
||||
<div class="mb-3">
|
||||
<strong>Agent ID:</strong> <?= htmlspecialchars($agentDetails['id']) ?><br>
|
||||
<strong>Type:</strong> <?= htmlspecialchars($agentDetails['agent_description']) ?><br>
|
||||
<strong>URL:</strong> <?= htmlspecialchars($agentDetails['url']) ?><br>
|
||||
<strong>Check Period:</strong> <?= htmlspecialchars($agentDetails['check_period']) ?> <?= ($agentDetails['check_period'] == 1 ? 'minute' : 'minutes') ?>
|
||||
</div>
|
||||
|
||||
<form method="post" action="<?= htmlspecialchars($app_root) ?>">
|
||||
<input type="hidden" name="platform" value="<?= htmlspecialchars($platform_id) ?>">
|
||||
<input type="hidden" name="agent" value="<?= htmlspecialchars($agentDetails['id']) ?>">
|
||||
<input type="hidden" name="item" value="agent">
|
||||
<input type="hidden" name="delete" value="true">
|
||||
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-danger">Delete Agent</button>
|
||||
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=agent" class="btn btn-secondary">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-danger">
|
||||
Agent not found.
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -1,57 +0,0 @@
|
|||
<?php if (!empty($agentDetails)): ?>
|
||||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Edit Jilo agent</p>
|
||||
<div class="card-body">
|
||||
<form method="post" action="<?= htmlspecialchars($app_root . '?page=' . $page) ?>">
|
||||
<input type="hidden" name="platform" value="<?= htmlspecialchars($platform_id) ?>">
|
||||
<input type="hidden" name="agent" value="<?= htmlspecialchars($agentDetails['id']) ?>">
|
||||
<input type="hidden" name="item" value="agent">
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="type" class="col-sm-2 col-form-label">Agent Type:</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-select" id="type" name="type" required>
|
||||
<?php foreach ($jilo_agent_types as $type): ?>
|
||||
<option value="<?= htmlspecialchars($type['id']) ?>" <?= $type['id'] == $agentDetails['agent_type_id'] ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($type['description']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="url" class="col-sm-2 col-form-label">URL:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="url" name="url" value="<?= htmlspecialchars($agentDetails['url']) ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="secret_key" class="col-sm-2 col-form-label">Secret Key:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="secret_key" name="secret_key" value="<?= htmlspecialchars($agentDetails['secret_key']) ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label for="check_period" class="col-sm-2 col-form-label">Check Period (minutes):</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="number" class="form-control" id="check_period" name="check_period" value="<?= htmlspecialchars($agentDetails['check_period']) ?>" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-sm-10 offset-sm-2">
|
||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=agent" class="btn btn-secondary">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-danger">
|
||||
Agent not found.
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
<!-- widget "agents" -->
|
||||
<div class="card text-center w-50 mx-auto">
|
||||
<p class="h4 card-header">Jilo Agent configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">delete an agent:</p>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
<?php
|
||||
foreach ($agentDetails[0] as $key => $value) {
|
||||
// if ($key === 'id') continue;
|
||||
?>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="<?= htmlspecialchars($key) ?>" class="form-label"><?= htmlspecialchars($key) ?>:</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="text-start"><?= htmlspecialchars($value ?? '') ?></div>
|
||||
<input type="hidden" name="<?= htmlspecialchars($key) ?>" value="<?= htmlspecialchars($value ?? '') ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<br />
|
||||
<input type="hidden" name="agent" value="<?= htmlspecialchars($agentDetails[0]['id']) ?>" />
|
||||
<input type="hidden" name="delete" value="true" />
|
||||
<p class="h5 text-danger">Are you sure you want to delete this agent?</p>
|
||||
<br />
|
||||
<a class="btn btn-secondary" href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform_id) ?>agent<?= htmlspecialchars($agentDetails[0]['id']) ?>" />Cancel</a>
|
||||
<input type="submit" class="btn btn-danger" value="Delete" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "agents" -->
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
<!-- agents -->
|
||||
<div class="card text-center w-50 mx-auto">
|
||||
<p class="h4 card-header">Jilo Agent configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">edit the agent details:</p>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="type_id" class="form-label">type</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<select class="form-control" type="text" name="type" id="agent_type_id" required>
|
||||
<option></option>
|
||||
<?php foreach ($jilo_agent_types as $agent_type) { ?>
|
||||
<option value="<?= htmlspecialchars($agent_type['id']) ?>" <?php if ($agentDetails[0]['agent_type_id'] === $agent_type['id']) echo 'selected'; ?>>
|
||||
<?= htmlspecialchars($agent_type['description']) ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<p class="text-start"><small>type of agent (meet, jvb, jibri, all)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="url" class="form-label">URL</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="url" value="<?= htmlspecialchars($agentDetails[0]['url']) ?>" required />
|
||||
<p class="text-start"><small>URL of the Jilo Agent API (https://example.com:8081)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="secret_key" class="form-label">secret key</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="secret_key" value="<?= htmlspecialchars($agentDetails[0]['secret_key']) ?>" required />
|
||||
<p class="text-start"><small>secret key for generating the access JWT token</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="check_period" class="form-label">check period</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="check_period" value="<?= htmlspecialchars($agentDetails[0]['check_period']) ?>" required />
|
||||
<p class="text-start"><small>period in minutes for the automatic agent check (0 disables it)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br />
|
||||
<input type="hidden" name="agent" value="<?= htmlspecialchars($agentDetails[0]['id']) ?>" />
|
||||
<a class="btn btn-secondary" href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform_id) ?>agent<?= htmlspecialchars($agentDetails[0]['id']) ?>" />Cancel</a>
|
||||
<input type="submit" class="btn btn-primary" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /agents -->
|
|
@ -1,50 +0,0 @@
|
|||
|
||||
<!-- widget "hosts" -->
|
||||
<div class="card text-center w-50 mx-lef">
|
||||
<p class="h4 card-header">Add new host in Jitsi platform <strong><?= htmlspecialchars($platformDetails[0]['name']) ?></strong></p>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config&item=host">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="address" class="form-label">address</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="address" value="" required autofocus />
|
||||
<p class="text-start"><small>DNS name or IP address of the machine</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="port" class="form-label">port</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="port" value="" required />
|
||||
<p class="text-start"><small>port on which the Jilo Agent is listening</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="name" class="form-label">name</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="name" value="" />
|
||||
<p class="text-start"><small>description or name of the host (optional)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="platform" value="<?= htmlspecialchars($platformDetails[0]['id'])?>" />
|
||||
<input type="hidden" name="item" value="host" />
|
||||
<input type="hidden" name="new" value="true" />
|
||||
|
||||
<br />
|
||||
<a class="btn btn-outline-secondary btn-sm" href="<?= htmlspecialchars($app_root) ?>?page=config&item=host&platform=<?= htmlspecialchars($platform_id) ?>&host=<?= htmlspecialchars($host) ?>#platform<?= htmlspecialchars($platform_id) ?>host<?= htmlspecialchars($host) ?>" />Cancel</a>
|
||||
|
||||
<input type="submit" class="btn btn-primary btn-sm" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "hosts" -->
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
<!-- widget "hosts" -->
|
||||
<div class="card text-center w-50 mx-lef">
|
||||
<p class="h4 card-header">Jilo configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">delete a host:</p>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config&item=host">
|
||||
<?php
|
||||
foreach ($hostDetails[0] as $key => $value) {
|
||||
?>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="<?= htmlspecialchars($key) ?>" class="form-label"><?= htmlspecialchars($key) ?>:</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="text-start"><?= htmlspecialchars($value ?? '') ?></div>
|
||||
<input type="hidden" name="<?= htmlspecialchars($key) ?>" value="<?= htmlspecialchars($value ?? '') ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<br />
|
||||
<input type="hidden" name="host" value="<?= htmlspecialchars($hostDetails[0]['id']) ?>" />
|
||||
<input type="hidden" name="delete" value="true" />
|
||||
<p class="h5 text-danger">Are you sure you want to delete this host?</p>
|
||||
<br />
|
||||
<a class="btn btn-outline-secondary btn-sm" href="<?= htmlspecialchars($app_root) ?>?page=config&item=host&platform=<?= htmlspecialchars($platform_id) ?>&host=<?= htmlspecialchars($host) ?>#platform<?= htmlspecialchars($platform_id) ?>host<?= htmlspecialchars($host) ?>" />Cancel</a>
|
||||
|
||||
<input type="submit" class="btn btn-danger btn-sm" value="Delete" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "hosts" -->
|
|
@ -6,9 +6,9 @@
|
|||
<h2>Jitsi Meet platforms configuration</h2>
|
||||
</div>
|
||||
<div class="col-md-6 text-end">
|
||||
<a class="btn btn-primary" href="<?= htmlspecialchars($app_root) ?>?page=config&item=platform&action=add">
|
||||
<button type="button" class="btn btn-primary" onclick="showAddPlatformModal()">
|
||||
<i class="fas fa-plus me-2"></i>Add new platform
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<?php if (!empty($platformsAll)): ?>
|
||||
|
@ -47,23 +47,17 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="btn-group platform-actions" data-platform-id="<?= htmlspecialchars($platform['id']) ?>">
|
||||
<button type="button" class="btn btn-outline-primary edit-platform">
|
||||
<button type="button" class="btn btn-outline-primary edit-platform platform-view-mode">
|
||||
<i class="fas fa-edit me-1"></i>Edit platform
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-primary save-platform" style="display: none;">
|
||||
<button type="button" class="btn btn-outline-primary save-platform platform-edit-mode" style="display: none;">
|
||||
<i class="fas fa-save me-1"></i>Save
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary cancel-edit" style="display: none;">
|
||||
<button type="button" class="btn btn-outline-secondary cancel-edit platform-edit-mode" style="display: none;">
|
||||
<i class="fas fa-times me-1"></i>Cancel
|
||||
</button>
|
||||
<?php if (count($platformsAll) <= 1): ?>
|
||||
<button class="btn btn-outline-secondary" disabled
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="Can't delete the last platform">
|
||||
<i class="fas fa-trash me-1"></i>Delete platform
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button type="button" class="btn btn-outline-danger delete-platform">
|
||||
<?php if ($userObject->hasRight($user_id, 'delete platform')): ?>
|
||||
<button type="button" class="btn btn-outline-danger platform-view-mode" onclick="showDeletePlatformModal(<?= htmlspecialchars($platform['id']) ?>, '<?= htmlspecialchars(addslashes($platform['name'])) ?>', '<?= htmlspecialchars(addslashes($platform['jitsi_url'])) ?>', '<?= htmlspecialchars(addslashes($platform['jilo_database'])) ?>')">
|
||||
<i class="fas fa-trash me-1"></i>Delete platform
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
|
@ -108,7 +102,7 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Hosts Section -->
|
||||
<!-- Hosts section -->
|
||||
<div class="mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div class="d-flex align-items-center">
|
||||
|
@ -118,9 +112,9 @@
|
|||
for platform "<?= htmlspecialchars($platform['name']) ?>"
|
||||
</span>
|
||||
</div>
|
||||
<a class="btn btn-primary" href="<?= htmlspecialchars($app_root) ?>?page=config&item=host&action=add&platform=<?= htmlspecialchars($platform['id']) ?>">
|
||||
<button class="btn btn-primary" onclick="showAddHostModal(<?= htmlspecialchars($platform['id']) ?>)">
|
||||
<i class="fas fa-plus me-2"></i>Add new host
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($hosts)): ?>
|
||||
|
@ -130,7 +124,7 @@
|
|||
return isset($agent['host_id']) && $agent['host_id'] === $host['id'];
|
||||
});
|
||||
?>
|
||||
<div class="card mt-5">
|
||||
<div class="card mt-5 host-details" data-host-id="<?= htmlspecialchars($host['id']) ?>">
|
||||
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
||||
<div class="flex-grow-1">
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
|
@ -179,15 +173,14 @@
|
|||
<button type="button" class="btn btn-outline-secondary btn-sm cancel-host-edit host-edit-mode" style="display: none;">
|
||||
<i class="fas fa-times me-1"></i>Cancel
|
||||
</button>
|
||||
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=host&platform=<?= htmlspecialchars($platform['id']) ?>&host=<?= htmlspecialchars($host['id']) ?>&action=delete"
|
||||
class="btn btn-outline-danger btn-sm host-view-mode">
|
||||
<button type="button" class="btn btn-outline-danger btn-sm host-view-mode" onclick="showDeleteHostModal(<?= htmlspecialchars($platform['id']) ?>, <?= htmlspecialchars($host['id']) ?>, '<?= htmlspecialchars(addslashes($host['name'])) ?>', '<?= htmlspecialchars(addslashes($host['address'])) ?>')">
|
||||
<i class="fas fa-trash me-1"></i>Delete host
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<!-- Agents Section -->
|
||||
<!-- Agents section -->
|
||||
<?php $hostAgents = $agentObject->getAgentDetails($platform['id']); ?>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div class="d-flex align-items-center">
|
||||
|
@ -197,9 +190,9 @@
|
|||
for this host
|
||||
</span>
|
||||
</div>
|
||||
<a class="btn btn-sm btn-primary" href="<?= htmlspecialchars($app_root) ?>?page=config&item=agent&action=add&platform=<?= htmlspecialchars($platform['id']) ?>&host=<?= htmlspecialchars($host['id']) ?>">
|
||||
<button class="btn btn-sm btn-primary" onclick="showAddAgentModal(<?= htmlspecialchars($platform['id']) ?>, <?= htmlspecialchars($host['id']) ?>)">
|
||||
<i class="fas fa-plus me-2"></i>Add new agent
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($hostAgents)): ?>
|
||||
|
@ -207,7 +200,7 @@
|
|||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Agent Type</th>
|
||||
<th>Agent type</th>
|
||||
<th>Endpoint URL</th>
|
||||
<th>Check period (minutes)</th>
|
||||
<th class="text-end">Actions</th>
|
||||
|
@ -215,7 +208,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($hostAgents as $agent): ?>
|
||||
<tr>
|
||||
<tr class="agent-details" data-agent-id="<?= htmlspecialchars($agent['id']) ?>">
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="fas fa-robot me-2 text-secondary"></i>
|
||||
|
@ -244,7 +237,7 @@
|
|||
<input type="text" class="form-control form-control-sm text-break mb-2" name="url"
|
||||
value="<?= htmlspecialchars($agent['url']) ?>"
|
||||
placeholder="e.g., http://localhost:8080" required>
|
||||
<label class="form-label small text-muted">Secret Key</label>
|
||||
<label class="form-label small text-muted">Secret key</label>
|
||||
<input type="text" class="form-control form-control-sm text-break" name="secret_key"
|
||||
value="<?= htmlspecialchars($agent['secret_key']) ?>"
|
||||
placeholder="Secret key for authentication" required>
|
||||
|
@ -277,10 +270,9 @@
|
|||
<button type="button" class="btn btn-outline-secondary btn-sm cancel-agent-edit agent-edit-mode" style="display: none;">
|
||||
<i class="fas fa-times me-1"></i>Cancel
|
||||
</button>
|
||||
<a href="<?= htmlspecialchars($app_root) ?>?page=config&item=agent&action=delete&platform=<?= htmlspecialchars($platform['id']) ?>&host=<?= htmlspecialchars($host['id']) ?>&agent=<?= htmlspecialchars($agent['id']) ?>"
|
||||
class="btn btn-outline-danger btn-sm agent-view-mode">
|
||||
<button type="button" class="btn btn-outline-danger btn-sm agent-view-mode" onclick="showDeleteAgentModal(<?= htmlspecialchars($platform['id']) ?>, <?= htmlspecialchars($host['id']) ?>, <?= htmlspecialchars($agent['id']) ?>, '<?= htmlspecialchars(addslashes($agent['agent_description'])) ?>')">
|
||||
<i class="fas fa-trash me-1"></i>Delete
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -317,6 +309,234 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add platform modal -->
|
||||
<div class="modal" id="addPlatformModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addPlatformModalLabel">Add new Jitsi platform</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config" id="addPlatformForm">
|
||||
<input type="hidden" name="item" value="platform">
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label for="platformName" class="form-label">Platform name <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="platformName" name="name" required>
|
||||
<small class="form-text text-muted">Descriptive name for the platform</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="platformJitsiUrl" class="form-label">Jitsi URL <span class="text-danger">*</span></label>
|
||||
<input type="url" class="form-control" id="platformJitsiUrl" name="jitsi_url" value="https://" required>
|
||||
<small class="form-text text-muted">URL of the Jitsi Meet (used for checks and for loading config.js)</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="platformDatabase" class="form-label">Jilo database <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="platformDatabase" name="jilo_database" required>
|
||||
<small class="form-text text-muted">Path to Jilo database file</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Add platform</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add host modal -->
|
||||
<div class="modal" id="addHostModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addHostModalLabel">Add new host</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config" id="addHostForm">
|
||||
<input type="hidden" name="item" value="host">
|
||||
<input type="hidden" name="platform" id="hostPlatformId">
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label for="hostAddress" class="form-label">Address <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="hostAddress" name="address" required>
|
||||
<small class="form-text text-muted">DNS name or IP address of the machine</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="hostName" class="form-label">Name</label>
|
||||
<input type="text" class="form-control" id="hostName" name="name">
|
||||
<small class="form-text text-muted">Description or name of the host (optional)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Add host</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add agent modal -->
|
||||
<div class="modal" id="addAgentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addAgentModalLabel">Add new Jilo agent</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config" id="addAgentForm">
|
||||
<input type="hidden" name="item" value="agent">
|
||||
<input type="hidden" name="platform" id="agentPlatformId">
|
||||
<input type="hidden" name="host" id="agentHostId">
|
||||
<input type="hidden" name="new" value="true">
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label for="agentType" class="form-label">Agent type <span class="text-danger">*</span></label>
|
||||
<select class="form-select form-control" id="agentType" name="type" required>
|
||||
<option value="">Select agent type</option>
|
||||
<?php foreach ($jilo_agent_types as $type): ?>
|
||||
<option value="<?= htmlspecialchars($type['id']) ?>"><?= htmlspecialchars($type['description']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="agentUrl" class="form-label">URL <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="agentUrl" name="url" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="agentSecretKey" class="form-label">Secret key <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="agentSecretKey" name="secret_key" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="agentCheckPeriod" class="form-label">Check period (minutes) <span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="agentCheckPeriod" name="check_period" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Add agent</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete platform modal -->
|
||||
<div class="modal fade" id="deletePlatformModal" tabindex="-1" role="dialog" aria-labelledby="deletePlatformModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deletePlatformModalLabel">Delete platform</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config" id="deletePlatformForm">
|
||||
<input type="hidden" name="item" value="platform">
|
||||
<input type="hidden" name="platform" id="deletePlatformId">
|
||||
<input type="hidden" name="delete" value="true">
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger">
|
||||
<h6>Are you sure you want to delete this platform?</h6>
|
||||
<div id="deletePlatformWarning"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Platform name</label>
|
||||
<div id="deletePlatformName" class="form-control-plaintext"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jitsi URL</label>
|
||||
<div id="deletePlatformUrl" class="form-control-plaintext"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Database</label>
|
||||
<div id="deletePlatformDatabase" class="form-control-plaintext"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Type 'delete' to confirm</label>
|
||||
<input type="text" class="form-control" id="deletePlatformConfirm" placeholder="delete">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-danger" id="deletePlatformButton" disabled>Delete platform</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete host modal -->
|
||||
<div class="modal fade" id="deleteHostModal" tabindex="-1" role="dialog" aria-labelledby="deleteHostModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteHostModalLabel">Delete host</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config" id="deleteHostForm">
|
||||
<input type="hidden" name="item" value="host">
|
||||
<input type="hidden" name="platform" id="deleteHostPlatformId">
|
||||
<input type="hidden" name="host" id="deleteHostId">
|
||||
<input type="hidden" name="delete" value="true">
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger">
|
||||
<h6>Are you sure you want to delete this host?</h6>
|
||||
<div id="deleteHostWarning"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Host name</label>
|
||||
<div id="deleteHostName" class="form-control-plaintext"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Address</label>
|
||||
<div id="deleteHostAddress" class="form-control-plaintext"></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Type 'delete' to confirm</label>
|
||||
<input type="text" class="form-control" id="deleteHostConfirm" placeholder="delete">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-danger" id="deleteHostButton" disabled>Delete host</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete agent modal -->
|
||||
<div class="modal fade" id="deleteAgentModal" tabindex="-1" role="dialog" aria-labelledby="deleteAgentModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteAgentModalLabel">Delete agent</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config" id="deleteAgentForm">
|
||||
<input type="hidden" name="item" value="agent">
|
||||
<input type="hidden" name="platform" id="deleteAgentPlatformId">
|
||||
<input type="hidden" name="host" id="deleteAgentHostId">
|
||||
<input type="hidden" name="agent" id="deleteAgentId">
|
||||
<input type="hidden" name="delete" value="true">
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger">
|
||||
<h6>Are you sure you want to delete this agent?</h6>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Agent type</label>
|
||||
<div id="deleteAgentType" class="form-control-plaintext"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-danger">Delete agent</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// Edit platform
|
||||
|
@ -330,11 +550,11 @@ $(function() {
|
|||
|
||||
// Toggle buttons
|
||||
const actions = $(this).closest('.platform-actions');
|
||||
actions.find('.edit-platform').hide();
|
||||
actions.find('.save-platform, .cancel-edit').show();
|
||||
actions.find('.platform-view-mode').hide();
|
||||
actions.find('.platform-edit-mode').show();
|
||||
});
|
||||
|
||||
// Cancel edit
|
||||
// Cancel platform edit
|
||||
$('.cancel-edit').click(function() {
|
||||
const platformId = $(this).closest('.platform-actions').data('platform-id');
|
||||
const platformTable = $(`.platform-details[data-platform-id="${platformId}"]`);
|
||||
|
@ -343,16 +563,10 @@ $(function() {
|
|||
platformTable.find('.view-mode').show();
|
||||
platformTable.find('.edit-mode').hide();
|
||||
|
||||
// Reset form values to original
|
||||
platformTable.find('.edit-mode input').each(function() {
|
||||
const originalValue = platformTable.find(`.view-mode:eq(${$(this).closest('tr').index()})`).text().trim();
|
||||
$(this).val(originalValue);
|
||||
});
|
||||
|
||||
// Toggle buttons
|
||||
const actions = $(this).closest('.platform-actions');
|
||||
actions.find('.edit-platform').show();
|
||||
actions.find('.save-platform, .cancel-edit').hide();
|
||||
actions.find('.platform-view-mode').show();
|
||||
actions.find('.platform-edit-mode').hide();
|
||||
});
|
||||
|
||||
// Save platform
|
||||
|
@ -384,8 +598,6 @@ $(function() {
|
|||
return JSON.parse(text);
|
||||
} catch (e) {
|
||||
console.log('Response text:', text);
|
||||
// If we can't parse JSON but the request was successful,
|
||||
// we'll treat it as a success since we know the save worked
|
||||
return { success: true };
|
||||
}
|
||||
});
|
||||
|
@ -411,8 +623,8 @@ $(function() {
|
|||
|
||||
// Toggle buttons
|
||||
const actions = $(this).closest('.platform-actions');
|
||||
actions.find('.edit-platform').show();
|
||||
actions.find('.save-platform, .cancel-edit').hide();
|
||||
actions.find('.platform-view-mode').show();
|
||||
actions.find('.platform-edit-mode').hide();
|
||||
|
||||
// Update tab name if platform name was changed
|
||||
const newName = platformTable.find('input[name="name"]').val();
|
||||
|
@ -442,8 +654,8 @@ $(function() {
|
|||
|
||||
// Toggle buttons
|
||||
const actions = $(this).closest('.platform-actions');
|
||||
actions.find('.edit-platform').show();
|
||||
actions.find('.save-platform, .cancel-edit').hide();
|
||||
actions.find('.platform-view-mode').show();
|
||||
actions.find('.platform-edit-mode').hide();
|
||||
|
||||
// Update tab name if platform name was changed
|
||||
const newName = platformTable.find('input[name="name"]').val();
|
||||
|
@ -690,8 +902,186 @@ $(function() {
|
|||
});
|
||||
});
|
||||
|
||||
// Delete Platform Modal
|
||||
function showDeletePlatformModal(platformId, name, url, database) {
|
||||
document.getElementById('deletePlatformId').value = platformId;
|
||||
document.getElementById('deletePlatformName').textContent = name;
|
||||
document.getElementById('deletePlatformUrl').textContent = url;
|
||||
document.getElementById('deletePlatformDatabase').textContent = database;
|
||||
|
||||
// Get hosts and agents for this platform
|
||||
const platformPane = document.getElementById(`platform-${platformId}`);
|
||||
if (!platformPane) {
|
||||
document.getElementById('deletePlatformWarning').innerHTML = '<p class="mb-0">Error: Platform not found.</p>';
|
||||
$('#deletePlatformModal').modal();
|
||||
return;
|
||||
}
|
||||
|
||||
const hosts = platformPane.querySelectorAll('.host-details');
|
||||
let warningText = '<p>This will delete the following items:</p>';
|
||||
|
||||
if (hosts.length > 0) {
|
||||
warningText += '<ul class="mb-0">';
|
||||
hosts.forEach(host => {
|
||||
const hostNameEl = host.querySelector('.card-header h6');
|
||||
const hostName = hostNameEl ? hostNameEl.textContent.trim() : 'Unknown host';
|
||||
const agents = host.querySelectorAll('.agent-details');
|
||||
warningText += `<li>Host: ${hostName}`;
|
||||
|
||||
if (agents.length > 0) {
|
||||
warningText += '<ul>';
|
||||
agents.forEach(agent => {
|
||||
const agentType = agent.querySelector('td:first-child span');
|
||||
const agentName = agentType ? agentType.textContent.trim() : 'Unknown agent';
|
||||
warningText += `<li>Agent: ${agentName}</li>`;
|
||||
});
|
||||
warningText += '</ul>';
|
||||
}
|
||||
warningText += '</li>';
|
||||
});
|
||||
warningText += '</ul>';
|
||||
} else {
|
||||
warningText = '<p class="mb-0">This platform has no hosts or agents.</p>';
|
||||
}
|
||||
|
||||
document.getElementById('deletePlatformWarning').innerHTML = warningText;
|
||||
$('#deletePlatformModal').modal();
|
||||
}
|
||||
|
||||
// Delete host modal
|
||||
function showDeleteHostModal(platformId, hostId, name, address) {
|
||||
document.getElementById('deleteHostPlatformId').value = platformId;
|
||||
document.getElementById('deleteHostId').value = hostId;
|
||||
document.getElementById('deleteHostName').textContent = name || '(no description)';
|
||||
document.getElementById('deleteHostAddress').textContent = address;
|
||||
|
||||
// Get agents for this host
|
||||
const platformPane = document.getElementById(`platform-${platformId}`);
|
||||
if (!platformPane) {
|
||||
document.getElementById('deleteHostWarning').innerHTML = '<p class="mb-0">Error: Platform not found.</p>';
|
||||
$('#deleteHostModal').modal();
|
||||
return;
|
||||
}
|
||||
|
||||
const hostCard = platformPane.querySelector(`.host-details[data-host-id="${hostId}"]`);
|
||||
let warningText = '<p>This will delete the following items:</p>';
|
||||
|
||||
if (hostCard) {
|
||||
const agents = hostCard.querySelectorAll('.agent-details');
|
||||
if (agents.length > 0) {
|
||||
warningText += '<ul class="mb-0">';
|
||||
agents.forEach(agent => {
|
||||
const agentType = agent.querySelector('td:first-child span');
|
||||
const agentName = agentType ? agentType.textContent.trim() : 'Unknown agent';
|
||||
warningText += `<li>Agent: ${agentName}</li>`;
|
||||
});
|
||||
warningText += '</ul>';
|
||||
} else {
|
||||
warningText = '<p class="mb-0">This host has no agents.</p>';
|
||||
}
|
||||
} else {
|
||||
warningText = '<p class="mb-0">Error: Host not found.</p>';
|
||||
}
|
||||
|
||||
document.getElementById('deleteHostWarning').innerHTML = warningText;
|
||||
$('#deleteHostModal').modal();
|
||||
}
|
||||
|
||||
// Delete agent modal
|
||||
function showDeleteAgentModal(platformId, hostId, agentId, type) {
|
||||
document.getElementById('deleteAgentPlatformId').value = platformId;
|
||||
document.getElementById('deleteAgentHostId').value = hostId;
|
||||
document.getElementById('deleteAgentId').value = agentId;
|
||||
document.getElementById('deleteAgentType').textContent = type;
|
||||
$('#deleteAgentModal').modal();
|
||||
}
|
||||
|
||||
// Handle confirmation inputs
|
||||
$('#deletePlatformConfirm').on('input', function() {
|
||||
document.getElementById('deletePlatformButton').disabled = this.value !== 'delete';
|
||||
});
|
||||
|
||||
$('#deleteHostConfirm').on('input', function() {
|
||||
document.getElementById('deleteHostButton').disabled = this.value !== 'delete';
|
||||
});
|
||||
|
||||
// Reset confirmation on modal close
|
||||
$('#deletePlatformModal').on('hidden.bs.modal', function() {
|
||||
document.getElementById('deletePlatformConfirm').value = '';
|
||||
document.getElementById('deletePlatformButton').disabled = true;
|
||||
});
|
||||
|
||||
$('#deleteHostModal').on('hidden.bs.modal', function() {
|
||||
document.getElementById('deleteHostConfirm').value = '';
|
||||
document.getElementById('deleteHostButton').disabled = true;
|
||||
});
|
||||
|
||||
// Make functions globally available
|
||||
window.showDeletePlatformModal = showDeletePlatformModal;
|
||||
window.showDeleteHostModal = showDeleteHostModal;
|
||||
window.showDeleteAgentModal = showDeleteAgentModal;
|
||||
|
||||
// Initialize tooltips
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
// Platform modal
|
||||
function showAddPlatformModal() {
|
||||
$('#addPlatformModal').modal('show');
|
||||
}
|
||||
|
||||
// Host modal
|
||||
function showAddHostModal(platformId) {
|
||||
document.getElementById('hostPlatformId').value = platformId;
|
||||
document.getElementById('addHostModalLabel').textContent = 'Add new host to platform #' + platformId;
|
||||
$('#addHostModal').modal('show');
|
||||
}
|
||||
|
||||
// Agent modal
|
||||
function showAddAgentModal(platformId, hostId) {
|
||||
document.getElementById('agentPlatformId').value = platformId;
|
||||
document.getElementById('agentHostId').value = hostId;
|
||||
document.getElementById('addAgentModalLabel').textContent = 'Add new agent to host #' + hostId;
|
||||
|
||||
// Filter agent types that are not yet in this host
|
||||
const existingTypes = Array.from(document.querySelectorAll(`[data-host-id="${hostId}"] [data-agent-type-id]`))
|
||||
.map(el => el.dataset.agentTypeId);
|
||||
|
||||
const agentTypeSelect = document.getElementById('agentType');
|
||||
Array.from(agentTypeSelect.options).forEach(option => {
|
||||
if (option.value && existingTypes.includes(option.value)) {
|
||||
option.disabled = true;
|
||||
} else {
|
||||
option.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#addAgentModal').modal('show');
|
||||
}
|
||||
|
||||
// Remove the old platform button creation since we have it in the HTML now
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Add Host buttons for each platform
|
||||
document.querySelectorAll('.platform-card').forEach(card => {
|
||||
const platformId = card.dataset.platformId;
|
||||
const addHostBtn = document.createElement('button');
|
||||
addHostBtn.className = 'btn btn-outline-primary btn-sm ms-2';
|
||||
addHostBtn.innerHTML = '<i class="fas fa-plus me-1"></i>Add host';
|
||||
addHostBtn.onclick = () => showAddHostModal(platformId);
|
||||
card.querySelector('.card-header').appendChild(addHostBtn);
|
||||
});
|
||||
|
||||
// Add Agent buttons for each host
|
||||
document.querySelectorAll('.host-card').forEach(card => {
|
||||
const platformId = card.closest('.platform-card').dataset.platformId;
|
||||
const hostId = card.dataset.hostId;
|
||||
const addAgentBtn = document.createElement('button');
|
||||
addAgentBtn.className = 'btn btn-outline-primary btn-sm ms-2';
|
||||
addAgentBtn.innerHTML = '<i class="fas fa-plus me-1"></i>Add agent';
|
||||
addAgentBtn.onclick = () => showAddAgentModal(platformId, hostId);
|
||||
card.querySelector('.card-header').appendChild(addAgentBtn);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- "jilo configuration" -->
|
|
@ -1,134 +0,0 @@
|
|||
|
||||
<!-- widget "config" -->
|
||||
<div class="card text-center w-75 mx-lef">
|
||||
<p class="h4 card-header">Jilo configuration</p>
|
||||
<p class="h6 card-header">
|
||||
<span class="btn btn-outline-primary btn-sm active" aria-pressed="true" style="cursor: default;">platforms</span>
|
||||
<a href="" class="btn btn-outline-primary btn-sm">hosts</a>
|
||||
<a href="" class="btn btn-outline-primary btn-sm">endpoints</a>
|
||||
|
||||
<a href="" class="btn btn-outline-primary btn-sm">config file</a>
|
||||
</p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">main variables</p>
|
||||
<?php
|
||||
include '../app/helpers/render.php';
|
||||
renderConfig($config, '0');
|
||||
echo "\n";
|
||||
?>
|
||||
|
||||
<hr />
|
||||
<p class="card-text">platforms configuration <a class="btn btn-secondary" style="padding: 0px;" href="<?= htmlspecialchars($app_root) ?>?page=config&item=platform&action=add">add new</a></p>
|
||||
|
||||
<?php foreach ($platformsAll as $platform_array) {
|
||||
$agents = $agentObject->getAgentDetails($platform_array['id']);
|
||||
?>
|
||||
|
||||
<a name="platform<?= htmlspecialchars($platform_array['id']) ?>"></a>
|
||||
<div class="row mb-3" style="padding-left: 0px;">
|
||||
<div class="border bg-light" style="padding-left: 50px; padding-bottom: 0px; padding-top: 0px;">
|
||||
<a style="text-decoration: none;" data-toggle="collapse" href="#collapsePlatform<?= htmlspecialchars($platform_array['id']) ?>" role="button" aria-expanded="true" aria-controls="collapsePlatform<?= htmlspecialchars($platform_array['id']) ?>">
|
||||
<div class="border bg-white text-start mb-3 rounded mt-3" data-toggle="tooltip" data-placement="bottom" title="configuration for platform <?= htmlspecialchars($platform_array['id']) ?>">
|
||||
<i class="fas fa-wrench"></i>
|
||||
<small>platform <?= htmlspecialchars($platform_array['id']) ?> (<?= htmlspecialchars($platform_array['name']) ?>)</small>
|
||||
</div>
|
||||
</a>
|
||||
<div class="collapse show" id="collapsePlatform<?= htmlspecialchars($platform_array['id']) ?>">
|
||||
|
||||
<div class="row mb-1" style="padding-left: 0px;">
|
||||
<div class="col-md-8 text-start">
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col-md-8 text-start">
|
||||
<a class="btn btn-secondary" style="padding: 2px;" href="<?= htmlspecialchars($app_root) ?>?page=config&platform=<?= htmlspecialchars($platform_array['id']) ?>&action=edit">edit platform</a>
|
||||
<?php if (count($platformsAll) <= 1) { ?>
|
||||
<span class="btn btn-light" style="padding: 2px;" href="#" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="can't delete the last platform">delete platform</span>
|
||||
<?php } else { ?>
|
||||
<a class="btn btn-danger" style="padding: 2px;" href="<?= htmlspecialchars($app_root) ?>?page=config&platform=<?= htmlspecialchars($platform_array['id']) ?>&action=delete">delete platform</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="padding-left: 100px; padding-bottom: 20px;">
|
||||
<?php foreach ($platform_array as $key => $value) {
|
||||
if ($key === 'id') continue;
|
||||
?>
|
||||
<div class="row mb-1" style="padding-left: 100px;">
|
||||
<div class="col-md-4 text-end">
|
||||
<?= htmlspecialchars($key) ?>:
|
||||
</div>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= htmlspecialchars($value) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<p class="card-text">jilo agents on platform <?= htmlspecialchars($platform_array['id']) ?> (<?= htmlspecialchars($platform_array['name']) ?>)
|
||||
<br />
|
||||
total <?= htmlspecialchars(count($agents)) ?> <?= htmlspecialchars(count($agents)) === 1 ? 'jilo agent' : 'jilo agents' ?>
|
||||
<a class="btn btn-secondary" style="padding: 0px;" href="<?= htmlspecialchars($app_root) ?>?page=config&platform=<?= htmlspecialchars($platform_array['id']) ?>&action=add-agent">
|
||||
add new
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<?php foreach ($agents as $agent_array) { ?>
|
||||
|
||||
<a name="platform<?= htmlspecialchars($platform_array['id']) ?>agent<?= htmlspecialchars($agent_array['id']) ?>"></a>
|
||||
<div class="row mb-3" style="padding-left: 0px;">
|
||||
<div class="border rounded bg-light" style="padding-left: 50px; padding-bottom: 20px; padding-top: 20px;">
|
||||
<div class="row mb-1" style="padding-left: 0px;">
|
||||
<div class="col-md-4 text-end">
|
||||
agent id <?= htmlspecialchars($agent_array['id']) ?>:
|
||||
</div>
|
||||
<div class="col-md-8 text-start">
|
||||
<a class="btn btn-secondary" style="padding: 2px;" href="<?= htmlspecialchars($app_root) ?>?page=config&platform=<?= htmlspecialchars($agent_array['platform_id']) ?>&agent=<?= htmlspecialchars($agent_array['id']) ?>&action=edit">edit agent</a>
|
||||
<a class="btn btn-danger" style="padding: 2px;" href="<?= htmlspecialchars($app_root) ?>?page=config&platform=<?= htmlspecialchars($agent_array['platform_id']) ?>&agent=<?= htmlspecialchars($agent_array['id']) ?>&action=delete">delete agent</a>
|
||||
</div>
|
||||
<div style="padding-left: 100px; padding-bottom: 20px;">
|
||||
<div class="row mb-1" style="padding-left: 100px;">
|
||||
<div class="col-md-4 text-end">
|
||||
agent type:
|
||||
</div>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= htmlspecialchars($agent_array['agent_description']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1" style="padding-left: 100px;">
|
||||
<div class="col-md-4 text-end">
|
||||
endpoint:
|
||||
</div>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= htmlspecialchars($agent_array['url'].$agent_array['agent_endpoint']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (isset($agent_array['check_period']) && $agent_array['check_period'] !== 0) { ?>
|
||||
<div class="row mb-1" style="padding-left: 100px;">
|
||||
<div class="col-md-4 text-end">
|
||||
check period:
|
||||
</div>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= htmlspecialchars($agent_array['check_period']) ?> <?= ($agent_array['check_period'] == 1 ? 'minute' : 'minutes') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "config" -->
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
<!-- widget "platforms" -->
|
||||
<div class="card text-center w-50 mx-lef">
|
||||
<p class="h4 card-header">Add new Jitsi platform</p>
|
||||
<div class="card-body">
|
||||
<!--p class="card-text">add new platform:</p-->
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config&item=platform">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="name" class="form-label">name</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="name" value="" required autofocus />
|
||||
<p class="text-start"><small>descriptive name for the platform</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="jitsi_url" class="form-label">Jitsi URL</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="jitsi_url" value="https://" required />
|
||||
<p class="text-start"><small>URL of the Jitsi Meet (used for checks and for loading config.js)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="jilo_database" class="form-label">jilo_database</label>
|
||||
<span class="text-danger" style="margin-right: -12px;">*</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="jilo_database" value="" required />
|
||||
<p class="text-start"><small>path to the database file (relative to the app root)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="new" value="true" />
|
||||
|
||||
<br />
|
||||
<a class="btn btn-outline-secondary btn-sm" href="<?= htmlspecialchars($app_root) ?>?page=config&item=platform" />Cancel</a>
|
||||
|
||||
<input type="submit" class="btn btn-primary btn-sm" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "platforms" -->
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
<!-- widget "platforms" -->
|
||||
<div class="card text-center w-50 mx-lef">
|
||||
<p class="h4 card-header">Jilo configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong> :: delete</p>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
<?php
|
||||
foreach ($platformDetails[0] as $key => $value) {
|
||||
if ($key === 'id') continue;
|
||||
?>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
<label for="<?= htmlspecialchars($key) ?>" class="form-label"><?= htmlspecialchars($key) ?>:</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="text-start"><?= htmlspecialchars($value) ?? '' ?></div>
|
||||
<input type="hidden" name="<?= htmlspecialchars($key) ?>" value="<?= htmlspecialchars($value ?? '')?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<br />
|
||||
<input type="hidden" name="platform" value="<?= htmlspecialchars($platform_id) ?>" />
|
||||
<input type="hidden" name="delete" value="true" />
|
||||
<p class="h5 text-danger">Are you sure you want to delete this platform?</p>
|
||||
<br />
|
||||
<a class="btn btn-outline-secondary btn-sm" href="<?= htmlspecialchars($app_root) ?>?page=config&item=platform&platform=<?= htmlspecialchars($platform_id) ?>#platform<?= htmlspecialchars($platform_id) ?>" />Cancel</a>
|
||||
|
||||
<input type="submit" class="btn btn-danger btn-sm" value="Delete" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /widget "platforms" -->
|
Loading…
Reference in New Issue