pve-manager/www/manager/storage/DirEdit.js
Dietmar Maurer 899b837395 vzdump: add new 'remove' flag to disable automatic file removal
The maxfiles flags is now a storage related flag. So we set that on
the storage definition, and removed it from the scheduled backup GUI.
We use '--remove 0' for 'Backup now', so the user need to remove
old backups himself.
2012-03-23 10:05:14 +01:00

140 lines
2.7 KiB
JavaScript

Ext.define('PVE.storage.DirInputPanel', {
extend: 'PVE.panel.InputPanel',
onGetValues: function(values) {
var me = this;
if (me.create) {
values.type = 'dir';
} 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',
height: 22, // hack: set same height as text fields
name: 'path',
value: '',
fieldLabel: gettext('Directory'),
allowBlank: false
},
{
xtype: 'pveContentTypeSelector',
name: 'content',
value: 'images',
multiSelect: true,
fieldLabel: gettext('Content'),
allowBlank: false
}
];
me.column2 = [
{
xtype: 'pvecheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
fieldLabel: gettext('Enable')
},
{
xtype: 'pvecheckbox',
name: 'shared',
uncheckedValue: 0,
fieldLabel: gettext('Shared')
},
{
xtype: 'numberfield',
fieldLabel: gettext('Max Backups'),
name: 'maxfiles',
minValue: 0,
maxValue: 365,
value: me.create ? '1' : undefined,
allowBlank: false
}
];
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.DirEdit', {
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.DirInputPanel', {
create: me.create,
storageId: me.storageId
});
Ext.apply(me, {
subject: 'Directory',
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);
}
});
}
}
});