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