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

added commandline including save option

- added shutdown and restart buttons
  - added some icons

git-svn-id: https://svn.fhem.de/fhem/trunk@2840 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
johannnes 2013-03-02 12:56:18 +00:00
parent bf4052c125
commit be9f58d92a
11 changed files with 306 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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);
},
/**
*
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

View File

@ -19,8 +19,70 @@ Ext.define('FHEM.view.Viewport', {
items: [
{
region: 'north',
html: '<p align="center"><img align="center" src="../../fhem/images/default/fhemicon.png" height="70px"</></p><h1 class="x-panel-header" align="center">Frontend</h1>',
height: 85
height: 85,
layout: 'hbox',
items: [
{
xtype: 'panel',
html: '<p><img src="../../fhem/images/default/fhemicon.png" height="70px"</></p><h1 class="x-panel-header">Frontend</h1>',
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',