[dss-commits] r8883 - in dss/trunk: data/webroot data/webroot/js websrc/dss-setup-interface websrc/dss-setup-interface/dSS websrc/dss-setup-interface/dSS/data websrc/dss-setup-interface/dSS/grid websrc/dss-setup-interface/dSS/system
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Wed Nov 4 11:43:18 CET 2009
Author: mfernandez
Date: 2009-11-04 11:43:18 +0100 (Wed, 04 Nov 2009)
New Revision: 8883
Added:
dss/trunk/websrc/dss-setup-interface/dSS/SystemPanel.js
dss/trunk/websrc/dss-setup-interface/dSS/system/
dss/trunk/websrc/dss-setup-interface/dSS/system/PropertyTree.js
Removed:
dss/trunk/websrc/dss-setup-interface/dSS/SystemPropertyTree.js
Modified:
dss/trunk/data/webroot/js/dss-setup-interface.js
dss/trunk/data/webroot/setup.html
dss/trunk/websrc/dss-setup-interface/dSS/data/DeviceStore.js
dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js
dss/trunk/websrc/dss-setup-interface/dss-setup-interface.js
Log:
Added system panel with a system property tree.
Modified: dss/trunk/data/webroot/js/dss-setup-interface.js
===================================================================
--- dss/trunk/data/webroot/js/dss-setup-interface.js 2009-11-04 10:43:15 UTC (rev 8882)
+++ dss/trunk/data/webroot/js/dss-setup-interface.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -277,6 +277,7 @@
{name:"circuit"},
{name:"modulator"},
{name:"zone"},
+ {name:"isPresent"},
{name:"firstSeen"},
{name:"lastDiscovered"}
]);
@@ -288,10 +289,16 @@
deviceRecord
);
- Ext.apply(this, { reader: deviceReader, sortInfo: {
- field: 'firstSeen',
- direction: 'DESC' // or 'DESC' (case sensitive for local sorting)
-}});
+ Ext.apply(
+ this,
+ {
+ reader: deviceReader,
+ sortInfo: {
+ field: 'firstSeen',
+ direction: 'DESC' // or 'DESC' (case sensitive for local sorting)
+ }
+ }
+ );
dSS.data.DeviceStore.superclass.constructor.call(this, arguments);
}
});
@@ -312,15 +319,6 @@
{header: "last discovered", width: 150, sortable: true, dataIndex: 'lastDiscovered', xtype: 'datecolumn', format: 'c'}
];
- var editor = new Ext.ux.grid.RowEditor({
- saveText: 'Update'
- });
-
- editor.on('afteredit', function() {
- deviceStore.commitChanges();
- filterDevices();
- });
-
var deviceStore = new dSS.data.DeviceStore();
Ext.apply(this, {
@@ -331,10 +329,16 @@
stripeRows : true,
forceFit : true,
title : 'Devices',
- plugins : [editor],
viewConfig: {
- autoFill: true
- }
+ autoFill: true,
+ getRowClass: function(record, index) {
+ var c = record.get('isPresent');
+ if (c === false) {
+ return 'nonPresentDevice';
+ }
+ return '';
+ }
+ }
});
dSS.grid.DevicePanel.superclass.initComponent.apply(this, arguments);
@@ -543,9 +547,9 @@
}
});
-Ext.namespace('dSS');
+Ext.namespace('dSS', 'dSS.system');
-dSS.SystemPropertyTree = Ext.extend(Ext.Panel, {
+dSS.system.PropertyTree = Ext.extend(Ext.Panel, {
initComponent: function() {
Ext.apply(this, {
@@ -613,8 +617,81 @@
}
});
-Ext.reg('dsssystempropertytree', dSS.SystemPropertyTree);
+Ext.reg('dsssystempropertytree', dSS.system.PropertyTree);
+Ext.namespace('dSS');
+
+dSS.SystemPanel = Ext.extend(Ext.Panel, {
+ initComponent: function() {
+
+ var tabRecord = Ext.data.Record.create([
+ { name:"title" }
+ ]);
+
+ var tabStore = new Ext.data.Store({}, tabRecord);
+
+
+ var contentPanel = {
+ ref: 'contentPanel',
+ region: 'center',
+ layout: 'card',
+ activeItem: 0,
+ border: false,
+ items: [
+ {
+ title: 'Property Tree',
+ xtype: 'dsssystempropertytree',
+ ref: 'systemPropertyTree'
+ }
+ ]
+ };
+
+ Ext.apply(this, {
+ layout: 'border',
+ items: [ {
+ xtype: 'listview',
+ title: 'System',
+ ref: 'listView',
+ store: tabStore,
+ singleSelect: true,
+ region: 'west',
+ hideHeaders: true,
+ width: 275,
+ columns: [{
+ header: 'name',
+ dataIndex: 'title'
+ }]
+ },
+ contentPanel
+ ]
+ });
+
+ dSS.ZoneBrowser.superclass.initComponent.apply(this, arguments);
+ this.on(
+ 'activate',
+ function(component) {
+ this.contentPanel.items.each(function(item) {
+ var tab = new tabRecord({title: item.title});
+ tabStore.add([tab]);
+ }, this);
+ this.listView.select(0, false, true);
+ },
+ this
+ );
+ this.items.get(0).on(
+ 'selectionchange',
+ function(listView, selections) {
+ if(selections.length === 1) {
+ this.contentPanel.layout.setActiveItem(selections[0].viewIndex);
+ }
+ },
+ this
+ );
+ }
+});
+
+Ext.reg('dsssystempanel', dSS.SystemPanel);
+
Ext.onReady(function(){
Ext.get('start').remove();
var viewport = new Ext.Viewport({
@@ -636,11 +713,12 @@
{
title: 'Zones',
xtype: 'dsszonebrowser',
- ref: 'zonebrowser'
+ ref: 'zoneBrowser'
},{
title: 'System Properties',
- xtype: 'dsssystempropertytree',
- ref: 'systempropertytree'
+ xtype: 'dsssystempanel',
+ ref: 'systemPanel',
+ id: 'hurz'
}
]
}]
Modified: dss/trunk/data/webroot/setup.html
===================================================================
--- dss/trunk/data/webroot/setup.html 2009-11-04 10:43:15 UTC (rev 8882)
+++ dss/trunk/data/webroot/setup.html 2009-11-04 10:43:18 UTC (rev 8883)
@@ -9,10 +9,6 @@
<script type="text/javascript" src="js/lib/extjs/adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="js/lib/extjs/ext-all-debug.js"></script>
- <!-- ExtJS extensions -->
- <script type="text/javascript" src="js/DataView-more.js"></script>
- <script type="text/javascript" src="js/lib/extjs/examples/ux/RowEditor.js"></script>
-
<script type="text/javascript" src="js/dss-setup-interface.js"></script>
<style>
.zone-wrap{
@@ -34,9 +30,13 @@
.x-panel-body{
background: white;
- font: 11px Arial, Helvetica, sans-serif;
+ font: 14px Arial, Helvetica, sans-serif;
}
+ .x-grid3-hd-row td, .x-grid3-row td, .x-grid3-summary-row td {
+ font-size: 14px;
+ }
+
.reloadAction {
background-image: url(images/refresh.gif) !important;
}
@@ -48,6 +48,10 @@
.editZoneAction {
background-image: url(images/edit.gif) !important;
}
+
+ .nonPresentDevice table {
+ color: #505050;
+ }
</style>
</head>
<body>
Added: dss/trunk/websrc/dss-setup-interface/dSS/SystemPanel.js
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dSS/SystemPanel.js (rev 0)
+++ dss/trunk/websrc/dss-setup-interface/dSS/SystemPanel.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -0,0 +1,75 @@
+//= require <dSS/system/PropertyTree.js>
+
+Ext.namespace('dSS');
+
+dSS.SystemPanel = Ext.extend(Ext.Panel, {
+ initComponent: function() {
+
+ var tabRecord = Ext.data.Record.create([
+ { name:"title" }
+ ]);
+
+ var tabStore = new Ext.data.Store({}, tabRecord);
+
+
+ var contentPanel = {
+ ref: 'contentPanel',
+ region: 'center',
+ layout: 'card',
+ activeItem: 0,
+ border: false,
+ items: [
+ {
+ title: 'Property Tree',
+ xtype: 'dsssystempropertytree',
+ ref: 'systemPropertyTree'
+ }
+ ]
+ };
+
+ Ext.apply(this, {
+ layout: 'border',
+ items: [ {
+ xtype: 'listview',
+ title: 'System',
+ ref: 'listView',
+ store: tabStore,
+ singleSelect: true,
+ region: 'west',
+ hideHeaders: true,
+ width: 275,
+ columns: [{
+ header: 'name',
+ dataIndex: 'title'
+ }]
+ },
+ contentPanel
+ ]
+ });
+
+ dSS.ZoneBrowser.superclass.initComponent.apply(this, arguments);
+ this.on(
+ 'activate',
+ function(component) {
+ // for each item in contentPanel
+ this.contentPanel.items.each(function(item) {
+ var tab = new tabRecord({title: item.title});
+ tabStore.add([tab]);
+ }, this);
+ this.listView.select(0, false, true);
+ },
+ this
+ );
+ this.items.get(0).on(
+ 'selectionchange',
+ function(listView, selections) {
+ if(selections.length === 1) {
+ this.contentPanel.layout.setActiveItem(selections[0].viewIndex);
+ }
+ },
+ this
+ );
+ }
+});
+
+Ext.reg('dsssystempanel', dSS.SystemPanel);
\ No newline at end of file
Deleted: dss/trunk/websrc/dss-setup-interface/dSS/SystemPropertyTree.js
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dSS/SystemPropertyTree.js 2009-11-04 10:43:15 UTC (rev 8882)
+++ dss/trunk/websrc/dss-setup-interface/dSS/SystemPropertyTree.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -1,73 +0,0 @@
-//= require <dSS/tree/PropertyTreeLoader>
-
-Ext.namespace('dSS');
-
-dSS.SystemPropertyTree = Ext.extend(Ext.Panel, {
- initComponent: function() {
-
- Ext.apply(this, {
- layout: 'border',
- items: [{
- xtype: 'treepanel',
- ref: 'propertytree',
- region: 'center',
- width: 225, // give east and west regions a width
- minSize: 175,
- maxSize: 400,
- autoScroll: true,
- animate: true,
- enableDD: false,
- containerScroll: true,
- border: false,
- loader: new dSS.tree.PropertyTreeLoader(),
- root: new Ext.tree.AsyncTreeNode({
- expanded: false,
- path: '/',
- type: 'none',
- text: 'dSS',
- leaf: false,
- }),
- rootVisible: true,
- listeners: {
- append: this.handleAppend
- }
- }
- ]
- });
-
- dSS.ZoneBrowser.superclass.initComponent.apply(this, arguments);
- },
- handleAppend: function(tree, parent, node, index) {
- if (node.attributes.type === 'none') return;
- var url = "/json/property/";
- switch(node.attributes.type) {
- case 'string':
- url += 'getString';
- break;
- case 'integer':
- url += 'getInteger';
- break;
- case 'boolean':
- url += 'getBoolean';
- break;
- default:
- return;
- }
- Ext.Ajax.request({
- url: url,
- params: { path: node.attributes.path },
- method: 'GET',
- success: function(response, opts) {
- var obj = Ext.decode(response.responseText);
- if(obj.ok === true) {
- node.setText(node.text + " : " + obj.result.value);
- }
- },
- failure: function(response, opts) {
- console.log('server-side failure with status code ' + response.status);
- }
- });
- }
-});
-
-Ext.reg('dsssystempropertytree', dSS.SystemPropertyTree);
\ No newline at end of file
Modified: dss/trunk/websrc/dss-setup-interface/dSS/data/DeviceStore.js
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dSS/data/DeviceStore.js 2009-11-04 10:43:15 UTC (rev 8882)
+++ dss/trunk/websrc/dss-setup-interface/dSS/data/DeviceStore.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -10,6 +10,7 @@
{name:"circuit"},
{name:"modulator"},
{name:"zone"},
+ {name:"isPresent"},
{name:"firstSeen"},
{name:"lastDiscovered"}
]);
@@ -22,10 +23,16 @@
deviceRecord
);
- Ext.apply(this, { reader: deviceReader, sortInfo: {
- field: 'firstSeen',
- direction: 'DESC' // or 'DESC' (case sensitive for local sorting)
-}});
+ Ext.apply(
+ this,
+ {
+ reader: deviceReader,
+ sortInfo: {
+ field: 'firstSeen',
+ direction: 'DESC' // or 'DESC' (case sensitive for local sorting)
+ }
+ }
+ );
dSS.data.DeviceStore.superclass.constructor.call(this, arguments);
}
});
Modified: dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js 2009-11-04 10:43:15 UTC (rev 8882)
+++ dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -16,16 +16,6 @@
{header: "last discovered", width: 150, sortable: true, dataIndex: 'lastDiscovered', xtype: 'datecolumn', format: 'c'}
];
- var editor = new Ext.ux.grid.RowEditor({
- saveText: 'Update'
- });
-
- editor.on('afteredit', function() {
- //console.log('a device has been edited');
- deviceStore.commitChanges();
- filterDevices();
- });
-
var deviceStore = new dSS.data.DeviceStore();
Ext.apply(this, {
@@ -35,12 +25,17 @@
enableDragDrop : true,
stripeRows : true,
forceFit : true,
-// autoExpandColumn : 'name',
title : 'Devices',
- plugins : [editor],
viewConfig: {
- autoFill: true
- }
+ autoFill: true,
+ getRowClass: function(record, index) {
+ var c = record.get('isPresent');
+ if (c === false) {
+ return 'nonPresentDevice';
+ }
+ return '';
+ }
+ }
});
dSS.grid.DevicePanel.superclass.initComponent.apply(this, arguments);
Copied: dss/trunk/websrc/dss-setup-interface/dSS/system/PropertyTree.js (from rev 8882, dss/trunk/websrc/dss-setup-interface/dSS/SystemPropertyTree.js)
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dSS/system/PropertyTree.js (rev 0)
+++ dss/trunk/websrc/dss-setup-interface/dSS/system/PropertyTree.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -0,0 +1,73 @@
+//= require <dSS/tree/PropertyTreeLoader>
+
+Ext.namespace('dSS', 'dSS.system');
+
+dSS.system.PropertyTree = Ext.extend(Ext.Panel, {
+ initComponent: function() {
+
+ Ext.apply(this, {
+ layout: 'border',
+ items: [{
+ xtype: 'treepanel',
+ ref: 'propertytree',
+ region: 'center',
+ width: 225, // give east and west regions a width
+ minSize: 175,
+ maxSize: 400,
+ autoScroll: true,
+ animate: true,
+ enableDD: false,
+ containerScroll: true,
+ border: false,
+ loader: new dSS.tree.PropertyTreeLoader(),
+ root: new Ext.tree.AsyncTreeNode({
+ expanded: false,
+ path: '/',
+ type: 'none',
+ text: 'dSS',
+ leaf: false,
+ }),
+ rootVisible: true,
+ listeners: {
+ append: this.handleAppend
+ }
+ }
+ ]
+ });
+
+ dSS.ZoneBrowser.superclass.initComponent.apply(this, arguments);
+ },
+ handleAppend: function(tree, parent, node, index) {
+ if (node.attributes.type === 'none') return;
+ var url = "/json/property/";
+ switch(node.attributes.type) {
+ case 'string':
+ url += 'getString';
+ break;
+ case 'integer':
+ url += 'getInteger';
+ break;
+ case 'boolean':
+ url += 'getBoolean';
+ break;
+ default:
+ return;
+ }
+ Ext.Ajax.request({
+ url: url,
+ params: { path: node.attributes.path },
+ method: 'GET',
+ success: function(response, opts) {
+ var obj = Ext.decode(response.responseText);
+ if(obj.ok === true) {
+ node.setText(node.text + " : " + obj.result.value);
+ }
+ },
+ failure: function(response, opts) {
+ console.log('server-side failure with status code ' + response.status);
+ }
+ });
+ }
+});
+
+Ext.reg('dsssystempropertytree', dSS.system.PropertyTree);
\ No newline at end of file
Modified: dss/trunk/websrc/dss-setup-interface/dss-setup-interface.js
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dss-setup-interface.js 2009-11-04 10:43:15 UTC (rev 8882)
+++ dss/trunk/websrc/dss-setup-interface/dss-setup-interface.js 2009-11-04 10:43:18 UTC (rev 8883)
@@ -1,5 +1,5 @@
//= require <dSS/ZoneBrowser>
-//= require <dSS/SystemPropertyTree>
+//= require <dSS/SystemPanel>
Ext.onReady(function(){
Ext.get('start').remove();
@@ -22,11 +22,12 @@
{
title: 'Zones',
xtype: 'dsszonebrowser',
- ref: 'zonebrowser'
+ ref: 'zoneBrowser'
},{
title: 'System Properties',
- xtype: 'dsssystempropertytree',
- ref: 'systempropertytree'
+ xtype: 'dsssystempanel',
+ ref: 'systemPanel',
+ id: 'hurz'
}
]
}]
More information about the dss-commits
mailing list