change index to templates using handlebars

using a handlebars instance in ApiConfig, to cache the templates
as long as possible, this is currently ok, as the index template
can only change when the whole package changes

if we split this in the future, we have to trigger a reload of
the daemon on gui package upgrade (so that the template gets reloaded)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2020-04-29 11:59:31 +02:00
committed by Dietmar Maurer
parent bc0d03885c
commit f9e3b1104e
8 changed files with 87 additions and 49 deletions

View File

@ -36,8 +36,9 @@ clean:
find . -name '*~' -exec rm {} ';'
rm -rf js
install: js/proxmox-backup-gui.js css/ext6-pbs.css
install: js/proxmox-backup-gui.js css/ext6-pbs.css index.hbs
install -dm755 $(DESTDIR)$(JSDIR)
install -m644 index.hbs $(DESTDIR)$(JSDIR)/
install -dm755 $(DESTDIR)$(JSDIR)/js
install -m644 js/proxmox-backup-gui.js $(DESTDIR)$(JSDIR)/js/
install -dm755 $(DESTDIR)$(JSDIR)/css

43
www/index.hbs Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Proxmox Backup Server</title>
<link rel="icon" sizes="128x128" href="/images/logo-128.png" />
<link rel="apple-touch-icon" sizes="128x128" href="/pve2/images/logo-128.png" />
<link rel="stylesheet" type="text/css" href="/extjs/theme-crisp/resources/theme-crisp-all.css" />
<link rel="stylesheet" type="text/css" href="/extjs/crisp/resources/charts-all.css" />
<link rel="stylesheet" type="text/css" href="/fontawesome/css/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="/css/ext6-pbs.css" />
<script type='text/javascript'> function gettext(buf) { return buf; } </script>
{{#if debug}}
<script type="text/javascript" src="/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="/extjs/charts-debug.js"></script>
{{else}}
<script type="text/javascript" src="/extjs/ext-all.js"></script>
<script type="text/javascript" src="/extjs/charts.js"></script>
{{/if}}
<script type="text/javascript">
Proxmox = {
Setup: { auth_cookie_name: 'PBSAuthCookie' },
NodeName: "{{ NodeName }}",
UserName: "{{ UserName }}",
CSRFPreventionToken: "{{ CSRFPreventionToken }}",
};
</script>
<script type="text/javascript" src="/widgettoolkit/proxmoxlib.js"></script>
<script type="text/javascript" src="/extjs/locale/locale-en.js"></script>
<script type="text/javascript">
Ext.History.fieldid = 'x-history-field';
</script>
<script type="text/javascript" src="/js/proxmox-backup-gui.js"></script>
</head>
<body>
<!-- Fields required for history management -->
<form id="history-form" class="x-hidden">
<input type="hidden" id="x-history-field"/>
</form>
</body>
</html>