[pve-devel] [PATCH manager 01/19] add proxmox-widget-toolkit to pve gui
Dominik Csapak
d.csapak at proxmox.com
Thu Dec 21 13:36:04 CET 2017
we will use components from proxmox-widget-toolkit rather than
directly from pve-manager
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/Service/pveproxy.pm | 11 +++++++++++
debian/control | 1 +
www/index.html.tpl | 8 ++++++++
3 files changed, 20 insertions(+)
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index ec1eb9a5..628e734a 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -52,6 +52,7 @@ my $basedirs = {
docs => '/usr/share/pve-docs',
fontawesome => '/usr/share/fonts-font-awesome',
xtermjs => '/usr/share/pve-xtermjs',
+ widgettoolkit => '/usr/share/javascript/proxmox-widget-toolkit',
};
sub init {
@@ -113,6 +114,9 @@ sub init {
'/favicon.ico' => {
file => "$basedirs->{manager}/images/favicon.ico",
},
+ '/proxmoxlib.js' => {
+ file => "$basedirs->{widgettoolkit}/proxmoxlib.js",
+ },
},
dirs => $dirs,
};
@@ -209,6 +213,12 @@ sub get_index {
my $ver = PVE::pvecfg::version();
my $release = PVE::pvecfg::release();
+ my $wtversionraw = PVE::Tools::file_read_firstline("$basedirs->{widgettoolkit}/proxmoxlib.js");
+ my $wtversion;
+ if ($wtversionraw =~ m|^// (.*)$|) {
+ $wtversion = $1;
+ };
+
my $vars = {
lang => $lang,
langfile => $langfile,
@@ -218,6 +228,7 @@ sub get_index {
nodename => $nodename,
debug => $server->{debug},
version => "$ver-$release",
+ wtversion => $wtversion,
};
# by default, load the normal index
diff --git a/debian/control b/debian/control
index c7d5a717..c5469c50 100644
--- a/debian/control
+++ b/debian/control
@@ -55,6 +55,7 @@ Depends: apt-transport-https,
novnc-pve,
perl (>= 5.10.0-19),
postfix | mail-transport-agent,
+ proxmox-widget-toolkit (>= 1.0-8),
pve-cluster (>= 5.0-17),
pve-container,
pve-docs,
diff --git a/www/index.html.tpl b/www/index.html.tpl
index 6bbdea18..147d3492 100644
--- a/www/index.html.tpl
+++ b/www/index.html.tpl
@@ -23,6 +23,14 @@
<script type="text/javascript" src="/pve2/ext6/ext-all.js"></script>
<script type="text/javascript" src="/pve2/ext6/charts.js"></script>
[% END %]
+ <script type="text/javascript">
+ Proxmox = {
+ Setup: { auth_cookie_name: 'PVEAuthCookie' },
+ UserName: '[% username %]',
+ CSRFPreventionToken: '[% token %]'
+ };
+ </script>
+ <script type="text/javascript" src="/proxmoxlib.js?ver=[% wtversion %]"></script>
<script type="text/javascript" src="/pve2/js/pvemanagerlib.js?ver=[% version %]"></script>
<script type="text/javascript" src="/pve2/ext6/locale/locale-[% lang %].js"></script>
--
2.11.0
More information about the pve-devel
mailing list