* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-6.sme
- Add in SM2 NutUPS configuration and status panel [SME: 12949]
This commit is contained in:
28
root/usr/share/smanager/themes/default/public/js/nutups.js
Normal file
28
root/usr/share/smanager/themes/default/public/js/nutups.js
Normal file
@@ -0,0 +1,28 @@
|
||||
$(document).ready(function() {
|
||||
function toggleUPSClasses() {
|
||||
var selectedOption = $('#Nutmode_select').val();
|
||||
$('.masterups').toggle(selectedOption === 'netserver' || selectedOption === 'standalone'); // Show/Hide masterups based on Net Server or Standalone
|
||||
$('.slaveups').toggle(selectedOption === 'netclient'); // Show/Hide slaveups based on Net Client
|
||||
|
||||
// Enable/Disable inputs based on the selected option
|
||||
$('.masterups input').prop('disabled', !(selectedOption === 'netserver' || selectedOption === 'standalone'));
|
||||
$('.slaveups input').prop('disabled', selectedOption !== 'netclient');
|
||||
}
|
||||
|
||||
function toggleGenerics() {
|
||||
var upsModelValue = $('#UPS_Model_select').val().toLowerCase(); // Get the current value from UPS_Model
|
||||
var isGenericUps = upsModelValue === 'genericups'; // Check if it's 'genericups'
|
||||
|
||||
// Show/Hide generics section and enable/disable inputs
|
||||
$('.generics').toggle(isGenericUps);
|
||||
$('.generics input').prop('disabled', !isGenericUps); // Enable/Disable inputs based on the value
|
||||
}
|
||||
|
||||
// Event listener for the selections
|
||||
$('#Nutmode_select').change(toggleUPSClasses);
|
||||
$('#UPS_Model_select').change(toggleGenerics); // Listen for changes in the UPS_Model dropdown
|
||||
|
||||
// Set the initial state based on current selections
|
||||
toggleGenerics();
|
||||
toggleUPSClasses();
|
||||
});
|
Reference in New Issue
Block a user