From 890b956f39019ad78ee667282fc74ff666121fb6 Mon Sep 17 00:00:00 2001 From: Meliox Date: Mon, 6 Apr 2026 16:56:32 +0200 Subject: [PATCH] minor fixes for method call references --- PveMod_SensorInfo.pm | 26 +++++--------------------- PveMod_pvemanagerlib.js | 26 ++++++++++++++------------ pve-mod-gui-sensors.sh | 5 +++-- 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/PveMod_SensorInfo.pm b/PveMod_SensorInfo.pm index baa96c6..b04609d 100644 --- a/PveMod_SensorInfo.pm +++ b/PveMod_SensorInfo.pm @@ -19,7 +19,7 @@ my %config = ( gpu => { intel_enabled => 1, amd_enabled => 0, - nvidia_enabled => 1, + nvidia_enabled => 0, }, debug => { nvidia_mode => 1, @@ -174,22 +174,6 @@ sub _acquire_exclusive_lock { return $fh; } -sub _is_lock_stale { - my ($lock_path) = @_; - - return 0 unless open(my $fh, '<', $lock_path); - - my $lock_pid = <$fh>; - chomp $lock_pid if defined $lock_pid; - close($fh); - - # Invalid or missing PID - return 1 unless defined $lock_pid && $lock_pid =~ /^\d+$/; - - # Valid PID but process is dead - return !_is_process_alive($lock_pid); -} - sub _ensure_pve_mod_directory_exists { unless (-d $pve_mod_working_dir) { _debug(__LINE__, "Creating directory $pve_mod_working_dir"); @@ -1383,7 +1367,7 @@ sub _parse_upsc_output { # API calls # ============================================================================ -sub get_graphic_stats { +sub get_graphic_info { # todo name the process without overruling other processes _debug(__LINE__, "get_graphic_stats called"); @@ -1483,7 +1467,7 @@ sub get_graphic_stats { return $last_snapshot; } -sub get_sensors_stats { +sub get_sensors_info { _debug(__LINE__, "get_sensors_stats called"); # Start PVE Mod @@ -1516,7 +1500,7 @@ sub get_sensors_stats { return $sensors_data; } -sub get_ups_stats { +sub get_ups_info { _debug(__LINE__, "get_ups_stats called"); # Start PVE Mod @@ -2006,4 +1990,4 @@ END { } } -1; +1; \ No newline at end of file diff --git a/PveMod_pvemanagerlib.js b/PveMod_pvemanagerlib.js index 9342af0..77cb26a 100644 --- a/PveMod_pvemanagerlib.js +++ b/PveMod_pvemanagerlib.js @@ -158,7 +158,7 @@ Ext.define('PVE.node.StatusView', { iconCls: 'fa fa-fw fa-desktop', title: gettext('GPU Usage'), printBar: false, - textField: 'gpuStats', + textField: 'PveMod_graphicsInfo', renderer: function(gpuStats) { if (!gpuStats || !gpuStats.Graphics) { return ''; @@ -279,7 +279,7 @@ Ext.define('PVE.node.StatusView', { printBar: false, title: gettext('CPU Thermal State'), iconCls: 'fa fa-fw fa-thermometer-half', - textField: 'pveMod_sensorInfo_json', + textField: 'PveMod_JsonSensorInfo', renderer: function(value){ // sensors configuration const cpuTempHelper = Ext.create('PVE.mod.TempHelper', {srcUnit: PVE.mod.TempHelper.CELSIUS, dstUnit: PVE.mod.TempHelper.CELSIUS}); @@ -453,7 +453,7 @@ Ext.define('PVE.node.StatusView', { iconCls: 'fa fa-fw fa-desktop', title: gettext('GPU Details'), printBar: false, - textField: 'gpuStats', + textField: 'PveMod_graphicsInfo', renderer: function(gpuStats) { if (!gpuStats || !gpuStats.Graphics) { return ''; @@ -564,7 +564,7 @@ Ext.define('PVE.node.StatusView', { printBar: false, title: gettext('NVMe Temperatures'), iconCls: 'fa fa-fw fa-thermometer-half', - textField: 'pveMod_sensorInfo_json', + textField: 'PveMod_JsonSensorInfo', renderer: function(value) { // sensors configuration const addressPrefix = "nvme-pci-"; @@ -649,7 +649,7 @@ Ext.define('PVE.node.StatusView', { printBar: false, title: gettext('System Fans'), iconCls: 'fa fa-fw fa-snowflake-o', - textField: 'pveMod_sensorInfo_json', + textField: 'PveMod_JsonSensorInfo', renderer: function(value) { // --- let objValue; @@ -711,13 +711,15 @@ Ext.define('PVE.node.StatusView', { printBar: false, title: gettext('GPU Fans'), iconCls: 'fa fa-fw fa-snowflake-o', - textField: 'gpuStats', + textField: 'PveMod_graphicsInfo', renderer: function(gpuStats) { if (!gpuStats || !gpuStats.Graphics || !gpuStats.Graphics.NVIDIA) { - return 'N/A'; + return ''; } let rows = []; + + // todo: handle intel, amd Object.keys(gpuStats.Graphics.NVIDIA).sort().forEach(key => { const gpuData = gpuStats.Graphics.NVIDIA[key]; @@ -737,7 +739,7 @@ Ext.define('PVE.node.StatusView', { '', ); }); - + if (rows.length === 0) { return 'N/A'; } @@ -751,7 +753,7 @@ Ext.define('PVE.node.StatusView', { printBar: false, title: gettext('UPS Status'), iconCls: 'fa fa-fw fa-battery-three-quarters', - textField: 'upsStats', + textField: 'PveMod_upsInfo', renderer: function(value) { let objValue = {}; try { @@ -985,7 +987,7 @@ Ext.define('PVE.node.StatusView', { colspan: 2, printBar: false, title: gettext('Sensor Mod Version'), - textField: 'pveMod_sensorInfo_version', + textField: 'PveMod_Version', value: '', }, { @@ -993,7 +995,7 @@ Ext.define('PVE.node.StatusView', { colspan: 2, printBar: false, title: gettext('Information'), - textField: 'pveMod_sensorInfo_systemInfo', + textField: 'PveMod_systemInfo', renderer: function(value) { if (value === null || value === undefined) { return ''; @@ -1029,4 +1031,4 @@ Ext.define('PVE.node.StatusView', { me.callParent(); }, -}); +}); \ No newline at end of file diff --git a/pve-mod-gui-sensors.sh b/pve-mod-gui-sensors.sh index fda800b..bbdfd73 100644 --- a/pve-mod-gui-sensors.sh +++ b/pve-mod-gui-sensors.sh @@ -569,8 +569,9 @@ insert_sensor_monitor_into_pve() { # Collect sensor data from PveMod_SensorInfo\ # Bad practice to add use here, but cleaner implementation would require several extensive modifications.\ use PVE::API2::PVEMod_SensorInfo;\ - $res->{pveMod_sensorInfo_json} = PVE::API2::PVEMod_SensorInfo::get_sensors_stats();\ - $res->{pveMod_sensorInfo_version} = PVE::API2::PVEMod_SensorInfo::get_pve_mod_version();\ + $res->{PveMod_JsonSensorInfo} = PVE::API2::PVEMod_SensorInfo::get_sensors_info();\ + $res->{PveMod_graphicsInfo} = PVE::API2::PVEMod_SensorInfo::get_pve_mod_version();\ + $res->{PveMod_upsInfo} = PVE::API2::PVEMod_SensorInfo::get_ups_info();\ ' "$NODES_PM_FILE" #endregion PveSensorInfoMod heredoc info "Sensor data retriever added to \"$NODES_PM_FILE\"."