start the GUI

This commit is contained in:
Dietmar Maurer 2018-12-04 17:53:10 +01:00
parent 826bb98286
commit 5c7a1b15c8
7 changed files with 180 additions and 1 deletions

View File

@ -20,6 +20,7 @@ deb ${DEB}:
rm -rf build rm -rf build
# build here to cache results # build here to cache results
cargo build --release cargo build --release
make -C www
rsync -a debian Cargo.lock Cargo.toml src www target build rsync -a debian Cargo.lock Cargo.toml src www target build
cd build; dpkg-buildpackage -b -us -uc cd build; dpkg-buildpackage -b -us -uc

1
debian/install vendored
View File

@ -1,3 +1,4 @@
target/release/api-test-server /usr/sbin target/release/api-test-server /usr/sbin
www/images/logo-128.png /usr/share/javascript/proxmox-backup-server/images/ www/images/logo-128.png /usr/share/javascript/proxmox-backup-server/images/
www/images/proxmox_logo.png /usr/share/javascript/proxmox-backup-server/images/ www/images/proxmox_logo.png /usr/share/javascript/proxmox-backup-server/images/
www/proxmox-backup-gui.js /usr/share/javascript/proxmox-backup-server/js/

View File

@ -239,7 +239,7 @@ fn get_index() -> BoxFut {
<script type="text/javascript"> <script type="text/javascript">
Ext.History.fieldid = 'x-history-field'; Ext.History.fieldid = 'x-history-field';
</script> </script>
<script type="text/javascript" src="/js/pbsmanagerlib.js"></script> <script type="text/javascript" src="/js/proxmox-backup-gui.js"></script>
</head> </head>
<body> <body>
<!-- Fields required for history management --> <!-- Fields required for history management -->

47
www/Application.js Normal file
View File

@ -0,0 +1,47 @@
/*global Proxmox*/
Ext.define('PBS.Application', {
extend: 'Ext.app.Application',
name: 'PBS',
appProperty: 'app',
stores: [
// 'NavigationStore'
],
layout: 'fit',
realignWindows: function() {
var modalwindows = Ext.ComponentQuery.query('window[modal]');
Ext.Array.forEach(modalwindows, function(item) {
item.center();
});
},
logout: function() {
var me = this;
//Proxmox.Utils.authClear();
//me.changeView('loginview', true);
},
changeView: function(view, skipCheck) {
var me = this;
//?
},
launch: function() {
var me = this;
Ext.on('resize', me.realignWindows);
var provider = new Ext.state.LocalStorageProvider({ prefix: 'ext-pbs-' });
Ext.state.Manager.setProvider(provider);
// fixme: show login window if not loggedin
me.currentView = Ext.create({
xtype: 'mainview'
});
}
});
Ext.application('PBS.Application');

14
www/Logo.js Normal file
View File

@ -0,0 +1,14 @@
Ext.define('PBS.image.Logo', {
extend: 'Ext.Img',
xtype: 'proxmoxlogo',
height: 30,
width: 172,
src: '/images/proxmox_logo.png',
alt: 'Proxmox',
autoEl: {
tag: 'a',
href: 'https://www.proxmox.com',
target: '_blank'
}
});

100
www/MainView.js Normal file
View File

@ -0,0 +1,100 @@
Ext.define('PBS.MainView', {
extend: 'Ext.container.Container',
xtype: 'mainview',
title: 'Proxmox Backup Server',
controller: {
xclass: 'Ext.app.ViewController',
routes: {
':path:subpath': {
action: 'changePath',
before: 'beforeChangePath',
conditions : {
':path' : '(?:([%a-zA-Z0-9\\-\\_\\s,]+))',
':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?'
}
}
},
beforeChangePath: function(path, subpath, action) {
var me = this;
action.resume();
},
changePath: function(path,subpath) {
var me = this;
var contentpanel = me.lookupReference('contentpanel');
var lastpanel = contentpanel.getLayout().getActiveItem();
},
init: function(view) {
var me = this;
console.log("init");
}
},
plugins: 'viewport',
layout: { type: 'border' },
items: [
{
region: 'north',
xtype: 'container',
layout: {
type: 'hbox',
align: 'middle'
},
margin: '2 5 2 5',
height: 38,
items: [
{
xtype: 'proxmoxlogo'
},
{
//xtype: 'versioninfo'
html: "version"
},
{
flex: 1
},
{
baseCls: 'x-plain',
reference: 'usernameinfo',
padding: '0 5',
tpl: Ext.String.format(gettext("You are logged in as {0}"), "'{username}'")
},
{
reference: 'logoutButton',
xtype: 'button',
iconCls: 'fa fa-sign-out',
text: gettext('Logout')
}
]
},
{
xtype: 'panel',
scrollable: 'y',
border: false,
region: 'west',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{ html: "test" }]
},
{
xtype: 'panel',
layout: { type: 'card' },
region: 'center',
border: false,
reference: 'contentpanel'
}
]
});

16
www/Makefile Normal file
View File

@ -0,0 +1,16 @@
JSSRC= \
Logo.js \
Application.js \
MainView.js
all: proxmox-backup-gui.js
proxmox-backup-gui.js: ${JSSRC}
cat ${JSSRC} >$@.tmp
mv $@.tmp $@
.PHONY: clean
clean:
find . -name '*~' -exec rm {} ';'
rm -r proxmox-backup-gui.js