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://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2767 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
57
www/frontend/app/app.js
Normal file
57
www/frontend/app/app.js
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Setup the application
|
||||
*/
|
||||
|
||||
Ext.Loader.setConfig({
|
||||
enabled: true,
|
||||
disableCaching: false,
|
||||
paths: {
|
||||
'FHEM': 'app'
|
||||
}
|
||||
});
|
||||
|
||||
Ext.application({
|
||||
name: 'FHEM Frontend',
|
||||
requires: [
|
||||
'FHEM.view.Viewport'
|
||||
],
|
||||
|
||||
controllers: [
|
||||
'FHEM.controller.MainController',
|
||||
'FHEM.controller.ChartController'
|
||||
],
|
||||
|
||||
launch: function() {
|
||||
|
||||
// Gather information from FHEM to display status, devices, etc.
|
||||
var me = this,
|
||||
url = '../../../fhem?cmd=jsonlist&XHR=1';
|
||||
|
||||
Ext.Ajax.request({
|
||||
method: 'GET',
|
||||
async: false,
|
||||
disableCaching: false,
|
||||
url: url,
|
||||
success: function(response){
|
||||
var json = Ext.decode(response.responseText);
|
||||
FHEM.version = json.Results[0].devices[0].ATTR.version;
|
||||
|
||||
Ext.each(json.Results, function(result) {
|
||||
//TODO: get more specific here...
|
||||
if (result.list === "DbLog" && result.devices[0].NAME) {
|
||||
FHEM.dblogname = result.devices[0].NAME;
|
||||
}
|
||||
});
|
||||
if (!FHEM.dblogname && Ext.isEmpty(FHEM.dblogname)) {
|
||||
Ext.Msg.alert("Error", "Could not find a DbLog Configuration. Do you have DbLog already running?");
|
||||
} else {
|
||||
Ext.create("FHEM.view.Viewport");
|
||||
}
|
||||
},
|
||||
failure: function() {
|
||||
Ext.Msg.alert("Error", "The connection to FHEM could not be established");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user