[pve-devel] [PATCH pve-manager 1/2] Serve debug versions of ExtJS libs when pveproxy is started in debug mode

Emmanuel Kasper e.kasper at proxmox.com
Tue May 3 13:40:56 CEST 2016


---
 PVE/ExtJSIndex.pm       | 14 ++++++++++++--
 PVE/Service/pveproxy.pm |  3 ++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/PVE/ExtJSIndex.pm b/PVE/ExtJSIndex.pm
index fae3546..9683148 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, $nodename) = @_;
+    my ($lang, $username, $csrftoken, $console, $nodename, $debug) = @_;
 
     my $page = <<_EOD;
 <!DOCTYPE html>
@@ -26,9 +26,19 @@ _EOD
 	$page .= '<script type="text/javascript">function gettext(buf) { return buf; }</script>';
     }
 
-    $page .= <<_EOD;
+    if ($debug) {
+	$page .= <<_EOD;
+    <script type="text/javascript" src="/pve2/ext6/ext-all-debug.js"></script>
+    <script type="text/javascript" src="/pve2/ext6/charts-debug.js"></script>
+_EOD
+    } else {
+	$page .= <<_EOD;
     <script type="text/javascript" src="/pve2/ext6/ext-all.js"></script>
     <script type="text/javascript" src="/pve2/ext6/charts.js"></script>
+_EOD
+    }
+
+$page .= <<_EOD;
     <script type="text/javascript" src="/pve2/ext6/pvemanagerlib.js"></script>
     <script type="text/javascript" src="/pve2/ext6/locale/locale-${lang}.js"></script>
 _EOD
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index eaea87d..9ed653b 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -201,7 +201,8 @@ sub get_index {
     } elsif ($mobile) {
 	$page = PVE::TouchIndex::get_index($lang, $username, $token, $args->{console}, $nodename);
     } else {
-	$page = PVE::ExtJSIndex::get_index($lang, $username, $token, $args->{console}, $nodename);
+	$page = PVE::ExtJSIndex::get_index($lang, $username, $token, $args->{console}, $nodename,
+	    $server->{debug});
     }
     my $headers = HTTP::Headers->new(Content_Type => "text/html; charset=utf-8");
     my $resp = HTTP::Response->new(200, "OK", $headers, $page);
-- 
2.1.4





More information about the pve-devel mailing list