pve-manager/www/manager6/storage/RBDEdit.js
Dominik Csapak 5ca0c804c6 remove displayfield height hack
this did not work anymore,
instead overwrite css for displayfields to have correct
min-height

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-04-06 16:29:35 +02:00

144 lines
2.9 KiB
JavaScript

Ext.define('PVE.storage.RBDInputPanel', {
extend: 'PVE.panel.InputPanel',
onGetValues: function(values) {
var me = this;
if (me.create) {
values.type = 'rbd';
} else {
delete values.storage;
}
values.disable = values.enable ? 0 : 1;
delete values.enable;
return values;
},
initComponent : function() {
var me = this;
me.column1 = [
{
xtype: me.create ? 'textfield' : 'displayfield',
name: 'storage',
value: me.storageId || '',
fieldLabel: 'ID',
vtype: 'StorageId',
allowBlank: false
},
{
xtype: me.create ? 'textfield' : 'displayfield',
name: 'pool',
value: 'rbd',
fieldLabel: gettext('Pool'),
allowBlank: false
},
{
xtype: me.create ? 'textfield' : 'displayfield',
name: 'monhost',
value: '',
fieldLabel: gettext('Monitor Host'),
allowBlank: false
},
{
xtype: me.create ? 'textfield' : 'displayfield',
name: 'username',
value: 'admin',
fieldLabel: gettext('User name'),
allowBlank: true
}
];
me.column2 = [
{
xtype: 'pvecheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
fieldLabel: gettext('Enable')
},
{
xtype: 'pveContentTypeSelector',
cts: ['images', 'rootdir'],
fieldLabel: gettext('Content'),
name: 'content',
value: ['images'],
multiSelect: true,
allowBlank: false
},
{
xtype: 'pvecheckbox',
name: 'krbd',
uncheckedValue: 0,
fieldLabel: gettext('KRBD')
}
];
if (me.create || me.storageId !== 'local') {
me.column2.unshift({
xtype: 'pveNodeSelector',
name: 'nodes',
fieldLabel: gettext('Nodes'),
emptyText: gettext('All') + ' (' +
gettext('No restrictions') +')',
multiSelect: true,
autoSelect: false
});
}
me.callParent();
}
});
Ext.define('PVE.storage.RBDEdit', {
extend: 'PVE.window.Edit',
initComponent : function() {
var me = this;
me.create = !me.storageId;
if (me.create) {
me.url = '/api2/extjs/storage';
me.method = 'POST';
} else {
me.url = '/api2/extjs/storage/' + me.storageId;
me.method = 'PUT';
}
var ipanel = Ext.create('PVE.storage.RBDInputPanel', {
create: me.create,
storageId: me.storageId
});
Ext.apply(me, {
subject: PVE.Utils.format_storage_type('rbd'),
isAdd: true,
items: [ ipanel ]
});
me.callParent();
if (!me.create) {
me.load({
success: function(response, options) {
var values = response.result.data;
var ctypes = values.content || '';
values.content = ctypes.split(',');
if (values.nodes) {
values.nodes = values.nodes.split(',');
}
values.enable = values.disable ? 0 : 1;
ipanel.setValues(values);
}
});
}
}
});