Add software tool functionality with device connection and upgrade options

- Implemented the software tool page with user interface for connecting devices.
- Added functionality to display connection status and software upgrade options.
- Included a help modal with step-by-step instructions for users.
- Integrated error handling and user permission checks.
- Enhanced user experience with dynamic content updates and visual feedback.
This commit is contained in:
“VeLiTi”
2025-12-21 14:16:55 +01:00
parent e57e0edbc4
commit 653e33d7e9
34 changed files with 2915 additions and 169 deletions

View File

@@ -233,10 +233,13 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
$sw_version = substr($sw_version, 0, -4);
}
// Translate hardware version to standardized format
$translated_hw_version = translateDeviceHardwareVersion($hw_version);
//Update Equipment record
$sql = "UPDATE equipment SET hw_version = ?, sw_version = ? $whereclause";
$stmt = $pdo->prepare($sql);
$stmt->execute([$hw_version,$sw_version]);
$stmt->execute([$translated_hw_version,$sw_version]);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Update equipment status ++++++++++++++++++++++++++

View File

@@ -62,16 +62,25 @@ $clause = substr($clause, 2); //Clean clause - remove first comma
$clause_insert = substr($clause_insert, 2); //Clean clause - remove first comma
$input_insert = substr($input_insert, 1); //Clean clause - remove first comma
//VALIDATE: Prevent FROM and TO being the same version
if (($command == 'insert' || $command == 'update') &&
isset($criterias['from_version_id']) && isset($criterias['to_version_id']) &&
$criterias['from_version_id'] == $criterias['to_version_id']) {
http_response_code(400);
echo json_encode(["error" => "FROM version cannot be the same as TO version in upgrade path"]);
exit;
}
//QUERY AND VERIFY ALLOWED
if ($command == 'update' && isAllowed('products_software_upgrade_paths',$profile,$permission,'U') === 1){
$sql = 'UPDATE products_software_upgrade_paths SET '.$clause.' WHERE rowID = ? ';
$execute_input[] = $id;
$stmt = $pdo->prepare($sql);
$stmt->execute($execute_input);
}
}
elseif ($command == 'insert' && isAllowed('products_software_upgrade_paths',$profile,$permission,'C') === 1){
//INSERT NEW ITEM
$sql = 'INSERT INTO products_software_upgrade_paths ('.$clause_insert.') VALUES ('.$input_insert.')';
$stmt = $pdo->prepare($sql);

View File

@@ -41,8 +41,11 @@ else {
//do nothing
}
//translate HW_VERSION to correct string
if (isset($post_content['hw_version']) && $post_content['hw_version'] !=''){$post_content['hw_version'] =translateDeviceHardwareVersion($post_content['hw_version']); }
//CREATE NEW ARRAY AND MAP TO CLAUSE
if(isset($post_content) && $post_content!=''){
if(isset($post_content) && $post_content!=''){
foreach ($post_content as $key => $var){
if ($key == 'submit' || $key == 'rowID'){
//do nothing