From 55066d2e6fbab91f61f1c1e38c5860d6a95bf7d7 Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Tue, 2 Sep 2025 09:22:59 +0200 Subject: [PATCH] =?UTF-8?q?Ger=C3=A4tetyp=20erweitert=20um=20Temperaturen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Layout/default/Devicetype/Form.php | 17 ++++++++++ application/Device/DeviceController.php | 2 ++ .../Devicetype/DevicetypeController.php | 13 ++++++++ application/Devicetype/DevicetypeModel.php | 2 ++ ...50902070036_devicetype_add_temperature.php | 33 +++++++++++++++++++ public/js/pages/Device/Device.js | 2 ++ 6 files changed, 69 insertions(+) create mode 100644 db/migrations/20250902070036_devicetype_add_temperature.php diff --git a/Layout/default/Devicetype/Form.php b/Layout/default/Devicetype/Form.php index 83bd9c70d..2a6bc254c 100644 --- a/Layout/default/Devicetype/Form.php +++ b/Layout/default/Devicetype/Form.php @@ -2,6 +2,12 @@ +
@@ -78,7 +84,18 @@ value="power ?>">
+
+ +
+ +
+
+ +
+
diff --git a/application/Device/DeviceController.php b/application/Device/DeviceController.php index 573bfc5ab..5c99a5ba0 100644 --- a/application/Device/DeviceController.php +++ b/application/Device/DeviceController.php @@ -44,6 +44,8 @@ class DeviceController extends mfBaseController "manufacturer" => $deviceType->devicemanufactor->name, "price" => $deviceType->price, "power" => $deviceType->power, + "temp_warning" => $deviceType->temp_warning, + "temp_critical" => $deviceType->temp_critical, "creator" => $deviceType->creator->name, "created" => $deviceType->create, ]; diff --git a/application/Devicetype/DevicetypeController.php b/application/Devicetype/DevicetypeController.php index 7950de6d3..3665059b1 100644 --- a/application/Devicetype/DevicetypeController.php +++ b/application/Devicetype/DevicetypeController.php @@ -76,6 +76,17 @@ class DevicetypeController extends mfBaseController } else { $power = $r->power; } + if (!$r->temp_warning) { + $temp_warning = "80"; + } else { + $temp_warning = $r->temp_warning; + } + + if (!$r->temp_critical) { + $temp_critical = "90"; + } else { + $temp_critical = $r->temp_critical; + } if ($r->olt) { @@ -88,6 +99,8 @@ class DevicetypeController extends mfBaseController $data['price'] = $price; $data['power'] = $power; $data['olt'] = $olt; + $data['temp_warning'] = $temp_warning; + $data['temp_critical'] = $temp_critical; if (!$data['name']) { $this->layout()->setFlash("Name darf nicht leer sein", "error"); diff --git a/application/Devicetype/DevicetypeModel.php b/application/Devicetype/DevicetypeModel.php index 829fef08d..c1754d029 100644 --- a/application/Devicetype/DevicetypeModel.php +++ b/application/Devicetype/DevicetypeModel.php @@ -7,6 +7,8 @@ class DevicetypeModel public $price = null; public $olt = null; public $devicemanufactor_id = null; + public $temp_warning = 80; + public $temp_critical = 90; public $create_by = null; diff --git a/db/migrations/20250902070036_devicetype_add_temperature.php b/db/migrations/20250902070036_devicetype_add_temperature.php new file mode 100644 index 000000000..ffff666d2 --- /dev/null +++ b/db/migrations/20250902070036_devicetype_add_temperature.php @@ -0,0 +1,33 @@ +getEnvironment() == "thetool") { + $table = $this->table("Devicetype"); + $table->addColumn("temp_warning", "integer", ['null' => false,'default' => '80', "after" => "power"]); + $table->addColumn("temp_critical", "integer", ['null' => false,'default' => '90', "after" => "temp_warning"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $this->table("Devicetype")->removeColumn("temp_warning")->save(); + $this->table("Devicetype")->removeColumn("temp_critical")->save(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} diff --git a/public/js/pages/Device/Device.js b/public/js/pages/Device/Device.js index 3b1c804a5..ef048a27b 100644 --- a/public/js/pages/Device/Device.js +++ b/public/js/pages/Device/Device.js @@ -241,6 +241,8 @@ Vue.component('DeviceType', { {text: 'Hersteller', key: 'manufacturer', filter: 'search', class: 'text-center'}, {text: 'Preis', key: 'price', filter: 'numberRange', class: 'text-center', suffix: ' €'}, {text: 'max. Leistung', key: 'power', filter: 'numberRange', class: 'text-center', suffix: ' W'}, + {text: 'Temp. Warnung', key: 'temp_warning', filter: 'numberRange', class: 'text-center', suffix: ' °C'}, + {text: 'Temp. Kritisch', key: 'temp_critical', filter: 'numberRange', class: 'text-center', suffix: ' °C'}, {text: 'Erstellungsdatum', key: 'created', filter: 'date', class: 'text-center'}, {text: 'Erstellt von', key: 'creator', filter: 'search', class: 'text-center'}, {text: 'Aktionen', key: 'actions', class: 'text-center', sortable: false, filter: false, priority: 9},