diff --git a/fhem/www/frontend/CHANGED b/fhem/www/frontend/CHANGED index 852ab266e..9b13c8805 100644 --- a/fhem/www/frontend/CHANGED +++ b/fhem/www/frontend/CHANGED @@ -1,3 +1,9 @@ +Update vom 2.3.2012 + +* Kommandozeile hinzugefügt, inkl Speichern in der fhem.cfg +* Shutdown und Restart Button für FHEM hinzugefügt +* Icons + Update vom 1.3.2012 * Charts unterstützen jetzt mehrere Y Achsen. Diese können nach Klick auf den Button "Add another Y Axis" hinzugefügt werden diff --git a/fhem/www/frontend/controls_frontend.txt b/fhem/www/frontend/controls_frontend.txt index 5e15f030d..fd7bae483 100644 --- a/fhem/www/frontend/controls_frontend.txt +++ b/fhem/www/frontend/controls_frontend.txt @@ -4,6 +4,8 @@ DIR www/frontend/app/model DIR www/frontend/app/store DIR www/frontend/app/view DIR www/frontend/app/controller +DIR www/frontend/app/resources +DIR www/frontend/app/resources/icons DIR www/frontend/lib DIR www/frontend/lib/ext-4.1.1a DIR www/frontend/lib/ext-4.1.1a/images @@ -38,13 +40,13 @@ DIR www/frontend/lib/ext-4.1.1a/images/gray/tip UPD 2013-03-01_05:44:48 49099 FHEM/93_DbLog.pm UPD 2013-02-25_08:13:15 499 www/frontend/index.html UPD 2013-02-27_07:20:39 236 www/frontend/README.txt -UPD 2013-03-01_05:42:05 1655 www/frontend/app/app.js +UPD 2013-03-02_01:26:28 1763 www/frontend/app/app.js UPD 2013-03-01_05:43:56 20350 www/frontend/app/view/LineChartPanel.js -UPD 2013-03-01_05:43:56 6770 www/frontend/app/view/Viewport.js +UPD 2013-03-02_01:42:33 9490 www/frontend/app/view/Viewport.js UPD 2013-03-01_05:43:56 2503 www/frontend/app/view/TableDataGridPanel.js UPD 2013-03-01_05:43:55 1310 www/frontend/app/view/LineChartView.js UPD 2013-03-01_05:42:32 41591 www/frontend/app/controller/ChartController.js -UPD 2013-03-01_05:42:32 2115 www/frontend/app/controller/MainController.js +UPD 2013-03-02_01:44:22 8479 www/frontend/app/controller/MainController.js UPD 2013-03-01_05:43:32 202 www/frontend/app/model/ReadingsModel.js UPD 2013-03-01_05:43:32 338 www/frontend/app/model/SavedChartsModel.js UPD 2013-03-01_05:43:31 674 www/frontend/app/model/ChartModel.js @@ -55,6 +57,12 @@ UPD 2013-03-01_05:43:45 505 www/frontend/app/store/SavedChartsStore.js UPD 2013-03-01_05:43:45 426 www/frontend/app/store/ReadingsStore.js UPD 2013-03-01_05:43:45 1048 www/frontend/app/store/TableDataStore.js UPD 2013-03-01_05:43:44 447 www/frontend/app/store/DeviceStore.js +UPD 2013-03-02_10:07:52 770 www/frontend/app/resources/icons/database_refresh.png +UPD 2013-03-02_10:04:18 755 www/frontend/app/resources/icons/database_save.png +UPD 2013-03-02_10:05:29 626 www/frontend/app/resources/icons/readme.txt +UPD 2013-03-02_10:04:18 524 www/frontend/app/resources/icons/resultset_last.png +UPD 2013-03-02_10:04:18 395 www/frontend/app/resources/icons/resultset_next.png +UPD 2013-03-02_10:07:52 700 www/frontend/app/resources/icons/stop.png UPD 2013-02-25_08:13:15 1291919 www/frontend/lib/ext-4.1.1a/ext-all.js UPD 2013-02-25_08:13:15 381835 www/frontend/lib/ext-4.1.1a/ext-all-gray-debug.css UPD 2013-02-25_08:13:15 1981 www/frontend/lib/ext-4.1.1a/images/gray/tools/tools-sprites-trans.gif diff --git a/fhem/www/frontend/www/frontend/app/app.js b/fhem/www/frontend/www/frontend/app/app.js index becf696a3..d7e158896 100644 --- a/fhem/www/frontend/www/frontend/app/app.js +++ b/fhem/www/frontend/www/frontend/app/app.js @@ -26,13 +26,14 @@ Ext.application({ // Gather information from FHEM to display status, devices, etc. var me = this, url = '../../../fhem?cmd=jsonlist&XHR=1'; - + Ext.getBody().mask("Please wait while the Frontend is starting..."); Ext.Ajax.request({ method: 'GET', async: false, disableCaching: false, url: url, success: function(response){ + Ext.getBody().unmask(); var json = Ext.decode(response.responseText); FHEM.version = json.Results[0].devices[0].ATTR.version; diff --git a/fhem/www/frontend/www/frontend/app/controller/MainController.js b/fhem/www/frontend/www/frontend/app/controller/MainController.js index 924096713..9faff8f35 100644 --- a/fhem/www/frontend/www/frontend/app/controller/MainController.js +++ b/fhem/www/frontend/www/frontend/app/controller/MainController.js @@ -16,6 +16,10 @@ Ext.define('FHEM.controller.MainController', { { selector: 'panel[name=culpanel]', ref: 'culpanel' //this.getCulpanel() + }, + { + selector: 'textfield[name=commandfield]', + ref: 'commandfield' //this.getCommandfield() } ], @@ -33,6 +37,21 @@ Ext.define('FHEM.controller.MainController', { }, 'panel[name=tabledataaccordionpanel]': { expand: this.showDatabaseTablePanel + }, + 'textfield[name=commandfield]': { + specialkey: this.checkCommand + }, + 'button[name=saveconfig]': { + click: this.saveConfig + }, + 'button[name=executecommand]': { + click: this.submitCommand + }, + 'button[name=shutdownfhem]': { + click: this.shutdownFhem + }, + 'button[name=restartfhem]': { + click: this.restartFhem } }); @@ -60,6 +79,188 @@ Ext.define('FHEM.controller.MainController', { // } }, + /** + * + */ + saveConfig: function() { + + var command = this.getCommandfield().getValue(); + if (command && !Ext.isEmpty(command)) { + this.submitCommand(); + } + + Ext.Ajax.request({ + method: 'GET', + disableCaching: false, + url: '../../../fhem?cmd=save', + success: function(response){ + + var win = Ext.create('Ext.window.Window', { + width: 110, + height: 60, + html: 'Save successful!', + preventHeader: true, + border: false, + closable: false, + plain: true + });win.showAt(Ext.getBody().getWidth() / 2 -100, 30); + win.getEl().animate({ + opacity: 0, + easing: 'easeOut', + duration: 3000, + delay: 2000 + }); + }, + failure: function() { + Ext.Msg.alert("Error", "Could not save the current configuration!"); + } + }); + }, + + /** + * + */ + checkCommand: function(field, e) { + if (e.getKey() == e.ENTER && !Ext.isEmpty(field.getValue())) { + this.submitCommand(); + } + }, + + /** + * + */ + submitCommand: function() { + + var command = this.getCommandfield().getValue(); + + if (command && !Ext.isEmpty(command)) { + Ext.Ajax.request({ + method: 'GET', + disableCaching: false, + url: '../../../fhem?cmd=' + command + '&XHR=1', + success: function(response){ + + if(response.responseText && !Ext.isEmpty(response.responseText)) { + Ext.create('Ext.window.Window', { + maxWidth: 600, + maxHeight: 500, + autoScroll: true, + layout: 'fit', + title: "Response", + items: [ + { + xtype: 'panel', + autoScroll: true, + items:[ + { + xtype: 'displayfield', + htmlEncode: true, + value: response.responseText + } + ] + } + ] + }).show(); + } else { + var win = Ext.create('Ext.window.Window', { + width: 130, + height: 60, + html: 'Command submitted!', + preventHeader: true, + border: false, + closable: false, + plain: true + });win.showAt(Ext.getBody().getWidth() / 2 -100, 30); + win.getEl().animate({ + opacity: 0, + easing: 'easeOut', + duration: 3000, + delay: 2000 + }); + } + + }, + failure: function() { + Ext.Msg.alert("Error", "Could not submit the command!"); + } + }); + } + + }, + + /** + * + */ + shutdownFhem: function() { + Ext.Ajax.request({ + method: 'GET', + disableCaching: false, + url: '../../../fhem?cmd=shutdown&XHR=1' + }); + var win = Ext.create('Ext.window.Window', { + width: 130, + height: 60, + html: 'Shutdown submitted!', + preventHeader: true, + border: false, + closable: false, + plain: true + });win.showAt(Ext.getBody().getWidth() / 2 -100, 30); + win.getEl().animate({ + opacity: 0, + easing: 'easeOut', + duration: 3000, + delay: 2000 + }); + }, + + /** + * + */ + restartFhem: function() { + Ext.Ajax.request({ + method: 'GET', + disableCaching: false, + url: '../../../fhem?cmd=shutdown restart&XHR=1' + }); + Ext.getBody().mask("Please wait while FHEM is restarting..."); + this.retryConnect(); + + }, + + /** + * + */ + retryConnect: function() { + var me = this; + + var task = new Ext.util.DelayedTask(function(){ + Ext.Ajax.request({ + method: 'GET', + disableCaching: false, + url: '../../../fhem?cmd=jsonlist&XHR=1', + + success: function(response){ + if (response.responseText !== "Unknown command JsonList, try help↵") { + //restarting the frontend + window.location.reload(); + } else { + console.log("fail.."); + me.retryConnect(); + } + + }, + failure: function() { + console.log("failure.."); + me.retryConnect(); + } + }); + }); + + task.delay(1000); + + }, + /** * */ diff --git a/fhem/www/frontend/www/frontend/app/resources/icons/database_refresh.png b/fhem/www/frontend/www/frontend/app/resources/icons/database_refresh.png new file mode 100644 index 000000000..ff803be12 Binary files /dev/null and b/fhem/www/frontend/www/frontend/app/resources/icons/database_refresh.png differ diff --git a/fhem/www/frontend/www/frontend/app/resources/icons/database_save.png b/fhem/www/frontend/www/frontend/app/resources/icons/database_save.png new file mode 100644 index 000000000..44c06dddf Binary files /dev/null and b/fhem/www/frontend/www/frontend/app/resources/icons/database_save.png differ diff --git a/fhem/www/frontend/www/frontend/app/resources/icons/readme.txt b/fhem/www/frontend/www/frontend/app/resources/icons/readme.txt new file mode 100644 index 000000000..400a64d78 --- /dev/null +++ b/fhem/www/frontend/www/frontend/app/resources/icons/readme.txt @@ -0,0 +1,22 @@ +Silk icon set 1.3 + +_________________________________________ +Mark James +http://www.famfamfam.com/lab/icons/silk/ +_________________________________________ + +This work is licensed under a +Creative Commons Attribution 2.5 License. +[ http://creativecommons.org/licenses/by/2.5/ ] + +This means you may use it for any purpose, +and make any changes you like. +All I ask is that you include a link back +to this page in your credits. + +Are you using this icon set? Send me an email +(including a link or picture if available) to +mjames@gmail.com + +Any other questions about this icon set please +contact mjames@gmail.com \ No newline at end of file diff --git a/fhem/www/frontend/www/frontend/app/resources/icons/resultset_last.png b/fhem/www/frontend/www/frontend/app/resources/icons/resultset_last.png new file mode 100644 index 000000000..8ec894784 Binary files /dev/null and b/fhem/www/frontend/www/frontend/app/resources/icons/resultset_last.png differ diff --git a/fhem/www/frontend/www/frontend/app/resources/icons/resultset_next.png b/fhem/www/frontend/www/frontend/app/resources/icons/resultset_next.png new file mode 100644 index 000000000..e252606d3 Binary files /dev/null and b/fhem/www/frontend/www/frontend/app/resources/icons/resultset_next.png differ diff --git a/fhem/www/frontend/www/frontend/app/resources/icons/stop.png b/fhem/www/frontend/www/frontend/app/resources/icons/stop.png new file mode 100644 index 000000000..0cfd58596 Binary files /dev/null and b/fhem/www/frontend/www/frontend/app/resources/icons/stop.png differ diff --git a/fhem/www/frontend/www/frontend/app/view/Viewport.js b/fhem/www/frontend/www/frontend/app/view/Viewport.js index 830199f0c..d482cb61d 100644 --- a/fhem/www/frontend/www/frontend/app/view/Viewport.js +++ b/fhem/www/frontend/www/frontend/app/view/Viewport.js @@ -19,8 +19,70 @@ Ext.define('FHEM.view.Viewport', { items: [ { region: 'north', - html: '

Frontend

', - height: 85 + height: 85, + layout: 'hbox', + items: [ + { + xtype: 'panel', + html: '

Frontend

', + width: '30%', + border: false + }, + { + xtype: 'textfield', + name: 'commandfield', + width: '30%', + padding: '30px 0 0 0', + fieldLabel: 'Send Commands', + border: false + }, + { + xtype: 'panel', + border: false, + width: '20%', + items: [ + { + xtype: 'button', + width: 60, + margin: '30px 0 0 5px', + text: 'Execute', + name: 'executecommand' + }, + { + xtype: 'button', + width: 90, + margin: '30px 0 0 5px', + text: 'Save to Config', + name: 'saveconfig' + } + ] + }, + { + xtype: 'panel', + border: false, + width: '20%', + items: [ + { + xtype: 'button', + width: 75, + margin: '30px 5px 0 5px', + text: 'Shutdown', + name: 'shutdownfhem', + tooltip: 'Shutdown FHEM', + icon: 'app/resources/icons/stop.png' + }, + { + xtype: 'button', + width: 70, + margin: '30px 5px 0 5px', + text: 'Restart', + name: 'restartfhem', + tooltip: 'Restart FHEM', + icon: 'app/resources/icons/database_refresh.png' + } + ] + } + ] }, { region: 'west', title: 'Navigation',