Moves config file to its own page
parent
ced3ac484d
commit
15798b08a7
|
@ -109,20 +109,32 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
// no form submitted, show the templates
|
// no form submitted, show the templates
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// $item - config.js and interface_config.js are special case; remote loaded files
|
|
||||||
switch ($item) {
|
switch ($item) {
|
||||||
case 'configjs':
|
case 'platforms':
|
||||||
$mode = $_REQUEST['mode'] ?? '';
|
$mode = $_REQUEST['mode'] ?? '';
|
||||||
$raw = ($mode === 'raw');
|
$raw = ($mode === 'raw');
|
||||||
$platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
$platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||||
include '../app/templates/config-list-configjs.php';
|
include '../app/templates/config-list-configjs.php';
|
||||||
break;
|
break;
|
||||||
case 'interfaceconfigjs':
|
case 'hosts':
|
||||||
$mode = $_REQUEST['mode'] ?? '';
|
$mode = $_REQUEST['mode'] ?? '';
|
||||||
$raw = ($mode === 'raw');
|
$raw = ($mode === 'raw');
|
||||||
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||||
include '../app/templates/config-list-interfaceconfigjs.php';
|
include '../app/templates/config-list-interfaceconfigjs.php';
|
||||||
break;
|
break;
|
||||||
|
case 'endpoints':
|
||||||
|
$mode = $_REQUEST['mode'] ?? '';
|
||||||
|
$raw = ($mode === 'raw');
|
||||||
|
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||||
|
include '../app/templates/config-list-interfaceconfigjs.php';
|
||||||
|
break;
|
||||||
|
case 'config_file':
|
||||||
|
if ($userObject->hasRight($user_id, 'view config file')) {
|
||||||
|
include '../app/templates/config-configfile.php';
|
||||||
|
} else {
|
||||||
|
include '../app/templates/error-unauthorized.php';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// if there is no $item, we work on the local config DB
|
// if there is no $item, we work on the local config DB
|
||||||
default:
|
default:
|
||||||
|
@ -153,12 +165,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
include '../app/templates/config-delete-platform.php';
|
include '../app/templates/config-delete-platform.php';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
if ($userObject->hasRight($user_id, 'view config file')) {
|
|
||||||
include '../app/templates/config-list.php';
|
|
||||||
} else {
|
|
||||||
include '../app/templates/error-unauthorized.php';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,97 +9,94 @@ require '../app/classes/agent.php';
|
||||||
$configObject = new Config();
|
$configObject = new Config();
|
||||||
$agentObject = new Agent($dbWeb);
|
$agentObject = new Agent($dbWeb);
|
||||||
|
|
||||||
// no form submitted, show the templates
|
switch ($item) {
|
||||||
|
|
||||||
// $item - config.js and interface_config.js are special case; remote loaded files
|
case 'graphs':
|
||||||
switch ($item) {
|
// FIXME example data
|
||||||
|
$one = date('Y-m-d',strtotime("-5 days"));
|
||||||
|
$two = date('Y-m-d',strtotime("-4 days"));
|
||||||
|
$three = date('Y-m-d',strtotime("-2 days"));
|
||||||
|
$four = date('Y-m-d',strtotime("-1 days"));
|
||||||
|
|
||||||
case 'graphs':
|
$graph[0]['data0'] = [
|
||||||
// FIXME example data
|
['date' => $one, 'value' => 10],
|
||||||
$one = date('Y-m-d',strtotime("-5 days"));
|
['date' => $two, 'value' => 20],
|
||||||
$two = date('Y-m-d',strtotime("-4 days"));
|
['date' => $three, 'value' => 15],
|
||||||
$three = date('Y-m-d',strtotime("-2 days"));
|
['date' => $four, 'value' => 25],
|
||||||
$four = date('Y-m-d',strtotime("-1 days"));
|
];
|
||||||
|
|
||||||
$graph[0]['data0'] = [
|
$graph[0]['data1'] = [
|
||||||
['date' => $one, 'value' => 10],
|
['date' => $one, 'value' => 12],
|
||||||
['date' => $two, 'value' => 20],
|
['date' => $two, 'value' => 23],
|
||||||
['date' => $three, 'value' => 15],
|
['date' => $three, 'value' => 11],
|
||||||
['date' => $four, 'value' => 25],
|
['date' => $four, 'value' => 27],
|
||||||
];
|
];
|
||||||
|
|
||||||
$graph[0]['data1'] = [
|
$graph[0]['graph_name'] = 'conferences';
|
||||||
['date' => $one, 'value' => 12],
|
$graph[0]['graph_title'] = 'Conferences in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time';
|
||||||
['date' => $two, 'value' => 23],
|
$graph[0]['graph_data0_label'] = 'Conferences from Jitsi logs (Jilo)';
|
||||||
['date' => $three, 'value' => 11],
|
$graph[0]['graph_data1_label'] = 'Conferences from Jitsi API (Jilo Agents)';
|
||||||
['date' => $four, 'value' => 27],
|
|
||||||
];
|
|
||||||
|
|
||||||
$graph[0]['graph_name'] = 'conferences';
|
$graph[1]['data0'] = [
|
||||||
$graph[0]['graph_title'] = 'Conferences in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time';
|
['date' => $one, 'value' => 20],
|
||||||
$graph[0]['graph_data0_label'] = 'Conferences from Jitsi logs (Jilo)';
|
['date' => $two, 'value' => 30],
|
||||||
$graph[0]['graph_data1_label'] = 'Conferences from Jitsi API (Jilo Agents)';
|
['date' => $three, 'value' => 15],
|
||||||
|
['date' => $four, 'value' => 55],
|
||||||
|
];
|
||||||
|
|
||||||
$graph[1]['data0'] = [
|
$graph[1]['data1'] = [
|
||||||
['date' => $one, 'value' => 20],
|
['date' => $one, 'value' => 22],
|
||||||
['date' => $two, 'value' => 30],
|
['date' => $two, 'value' => 33],
|
||||||
['date' => $three, 'value' => 15],
|
['date' => $three, 'value' => 11],
|
||||||
['date' => $four, 'value' => 55],
|
['date' => $four, 'value' => 57],
|
||||||
];
|
];
|
||||||
|
|
||||||
$graph[1]['data1'] = [
|
$graph[1]['graph_name'] = 'participants';
|
||||||
['date' => $one, 'value' => 22],
|
$graph[1]['graph_title'] = 'Participants in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time';
|
||||||
['date' => $two, 'value' => 33],
|
$graph[1]['graph_data0_label'] = 'Participants from Jitsi logs (Jilo)';
|
||||||
['date' => $three, 'value' => 11],
|
$graph[1]['graph_data1_label'] = 'Participants from Jitsi API (Jilo Agents)';
|
||||||
['date' => $four, 'value' => 57],
|
|
||||||
];
|
|
||||||
|
|
||||||
$graph[1]['graph_name'] = 'participants';
|
include '../app/templates/graphs-combined.php';
|
||||||
$graph[1]['graph_title'] = 'Participants in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time';
|
break;
|
||||||
$graph[1]['graph_data0_label'] = 'Participants from Jitsi logs (Jilo)';
|
|
||||||
$graph[1]['graph_data1_label'] = 'Participants from Jitsi API (Jilo Agents)';
|
|
||||||
|
|
||||||
include '../app/templates/graphs-combined.php';
|
case 'latest':
|
||||||
break;
|
$latestJvbConferences = $agentObject->getLatestData($platform_id, 'jvb', 'conferences');
|
||||||
|
$latestJvbParticipants = $agentObject->getLatestData($platform_id, 'jvb', 'participants');
|
||||||
|
$latestJicofoConferences = $agentObject->getLatestData($platform_id, 'jicofo', 'conferences');
|
||||||
|
$latestJicofoParticipants = $agentObject->getLatestData($platform_id, 'jicofo', 'participants');
|
||||||
|
|
||||||
case 'latest':
|
$widget['records'] = array();
|
||||||
$latestJvbConferences = $agentObject->getLatestData($platform_id, 'jvb', 'conferences');
|
|
||||||
$latestJvbParticipants = $agentObject->getLatestData($platform_id, 'jvb', 'participants');
|
|
||||||
$latestJicofoConferences = $agentObject->getLatestData($platform_id, 'jicofo', 'conferences');
|
|
||||||
$latestJicofoParticipants = $agentObject->getLatestData($platform_id, 'jicofo', 'participants');
|
|
||||||
|
|
||||||
$widget['records'] = array();
|
// prepare the widget
|
||||||
|
$widget['full'] = false;
|
||||||
|
$widget['name'] = 'LatestData';
|
||||||
|
$widget['title'] = 'Latest data from Jilo Agents';
|
||||||
|
$widget['collapsible'] = false;
|
||||||
|
$widget['collapsed'] = false;
|
||||||
|
$widget['filter'] = false;
|
||||||
|
if (!empty($latestJvbConferences) && !empty($latestJvbParticipants) && !empty($latestJicofoConferences) && !empty($latestJicofoParticipants)) {
|
||||||
|
$widget['full'] = true;
|
||||||
|
}
|
||||||
|
$widget['pagination'] = true;
|
||||||
|
|
||||||
// prepare the widget
|
include '../app/templates/latest-data.php';
|
||||||
$widget['full'] = false;
|
break;
|
||||||
$widget['name'] = 'LatestData';
|
|
||||||
$widget['title'] = 'Latest data from Jilo Agents';
|
|
||||||
$widget['collapsible'] = false;
|
|
||||||
$widget['collapsed'] = false;
|
|
||||||
$widget['filter'] = false;
|
|
||||||
if (!empty($latestJvbConferences) && !empty($latestJvbParticipants) && !empty($latestJicofoConferences) && !empty($latestJicofoParticipants)) {
|
|
||||||
$widget['full'] = true;
|
|
||||||
}
|
|
||||||
$widget['pagination'] = true;
|
|
||||||
|
|
||||||
include '../app/templates/latest-data.php';
|
case 'configjs':
|
||||||
break;
|
$mode = $_REQUEST['mode'] ?? '';
|
||||||
|
$raw = ($mode === 'raw');
|
||||||
|
$platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||||
|
include '../app/templates/config-list-configjs.php';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'configjs':
|
case 'interfaceconfigjs':
|
||||||
$mode = $_REQUEST['mode'] ?? '';
|
$mode = $_REQUEST['mode'] ?? '';
|
||||||
$raw = ($mode === 'raw');
|
$raw = ($mode === 'raw');
|
||||||
$platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
||||||
include '../app/templates/config-list-configjs.php';
|
include '../app/templates/config-list-interfaceconfigjs.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'interfaceconfigjs':
|
default:
|
||||||
$mode = $_REQUEST['mode'] ?? '';
|
}
|
||||||
$raw = ($mode === 'raw');
|
|
||||||
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
|
|
||||||
include '../app/templates/config-list-interfaceconfigjs.php';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
<!-- 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";
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /widget "config" -->
|
Loading…
Reference in New Issue