Update nutups and js file into generated mix

This commit is contained in:
2025-01-20 16:27:26 +00:00
parent c7dc45ccb5
commit 51a59b9696
12 changed files with 212 additions and 56 deletions

View File

@@ -1,5 +1,5 @@
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
#
#
# Routines to be edited by the developer to provide content and validation for parameters
@@ -50,6 +50,8 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
{$ret .= 'Validation for Nutmode failed';}
if (! TRUE) #validate $c->param('SlaveUPS_Name')
{$ret .= 'Validation for SlaveUPS_Name failed';}
if (! TRUE) #validate $c->param('MasterUPS_Name')
{$ret .= 'Validation for MasterUPS_Name failed';}
if (! TRUE) #validate $c->param('UPS_Model')
{$ret .= 'Validation for UPS_Model failed';}
if (! TRUE) #validate $c->param('UPS_Device')
@@ -88,6 +90,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
'status'=>'status contents',
'Nutmode'=>'Nutmode contents',
'SlaveUPS_Name'=>'SlaveUPS_Name contents',
'MasterUPS_Name'=>'MasterUPS_Name contents',
'UPS_Model'=>'UPS_Model contents',
'UPS_Device'=>'UPS_Device contents',
'UPS_gen_Type'=>'UPS_gen_Type contents',
@@ -153,6 +156,8 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
{$ret .= 'Perform/save failed for Nutmode';}
if (! TRUE) #copy or perform with value: SlaveUPS_Name e.g. $db->set_prop($dbkey,'SlaveUPS_Name',$c->param('SlaveUPS_Name'),type=>'service'))
{$ret .= 'Perform/save failed for SlaveUPS_Name';}
if (! TRUE) #copy or perform with value: MasterUPS_Name e.g. $db->set_prop($dbkey,'MasterUPS_Name',$c->param('MasterUPS_Name'),type=>'service'))
{$ret .= 'Perform/save failed for MasterUPS_Name';}
if (! TRUE) #copy or perform with value: UPS_Model e.g. $db->set_prop($dbkey,'UPS_Model',$c->param('UPS_Model'),type=>'service'))
{$ret .= 'Perform/save failed for UPS_Model';}
if (! TRUE) #copy or perform with value: UPS_Device e.g. $db->set_prop($dbkey,'UPS_Device',$c->param('UPS_Device'),type=>'service'))
@@ -174,4 +179,9 @@ sub create_link{
my $link = "$route?trt=$panel&Selected=$index";
return $link;
}
sub get_model_options{
return [];
}
1;

View File

@@ -1,11 +1,11 @@
package SrvMngr::Controller::Nutups;
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
#
#----------------------------------------------------------------------
# heading : Network
# heading : System
# description : NutUPS configuration
# navigation : 6000 6700
# navigation : 4000 700
#
# name : nutups, method : get, url : /nutups, ctlact : Nutups#main
# name : nutupsu, method : post, url : /nutupsu, ctlact : Nutups#do_update

View File

@@ -1,5 +1,5 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
%#
<div id="Nutups-CONFIG" class="partial Nutups-CONFIG">
<script>
@@ -25,7 +25,7 @@
</span><span class=data>
% my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled']];
% param 'status' => $nut_data->{status} unless param 'status';
%= select_field 'status' => @status_options, class => 'input'
%= select_field 'status' => @status_options, class => 'input', id => 'status_select'
<br></span> </p>
<p><span class=label>
@@ -33,10 +33,13 @@
</span><span class=data>
% my @Nutmode_options = [['Standalone' => 'standalone'], ['Net Server' => 'netserver'], ['Net Client ' => 'netclient']];
% param 'Nutmode' => $nut_data->{Nutmode} unless param 'Nutmode';
%= select_field 'Nutmode' => @Nutmode_options, class => 'input'
%= select_field 'Nutmode' => @Nutmode_options, class => 'input', id => 'Nutmode_select'
<br></span> </p>
<h2 class='subh3'><%=l('nut_if_Net_Client')%></h2>
<div class=slaveups>
<h2 class='subh3'><%=l('nut_if_Net_Server')%></h2>
<p><span class=label>
%=l('nut_SlaveUPS_UPSNAME@IP')
@@ -50,15 +53,42 @@
</span><span class=data>
% param 'SlaveUPS_Password' => $nut_data->{SlaveUPS_Password} unless param 'SlaveUPS_Password';
%=password_field 'SlaveUPS_Password', class => 'pass4 sme-password'
</span>span></p>
</span></p>
</div>
<div class=masterups>
<h2 class='subh4'><%=l('nut_if_Net_Master')%></h2>
<p><span class=label>
%=l('nut_MasterUPS_UPSNAME@IP')
</span><span class=data>
% param 'MasterUPS_Name' => $nut_data->{MasterUPS_Name} unless param 'MasterUPS_Name';
%= text_field 'MasterUPS_Name', size => '50', class => 'textinput MasterUPS_Name' , pattern=>'.*' , placeholder=>'MasterUPS_Name'
<br></span></p>
<p><span class='label'>
%=l('nut_MasterUPS_Password')
</span><span class=data>
% param 'MasterUPS_Password' => $nut_data->{MasterUPS_Password} unless param 'MasterUPS_Password';
%=password_field 'MasterUPS_Password', class => 'pass6 sme-password'
</span></p>
</div>
<p><span class=label>
%=l('nut_UPS_Model')
</span><span class=data>
% my @UPS_Model_options = ;
% param 'UPS_Model' => $nut_data->{UPS_Model} unless param 'UPS_Model';
%= text_field 'UPS_Model', size => '50', class => 'textinput UPS_Model' , pattern=>'.*' , placeholder=>'UPS_Model'
<br></span></p>
%= select_field 'UPS_Model' => @UPS_Model_options, class => 'input', id => 'UPS_Model_select'
<br></span> </p>
<p><span class=label>
%=l('nut_UPS_Device')
@@ -67,7 +97,10 @@
%= text_field 'UPS_Device', size => '50', class => 'textinput UPS_Device' , pattern=>'.*' , placeholder=>'UPS_Device'
<br></span></p>
<h2 class='subh4'><%=l('nut_if_genericups')%></h2>
<div class=generics>
<h2 class='subh5'><%=l('nut_if_genericups')%></h2>
<p><span class=label>
%=l('nut_UPS_Generic_Type')
@@ -90,6 +123,13 @@
%= text_field 'UPS_gen_Model', size => '50', class => 'textinput UPS_gen_Model' , pattern=>'.*' , placeholder=>'UPS_gen_Model'
<br></span></p>
<span class='data'>
%= submit_button l('nut_Save'), class => 'action subm12'
</span>
</div>
%# Probably finally by a submit.
%end
</div>

View File

@@ -1,5 +1,5 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
%#
<div id="Nutups-STATUS" class="partial Nutups-STATUS">
<script>

View File

@@ -1,12 +1,12 @@
/*
Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:09:58
*/
.Nutups-panel {}
.name {}
.rout {}
.grou {}
.grou1 {}
.link1 {}
.endg {}
.endg1 {}
.subh1 {}
.para1 {}
.text1 {}
@@ -15,12 +15,55 @@ Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Pytho
.subh2 {}
.sele1 {}
.sele2 {}
.grou2 {}
.subh3 {}
.text3 {}
.pass4 {}
.text5 {}
.text6 {}
.endg2 {}
.grou3 {}
.subh4 {}
.text5 {}
.pass6 {}
.endg3 {}
.text7 {}
.text8 {}
.subh5 {}
.text9 {}
.text10 {}
.text11 {}
.subm12 {}
.inline-buttons {
display: flex; /* Use flexbox to arrange items horizontally */
gap: 10px; /* Optional: Add space between buttons */
}
.inline-buttons .link {
/* Additional styling can be added here if needed */
}
.inline-buttons .link {
display: inline-block; /* Keep links as inline-block for button shape */
padding: 7px 14px; /* Adjusted padding to approximate 70% of the original */
margin: 0; /* Remove margin */
background-color: #efefef; /* Light gray background color */
color: black; /* Text color */
text-decoration: none; /* Remove underline */
border: 2px solid #bbb; /* Thin, light gray border */
border-radius: 3px; /* Slightly rounded corners */
font-size: 11.2px; /* Adjusted font size to approximate 70% of the original */
text-align: center; /* Center the text */
cursor: pointer; /* Pointer cursor on hover */ }
/* Hover and active effects for better interaction */
.inline-buttons .link:hover {
background-color: #d9d9d9; /* Darker shade on hover */
}
.inline-buttons .link:active {
background-color: #c0c0c0; /* Even darker shade on click */
}
span .label {
padding-top:13em;
}

View File

@@ -1,10 +1,11 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
%#
% layout 'default', title => "Sme server 2 - NutUPS configuration", share_dir => './';
%# css specific to this panel:
% content_for 'module' => begin
%= stylesheet '/css/nutups.css'
%= javascript '/js/nutups.js'
<div id="module" class="module Nutups-panel">
% if ($config->{debug} == 1) {

20
Targets/Nutups/nutups.js Normal file
View File

@@ -0,0 +1,20 @@
//
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:09:58
//
$(document).ready(function() {
function toggleUPSClasses() {
var selectedOption = $('#Nutmode_select').val();
$('.masterups').toggle(selectedOption === 'netclient'); // Show/Hide masterups based on Net Client
$('.slaveups').toggle(selectedOption === 'netserver'); // Show/Hide slaveups based on Net Server
// Enable/Disable inputs based on the selected option
$('.masterups input').prop('disabled', selectedOption !== 'netclient');
$('.slaveups input').prop('disabled', selectedOption !== 'netserver');
}
// Event listener for the select change
$('#Nutmode_select').change(toggleUPSClasses);
// Set the initial state
toggleUPSClasses();
});

View File

@@ -1,25 +1,29 @@
#
# Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 12:01:10
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
#
'nut_Nut_mode' => 'Nut mode',
'nut_UPS_Generic_Type' => 'UPS Generic Type',
'nut_Error_Status_Report' => 'Error Status Report',
'nut_Manage_Nutups-config_settings:' => 'Manage Nutups-config settings',
'nut_if_Net_Client' => 'If Net Client',
'nut_Status_of_the_controlled_UPS' => 'Status of the controlled UPS',
'nut_Status_(from_upsd)' => 'Status from upset',
'nut_if_genericups' => 'If generic's',
'nut_NutUPS_configuration' => 'cutups configuration',
'nut_Nut_status' => 'Nut status',
'nut_UPS_Generic_Manufacturer' => 'UPS Generic Manufacturer',
'nut_Configure_NutUPS' => 'Configure cutups',
'nut_Descriptive_paragraph' => 'Descriptive paragraph',
'nut_UPS_Device' => 'UPS Device',
'nut_Status_Report' => 'Status Report',
'nut_SlaveUPS_Password' => 'slaves Password',
'nut_UPS_Model' => 'UPS Model',
'nut_APPLY' => 'Apply',
'nut_UPS_Generic_Model' => 'UPS Generic Model',
'nut_SlaveUPS_UPSNAME@IP' => 'slaves UPSNAME@IP',
'nut_UPS_Model' => 'UPS Model',
'nut_Manage_Nutups-config_settings:' => 'Manage Nutups-config settings',
'nut_Descriptive_paragraph' => 'Descriptive paragraph',
'nut_MasterUPS_UPSNAME@IP' => 'masters UPSNAME@IP',
'nut_Nut_status' => 'Nut status',
'nut_Configure_NutUPS' => 'Configure cutups',
'nut_SlaveUPS_Password' => 'slaves Password',
'nut_CONFIG_panel_action_was_successful' => 'CONFIG panel action was successful',
'nut_UPS_Generic_Type' => 'UPS Generic Type',
'nut_Status_(from_upsd)' => 'Status from upset',
'nut_Error_Status_Report' => 'Error Status Report',
'nut_if_Net_Server' => 'If Net Server',
'nut_if_genericups' => 'If generic's',
'nut_if_Net_Master' => 'If Net Master',
'nut_STATUS_panel_action_was_successful' => 'STATUS panel action was successful',
'nut_Nut_mode' => 'Nut mode',
'nut_Status_Report' => 'Status Report',
'nut_MasterUPS_Password' => 'masters Password',
'nut_NutUPS_configuration' => 'cutups configuration',
'nut_APPLY' => 'Apply',
'nut_UPS_Device' => 'UPS Device',
'nut_UPS_Generic_Manufacturer' => 'UPS Generic Manufacturer',
'nut_Status_of_the_controlled_UPS' => 'Status of the controlled UPS',
'nut_SlaveUPS_UPSNAME@IP' => 'slaves UPSNAME@IP',
'nut_Save' => 'Save',