add ha resource panel

This commit is contained in:
Dietmar Maurer 2015-04-03 09:10:20 +02:00
parent 2904aaf98f
commit 02d79a0cc0
2 changed files with 80 additions and 0 deletions

View File

@ -166,6 +166,7 @@ JSSRC= \
storage/ZFSEdit.js \ storage/ZFSEdit.js \
storage/ZFSPoolEdit.js \ storage/ZFSPoolEdit.js \
ha/StatusView.js \ ha/StatusView.js \
ha/Resources.js \
ha/Config.js \ ha/Config.js \
dc/Summary.js \ dc/Summary.js \
dc/OptionView.js \ dc/OptionView.js \

View File

@ -0,0 +1,79 @@
Ext.define('PVE.ha.ResourcesView', {
extend: 'Ext.grid.GridPanel',
alias: ['widget.pveHAResourcesView'],
initComponent : function() {
var me = this;
var store = new Ext.data.Store({
model: 'pve-ha-resources',
proxy: {
type: 'pve',
url: "/api2/json/cluster/ha/resources"
},
sorters: {
property: 'sid',
order: 'DESC'
}
});
var reload = function() {
store.load();
};
var sm = Ext.create('Ext.selection.RowModel', {});
Ext.apply(me, {
store: store,
selModel: sm,
stateful: false,
viewConfig: {
trackOver: false
},
columns: [
{
header: 'ID',
width: 100,
sortable: true,
dataIndex: 'sid'
},
{
header: gettext('State'),
width: 100,
sortable: true,
renderer: function(v) {
return v ? v : 'enabled';
},
dataIndex: 'state'
},
{
header: gettext('Group'),
width: 200,
sortable: true,
dataIndex: 'group'
},
{
header: gettext('Description'),
flex: 1,
dataIndex: 'comment'
}
],
listeners: {
show: reload
// itemdblclick: run_editor
}
});
me.callParent();
}
}, function() {
Ext.define('pve-ha-resources', {
extend: 'Ext.data.Model',
fields: [
'sid', 'type', 'state', 'digest', 'group', 'comment'
],
idProperty: 'sid'
});
});