Commit b2cf15f7 authored by Alexandre Derumier's avatar Alexandre Derumier Committed by Dietmar Maurer

add sheepdog storage panel

Signed-off-by: 's avatarAlexandre Derumier <aderumier@odiso.com>
parent 61f53cab
......@@ -122,6 +122,7 @@ JSSRC= \
storage/IScsiEdit.js \
storage/LVMEdit.js \
storage/RBDEdit.js \
storage/SheepdogEdit.js \
dc/Summary.js \
dc/OptionView.js \
dc/StorageView.js \
......
......@@ -42,6 +42,8 @@ Ext.define('PVE.dc.StorageView', {
editor = 'PVE.storage.IScsiEdit';
} else if (type === 'rbd') {
editor = 'PVE.storage.RBDEdit';
} else if (type === 'sheepdog') {
editor = 'PVE.storage.SheepdogEdit';
} else {
return;
}
......@@ -140,6 +142,15 @@ Ext.define('PVE.dc.StorageView', {
win.show();
}
},
{
text: 'Sheepdog',
iconCls: 'pve-itype-icon-node',
handler: function() {
var win = Ext.create('PVE.storage.SheepdogEdit', {});
win.on('destroy', reload);
win.show();
}
},
]
})
......
Ext.define('PVE.storage.SheepdogInputPanel', {
extend: 'PVE.panel.InputPanel',
onGetValues: function(values) {
var me = this;
if (me.create) {
values.type = 'sheepdog';
values.content = 'images';
} 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',
height: 22, // hack: set same height as text fields
value: me.storageId || '',
fieldLabel: 'ID',
vtype: 'StorageId',
allowBlank: false
},
{
xtype: me.create ? 'textfield' : 'displayfield',
name: 'portal',
height: 22, // hack: set same height as text fields
value: '127.0.0.1:7000',
fieldLabel: gettext('Gateway'),
allowBlank: false
},
];
me.column2 = [
{
xtype: 'pvecheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
fieldLabel: gettext('Enable')
},
];
if (me.create || me.storageId !== 'local') {
me.column2.unshift({
xtype: 'PVE.form.NodeSelector',
name: 'nodes',
fieldLabel: gettext('Nodes'),
emptyText: gettext('All') + ' (' +
gettext('No restrictions') +')',
multiSelect: true,
autoSelect: false
});
}
me.callParent();
}
});
Ext.define('PVE.storage.SheepdogEdit', {
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.SheepdogInputPanel', {
create: me.create,
storageId: me.storageId
});
Ext.apply(me, {
subject: 'Sheepdog Storage',
isAdd: true,
items: [ ipanel ]
});
me.callParent();
if (!me.create) {
me.load({
success: function(response, options) {
var values = response.result.data;
if (values.nodes) {
values.nodes = values.nodes.split(',');
}
values.enable = values.disable ? 0 : 1;
ipanel.setValues(values);
}
});
}
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment