Patching Proxmox for UI Issues

I had an issue in the Proxmox VE manager, where on Safari (all the time) or Firefox, when the screen width was too low, the various UI elements made it so I couldn’t access the buttons in the top left.

I found that all of the necessary things to change were in /usr/share/pve-manager/js/pvemanagerlib.js.

Messing around, I screwed it up and had to learn how to extract a file from a .deb file to get the old one back. Let’s grab the package. Don’t judge me for running an old version, my firewall/router is on VM host, which makes upgrades… probematic. I’ve finally got around to making a temporary thing to use to run as a firewall to do the upgrade now 🤣

 > cd $(mktemp -d)
 > wget http://download.proxmox.com/debian/pve/dists/stretch/pve-no-subscription/binary-amd64/pve-manager_5.4-15_amd64.deb
<snip>

2021-04-03 10:29:54 (1.96 MB/s) - ‘pve-manager_5.4-15_amd64.deb’ saved [1970762/1970762]

Now let’s extract the .deb file’s contents and find the file I broke.

 > dpkg-deb -x pve-manager_5.4-15_amd64.deb ./
 > find . | grep pvemanagerlib.js
./usr/share/pve-manager/js/pvemanagerlib.js

Woo, found it. Let’s copy it into place near where the other one is.

 > cp ./usr/share/pve-manager/js/pvemanagerlib.js /usr/share/pve-manager/js/pvemanagerlib.js.dist

Now let’s make a diff patch so we can post it on the internet for later. (Here, or on a GitHub Gist) I had to put the “version info” thing back in because some JS refers to it in updateVersionInfo on line 38421.

The missing div doesn’t break anything, but I prefer less console errors and it still stays within my original fix.

 > diff -u /usr/share/pve-manager/js/pvemanagerlib.js.dist /usr/share/pve-manager/js/pvemanagerlib.js | tee ~/pvemanager-patch.diff
--- /usr/share/pve-manager/js/pvemanagerlib.js.dist	2021-04-03 10:48:43.163503735 +1000
+++ /usr/share/pve-manager/js/pvemanagerlib.js	2021-04-03 10:53:39.855772027 +1000
@@ -38407,7 +38407,7 @@
 	var ui = me.query('#userinfo')[0];

 	if (Proxmox.UserName) {
-	    var msg =  Ext.String.format(gettext("You are logged in as {0}"), "'" + Ext.String.htmlEncode(Proxmox.UserName) + "'");
+	    var msg =  Ext.String.format(gettext(' {0}', Ext.String.htmlEncode(Proxmox.UserName) ));
 	    ui.update('<div class="x-unselectable" style="white-space:nowrap;">' + msg + '</div>');
 	} else {
 	    ui.update('');
@@ -38533,16 +38533,19 @@
 		    border: false,
 		    margin: '2 0 2 5',
 		    items: [
+/*
 			{
 			    html: '<a class="x-unselectable" target=_blank href="https://www.proxmox.com">' +
 				'<img style="padding-top:4px;padding-right:5px" src="/pve2/images/proxmox_logo.png"/></a>'
 			},
+*/
 			{
-			    minWidth: 150,
+//			    minWidth: 150,
 			    id: 'versioninfo',
 			    html: 'Virtual Environment'
 			},
-			{
+/*
+{
 			    xtype: 'pveGlobalSearchField',
 			    tree: rtree
 			},
@@ -38563,6 +38566,7 @@
 			{
 			    flex: 1
 			},
+*/
 			{
 			    pack: 'end',
 			    id: 'userinfo',

Comparison screenshots

Before: Way too wide After: Fixed

It’s ugly, but it works, and I don’t care about ugly.

References



#hacks #proxmox #pve #javascript #fixes