mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-12-26 23:26:47 +01:00
Merge pull request #1799 from RaspAP/feat/dashboard-devices
Feature: Dashboard + System device illustrations
This commit is contained in:
1083
app/img/devices/compute.php
Normal file
1083
app/img/devices/compute.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
<?php header("Content-Type: image/svg+xml; charset=utf-8"); ?>
|
||||
<?php
|
||||
require_once '../../includes/functions.php';
|
||||
require_once '../../../includes/functions.php';
|
||||
$color = getColorOpt();
|
||||
?>
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
1561
app/img/devices/zero.php
Normal file
1561
app/img/devices/zero.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,7 @@ function DisplayDashboard(&$extraFooterScripts): void
|
||||
$clientInterface = $_SESSION['wifi_client_interface'];
|
||||
$hostname = $system->hostname();
|
||||
$revision = $system->rpiRevision();
|
||||
$deviceImage = $dashboard->getDeviceImage($revision);
|
||||
$hostapd = $system->hostapdStatus();
|
||||
$adblock = $system->adBlockStatus();
|
||||
$vpn = $system->getActiveVpnInterface();
|
||||
@@ -88,6 +89,7 @@ function DisplayDashboard(&$extraFooterScripts): void
|
||||
echo renderTemplate(
|
||||
"dashboard", compact(
|
||||
"revision",
|
||||
"deviceImage",
|
||||
"interface",
|
||||
"clientInterface",
|
||||
"state",
|
||||
|
||||
@@ -9,6 +9,7 @@ require_once 'config.php';
|
||||
function DisplaySystem(&$extraFooterScripts)
|
||||
{
|
||||
$status = new \RaspAP\Messages\StatusMessage;
|
||||
$dashboard = new \RaspAP\UI\Dashboard;
|
||||
$pluginInstaller = \RaspAP\Plugins\PluginInstaller::getInstance();
|
||||
|
||||
if (isset($_POST['SaveLanguage'])) {
|
||||
@@ -86,6 +87,7 @@ function DisplaySystem(&$extraFooterScripts)
|
||||
$kernel = $system->kernelVersion();
|
||||
$systime = $system->systime();
|
||||
$revision = $system->rpiRevision();
|
||||
$deviceImage = $dashboard->getDeviceImage($revision);
|
||||
|
||||
// memory use
|
||||
$memused = $system->usedMemory();
|
||||
@@ -129,6 +131,7 @@ function DisplaySystem(&$extraFooterScripts)
|
||||
"uptime",
|
||||
"systime",
|
||||
"revision",
|
||||
"deviceImage",
|
||||
"cores",
|
||||
"os",
|
||||
"kernel",
|
||||
|
||||
@@ -95,7 +95,7 @@ class Sysinfo
|
||||
|
||||
/*
|
||||
* Returns RPi Model and PCB Revision from Pi Revision Code (cpuinfo)
|
||||
* @see http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/
|
||||
* @see https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/raspberry-pi/revision-codes.adoc
|
||||
*/
|
||||
public function rpiRevision()
|
||||
{
|
||||
@@ -113,24 +113,26 @@ class Sysinfo
|
||||
'000f' => 'Raspberry Pi Model B Rev 2.0',
|
||||
'0010' => 'Raspberry Pi Model B+',
|
||||
'0013' => 'Raspberry Pi Model B+',
|
||||
'0011' => 'Compute Module',
|
||||
'0011' => 'Compute Module 1',
|
||||
'0012' => 'Raspberry Pi Model A+',
|
||||
'a01041' => 'a01041',
|
||||
'a21041' => 'a21041',
|
||||
'a01041' => 'Raspberry Pi 2 Model B',
|
||||
'a21041' => 'Raspberry Pi 2 Model B',
|
||||
'900092' => 'Raspberry Pi Zero 1.2',
|
||||
'900093' => 'Raspberry Pi Zero 1.3',
|
||||
'9000c1' => 'Raspberry Pi Zero W',
|
||||
'a02082' => 'Raspberry Pi 3 Model B',
|
||||
'a22082' => 'Raspberry Pi 3 Model B',
|
||||
'a32082' => 'Raspberry Pi 3 Model B',
|
||||
'a52082' => 'Raspberry Pi 3 Model B',
|
||||
'a020d3' => 'Raspberry Pi 3 Model B+',
|
||||
'a220a0' => 'Compute Module 3',
|
||||
'a020a0' => 'Compute Module 3',
|
||||
'a52082' => 'Raspberry Pi 3 Model B+',
|
||||
'9020e0' => 'Raspberry Pi 3 Model A+',
|
||||
'a02100' => 'Compute Module 3+',
|
||||
'a03111' => 'Raspberry Pi 4B Rev 1.1 (1 GB)',
|
||||
'b03111' => 'Raspberry Pi 4B Rev 1.1 (2 GB)',
|
||||
'c03111' => 'Raspberry Pi 4B Rev 1.1 (4 GB)',
|
||||
'a03111' => 'Raspberry Pi 4 Model B (1 GB)',
|
||||
'b03111' => 'Raspberry Pi 4 Model B (2 GB)',
|
||||
'c03111' => 'Raspberry Pi 4 Model B (4 GB)',
|
||||
'b03112' => 'Raspberry Pi 4 Model B (2 GB)',
|
||||
'c03112' => 'Raspberry Pi 4 Model B (4 GB)',
|
||||
'd03114' => 'Raspberry Pi 4 Model B (8 GB)',
|
||||
'902120' => 'Raspberry Pi Zero 2 W',
|
||||
'a03140' => 'Compute Module 4 (1 GB)',
|
||||
'b03140' => 'Compute Module 4 (2 GB)',
|
||||
'c03140' => 'Compute Module 4 (4 GB)',
|
||||
|
||||
@@ -305,6 +305,23 @@ class Dashboard {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an SVG resource associated with a Pi revision
|
||||
*
|
||||
* @param string $deviceName
|
||||
* @return string
|
||||
*/
|
||||
public function getDeviceImage($deviceName): string
|
||||
{
|
||||
if (stripos($deviceName, 'zero') !== false) {
|
||||
return 'zero.php';
|
||||
}
|
||||
if (stripos($deviceName, 'compute') !== false) {
|
||||
return 'compute.php';
|
||||
}
|
||||
return 'default.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles dashboard page actions
|
||||
*
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
<div class="center-device col-12 col-lg-4">
|
||||
<div class="center-device-top">
|
||||
<a href="/system_info"><img class="device-illustration" src="app/img/device.php" alt="<?php echo htmlspecialchars($revision, ENT_QUOTES); ?>"></a>
|
||||
<a href="/system_info"><img class="device-illustration" src="app/img/devices/<?php echo $deviceImage; ?>" alt="<?php echo htmlspecialchars($revision, ENT_QUOTES); ?>"></a>
|
||||
<div class="device-label"><a href="/system_info"><?php echo htmlspecialchars($revision, ENT_QUOTES); ?></a></div>
|
||||
<div class="mt-1 small"><?php echo _("IP Address"); ?>: <a href="/dhcpd_conf"><?php echo htmlspecialchars($ipv4Address, ENT_QUOTES); ?></a></div>
|
||||
<div class="small"><?php echo _("Netmask"); ?>: <a href="/dhcpd_conf"><?php echo htmlspecialchars($ipv4Netmask, ENT_QUOTES); ?></a></div>
|
||||
|
||||
@@ -10,7 +10,7 @@ include('includes/sysstats.php');
|
||||
<h4 class="mt-3"><?php echo _("System Information"); ?></h4>
|
||||
<div class="row ms-1">
|
||||
<div class="col-4">
|
||||
<img class="device-illustration mx-3 my-2" src="app/img/device.php" alt="<?php echo htmlspecialchars($revision, ENT_QUOTES); ?>"></a>
|
||||
<img class="device-illustration mx-3 my-2" src="app/img/devices/<?php echo $deviceImage; ?>" alt="<?php echo htmlspecialchars($revision, ENT_QUOTES); ?>"></a>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<div class="row mb-1">
|
||||
|
||||
Reference in New Issue
Block a user