Skip to content
Snippets Groups Projects
Commit 5a3ff53d authored by Tibo's avatar Tibo
Browse files

Default name of sensor is short class name

parent 49a578fb
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,10 @@ abstract class AbstractSensor implements Sensor { ...@@ -22,6 +22,10 @@ abstract class AbstractSensor implements Sensor {
return $this->server; return $this->server;
} }
public function getName() : string {
return (new \ReflectionClass($this))->getShortName();
}
/** /**
* Return the last record if it contains the field $field, * Return the last record if it contains the field $field,
* otherwise return null. * otherwise return null.
......
...@@ -12,4 +12,10 @@ interface Sensor ...@@ -12,4 +12,10 @@ interface Sensor
public function __construct(Server $server); public function __construct(Server $server);
public function status(); public function status();
public function report(); public function report();
/**
* Get the name of this sensor (e.g meminfo, cpuload, heartbeat)
* @return string
*/
public function getName() : string;
} }
\ No newline at end of file
...@@ -82,7 +82,7 @@ window.monitorServerToken = "{{ $server->read_token }}"; ...@@ -82,7 +82,7 @@ window.monitorServerToken = "{{ $server->read_token }}";
@foreach ($server->getSensors() as $sensor) @foreach ($server->getSensors() as $sensor)
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
{{ get_class($sensor) }} {{ $sensor->getName() }}
<div class="float-right"> <div class="float-right">
{!! $sensor->getBadge() !!} {!! $sensor->getBadge() !!}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment