Project

General

Profile

Feature #14255 » 1026.diff

Steve Wheeler, 04/11/2023 05:14 PM

View differences:

src/usr/local/www/widgets/javascript/thermal_sensors.js
80 80
		if (sensorName.indexOf("cpu") > -1) { //check CPU Threshold config settings
81 81
			warningTemp = tsParams.coreWarningTempThreshold;
82 82
			criticalTemp = tsParams.coreCriticalTempThreshold;
83
		} else if (sensorName.indexOf("pch") > -1) { //check PCH Threshold config settings
84
			warningTemp = tsParams.pchWarningTempThreshold;
85
			criticalTemp = tsParams.pchCriticalTempThreshold;			
83 86
		} else { //assuming sensor is for a zone, check Zone Threshold config settings
84 87
			warningTemp = tsParams.zoneWarningTempThreshold;
85 88
			criticalTemp = tsParams.zoneCriticalTempThreshold;
......
133 136
		if (sensorName.indexOf("cpu") > -1) { //check CPU Threshold config settings
134 137
			warningTemp = tsParams.coreWarningTempThreshold;
135 138
			criticalTemp = tsParams.coreCriticalTempThreshold;
139
		} else if (sensorName.indexOf("pch") > -1) { //check PCH Threshold config settings
140
			warningTemp = tsParams.pchWarningTempThreshold;
141
			criticalTemp = tsParams.pchCriticalTempThreshold;			
136 142
		} else { //assuming sensor is for a zone, check Zone Threshold config settings
137 143
			warningTemp = tsParams.zoneWarningTempThreshold;
138 144
			criticalTemp = tsParams.zoneCriticalTempThreshold;
src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
124 124
		$_POST["thermal_sensors_widget_zone_critical_threshold"] = floor(($_POST["thermal_sensors_widget_zone_critical_threshold"] - 32) / 1.8);
125 125
		$_POST["thermal_sensors_widget_core_warning_threshold"] = floor(($_POST["thermal_sensors_widget_core_warning_threshold"] - 32) / 1.8);
126 126
		$_POST["thermal_sensors_widget_core_critical_threshold"] = floor(($_POST["thermal_sensors_widget_core_critical_threshold"] - 32) / 1.8);
127
		$_POST["thermal_sensors_widget_pch_warning_threshold"] = floor(($_POST["thermal_sensors_widget_pch_warning_threshold"] - 32) / 1.8);
128
		$_POST["thermal_sensors_widget_pch_critical_threshold"] = floor(($_POST["thermal_sensors_widget_pch_critical_threshold"] - 32) / 1.8);
127 129
	}
128 130

  
129 131
	set_customwidgettitle($user_settings);
130 132
	saveThresholdSettings($user_settings, $_POST, "thermal_sensors_widget_zone_warning_threshold", "thermal_sensors_widget_zone_critical_threshold");
131 133
	saveThresholdSettings($user_settings, $_POST, "thermal_sensors_widget_core_warning_threshold", "thermal_sensors_widget_core_critical_threshold");
134
	saveThresholdSettings($user_settings, $_POST, "thermal_sensors_widget_pch_warning_threshold", "thermal_sensors_widget_pch_critical_threshold");
132 135

  
133 136
	//handle checkboxes separately
134 137
	saveGraphDisplaySettings($user_settings, $_POST, "thermal_sensors_widget_show_raw_output");
......
150 153
$thermal_sensors_widget_zoneCriticalTempThreshold = getThresholdValueFromConfig($user_settings, "thermal_sensors_widget_zone_critical_threshold", DEFAULT_CRITICAL_THRESHOLD, $widgetkey);
151 154
$thermal_sensors_widget_coreWarningTempThreshold = getThresholdValueFromConfig($user_settings, "thermal_sensors_widget_core_warning_threshold", DEFAULT_WARNING_THRESHOLD, $widgetkey);
152 155
$thermal_sensors_widget_coreCriticalTempThreshold = getThresholdValueFromConfig($user_settings, "thermal_sensors_widget_core_critical_threshold", DEFAULT_CRITICAL_THRESHOLD, $widgetkey);
156
$thermal_sensors_widget_pchWarningTempThreshold = getThresholdValueFromConfig($user_settings, "thermal_sensors_widget_pch_warning_threshold", DEFAULT_WARNING_THRESHOLD, $widgetkey);
157
$thermal_sensors_widget_pchCriticalTempThreshold = getThresholdValueFromConfig($user_settings, "thermal_sensors_widget_pch_critical_threshold", DEFAULT_CRITICAL_THRESHOLD, $widgetkey);
153 158

  
154 159
//get display settings from config (apply defaults if missing)
155 160
$thermal_sensors_widget_showRawOutput = getBoolValueFromConfig($user_settings, "thermal_sensors_widget_show_raw_output", false, $widgetkey);
......
171 176
			zoneCriticalTempThreshold:<?= $thermal_sensors_widget_zoneCriticalTempThreshold; ?>,
172 177
			coreWarningTempThreshold:<?= $thermal_sensors_widget_coreWarningTempThreshold; ?>,
173 178
			coreCriticalTempThreshold:<?= $thermal_sensors_widget_coreCriticalTempThreshold; ?>,
179
			pchWarningTempThreshold:<?= $thermal_sensors_widget_pchWarningTempThreshold; ?>,
180
			pchCriticalTempThreshold:<?= $thermal_sensors_widget_pchCriticalTempThreshold; ?>,
174 181
			showRawOutput:<?= $thermal_sensors_widget_showRawOutput ? "true" : "false"; ?>,
175 182
			showFullSensorName:<?= $thermal_sensors_widget_showFullSensorName ? "true" : "false"; ?>,
176 183
			pulsateWarning:<?= $thermal_sensors_widget_pulsateWarning ? "true" : "false"; ?>,
......
187 194
				$("#thermal_sensors_widget_zone_critical_threshold").val(function(){return getFahrenheitValue(this.value);});
188 195
				$("#thermal_sensors_widget_core_warning_threshold").val(function(){return getFahrenheitValue(this.value);});
189 196
				$("#thermal_sensors_widget_core_critical_threshold").val(function(){return getFahrenheitValue(this.value);});
197
				$("#thermal_sensors_widget_pch_warning_threshold").val(function(){return getFahrenheitValue(this.value);});
198
				$("#thermal_sensors_widget_pch_critical_threshold").val(function(){return getFahrenheitValue(this.value);});
190 199
			} else {
191 200
				$(".thermal_sensors_widget_unit").html('<?=gettext("&deg;C")?>');
192 201
				$(".thermal_sensors_widget_range").html('<?=gettext("(1&ndash;100)")?>');
......
194 203
				$("#thermal_sensors_widget_zone_critical_threshold").val(function(){return getCelsiusValue(this.value);});
195 204
				$("#thermal_sensors_widget_core_warning_threshold").val(function(){return getCelsiusValue(this.value);});
196 205
				$("#thermal_sensors_widget_core_critical_threshold").val(function(){return getCelsiusValue(this.value);});
206
				$("#thermal_sensors_widget_pch_warning_threshold").val(function(){return getCelsiusValue(this.value);});
207
				$("#thermal_sensors_widget_pch_critical_threshold").val(function(){return getCelsiusValue(this.value);});
197 208
			}
198 209
		});
199 210
		// --------------------- Centralized widget refresh system ------------------------------
......
233 244
	$thermal_sensors_widget_zoneCriticalTempThreshold = ceil($thermal_sensors_widget_zoneCriticalTempThreshold * 1.8 + 32);
234 245
	$thermal_sensors_widget_coreWarningTempThreshold = ceil($thermal_sensors_widget_coreWarningTempThreshold * 1.8 + 32);
235 246
	$thermal_sensors_widget_coreCriticalTempThreshold = ceil($thermal_sensors_widget_coreCriticalTempThreshold * 1.8 + 32);
247
	$thermal_sensors_widget_pchWarningTempThreshold = ceil($thermal_sensors_widget_pchWarningTempThreshold * 1.8 + 32);
248
	$thermal_sensors_widget_pchCriticalTempThreshold = ceil($thermal_sensors_widget_pchCriticalTempThreshold * 1.8 + 32);
236 249
}
237 250
?>
238 251
<div style="padding: 5px">
......
281 294
			</div>
282 295
		</div>
283 296

  
297
		<div class="form-group">
298
			<label class="col-sm-4 control-label"><?=gettext('PCH Warning')?></label>
299
			<div class="col-sm-4">
300
				<input type="text" name="thermal_sensors_widget_pch_warning_threshold" id="thermal_sensors_widget_pch_warning_threshold" value="<?= $thermal_sensors_widget_pchWarningTempThreshold; ?>" class="form-control" />
301
			</div>
302
		</div>
303

  
304
		<div class="form-group">
305
			<label class="col-sm-4 control-label"><?=gettext('PCH Critical')?></label>
306
			<div class="col-sm-4">
307
				<input type="text" name="thermal_sensors_widget_pch_critical_threshold" id="thermal_sensors_widget_pch_critical_threshold" value="<?= $thermal_sensors_widget_pchCriticalTempThreshold; ?>" class="form-control" />
308
			</div>
309
		</div>
310

  
284 311
		<div class="form-group">
285 312
			<label class="col-sm-6 control-label"><?=gettext('Display settings:')?></label>
286 313
		</div>
(2-2/2)