mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-06 17:53:48 +00:00
js/mobile: fix eslint and enable linting on build
lint the build file, as else eslint does not has the full picture. Add a prelude to define globals once at the top Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
f1bb77563c
commit
f07b75b056
2
Makefile
2
Makefile
@ -56,7 +56,7 @@ distclean: clean
|
||||
.PHONY: lint
|
||||
lint:
|
||||
$(MAKE) -C js/ lint
|
||||
#$(MAKE) -C js/mobile lint
|
||||
$(MAKE) -C js/mobile lint
|
||||
|
||||
clean:
|
||||
make -C js clean
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
# caution: order is important
|
||||
MOBILESRC= \
|
||||
prelude.js \
|
||||
component.js \
|
||||
loginscreen.js \
|
||||
mailview.js \
|
||||
@ -8,6 +9,9 @@ MOBILESRC= \
|
||||
utils.js \
|
||||
app.js \
|
||||
|
||||
lint: pmgmanagerlib-mobile.js
|
||||
eslint $^
|
||||
|
||||
pmgmanagerlib-mobile.js: ${MOBILESRC}
|
||||
cat $^ >$@.tmp
|
||||
mv $@.tmp $@
|
||||
|
@ -1,5 +1,5 @@
|
||||
var $$ = Dom7;
|
||||
var app = new Framework7({
|
||||
$$ = Dom7;
|
||||
app = new Framework7({
|
||||
root: '#app',
|
||||
init: false,
|
||||
name: 'Proxmox Mail Gateway',
|
||||
@ -73,6 +73,6 @@ var app = new Framework7({
|
||||
],
|
||||
});
|
||||
|
||||
let quarlist = new QuarantineView();
|
||||
let _quarantine_view = new QuarantineView();
|
||||
|
||||
app.init();
|
||||
|
@ -52,7 +52,8 @@ class MailView extends Component {
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<iframe frameborder=0 width="100%" height="100%" sandbox="allow-same-origin" src="/api2/htmlmail/quarantine/content?id={{mailid}}"></iframe>
|
||||
<iframe frameborder=0 width="100%" height="100%" sandbox="allow-same-origin"
|
||||
src="/api2/htmlmail/quarantine/content?id={{mailid}}"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
4
js/mobile/prelude.js
Normal file
4
js/mobile/prelude.js
Normal file
@ -0,0 +1,4 @@
|
||||
/* global Framework7, Template7, Dom7 */
|
||||
|
||||
var $$ = Dom7;
|
||||
var app, PMG; // set in app.js
|
@ -6,7 +6,8 @@ class QuarantineView extends Component {
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="left">
|
||||
<img class="logo-navbar" style="padding: 0 10px" src="pve2/images/logo-128.png" height=32 />
|
||||
<img class="logo-navbar" style="padding: 0 10px"
|
||||
src="pve2/images/logo-128.png" height=32 />
|
||||
</div>
|
||||
<div class="title">Mail Gateway</div>
|
||||
</div>
|
||||
@ -142,7 +143,7 @@ class QuarantineView extends Component {
|
||||
});
|
||||
|
||||
// setup pull to refresh
|
||||
$$('.ptr-content').on('ptr:refresh', (e) => {
|
||||
$$('.ptr-content').on('ptr:refresh', (ev) => {
|
||||
me.setItems([
|
||||
{ skel: true, divider: true },
|
||||
{ skel: true },
|
||||
@ -167,7 +168,7 @@ class QuarantineView extends Component {
|
||||
grouperFn: (val) => PMG.Utils.unixToIso(val.time),
|
||||
});
|
||||
}).catch(PMG.Utils.showError).then(() => {
|
||||
e.detail();
|
||||
ev.detail();
|
||||
});
|
||||
});
|
||||
|
||||
@ -220,8 +221,8 @@ class QuarantineView extends Component {
|
||||
let date = starttime;
|
||||
if (!(starttime instanceof Date)) {
|
||||
// we assume an ISO string
|
||||
if (starttime == '') {
|
||||
return;
|
||||
if (starttime === '') {
|
||||
return null;
|
||||
}
|
||||
date = new Date(PMG.Utils.isoToUnix(starttime)*1000);
|
||||
}
|
||||
@ -238,8 +239,8 @@ class QuarantineView extends Component {
|
||||
var me = this;
|
||||
let date = endtime;
|
||||
if (!(endtime instanceof Date)) {
|
||||
if (endtime == '') {
|
||||
return;
|
||||
if (endtime === '') {
|
||||
return null;
|
||||
}
|
||||
// we assume an ISO string
|
||||
date = new Date(PMG.Utils.isoToUnix(endtime)*1000);
|
||||
@ -323,7 +324,7 @@ class QuarantineView extends Component {
|
||||
for (let i = 0; i+offset < items.length; i++) {
|
||||
let item = items[i+offset];
|
||||
let curgroup = options.grouperFn(item);
|
||||
if (curgroup != lastgroup) {
|
||||
if (curgroup !== lastgroup) {
|
||||
me.vList.insertItemBefore(i+offset++, {
|
||||
divider: true,
|
||||
group: curgroup,
|
||||
|
@ -1,4 +1,4 @@
|
||||
var PMG = {
|
||||
PMG = {
|
||||
Utils: {
|
||||
getCookie(name) {
|
||||
let cookies = document.cookie.split(/;\s*/);
|
||||
@ -73,7 +73,7 @@ var PMG = {
|
||||
let mail, action, date, username, ticket;
|
||||
if (queryObj.ticket) {
|
||||
let tocheck = decodeURIComponent(queryObj.ticket);
|
||||
let match = tocheck.match(/^PMGQUAR:([^\s\:]+):/);
|
||||
let match = tocheck.match(/^PMGQUAR:([^\s:]+):/);
|
||||
if (match) {
|
||||
ticket = tocheck;
|
||||
username = match[1];
|
||||
|
Loading…
Reference in New Issue
Block a user