[pve-devel] [RFC manager] show the nodename in the page title

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Dec 7 15:35:14 CET 2015


Closes #822
---
 PVE/ExtJSIndex.pm         |  4 ++--
 PVE/ExtJSIndex6.pm        |  4 ++--
 PVE/NoVncIndex.pm         |  4 ++--
 PVE/Service/pveproxy.pm   | 12 ++++++------
 PVE/TouchIndex.pm         |  4 ++--
 www/manager/Workspace.js  |  2 --
 www/manager6/Workspace.js |  2 --
 7 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/PVE/ExtJSIndex.pm b/PVE/ExtJSIndex.pm
index c8c8f64..2671c54 100644
--- a/PVE/ExtJSIndex.pm
+++ b/PVE/ExtJSIndex.pm
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 sub get_index {
-    my ($lang, $username, $csrftoken, $console) = @_;
+    my ($lang, $username, $csrftoken, $console, $nodename) = @_;
 
     my $page = <<_EOD;
 <!DOCTYPE html>
@@ -12,7 +12,7 @@ sub get_index {
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta http-equiv="X-UA-Compatible" content="IE=10">
-    <title>Proxmox Virtual Environment</title>
+    <title>$nodename - Proxmox Virtual Environment</title>
  
     <link rel="stylesheet" type="text/css" href="/pve2/ext4/resources/css/ext-all.css" />
     <link rel="stylesheet" type="text/css" href="/pve2/css/ext-pve.css" />
diff --git a/PVE/ExtJSIndex6.pm b/PVE/ExtJSIndex6.pm
index 0604fc2..5165f65 100644
--- a/PVE/ExtJSIndex6.pm
+++ b/PVE/ExtJSIndex6.pm
@@ -4,14 +4,14 @@ use strict;
 use warnings;
 
 sub get_index {
-    my ($lang, $username, $csrftoken, $console) = @_;
+    my ($lang, $username, $csrftoken, $console, $nodename) = @_;
 
     my $page = <<_EOD;
 <!DOCTYPE html>
 <html>
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>Proxmox Virtual Environment</title>
+    <title>$nodename - Proxmox Virtual Environment</title>
     <link rel="stylesheet" type="text/css" href="/pve2/ext6/theme-triton/resources/theme-triton-all.css" />
     <link rel="stylesheet" type="text/css" href="/pve2/css/ext-pve.css" />
 _EOD
diff --git a/PVE/NoVncIndex.pm b/PVE/NoVncIndex.pm
index d17a003..2869c2a 100644
--- a/PVE/NoVncIndex.pm
+++ b/PVE/NoVncIndex.pm
@@ -4,13 +4,13 @@ use strict;
 use warnings;
 
 sub get_index {
-    my ($lang, $username, $csrftoken, $console) = @_;
+    my ($lang, $username, $csrftoken, $console, $nodename) = @_;
 
     my $page = <<_EOD;
 <!DOCTYPE html>
 <html>
 <head>
-    <title>Proxmox Console</title>
+    <title>$nodename - Proxmox Console</title>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <!-- Apple iOS Safari settings -->
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index 5be7488..d1fd634 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -117,7 +117,7 @@ sub init {
 	},
 	# Note: there is no authentication for those pages and dirs!
 	pages => {
-	    '/' => \&get_index,
+	    '/' => sub { get_index($self->{nodename}, @_) },
 	    # avoid authentication when accessing favicon
 	    '/favicon.ico' => {
 		file => '/usr/share/pve-manager/images/favicon.ico',
@@ -165,7 +165,7 @@ sub is_phone {
 # so we must be very careful here
 
 sub get_index {
-    my ($server, $r, $args) = @_;
+    my ($nodename, $server, $r, $args) = @_;
 
     my $lang = 'en';
     my $username;
@@ -199,13 +199,13 @@ sub get_index {
     my $page;
 
     if (defined($args->{console}) && $args->{novnc}) {
-	$page = PVE::NoVncIndex::get_index($lang, $username, $token, $args->{console});
+	$page = PVE::NoVncIndex::get_index($lang, $username, $token, $args->{console}, $nodename);
     } elsif ($mobile) {
-	$page = PVE::TouchIndex::get_index($lang, $username, $token, $args->{console});
+	$page = PVE::TouchIndex::get_index($lang, $username, $token, $args->{console}, $nodename);
     } elsif ($ext6 && $ext6_dir_exists) {
-	$page = PVE::ExtJSIndex6::get_index($lang, $username, $token, $args->{console});
+	$page = PVE::ExtJSIndex6::get_index($lang, $username, $token, $args->{console}, $nodename);
     } else {
-	$page = PVE::ExtJSIndex::get_index($lang, $username, $token, $args->{console});
+	$page = PVE::ExtJSIndex::get_index($lang, $username, $token, $args->{console}, $nodename);
     }
     my $headers = HTTP::Headers->new(Content_Type => "text/html; charset=utf-8");
     my $resp = HTTP::Response->new(200, "OK", $headers, $page);
diff --git a/PVE/TouchIndex.pm b/PVE/TouchIndex.pm
index 9679c46..a83c30a 100644
--- a/PVE/TouchIndex.pm
+++ b/PVE/TouchIndex.pm
@@ -4,14 +4,14 @@ use strict;
 use warnings;
 
 sub get_index {
-    my ($lang, $username, $csrftoken, $console) = @_;
+    my ($lang, $username, $csrftoken, $console, $nodename) = @_;
 
     my $page = <<_EOD;
 <!DOCTYPE html>
 <html>
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>Proxmox Virtual Environment</title>
+    <title>$nodename - Proxmox Virtual Environment</title>
  
     <link rel="stylesheet" type="text/css" href="/pve2/touch/resources/css/sencha-touch.css" />
     <link rel="stylesheet" type="text/css" href="/pve2/touch/resources/css/pve.css" />
diff --git a/www/manager/Workspace.js b/www/manager/Workspace.js
index 2606fb9..7233f6f 100644
--- a/www/manager/Workspace.js
+++ b/www/manager/Workspace.js
@@ -65,8 +65,6 @@ Ext.define('PVE.Workspace', {
 	    }
 	});
 
-	document.title = me.title;
-
 	me.callParent();
 
         if (!PVE.Utils.authOK()) {
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 5dc4d2a..7f6d20e 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -65,8 +65,6 @@ Ext.define('PVE.Workspace', {
 	    }
 	});
 
-	document.title = me.title;
-
 	me.callParent();
 
         if (!PVE.Utils.authOK()) {
-- 
2.1.4




More information about the pve-devel mailing list