2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00
johannnes e9ec74a1f1 initial upload of new Javascript Frontend based on ExtJS (by Johannes)
- contains ExtJS Library 4.1.1a, together with css and images
  - is related to the module 93_DbLog.pm, which holds some functions used by the frontend

git-svn-id: https://svn.fhem.de/fhem/trunk@2767 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2013-02-19 18:54:42 +00:00

80 lines
2.1 KiB
JavaScript

/**
* The Main Controller handling Main Application Logic
*/
Ext.define('FHEM.controller.MainController', {
extend: 'Ext.app.Controller',
refs: [
{
selector: 'viewport[name=mainviewport]',
ref: 'mainviewport' //this.getMainviewport()
},
{
selector: 'text[name=statustextfield]',
ref: 'statustextfield' //this.getStatustextfield()
},
{
selector: 'panel[name=culpanel]',
ref: 'culpanel' //this.getCulpanel()
}
],
/**
* init function to register listeners
*/
init: function() {
this.control({
'viewport[name=mainviewport]': {
afterrender: this.viewportRendered
},
'panel[name=linechartaccordionpanel]': {
expand: this.showLineChartPanel
},
'panel[name=tabledataaccordionpanel]': {
expand: this.showDatabaseTablePanel
}
});
},
/**
* load the FHEM devices and state on viewport render completion
*/
viewportRendered: function(){
if (Ext.isDefined(FHEM.version)) {
var sp = this.getStatustextfield();
sp.setText(FHEM.version);
}
// var cp = me.getCulpanel();
// if (result.list === "CUL") {
// var culname = result.devices[0].NAME;
// cp.add(
// {
// xtype: 'text',
// text: culname
// }
// );
// }
},
/**
*
*/
showLineChartPanel: function() {
Ext.ComponentQuery.query('panel[name=tabledatagridpanel]')[0].hide();
Ext.ComponentQuery.query('panel[name=linechartpanel]')[0].show();
},
/**
*
*/
showDatabaseTablePanel: function() {
//TODO: use this when new dblog module is deployed
//Ext.ComponentQuery.query('panel[name=linechartpanel]')[0].hide();
//Ext.ComponentQuery.query('panel[name=tabledatagridpanel]')[0].show();
}
});