mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26:34 +00:00
adding support for filelog in charts
- fixed a memory leak in increasing chartdata git-svn-id: https://svn.fhem.de/fhem/trunk@4334 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
211c4e09ea
commit
72b8776698
@ -31,7 +31,7 @@ DIR www/frontend/lib/ext-4.2.0.663/images/util
|
|||||||
DIR www/frontend/lib/ext-4.2.0.663/images/util/splitter
|
DIR www/frontend/lib/ext-4.2.0.663/images/util/splitter
|
||||||
UPD 2013-06-30_11:59:26 982 www/frontend/index.html
|
UPD 2013-06-30_11:59:26 982 www/frontend/index.html
|
||||||
UPD 2013-04-01_07:03:30 260475 www/frontend/lib/ext-4.2.0.663/ext-theme-gray-all.css
|
UPD 2013-04-01_07:03:30 260475 www/frontend/lib/ext-4.2.0.663/ext-theme-gray-all.css
|
||||||
UPD 2013-04-01_07:03:30 1434875 www/frontend/lib/ext-4.2.0.663/ext-all.js
|
UPD 2013-12-07_02:00:26 1497654 www/frontend/lib/ext-4.2.0.663/ext-all.js
|
||||||
UPD 2013-04-01_07:03:33 1981 www/frontend/lib/ext-4.2.0.663/images/tools/tools-sprites-trans.gif
|
UPD 2013-04-01_07:03:33 1981 www/frontend/lib/ext-4.2.0.663/images/tools/tools-sprites-trans.gif
|
||||||
UPD 2013-04-01_07:03:32 5835 www/frontend/lib/ext-4.2.0.663/images/tools/tool-sprites.gif
|
UPD 2013-04-01_07:03:32 5835 www/frontend/lib/ext-4.2.0.663/images/tools/tool-sprites.gif
|
||||||
UPD 2013-04-01_07:03:32 971 www/frontend/lib/ext-4.2.0.663/images/tools/tool-sprite-tpl.gif
|
UPD 2013-04-01_07:03:32 971 www/frontend/lib/ext-4.2.0.663/images/tools/tool-sprite-tpl.gif
|
||||||
@ -272,14 +272,14 @@ UPD 2013-03-02_01:53:05 524 www/frontend/app/resources/icons/resultset_last.png
|
|||||||
UPD 2013-04-03_07:27:17 733 www/frontend/app/resources/icons/add.png
|
UPD 2013-04-03_07:27:17 733 www/frontend/app/resources/icons/add.png
|
||||||
UPD 2013-04-03_07:27:17 389 www/frontend/app/resources/icons/resultset_previous.png
|
UPD 2013-04-03_07:27:17 389 www/frontend/app/resources/icons/resultset_previous.png
|
||||||
UPD 2013-06-30_11:47:12 101 www/frontend/app/resources/application.css
|
UPD 2013-06-30_11:47:12 101 www/frontend/app/resources/application.css
|
||||||
UPD 2013-11-22_05:34:28 2151 www/frontend/app/app.js
|
UPD 2013-12-07_12:24:10 2270 www/frontend/app/app.js
|
||||||
UPD 2013-04-28_02:00:20 1205 www/frontend/app/view/ChartGridPanel.js
|
UPD 2013-04-28_02:00:20 1205 www/frontend/app/view/ChartGridPanel.js
|
||||||
UPD 2013-07-07_12:12:08 16201 www/frontend/app/view/DevicePanel.js
|
UPD 2013-07-07_12:12:08 16201 www/frontend/app/view/DevicePanel.js
|
||||||
UPD 2013-11-15_03:17:04 9893 www/frontend/app/view/Viewport.js
|
UPD 2013-11-15_03:17:04 9893 www/frontend/app/view/Viewport.js
|
||||||
UPD 2013-11-22_05:34:29 10042 www/frontend/app/view/TableDataGridPanel.js
|
UPD 2013-12-07_01:40:04 10257 www/frontend/app/view/TableDataGridPanel.js
|
||||||
UPD 2013-11-22_05:34:29 28202 www/frontend/app/view/LineChartPanel.js
|
UPD 2013-12-07_12:47:24 29654 www/frontend/app/view/LineChartPanel.js
|
||||||
UPD 2013-11-15_04:48:21 87082 www/frontend/app/controller/ChartController.js
|
UPD 2013-12-07_01:59:34 95479 www/frontend/app/controller/ChartController.js
|
||||||
UPD 2013-11-30_04:29:42 18670 www/frontend/app/controller/MainController.js
|
UPD 2013-12-07_02:17:55 18670 www/frontend/app/controller/MainController.js
|
||||||
UPD 2013-06-30_11:46:54 5415 www/frontend/app/controller/TableDataController.js
|
UPD 2013-06-30_11:46:54 5415 www/frontend/app/controller/TableDataController.js
|
||||||
UPD 2013-04-01_07:04:35 202 www/frontend/app/model/ReadingsModel.js
|
UPD 2013-04-01_07:04:35 202 www/frontend/app/model/ReadingsModel.js
|
||||||
UPD 2013-04-01_07:04:36 338 www/frontend/app/model/SavedChartsModel.js
|
UPD 2013-04-01_07:04:36 338 www/frontend/app/model/SavedChartsModel.js
|
||||||
|
@ -40,11 +40,13 @@ Ext.application({
|
|||||||
Ext.each(FHEM.info.Results, function(result) {
|
Ext.each(FHEM.info.Results, function(result) {
|
||||||
if (result.list === "DbLog" && result.devices[0].NAME) {
|
if (result.list === "DbLog" && result.devices[0].NAME) {
|
||||||
FHEM.dblogname = result.devices[0].NAME;
|
FHEM.dblogname = result.devices[0].NAME;
|
||||||
return false;
|
}
|
||||||
|
if (result.list === "FileLog" && result.devices.length > 0) {
|
||||||
|
FHEM.filelogs = result.devices;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!FHEM.dblogname && Ext.isEmpty(FHEM.dblogname) && FHEM.dblogname != "undefined") {
|
if ((!FHEM.dblogname || Ext.isEmpty(FHEM.dblogname)) && !FHEM.filelogs) {
|
||||||
Ext.Msg.alert("Error", "Could not find a DbLog Configuration. Do you have DbLog already running?");
|
Ext.Msg.alert("Error", "Could not find a DbLog or FileLog Configuration. Do you have them already defined?");
|
||||||
} else {
|
} else {
|
||||||
Ext.create("FHEM.view.Viewport", {
|
Ext.create("FHEM.view.Viewport", {
|
||||||
hidden: true
|
hidden: true
|
||||||
|
@ -67,6 +67,10 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
{
|
{
|
||||||
selector: 'panel[name=maintreepanel]',
|
selector: 'panel[name=maintreepanel]',
|
||||||
ref: 'maintreepanel' //this.getMaintreepanel()
|
ref: 'maintreepanel' //this.getMaintreepanel()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
selector: 'radiogroup[name=datasourceradio]',
|
||||||
|
ref: 'datasourceradio' //this.getDatasourceradio()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -116,11 +120,163 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
'panel[name=chartgridpanel]': {
|
'panel[name=chartgridpanel]': {
|
||||||
collapse: this.resizeChart,
|
collapse: this.resizeChart,
|
||||||
expand: this.resizeChart
|
expand: this.resizeChart
|
||||||
|
},
|
||||||
|
'radiogroup[name=datasourceradio]': {
|
||||||
|
change: this.dataSourceChanged
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reconfigure combos to handle dblog / filelog
|
||||||
|
*/
|
||||||
|
dataSourceChanged: function(radio, newval, oldval) {
|
||||||
|
|
||||||
|
var me = this,
|
||||||
|
devicecombo = radio.up().down('combobox[name=devicecombo]'),
|
||||||
|
readingscombo = radio.up().down("combobox[name=yaxiscombo]"),
|
||||||
|
selection = radio.getChecked()[0].inputValue;
|
||||||
|
|
||||||
|
if (selection === "filelog") {
|
||||||
|
|
||||||
|
// disable save button and statistics for the moment
|
||||||
|
this.getSavechartdatabtn().setDisabled(true);
|
||||||
|
radio.up().down("combobox[name=yaxisstatisticscombo]").setDisabled(true);
|
||||||
|
|
||||||
|
// Getting the FileLog Names to show them in Device-Combo
|
||||||
|
var fileLogNames = [];
|
||||||
|
|
||||||
|
Ext.each(FHEM.filelogs, function(log) {
|
||||||
|
if (log.REGEXP && log.REGEXP !== "fakelog" && log.NAME !== "") {
|
||||||
|
var devObj = { "DEVICE": log.NAME};
|
||||||
|
fileLogNames.push(devObj);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
devicecombo.setValue("");
|
||||||
|
devicecombo.getStore().removeAll();
|
||||||
|
var localstore = Ext.create('Ext.data.Store', {
|
||||||
|
model: 'FHEM.model.DeviceModel',
|
||||||
|
data: fileLogNames
|
||||||
|
});
|
||||||
|
devicecombo.queryMode = 'local';
|
||||||
|
// bind the new one
|
||||||
|
devicecombo.bindStore(localstore);
|
||||||
|
devicecombo.on("select", me.fileLogSelected);
|
||||||
|
|
||||||
|
readingscombo.setValue();
|
||||||
|
readingscombo.getStore().removeAll();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// enable save button and statistics
|
||||||
|
this.getSavechartdatabtn().setDisabled(false);
|
||||||
|
radio.up().down("combobox[name=yaxisstatisticscombo]").setDisabled(false);
|
||||||
|
|
||||||
|
devicecombo.setValue();
|
||||||
|
devicecombo.getStore().removeAll();
|
||||||
|
var lcp = Ext.ComponentQuery.query("linechartpanel")[0];
|
||||||
|
// bind the new one
|
||||||
|
devicecombo.bindStore(lcp.devicestore);
|
||||||
|
// unregister listener
|
||||||
|
devicecombo.un("select", me.fileLogSelected);
|
||||||
|
devicecombo.queryMode = 'remote';
|
||||||
|
devicecombo.getStore().load();
|
||||||
|
|
||||||
|
readingscombo.setValue();
|
||||||
|
readingscombo.getStore().removeAll();
|
||||||
|
// bind the new one
|
||||||
|
readingscombo.bindStore(readingscombo.ajaxStore);
|
||||||
|
readingscombo.queryMode = 'remote';
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gather filelog information to fill combos
|
||||||
|
*/
|
||||||
|
fileLogSelected: function(combo, selectionArray) {
|
||||||
|
|
||||||
|
var readingscombo = combo.up().down("combobox[name=yaxiscombo]"),
|
||||||
|
currentlogfile;
|
||||||
|
if (selectionArray[0]) {
|
||||||
|
var logname = selectionArray[0].data.DEVICE;
|
||||||
|
Ext.each(FHEM.filelogs, function(log) {
|
||||||
|
if (log.NAME === logname) {
|
||||||
|
// found the filelog entry, getting the logfile to load values
|
||||||
|
currentlogfile = log.currentlogfile;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!Ext.isEmpty(currentlogfile)) {
|
||||||
|
// retrieve the filelog, parse its containing fields
|
||||||
|
readingscombo.setLoading(true);
|
||||||
|
|
||||||
|
var date = new Date(),
|
||||||
|
endtime = Ext.Date.format(date, 'Y-m-d_H:i:s');
|
||||||
|
starttime = Ext.Date.add(date, Ext.Date.HOUR, -24);
|
||||||
|
starttime = Ext.Date.format(starttime, 'Y-m-d_H:i:s');
|
||||||
|
|
||||||
|
Ext.Ajax.request({
|
||||||
|
method: 'GET',
|
||||||
|
disableCaching: false,
|
||||||
|
url: '../../../fhem?cmd=get%20Logfile%20' + currentlogfile + '%20-%20' + starttime + '%20' + endtime + '&XHR=1',
|
||||||
|
success: function(response){
|
||||||
|
if (response && response.responseText) {
|
||||||
|
var responseArr = response.responseText.split(/\n/),
|
||||||
|
keyObjArray = [],
|
||||||
|
keyArray = [];
|
||||||
|
|
||||||
|
Ext.each(responseArr, function(row) {
|
||||||
|
// the first column is always the timestamp, followed by device and key:value
|
||||||
|
var keyindex = row.split(": ")[0].split(" ").length - 1,
|
||||||
|
key = row.split(": ")[0].split(" ")[keyindex];
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
// filling keyarray for combo
|
||||||
|
if (!Ext.Array.contains(keyArray, key)) {
|
||||||
|
keyArray.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.Array.sort(keyArray);
|
||||||
|
Ext.each(keyArray, function(key) {
|
||||||
|
var obj = {"READING": key};
|
||||||
|
keyObjArray.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
//reconfigure readings store
|
||||||
|
if (keyObjArray.length > 0) {
|
||||||
|
|
||||||
|
var localstore = Ext.create('Ext.data.Store', {
|
||||||
|
model: 'FHEM.model.ReadingsModel',
|
||||||
|
data: keyObjArray,
|
||||||
|
autoLoad: true
|
||||||
|
});
|
||||||
|
readingscombo.ajaxStore = readingscombo.getStore();
|
||||||
|
// bind the new one
|
||||||
|
readingscombo.bindStore(localstore);
|
||||||
|
readingscombo.queryMode = 'local';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Ext.Msg.alert("Error", "No Readings found in the last 24 hours for this Logfile!");
|
||||||
|
}
|
||||||
|
readingscombo.setLoading(false);
|
||||||
|
} else {
|
||||||
|
readingscombo.setLoading(false);
|
||||||
|
Ext.Msg.alert("Error", "No Readings found in the last 24 hours for this Logfile!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Ext.Msg.alert("Error", "No valid LogFile was found for your selection!");
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggers a request to FHEM Module to get the data from Database
|
* Triggers a request to FHEM Module to get the data from Database
|
||||||
*/
|
*/
|
||||||
@ -128,21 +284,12 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
//hiding chart for performance reasons
|
|
||||||
if (me.getChart()) {
|
|
||||||
me.getChart().getStore().removeAll();
|
|
||||||
me.getChart().hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
//show loadmask
|
//show loadmask
|
||||||
me.getLinechartpanel().setLoading(true);
|
me.getLinechartpanel().setLoading(true);
|
||||||
|
|
||||||
//timeout needed for loadmask to appear
|
//timeout needed for loadmask to appear
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
|
|
||||||
//suspending complex layouts
|
|
||||||
Ext.suspendLayouts();
|
|
||||||
|
|
||||||
//getting the necessary values
|
//getting the necessary values
|
||||||
var devices = Ext.ComponentQuery.query('combobox[name=devicecombo]'),
|
var devices = Ext.ComponentQuery.query('combobox[name=devicecombo]'),
|
||||||
yaxes = Ext.ComponentQuery.query('combobox[name=yaxiscombo]'),
|
yaxes = Ext.ComponentQuery.query('combobox[name=yaxiscombo]'),
|
||||||
@ -179,22 +326,13 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
existingchartgrid.down('grid').getStore().removeAll();
|
existingchartgrid.down('grid').getStore().removeAll();
|
||||||
}
|
}
|
||||||
var existingchart = Ext.ComponentQuery.query('panel[name=chartpanel]')[0];
|
var existingchart = Ext.ComponentQuery.query('panel[name=chartpanel]')[0];
|
||||||
if (!existingchart) {
|
if (existingchart) {
|
||||||
|
existingchart.destroy();
|
||||||
|
}
|
||||||
var store = Ext.create('FHEM.store.ChartStore'),
|
var store = Ext.create('FHEM.store.ChartStore'),
|
||||||
proxy = store.getProxy();
|
proxy = store.getProxy();
|
||||||
chart = me.createChart(store);
|
chart = me.createChart(store);
|
||||||
chartpanel.add(chart);
|
chartpanel.add(chart);
|
||||||
} else {
|
|
||||||
chart.getStore().removeAll();
|
|
||||||
chart.getStore().destroy();
|
|
||||||
//removes the store completely from chart
|
|
||||||
chart.bindStore();
|
|
||||||
var chartstore = Ext.create('FHEM.store.ChartStore');
|
|
||||||
chart.bindStore(chartstore);
|
|
||||||
chart.series.removeAll();
|
|
||||||
chart.axes.get(0).setTitle("");
|
|
||||||
chart.axes.get(1).setTitle("");
|
|
||||||
}
|
|
||||||
|
|
||||||
//reset zoomValues
|
//reset zoomValues
|
||||||
chartpanel.setLastYmax(null);
|
chartpanel.setLastYmax(null);
|
||||||
@ -276,12 +414,14 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
yaxisfillcheck = yaxesfillchecks[i].checked,
|
yaxisfillcheck = yaxesfillchecks[i].checked,
|
||||||
yaxisstepcheck = yaxesstepcheck[i].checked,
|
yaxisstepcheck = yaxesstepcheck[i].checked,
|
||||||
yaxisstatistics = yaxesstatistics[i].getValue(),
|
yaxisstatistics = yaxesstatistics[i].getValue(),
|
||||||
axisside = axissideradio[i].getChecked()[0].getSubmitValue();
|
axisside = axissideradio[i].getChecked()[0].getSubmitValue(),
|
||||||
|
logtype = axissideradio[i].up().down("radiogroup[name=datasourceradio]").getChecked()[0].inputValue;
|
||||||
if(yaxis === "" || yaxis === null) {
|
if(yaxis === "" || yaxis === null) {
|
||||||
yaxis = yaxes[i].getRawValue();
|
yaxis = yaxes[i].getRawValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
me.populateAxis(i, yaxes.length, device, yaxis, yaxiscolorcombo, yaxisfillcheck, yaxisstepcheck, axisside, yaxisstatistics, dbstarttime, dbendtime);
|
me.populateAxis(i, yaxes.length, device, yaxis, yaxiscolorcombo, yaxisfillcheck,
|
||||||
|
yaxisstepcheck, axisside, yaxisstatistics, dbstarttime, dbendtime, logtype);
|
||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -299,8 +439,6 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
var cdg = Ext.ComponentQuery.query('panel[name=chartgridpanel]')[0];
|
var cdg = Ext.ComponentQuery.query('panel[name=chartgridpanel]')[0];
|
||||||
|
|
||||||
if (lcv) {
|
if (lcv) {
|
||||||
// disable animation as long as we resize, causes serious performance issues
|
|
||||||
lcv.animate = false;
|
|
||||||
|
|
||||||
if (lcp && lcv && cfp && cdg) {
|
if (lcp && lcv && cfp && cdg) {
|
||||||
var lcph = lcp.getHeight(),
|
var lcph = lcp.getHeight(),
|
||||||
@ -326,7 +464,6 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lcv.animate = true;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -630,7 +767,7 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
/**
|
/**
|
||||||
* fill the axes with data
|
* fill the axes with data
|
||||||
*/
|
*/
|
||||||
populateAxis: function(i, axeslength, device, yaxis, yaxiscolorcombo, yaxisfillcheck, yaxisstepcheck, axisside, yaxisstatistics, dbstarttime, dbendtime) {
|
populateAxis: function(i, axeslength, device, yaxis, yaxiscolorcombo, yaxisfillcheck, yaxisstepcheck, axisside, yaxisstatistics, dbstarttime, dbendtime, logtype) {
|
||||||
|
|
||||||
var me = this,
|
var me = this,
|
||||||
chart = me.getChart(),
|
chart = me.getChart(),
|
||||||
@ -647,7 +784,18 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var url;
|
var url;
|
||||||
if (!Ext.isDefined(yaxisstatistics) || yaxisstatistics === "none" || Ext.isEmpty(yaxisstatistics)) {
|
if (logtype && logtype === "filelog") {
|
||||||
|
Ext.each(FHEM.filelogs, function(log) {
|
||||||
|
if (log.NAME === device) {
|
||||||
|
// found the filelog entry, getting the logfile to load values
|
||||||
|
currentlogfile = log.currentlogfile;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
url += '../../../fhem?cmd=get%20Logfile%20' +
|
||||||
|
currentlogfile + '%20-%20' + dbstarttime +
|
||||||
|
'%20' + dbendtime + '%201:' + yaxis + '.*::$fld[3]&XHR=1';
|
||||||
|
} else if (!Ext.isDefined(yaxisstatistics) || yaxisstatistics === "none" || Ext.isEmpty(yaxisstatistics)) {
|
||||||
url += '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+' + dbstarttime + '+' + dbendtime + '+';
|
url += '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+' + dbstarttime + '+' + dbendtime + '+';
|
||||||
url +=device + '+timerange+' + "TIMESTAMP" + '+' + yaxis;
|
url +=device + '+timerange+' + "TIMESTAMP" + '+' + yaxis;
|
||||||
url += '&XHR=1';
|
url += '&XHR=1';
|
||||||
@ -678,8 +826,43 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
disableCaching: false,
|
disableCaching: false,
|
||||||
url: url,
|
url: url,
|
||||||
success: function(response){
|
success: function(response){
|
||||||
|
var json;
|
||||||
|
|
||||||
var json = Ext.decode(response.responseText);
|
try {
|
||||||
|
// check if db response
|
||||||
|
json = Ext.decode(response.responseText);
|
||||||
|
} catch(error) {
|
||||||
|
// else we got filelog data
|
||||||
|
var resultObj = {},
|
||||||
|
dataArray = [];
|
||||||
|
if (response && response.responseText) {
|
||||||
|
var responseArr = response.responseText.split(/\n/);
|
||||||
|
|
||||||
|
Ext.each(responseArr, function(row) {
|
||||||
|
// the first column is always the timestamp, followed by device and key:value
|
||||||
|
var timestamp = row.split(" ")[0].replace("_", " "),
|
||||||
|
//keyindex = row.split(": ")[0].split(" ").length - 1,
|
||||||
|
//key = row.split(": ")[0].split(" ")[keyindex],
|
||||||
|
val = row.split(" ")[1];
|
||||||
|
|
||||||
|
if (timestamp && val) {
|
||||||
|
// filling dataarray for chart
|
||||||
|
var rowObj = {
|
||||||
|
"TIMESTAMP": timestamp,
|
||||||
|
"VALUE": val
|
||||||
|
};
|
||||||
|
dataArray.push(rowObj);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Ext.Msg.alert("Error", "No Data for the selected time found in this Logfile!");
|
||||||
|
}
|
||||||
|
|
||||||
|
resultObj.data = dataArray;
|
||||||
|
json = resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
if (json.success && json.success === "false") {
|
if (json.success && json.success === "false") {
|
||||||
Ext.Msg.alert("Error", "Error an adding Y-Axis number " + i + ", error was: <br>" + json.msg);
|
Ext.Msg.alert("Error", "Error an adding Y-Axis number " + i + ", error was: <br>" + json.msg);
|
||||||
@ -972,13 +1155,9 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
|
|
||||||
me.resizeChart();
|
me.resizeChart();
|
||||||
|
|
||||||
me.getLinechartpanel().setLoading(false);
|
|
||||||
|
|
||||||
//enable animation
|
|
||||||
chart.animate = true;
|
|
||||||
|
|
||||||
chart.show();
|
chart.show();
|
||||||
|
|
||||||
|
me.getLinechartpanel().setLoading(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -986,9 +1165,6 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
*/
|
*/
|
||||||
createSeries: function(yfield, title, fill, color, axisside) {
|
createSeries: function(yfield, title, fill, color, axisside) {
|
||||||
|
|
||||||
//resuming the layout
|
|
||||||
Ext.resumeLayouts(true);
|
|
||||||
|
|
||||||
//setting axistitle and fontsize
|
//setting axistitle and fontsize
|
||||||
var chart = this.getChart(),
|
var chart = this.getChart(),
|
||||||
axis;
|
axis;
|
||||||
@ -1771,7 +1947,6 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
chartrecord,
|
chartrecord,
|
||||||
found = false,
|
found = false,
|
||||||
highlightSprite;
|
highlightSprite;
|
||||||
|
|
||||||
chartstore.each(function(rec) {
|
chartstore.each(function(rec) {
|
||||||
if (Ext.Date.isEqual(new Date(rec.get("TIMESTAMP")), recdate)) {
|
if (Ext.Date.isEqual(new Date(rec.get("TIMESTAMP")), recdate)) {
|
||||||
var valuematcher = record.raw.valuetext,
|
var valuematcher = record.raw.valuetext,
|
||||||
@ -1801,8 +1976,21 @@ Ext.define('FHEM.controller.ChartController', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (highlightSprite && !Ext.isEmpty(highlightSprite)) {
|
if (highlightSprite && !Ext.isEmpty(highlightSprite)) {
|
||||||
highlightSprite.sprite.attr.radius = 10;
|
Ext.create('Ext.fx.Animator', {
|
||||||
this.getChart().redraw();
|
target: highlightSprite.sprite.el.dom,
|
||||||
|
duration: 700, // 10 seconds
|
||||||
|
keyframes: {0: {
|
||||||
|
strokeWidth: 2
|
||||||
|
},
|
||||||
|
50: {
|
||||||
|
strokeWidth: 70
|
||||||
|
},
|
||||||
|
|
||||||
|
100: {
|
||||||
|
strokeWidth: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -95,7 +95,7 @@ Ext.define('FHEM.controller.MainController', {
|
|||||||
|
|
||||||
if (Ext.isDefined(FHEM.version)) {
|
if (Ext.isDefined(FHEM.version)) {
|
||||||
var sp = this.getStatustextfield();
|
var sp = this.getStatustextfield();
|
||||||
sp.setText(FHEM.version + "; Frontend Version: 1.0.2 - 2013-11-30");
|
sp.setText(FHEM.version + "; Frontend Version: 1.0.3 - 2013-12-07");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setupTree(false);
|
this.setupTree(false);
|
||||||
|
@ -427,25 +427,54 @@ Ext.define('FHEM.view.LineChartPanel', {
|
|||||||
},
|
},
|
||||||
items:
|
items:
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
xtype: 'radiogroup',
|
||||||
|
name: 'datasourceradio',
|
||||||
|
rowCount: me.getAxiscounter(),
|
||||||
|
allowBlank: false,
|
||||||
|
defaults: {
|
||||||
|
labelWidth: 40,
|
||||||
|
padding: "0 5px 0 0"
|
||||||
|
},
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
fieldLabel: 'DbLog',
|
||||||
|
name: 'logtype' + me.getAxiscounter(),
|
||||||
|
inputValue: 'dblog',
|
||||||
|
checked: true,
|
||||||
|
disabled: !FHEM.dblogname
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldLabel: 'FileLog',
|
||||||
|
name: 'logtype' + me.getAxiscounter(),
|
||||||
|
inputValue: 'filelog',
|
||||||
|
checked: false,
|
||||||
|
disabled: !FHEM.filelogs
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
xtype: 'combobox',
|
xtype: 'combobox',
|
||||||
name: 'devicecombo',
|
name: 'devicecombo',
|
||||||
fieldLabel: 'Select Device',
|
fieldLabel: 'Select Device',
|
||||||
labelWidth: 90,
|
labelWidth: 90,
|
||||||
store: me.devicestore,
|
store: me.devicestore,
|
||||||
|
triggerAction: 'all',
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
queryMode: 'local',
|
|
||||||
displayField: 'DEVICE',
|
displayField: 'DEVICE',
|
||||||
valueField: 'DEVICE',
|
valueField: 'DEVICE',
|
||||||
listeners: {
|
listeners: {
|
||||||
select: function(combo) {
|
select: function(combo) {
|
||||||
|
|
||||||
var device = combo.getValue(),
|
var device = combo.getValue(),
|
||||||
readingscombo = combo.up().down('combobox[name=yaxiscombo]'),
|
readingscombo = combo.up().down('combobox[name=yaxiscombo]'),
|
||||||
readingsstore = readingscombo.getStore(),
|
readingsstore = readingscombo.getStore();
|
||||||
readingsproxy = readingsstore.getProxy();
|
|
||||||
|
|
||||||
|
if (readingsstore && readingsstore.queryMode !== 'local') {
|
||||||
|
var readingsproxy = readingsstore.getProxy();
|
||||||
readingsproxy.url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+""+""+' + device + '+getreadings&XHR=1';
|
readingsproxy.url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+""+""+' + device + '+getreadings&XHR=1';
|
||||||
readingsstore.load();
|
readingsstore.load();
|
||||||
|
}
|
||||||
readingscombo.setDisabled(false);
|
readingscombo.setDisabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -459,6 +488,7 @@ Ext.define('FHEM.view.LineChartPanel', {
|
|||||||
labelWidth: 90,
|
labelWidth: 90,
|
||||||
inputWidth: 110,
|
inputWidth: 110,
|
||||||
store: Ext.create('FHEM.store.ReadingsStore', {
|
store: Ext.create('FHEM.store.ReadingsStore', {
|
||||||
|
queryMode: 'remote',
|
||||||
proxy: {
|
proxy: {
|
||||||
type: 'ajax',
|
type: 'ajax',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -33,11 +33,17 @@ Ext.define('FHEM.view.TableDataGridPanel', {
|
|||||||
totalProperty: 'totalCount'
|
totalProperty: 'totalCount'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoLoad: true
|
autoLoad: false
|
||||||
});
|
});
|
||||||
|
|
||||||
me.on("afterlayout", function() {
|
me.on("afterlayout", function() {
|
||||||
|
|
||||||
|
if (!FHEM.dblogname) {
|
||||||
|
Ext.Msg.alert("Error", "This function is currently only available to users of DbLog!");
|
||||||
|
}
|
||||||
|
|
||||||
|
me.devicestore.load();
|
||||||
|
|
||||||
me.add(
|
me.add(
|
||||||
{
|
{
|
||||||
xtype: 'fieldset',
|
xtype: 'fieldset',
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user