Refactor and enhance code readability across multiple components
- Updated SQL query in `VMs-Backups.php` to include `policy` condition. - Improved formatting and indentation in `StdOut-detail.php`, `StdOut.php`, and `Server-Detail.php`. - Simplified conditional checks and removed redundant spaces for better clarity. - Modified `.idea/sqldialects.xml` file to add new SQL dialect mappings.
This commit is contained in:
@@ -30,9 +30,9 @@ $data = [];
|
||||
// Get CPU & Memory Items
|
||||
foreach ($items as $item) {
|
||||
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
||||
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
|
||||
$valueType = $item['value_type'] ?? ($isMemory ? 3 : 0);
|
||||
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
||||
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
|
||||
$table = $tableMap[$valueType] ?? ($isMemory ? 'history_uint' : 'history');
|
||||
// Get History Data
|
||||
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
||||
AVG(value) AS avg_value
|
||||
@@ -51,7 +51,6 @@ foreach ($items as $item) {
|
||||
}
|
||||
$data[$item['name']] = $results;
|
||||
}
|
||||
// Send Json back
|
||||
// Send JSON back
|
||||
echo json_encode($data, JSON_NUMERIC_CHECK);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user