Remov changes from other branch

This commit is contained in:
Meliox 2024-05-17 11:38:12 +02:00
parent cc65cc33ab
commit 1f08e526f8

View File

@ -25,7 +25,6 @@ BACKUP_DIR="$SCRIPT_CWD/backup"
# File paths # File paths
pvemanagerlibjs="/usr/share/pve-manager/js/pvemanagerlib.js" pvemanagerlibjs="/usr/share/pve-manager/js/pvemanagerlib.js"
nodespm="/usr/share/perl5/PVE/API2/Nodes.pm" nodespm="/usr/share/perl5/PVE/API2/Nodes.pm"
pvemanagermobilelibjs="/usr/share/pve-manager/touch/pvemanager-mobile.js"
############################################### ###############################################
@ -549,26 +548,15 @@ function install_mod {
}" "$pvemanagerlibjs" }" "$pvemanagerlibjs"
msg "Sensor display items added to the summary panel in \"$pvemanagerlibjs\"." msg "Sensor display items added to the summary panel in \"$pvemanagerlibjs\"."
restart_proxy
msg "Installation completed"
msg "Clear the browser cache to ensure all changes are visualized."
else else
warn "Sensor display items already added to the summary panel in \"$pvemanagerlibjs\"." warn "Sensor display items already added to the summary panel in \"$pvemanagerlibjs\"."
fi fi
# Add new item to the items array in PVE.node.StatusView
# todo what to grep
if [[ -z $(cat "$pvemanagermobilelibjs" | grep -e "itemId: 'thermal[[:alnum:]]*'") ]]; then
# Create backup of original file
cp "$pvemanagermobilelibjs" "$BACKUP_DIR/pvemanager-mobile.js.$timestamp"
msg "Backup of \"$pvemanagermobilelibjs\" saved to \"$BACKUP_DIR/pvemanager-mobile.js.$timestamp\"."
else
warn "Sensor display items already added to the summary panel in \"$pvemanagermobilelibjs\"."
fi
restart_proxy
msg "Installation completed"
msg "Clear the browser cache to ensure all changes are visualized."
} }
# Function to uninstall the modification # Function to uninstall the modification
@ -596,18 +584,7 @@ function uninstall_mod {
warn "No pvemanagerlib.js files found." warn "No pvemanagerlib.js files found."
fi fi
# Find the latest pvemanagermobilelib.js file using the find command if [ -n "$latest_nodes_pm" ] || [ -n "$latest_pvemanagerlibjs" ]; then
local latest_pvemanagerlibmobilejs=$(find "$BACKUP_DIR" -name "pvemanager-mobile.js.*" -type f -printf '%T+ %p\n' 2>/dev/null | sort -r | head -n 1 | awk '{print $2}')
if [ -n "$latest_pvemanagerlibmobilejs" ]; then
# Remove the latest pvemanager-mobile.js file
cp "$latest_pvemanagerlibmobilejs" "$pvemanagermobilelibjs"
msg "Copied latest backup to \"$pvemanagermobilelibjs\"."
else
warn "No pvemanager-mobile.js files found."
fi
if [ -n "$latest_nodes_pm" ] || [ -n "$latest_pvemanagerlibjs" ]|| [ -n "$latest_pvemanagerlibmobilejs" ]; then
# At least one of the variables is not empty, restart the proxy # At least one of the variables is not empty, restart the proxy
restart_proxy restart_proxy
fi fi
@ -643,4 +620,4 @@ done
# If no arguments were provided or all arguments have been processed, print the usage message # If no arguments were provided or all arguments have been processed, print the usage message
if [[ $executed -eq 0 ]]; then if [[ $executed -eq 0 ]]; then
usage usage
fi fi