diff --git a/station/config.py b/station/config.py index a713fb4..29d7882 100644 --- a/station/config.py +++ b/station/config.py @@ -1,4 +1,4 @@ masterUrl = "http://10.0.0.8" -apiKey = "5b20d5f4-11ce-4125-86fb-601e66143388" -pullInterval = 120 # in sec +apiKey = "783439f5-be14-4877-a396-6d8bc4783c3c" +pullInterval = 120 # in sec planInterval = 1200 # in sec \ No newline at end of file diff --git a/station/planner.py b/station/planner.py index 31f6839..0a43a90 100644 --- a/station/planner.py +++ b/station/planner.py @@ -29,7 +29,7 @@ def plan(lat, lon, alt, tle, transmitter, receiver, priority, name, delta = time start = ob[0] end = ob[1] - if start <= last: + if start <= (last + timedelta(seconds=60)): # must be minute after last print(f"[INFO] alredy planed {name} at {start}") continue diff --git a/web/CONTROLLERS/dashboard.php b/web/CONTROLLERS/dashboard.php index 7d66fd4..7d4a253 100644 --- a/web/CONTROLLERS/dashboard.php +++ b/web/CONTROLLERS/dashboard.php @@ -75,6 +75,7 @@ $stations = (new \wsos\database\core\table(\DAL\station::class))->getAll()->values; foreach ($stations as $station) { $context["stations"][] = [ + "id" => $station->id->get(), "name" => $station->name->get(), "observations" => $observationTable->count("receiver.station.id == ?", [$station->id->get()]), "lastSeen" => $station->lastSeen->strDelta() diff --git a/web/CONTROLLERS/station.php b/web/CONTROLLERS/station.php new file mode 100644 index 0000000..03375bd --- /dev/null +++ b/web/CONTROLLERS/station.php @@ -0,0 +1,42 @@ +get("templateLoader"); + $router = $container->get("router"); + $context = $container->get("context"); + $auth = $container->get("auth"); + + // to show this page user must be logined + $auth->requireLogin(); + + //get station ID + $stationId = $router->getArgs()[0]; + + //get correct observation + $context["station"] = new \DAL\station(new \wsos\database\types\uuid($stationId)); + $context["station"]->fetch(); + + $observationsTable = new \wsos\database\core\table(\DAL\observation::class); + $ob = new \DAL\observation(); + + $context["receivers"] = new \wsos\database\core\table(\DAL\receiver::class); + $context["receivers"] = $context["receivers"]->query( + "station.id == ?", [$stationId] + )->values; + + $context["station"] = [ + "id" => $context["station"]->id->get(), + "name" => $context["station"]->name->get(), + "apiKey" => $context["station"]->apiKey->get(), + "lat" => $context["station"]->locator->get()["gps"]["lat"], + "lon" => $context["station"]->locator->get()["gps"]["lon"], + "alt" => $context["station"]->locator->get()["gps"]["alt"], + "lastSeen" => $context["station"]->lastSeen->strDelta(), + "description" => $context["station"]->description->get(), + "success" => $observationsTable->count("status==? && receiver.station.id == ?", [$ob->status->getVal("success"), $stationId]), + "fail" => $observationsTable->count("status==? && receiver.station.id == ?", [$ob->status->getVal("fail"), $stationId]) + ]; + + $templates->load("station.html"); + $templates->render($context); + $templates->show(); \ No newline at end of file diff --git a/web/VIEWS/blocks/receiver-item.html b/web/VIEWS/blocks/receiver-item.html new file mode 100644 index 0000000..ebc2591 --- /dev/null +++ b/web/VIEWS/blocks/receiver-item.html @@ -0,0 +1,6 @@ + + {% BIND item.centerFrequency %}Hz + {% BIND item.bandwidth %}Hz + {% BIND item.gain %} + + \ No newline at end of file diff --git a/web/VIEWS/blocks/station-item.html b/web/VIEWS/blocks/station-item.html index 716a94b..ceb7c16 100644 --- a/web/VIEWS/blocks/station-item.html +++ b/web/VIEWS/blocks/station-item.html @@ -1,4 +1,4 @@ - + {% BIND item.name %} {% BIND item.observations %} {% BIND item.lastSeen %} ago diff --git a/web/VIEWS/station.html b/web/VIEWS/station.html new file mode 100644 index 0000000..fe7722f --- /dev/null +++ b/web/VIEWS/station.html @@ -0,0 +1,156 @@ + + +{% INCLUDE layout/head.html %} + + +
+ {% BINDINCLUDE layout/header.html logined %} + + + +
+
+
+ +
+
+
+
+
+

Base info

+
+
+
+
+
Name
+
+ {% BIND station.name %} +
+
+ + +
+
GPS ALT
+
{% BIND station.alt %}m
+
+
+
Last seen
+
ago {% BIND station.lastSeen %}
+
+
+
API Key
+
+ {% BIND station.apiKey %} +
+
+
+
Success observations
+
{% BIND station.success %}
+
+
+
Fail observations
+
{% BIND station.fail %}
+
+
+
+
+
Description
+
{% BIND station.description %}
+
+
+
+
+
+
+ +
+
+
+
+
+

Station receivers

+
+
+ + + + + + + + + + + {% FOREACH receivers RENDER blocks/receiver-item.html %} + +
FrequencyBandwidthGainActions
+
+
+
+
+
+ +
+
+
+
+
+

Station rotators

+
+
+ + + + + + + + + + + +
DriverPort/HostActions
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + + \ No newline at end of file diff --git a/web/index.php b/web/index.php index a8297e5..90e8f1a 100644 --- a/web/index.php +++ b/web/index.php @@ -22,6 +22,7 @@ "datatypes" => ["controller" => __DIR__ . "/CONTROLLERS/datatypes.php", "name" => "Data Types", "icon" => "/static/icons/file-analytics.svg", "menu" => true], */ "observation" => ["controller" => __DIR__ . "/CONTROLLERS/observation.php", "name" => "Observation view", "menu" => false], + "station" => ["controller" => __DIR__ . "/CONTROLLERS/station.php", "name" => "Station view", "menu" => false], "login" => ["controller" => __DIR__ . "/CONTROLLERS/login.php", "name" => "Login", "menu" => false], "api" => ["controller" => __DIR__ . "/API/main.php", "name" => "api", "menu" => false], ],