Skip to content

Commit

Permalink
v3.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jemu75 committed Apr 7, 2021
1 parent 8408042 commit 7ce511c
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 41 deletions.
15 changes: 14 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
{{ app.data.header }}
</div>
<v-spacer />
<v-btn
v-if="app.options.debugMode"
small
icon
link
to="/syslog"
>
<v-icon
small
>
mdi-format-list-bulleted
</v-icon>
</v-btn>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
Expand Down Expand Up @@ -194,7 +207,7 @@
header: ''
}
},
version: 'v3.7.0',
version: 'v3.7.1',
status: {
color: 'secondary',
icon: 'mdi-circle',
Expand Down
10 changes: 5 additions & 5 deletions src/components/TemplChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@
methods: {
init() {
let setup = this.$fhem.getEl(this.item, 'Options', 'setup');
if(setup) Object.assign(this.setup, setup);
if (this.setup.lineWidth) this.chart.options.stroke.width = this.setup.lineWidth;
if(this.$route.params.filter && this.$route.params.filter.match('&size=max')) {
this.vals.maxSize = true;
this.vals.gridSize = 'col-12';
this.setup.size = 'col-12';
this.vals.linkIcon = 'mdi-arrow-collapse';
} else {
let setup = this.$fhem.getEl(this.item, 'Options', 'setup');
if(setup) Object.assign(this.setup, setup);
if (this.setup.lineWidth) this.chart.options.stroke.width = this.setup.lineWidth;
}
this.vals.from = this.$fhem.getDate(this.setup.daysAgo);
Expand Down
8 changes: 4 additions & 4 deletions src/components/TemplDefault.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
small
icon
:disabled="vals.main.leftBtnDisabled"
@touchstart="clickStart('left')"
@touchend="clickEnd('left')"
@mousedown="clickStart('left')"
@mouseup="clickEnd('left')"
>
<v-icon large>
{{ vals.main.leftBtn }}
Expand Down Expand Up @@ -119,8 +119,8 @@
small
icon
:disabled="vals.main.rightBtnDisabled"
@touchstart="clickStart('right')"
@touchend="clickEnd('right')"
@mousedown="clickStart('right')"
@mouseup="clickEnd('right')"
>
<v-icon large>
{{ vals.main.rightBtn }}
Expand Down
4 changes: 2 additions & 2 deletions src/components/TemplSysmon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
this.vals.tempVal = temp ? temp.toFixed(1) : '';
this.vals.tempColor = temp > 60 ? 'error' : 'success';
this.vals.mainColor = cpu > 70 || ram > 70 || temp > 60 ? 'error' : 'success';
this.vals.startServer = this.$fhem.getDateTime(serverStartTime);
this.vals.startFhem = this.$fhem.getDateTime(fhemStartTime);
this.vals.startServer = serverStartTime;
this.vals.startFhem = fhemStartTime;
this.vals.systemLastEvent = this.$fhem.getDateTime(lastEvent);
}
},
Expand Down
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Vue.prototype.$fhem = new fhem()
fetch('./cfg/config.json')
.then(res => res.json())
.catch((err) =>{
Vue.prototype.$fhem.log = { type: 'error', message: 'Loading config.json failed.', meta: err }
Vue.prototype.$fhem.log = { type: 'error', message: 'Loading config.json failed.', meta: err, debugLevel: 1 }
})
.then(cfg => {

Expand All @@ -34,8 +34,8 @@ fetch('./cfg/config.json')
}
}

Vue.prototype.$fhem.log = { type: 'info', message: 'Config: ' + JSON.stringify(cfg) }
Vue.prototype.$fhem.log = { type: 'info', message: 'Connection: ' + JSON.stringify(Vue.prototype.$fhem.app.connection) }
Vue.prototype.$fhem.log = { type: 'status', message: 'Config: ' + JSON.stringify(cfg), debugLevel: 2 }
Vue.prototype.$fhem.log = { type: 'status', message: 'Connection: ' + JSON.stringify(Vue.prototype.$fhem.app.connection), debugLevel: 2 }

new Vue({
vuetify,
Expand Down
51 changes: 30 additions & 21 deletions src/plugins/fhem.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default class Fhem extends EventEmitter {
logLast: {}
},
options: {
debugMode: false,
debugLevel: 3, // 1 = fehler, 2 = status, 3 = requests, 4 = informChannel, 5 = internals
loading: false,
loadCount: 0,
clock: null,
Expand Down Expand Up @@ -53,6 +55,7 @@ export default class Fhem extends EventEmitter {
type: 'info',
timestamp: Date.now(),
timeFlag: null,
debugLevel: this.app.options.debugLevel,
message: '',
icon: '',
color: ''
Expand All @@ -64,14 +67,17 @@ export default class Fhem extends EventEmitter {
let miSecs = new Date(target.timestamp).getMilliseconds();

target.timeFlag = time + ':' + ('000' + miSecs).slice(-3);
target.icon = target.type === 'error' ? 'mdi-alert' : target.type === 'info' ? 'mdi-information' : 'mdi-sync-circle';
target.color = target.type;
if(target.type === 'error') { target.icon = 'mdi-alert-outline'; target.color = 'error' } // debugLevel 1 error
if(target.type === 'status') { target.icon = 'mdi-connection'; target.color = 'info' } // debugLevel 2 status
if(target.type === 'request') { target.icon = 'mdi-send-circle-outline'; target.color = 'success' } // debugLevel 3 request
if(target.type === 'warning') { target.icon = 'mdi-help-circle-outline'; target.color = 'warning' } // debugLevel 3 request
if(target.type === 'info') { target.icon = 'mdi-sync'; target.color = 'success' } // debugLevel 4 request

this.app.session.logLast = target;

if(target.type === 'error') this.emit('message', { type: target.type, message: target.message, meta: target.meta });

if(this.app.options.logRecord) {
if(this.app.options.logRecord && target.debugLevel <= this.app.options.debugLevel) {
this.app.session.logList.unshift(target);
if(this.app.session.logList.length > this.app.options.logBuffer) this.app.session.logList.length = this.app.options.logBuffer;
}
Expand Down Expand Up @@ -136,7 +142,7 @@ export default class Fhem extends EventEmitter {
if(typeof cmd === 'string') options.push({ param: 'cmd', value: cmd });
let req = this.createURL(options);

this.log = { type: 'info', message: 'Request: ' + req };
this.log = { type: 'request', message: 'Request: ' + req, debugLevel: 3 };

fetch(req)
.then((res) => {
Expand Down Expand Up @@ -220,14 +226,14 @@ export default class Fhem extends EventEmitter {
}
})
.catch((err) => {
this.log = { type: 'error', message: 'Fetch data from FHEM Logfile failed.', meta: err };
this.log = { type: 'error', message: 'Fetch data from FHEM Logfile failed.', meta: err, debugLevel: 1 };
reject();
});

idx ++;
}
} else {
this.log = { type: 'error', message: 'No Definitions for Chart found.', meta: obj };
this.log = { type: 'error', message: 'No Definitions for Chart found.', meta: obj, debugLevel: 1 };
reject();
}
});
Expand All @@ -254,7 +260,7 @@ export default class Fhem extends EventEmitter {
}
})
.catch((err) => {
this.log = { type: 'error', message: 'FHEM check for Updates failed.', meta: err };
this.log = { type: 'error', message: 'FHEM check for Updates failed.', meta: err, debugLevel: 1 };
reject(err);
})
});
Expand Down Expand Up @@ -297,11 +303,11 @@ export default class Fhem extends EventEmitter {
}
})
.catch((err) => {
this.log = { type: 'error', message: 'Loading ' + attr + 's from FHEM failed.', meta: err };
this.log = { type: 'error', message: 'Loading ' + attr + 's from FHEM failed.', meta: err, debugLevel: 1 };
this.app.options.loading = false;
});
} else {
this.log = { type: 'error', message: 'Creating Routes failed.', meta: attr };
this.log = { type: 'error', message: 'Creating Routes failed.', meta: attr, debugLevel: 1 };
this.app.options.loading = false;
}
}
Expand Down Expand Up @@ -407,7 +413,7 @@ export default class Fhem extends EventEmitter {
}
}
} else {
this.log = { type: 'error', message: 'Wrong Definition for Device-States.', meta: device }
this.log = { type: 'error', message: 'Wrong Definition for Device-States.', meta: device, debugLevel: 1 }
}
}
}
Expand All @@ -433,7 +439,7 @@ export default class Fhem extends EventEmitter {
return res.Results[0];
})
.catch((err) => {
this.log = { type: 'error', message: 'Request to FHEM failed.', meta: err };
this.log = { type: 'error', message: 'Request to FHEM failed.', meta: err, debugLevel: 1 };
})
}
}
Expand Down Expand Up @@ -467,15 +473,15 @@ export default class Fhem extends EventEmitter {
let templDef = await res.json();
let setup = {};

if(templDef.size) setup.size = templDef.size;
if(templDef.size) setup.size = templDef.size;
if(templDef.status) Object.assign(setup, { status: templDef.status });
if(templDef.main) Object.assign(setup, { main: templDef.main });
if(templDef.info) Object.assign(setup, { info: templDef.info});

return setup;
})
.catch((err) => {
this.log = { type: 'error', message: 'Loading Template ' + template + ' failed.', meta: err };
this.log = { type: 'error', message: 'Loading Template ' + template + ' failed.', meta: err, debugLevel: 1 };
return {};
})
}
Expand Down Expand Up @@ -503,7 +509,7 @@ export default class Fhem extends EventEmitter {
try {
result = JSON.parse(string);
} catch(err) {
this.log = { type: 'error', message: 'Json-Object is no valid. ' + string, meta: err.message };
this.log = { type: 'error', message: 'Json-Object is no valid. ' + string, meta: err.message, debugLevel: 1 };
}
}
return result;
Expand Down Expand Up @@ -594,7 +600,7 @@ export default class Fhem extends EventEmitter {
}
})
.catch((err) => {
this.log = { type: 'error', message: 'Request to FHEM failed.', meta: err };
this.log = { type: 'error', message: 'Request to FHEM failed.', meta: err, debugLevel: 1 };
this.app.options.loading = false;
})
}
Expand All @@ -606,7 +612,7 @@ export default class Fhem extends EventEmitter {

if(!arr[2].match('<div')) {
if(!arr[0].match('-ts')) {
this.log = { type: 'success', message: arr[0].replace('-',': ') + ': ' + arr[1] };
this.log = { type: 'info', message: arr[0].replace('-',': ') + ': ' + arr[1], debugLevel: 4 };
}

if(arr[0].match('global-UPDATE')) {
Expand All @@ -630,7 +636,7 @@ export default class Fhem extends EventEmitter {
}
} else {
// alles was nicht verarbeitet werden kann
this.log = { type: 'warning', message: 'No Handling for this FHEM data.', meta: arr };
this.log = { type: 'warning', message: 'No Handling for this FHEM data. ' + arr, meta: arr, debugLevel: 3 };
}
}

Expand Down Expand Up @@ -696,8 +702,9 @@ export default class Fhem extends EventEmitter {
}

this.log = {
type: 'info',
type: 'status',
message: 'Connection with FHEM was closed. Try to Reconnect in 3 seconds...',
debugLevel: 2
}
}

Expand All @@ -711,9 +718,10 @@ export default class Fhem extends EventEmitter {
this.emit('connect');

this.log = {
type: 'info',
type: 'status',
message: 'Connection with FHEM is opened.',
meta: this.session
meta: this.session,
debugLevel: 2
}
this.app.options.loading = false;
})
Expand All @@ -724,7 +732,8 @@ export default class Fhem extends EventEmitter {
this.log = {
type: 'error',
message: 'Retrieve csrf-Token failed.',
meta: err
meta: err,
debugLevel: 1
};
})
.finally(() => this.app.options.loading = false);
Expand Down
2 changes: 1 addition & 1 deletion www/fhemapp/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-capable" content="yes"><link rel="icon" href="favicon.png"><link rel="apple-touch-icon" href="apple-touch-icon.png"><title>fhemapp</title><link href="css/chunk-03454508.55c011d2.css" rel="prefetch"><link href="css/chunk-0458398b.c4749bc4.css" rel="prefetch"><link href="css/chunk-098d33d4.61e1e199.css" rel="prefetch"><link href="css/chunk-15fa718e.55c011d2.css" rel="prefetch"><link href="css/chunk-27250ed3.55c011d2.css" rel="prefetch"><link href="css/chunk-2c05d556.cb4d0868.css" rel="prefetch"><link href="css/chunk-57a6c555.611711b5.css" rel="prefetch"><link href="css/chunk-58038582.55c011d2.css" rel="prefetch"><link href="css/chunk-62d9ca09.792facbe.css" rel="prefetch"><link href="css/chunk-72c6e8d8.8d89ed40.css" rel="prefetch"><link href="css/chunk-83618c9a.3058ccc5.css" rel="prefetch"><link href="css/chunk-d584b056.4c33e4ab.css" rel="prefetch"><link href="css/chunk-f90907bc.01cf6fd8.css" rel="prefetch"><link href="js/chunk-03454508.84b6b243.js" rel="prefetch"><link href="js/chunk-0458398b.ff29fd68.js" rel="prefetch"><link href="js/chunk-098d33d4.466fafea.js" rel="prefetch"><link href="js/chunk-15fa718e.f3d4c9ba.js" rel="prefetch"><link href="js/chunk-27250ed3.cac11d8b.js" rel="prefetch"><link href="js/chunk-2c05d556.f53def44.js" rel="prefetch"><link href="js/chunk-2d212bf1.5c618452.js" rel="prefetch"><link href="js/chunk-57a6c555.979b66ca.js" rel="prefetch"><link href="js/chunk-58038582.48f0eca8.js" rel="prefetch"><link href="js/chunk-62d9ca09.da27c615.js" rel="prefetch"><link href="js/chunk-72c6e8d8.c00175b8.js" rel="prefetch"><link href="js/chunk-83618c9a.ca2a0c78.js" rel="prefetch"><link href="js/chunk-d584b056.0ab1a6c1.js" rel="prefetch"><link href="js/chunk-f90907bc.7a5c4a6c.js" rel="prefetch"><link href="css/chunk-vendors.95431e8e.css" rel="preload" as="style"><link href="js/app.5e040ccb.js" rel="preload" as="script"><link href="js/chunk-vendors.aacf57ae.js" rel="preload" as="script"><link href="css/chunk-vendors.95431e8e.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but fhemapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.aacf57ae.js"></script><script src="js/app.5e040ccb.js"></script></body></html>
<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-capable" content="yes"><link rel="icon" href="favicon.png"><link rel="apple-touch-icon" href="apple-touch-icon.png"><title>fhemapp</title><link href="css/chunk-03454508.55c011d2.css" rel="prefetch"><link href="css/chunk-0458398b.c4749bc4.css" rel="prefetch"><link href="css/chunk-098d33d4.61e1e199.css" rel="prefetch"><link href="css/chunk-15fa718e.55c011d2.css" rel="prefetch"><link href="css/chunk-27250ed3.55c011d2.css" rel="prefetch"><link href="css/chunk-2c05d556.cb4d0868.css" rel="prefetch"><link href="css/chunk-57a6c555.611711b5.css" rel="prefetch"><link href="css/chunk-58038582.55c011d2.css" rel="prefetch"><link href="css/chunk-62d9ca09.792facbe.css" rel="prefetch"><link href="css/chunk-72c6e8d8.8d89ed40.css" rel="prefetch"><link href="css/chunk-83618c9a.3058ccc5.css" rel="prefetch"><link href="css/chunk-d584b056.4c33e4ab.css" rel="prefetch"><link href="css/chunk-f90907bc.01cf6fd8.css" rel="prefetch"><link href="js/chunk-03454508.84b6b243.js" rel="prefetch"><link href="js/chunk-0458398b.ff29fd68.js" rel="prefetch"><link href="js/chunk-098d33d4.466fafea.js" rel="prefetch"><link href="js/chunk-15fa718e.f3d4c9ba.js" rel="prefetch"><link href="js/chunk-27250ed3.11aa815c.js" rel="prefetch"><link href="js/chunk-2c05d556.f53def44.js" rel="prefetch"><link href="js/chunk-2d212bf1.5c618452.js" rel="prefetch"><link href="js/chunk-57a6c555.979b66ca.js" rel="prefetch"><link href="js/chunk-58038582.48f0eca8.js" rel="prefetch"><link href="js/chunk-62d9ca09.da27c615.js" rel="prefetch"><link href="js/chunk-72c6e8d8.c00175b8.js" rel="prefetch"><link href="js/chunk-83618c9a.6c4e7b37.js" rel="prefetch"><link href="js/chunk-d584b056.b1afb887.js" rel="prefetch"><link href="js/chunk-f90907bc.7a5c4a6c.js" rel="prefetch"><link href="css/chunk-vendors.95431e8e.css" rel="preload" as="style"><link href="js/app.5b6facfe.js" rel="preload" as="script"><link href="js/chunk-vendors.aacf57ae.js" rel="preload" as="script"><link href="css/chunk-vendors.95431e8e.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but fhemapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.aacf57ae.js"></script><script src="js/app.5b6facfe.js"></script></body></html>
1 change: 1 addition & 0 deletions www/fhemapp/js/app.5b6facfe.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion www/fhemapp/js/app.5e040ccb.js

This file was deleted.

Loading

0 comments on commit 7ce511c

Please sign in to comment.