]> git.proxmox.com Git - pmg-gui.git/blob - js/mobile/app.js
fix #5251: login: set autocomplete on password and user
[pmg-gui.git] / js / mobile / app.js
1 $$ = Dom7;
2 app = new Framework7({
3 root: '#app',
4 init: false,
5 name: 'Proxmox Mail Gateway',
6 autoDarkTheme: true,
7 routes: [
8 {
9 path: '/:path/:subpath?',
10 async: function(routeTo, routeFrom, resolve, reject) {
11 if (routeTo.params.path === 'mail') {
12 let mail = new MailView();
13 resolve({
14 template: mail.getTpl(),
15 }, {
16 context: {
17 mailid: routeTo.params.subpath,
18 },
19 });
20 } else {
21 reject();
22 }
23 },
24 },
25 {
26 path: '/mail/:mailid/:action',
27 async: function(routeTo, routeFrom, resolve, reject) {
28 let action = routeTo.params.action;
29 let mailid = routeTo.params.mailid;
30 app.dialog.confirm(
31 `${action}: ${mailid}`,
32 gettext('Confirm'),
33 () => {
34 let loader = app.dialog.preloader();
35 app.request({
36 method: 'POST',
37 url: '/api2/json/quarantine/content/',
38 data: {
39 action: action,
40 id: mailid,
41 },
42 headers: {
43 CSRFPreventionToken: Proxmox.CSRFPreventionToken,
44 },
45 success: (data, status, xhr) => {
46 loader.close();
47 PMG.Utils.showSuccessToast(`Action '${action}' successful`);
48 if (action === 'delete' || action === 'deliver') {
49 app.ptr.refresh();
50 }
51 reject();
52 },
53 error: xhr => {
54 loader.close();
55 PMG.Utils.showError(xhr);
56 reject();
57 },
58 });
59 },
60 () => {
61 reject();
62 },
63 );
64 },
65 },
66 ],
67 });
68
69 let _quarantine_view = new QuarantineView();
70
71 app.init();