2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

bugfixes for saving of charts

git-svn-id: https://svn.fhem.de/fhem/trunk@2867 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
johannnes 2013-03-07 19:37:27 +00:00
parent b1cf8a6fed
commit d820e060f4
4 changed files with 35 additions and 24 deletions

View File

@ -1,4 +1,8 @@
Update vom 6.2.2013
Update vom 7.3.2013
* Bugfixes für Chart speichern
Update vom 6.3.2013
* Name des Charts beim Speichern escaped
* Bessere Fehlermeldung bei Device Selektion

View File

@ -810,7 +810,6 @@ sub chartQuery($@) {
if ($sql eq "error") {
return jsonError("Could not setup SQL String");
}
my ($hash, @a) = @_;
my $dbhf= $hash->{DBHF};
@ -863,8 +862,8 @@ sub chartQuery($@) {
$jsonstring .= '":';
if (defined $data[$i]) {
my $fragment = substr($data[$i],0,2);
if ($fragment eq "[{") {
my $fragment = substr($data[$i],0,1);
if ($fragment eq "{") {
$jsonstring .= $data[$i];
} else {
$jsonstring .= '"'.$data[$i].'"';
@ -1328,4 +1327,4 @@ sub chartQuery($@) {
</ul>
=end html_DE
=cut
=cut

View File

@ -37,7 +37,7 @@ DIR www/frontend/lib/ext-4.1.1a/images/gray/grid
DIR www/frontend/lib/ext-4.1.1a/images/gray/util
DIR www/frontend/lib/ext-4.1.1a/images/gray/panel-header
DIR www/frontend/lib/ext-4.1.1a/images/gray/tip
UPD 2013-03-06_11:11:22 49747 FHEM/93_DbLog.pm
UPD 2013-03-07_12:12:22 49744 FHEM/93_DbLog.pm
UPD 2013-03-06_11:11:22 499 www/frontend/index.html
UPD 2013-03-06_11:11:22 236 www/frontend/README.txt
UPD 2013-03-06_11:11:22 1856 www/frontend/app/app.js
@ -46,7 +46,7 @@ UPD 2013-03-06_11:11:22 7826 www/frontend/app/view/Viewport.js
UPD 2013-03-06_11:11:22 4269 www/frontend/app/view/DevicePanel.js
UPD 2013-03-06_11:11:22 2503 www/frontend/app/view/TableDataGridPanel.js
UPD 2013-03-06_11:11:22 1310 www/frontend/app/view/LineChartView.js
UPD 2013-03-06_11:11:22 41802 www/frontend/app/controller/ChartController.js
UPD 2013-03-07_06:58:22 41859 www/frontend/app/controller/ChartController.js
UPD 2013-03-06_11:11:22 10761 www/frontend/app/controller/MainController.js
UPD 2013-03-06_11:11:22 202 www/frontend/app/model/ReadingsModel.js
UPD 2013-03-06_11:11:22 338 www/frontend/app/model/SavedChartsModel.js

View File

@ -733,20 +733,20 @@ Ext.define('FHEM.controller.ChartController', {
dbendtime = Ext.Date.format(endtime, 'Y-m-d_H:i:s'),
view = this.getLinechartview();
var jsonConfig = '{\\"x\\":\\"' + xaxis + '\\",\\"y\\":\\"' + yaxis + '\\",\\"device\\":\\"' + device + '\\",';
jsonConfig += '\\"yaxiscolorcombo\\":\\"\\' + yaxiscolorcombo + '\\",\\"yaxisfillcheck\\":\\"' + yaxisfillcheck + '\\",';
jsonConfig += '\\"y2device\\":\\"' + y2device + '\\",';
jsonConfig += '\\"y2axis\\":\\"' + y2axis + '\\",\\"y2axiscolorcombo\\":\\"' + y2axiscolorcombo + '\\",';
jsonConfig += '\\"y2axisfillcheck\\":\\"' + y2axisfillcheck + '\\",\\"y3axis\\":\\"' + y3axis + '\\",';
jsonConfig += '\\"y3device\\":\\"' + y3device + '\\",';
jsonConfig += '\\"y3axiscolorcombo\\":\\"' + y3axiscolorcombo + '\\",\\"y3axisfillcheck\\":\\"' + y3axisfillcheck + '\\",';
jsonConfig += '\\"base1start\\":\\"' + base1start + '\\",\\"base1end\\":\\"' + base1end + '\\",';
jsonConfig += '\\"base1color\\":\\"' + base1color + '\\",\\"base1fill\\":\\"' + base1fill + '\\",';
jsonConfig += '\\"base2start\\":\\"' + base2start + '\\",\\"base2end\\":\\"' + base2end + '\\",';
jsonConfig += '\\"base2color\\":\\"' + base2color + '\\",\\"base2fill\\":\\"' + base2fill + '\\",';
jsonConfig += '\\"base3start\\":\\"' + base3start + '\\",\\"base3end\\":\\"' + base3end + '\\",';
jsonConfig += '\\"base3color\\":\\"' + base3color + '\\",\\"base3fill\\":\\"' + base3fill + '\\",';
jsonConfig += '\\"starttime\\":\\"' + dbstarttime + '\\",\\"endtime\\":\\"' + dbendtime + '\\"}';
var jsonConfig = '{"x":"' + xaxis + '","y":"' + yaxis + '","device":"' + device + '",';
jsonConfig += '"yaxiscolorcombo":"' + yaxiscolorcombo + '","yaxisfillcheck":"' + yaxisfillcheck + '",';
jsonConfig += '"y2device":"' + y2device + '",';
jsonConfig += '"y2axis":"' + y2axis + '","y2axiscolorcombo":"' + y2axiscolorcombo + '",';
jsonConfig += '"y2axisfillcheck":"' + y2axisfillcheck + '","y3axis":"' + y3axis + '",';
jsonConfig += '"y3device":"' + y3device + '",';
jsonConfig += '"y3axiscolorcombo":"' + y3axiscolorcombo + '","y3axisfillcheck":"' + y3axisfillcheck + '",';
jsonConfig += '"base1start":"' + base1start + '","base1end":"' + base1end + '",';
jsonConfig += '"base1color":"' + base1color + '","base1fill":"' + base1fill + '",';
jsonConfig += '"base2start":"' + base2start + '","base2end":"' + base2end + '",';
jsonConfig += '"base2color":"' + base2color + '","base2fill":"' + base2fill + '",';
jsonConfig += '"base3start":"' + base3start + '","base3end":"' + base3end + '",';
jsonConfig += '"base3color":"' + base3color + '","base3fill":"' + base3fill + '",';
jsonConfig += '"starttime":"' + dbstarttime + '","endtime":"' + dbendtime + '"}';
var url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+' + dbstarttime + '+' + dbendtime + '+';
url +=device + '+savechart+""+""+' + savename + '+' + jsonConfig + '&XHR=1';
@ -754,7 +754,7 @@ Ext.define('FHEM.controller.ChartController', {
view.setLoading(true);
Ext.Ajax.request({
method: 'GET',
method: 'POST',
disableCaching: false,
url: url,
success: function(response){
@ -790,8 +790,16 @@ Ext.define('FHEM.controller.ChartController', {
if (cellIndex === 0) {
var name = record.get('NAME'),
rawchartdata = record.get('VALUE'),
chartdata = Ext.decode(rawchartdata);
chartdata = record.get('VALUE');
if (typeof chartdata !== "object") {
try {
chartdata = Ext.decode(chartdata);
} catch (e) {
Ext.Msg.alert("Error", "The Chart could not be loaded! RawChartdata was: <br>" + chartdata);
}
}
//cleanup the form before loading
this.resetFormFields();