]>
Commit | Line | Data |
---|---|---|
f07b75b0 TL |
1 | $$ = Dom7; |
2 | app = new Framework7({ | |
43f0b189 DC |
3 | root: '#app', |
4 | init: false, | |
5 | name: 'Proxmox Mail Gateway', | |
c7c07a82 | 6 | autoDarkTheme: true, |
43f0b189 DC |
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({ | |
c87d46fb TL |
14 | template: mail.getTpl(), |
15 | }, { | |
43f0b189 | 16 | context: { |
c87d46fb TL |
17 | mailid: routeTo.params.subpath, |
18 | }, | |
43f0b189 DC |
19 | }); |
20 | } else { | |
21 | reject(); | |
22 | } | |
c87d46fb | 23 | }, |
43f0b189 DC |
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; | |
43f0b189 DC |
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, | |
c87d46fb | 40 | id: mailid, |
43f0b189 DC |
41 | }, |
42 | headers: { | |
c87d46fb | 43 | CSRFPreventionToken: Proxmox.CSRFPreventionToken, |
43f0b189 DC |
44 | }, |
45 | success: (data, status, xhr) => { | |
46 | loader.close(); | |
7acfe33c | 47 | PMG.Utils.showSuccessToast(`Action '${action}' successful`); |
016ba5ab TL |
48 | if (action === 'delete' || action === 'deliver') { |
49 | app.ptr.refresh(); | |
50 | } | |
43f0b189 DC |
51 | reject(); |
52 | }, | |
53 | error: xhr => { | |
54 | loader.close(); | |
55 | PMG.Utils.showError(xhr); | |
56 | reject(); | |
c87d46fb TL |
57 | }, |
58 | }); | |
43f0b189 DC |
59 | }, |
60 | () => { | |
61 | reject(); | |
c87d46fb | 62 | }, |
43f0b189 | 63 | ); |
c87d46fb TL |
64 | }, |
65 | }, | |
66 | ], | |
43f0b189 DC |
67 | }); |
68 | ||
f07b75b0 | 69 | let _quarantine_view = new QuarantineView(); |
43f0b189 DC |
70 | |
71 | app.init(); |