2020-06-05 08:11:51 +00:00
|
|
|
Ext.define('pbs-datastore-list', {
|
|
|
|
extend: 'Ext.data.Model',
|
|
|
|
fields: [ 'name', 'comment' ],
|
|
|
|
proxy: {
|
|
|
|
type: 'proxmox',
|
|
|
|
url: "/api2/json/admin/datastore"
|
|
|
|
},
|
|
|
|
idProperty: 'store'
|
|
|
|
});
|
|
|
|
|
2019-01-25 12:04:10 +00:00
|
|
|
Ext.define('pbs-data-store-config', {
|
|
|
|
extend: 'Ext.data.Model',
|
|
|
|
fields: [ 'name', 'path', 'comment' ],
|
|
|
|
proxy: {
|
|
|
|
type: 'proxmox',
|
|
|
|
url: "/api2/json/config/datastore"
|
|
|
|
},
|
|
|
|
idProperty: 'name'
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.DataStoreConfig', {
|
|
|
|
extend: 'Ext.grid.GridPanel',
|
|
|
|
alias: 'widget.pbsDataStoreConfig',
|
|
|
|
|
2019-02-16 12:46:20 +00:00
|
|
|
title: gettext('Data Store Configuration'),
|
|
|
|
|
2019-01-25 12:04:10 +00:00
|
|
|
initComponent : function() {
|
|
|
|
var me = this;
|
|
|
|
|
|
|
|
var store = new Ext.data.Store({
|
|
|
|
model: 'pbs-data-store-config',
|
|
|
|
sorters: 'name',
|
|
|
|
});
|
|
|
|
|
|
|
|
var reload = function() {
|
|
|
|
store.load();
|
|
|
|
};
|
|
|
|
|
2019-04-01 06:08:34 +00:00
|
|
|
var sm = Ext.create('Ext.selection.RowModel', {});
|
|
|
|
|
|
|
|
var gc_btn = new Proxmox.button.Button({
|
|
|
|
text: gettext('Start GC'),
|
|
|
|
disabled: true,
|
|
|
|
selModel: sm,
|
|
|
|
handler: function() {
|
|
|
|
var rec = sm.getSelection()[0];
|
|
|
|
Proxmox.Utils.API2Request({
|
|
|
|
url: '/admin/datastore/' + rec.data.name + '/gc',
|
|
|
|
method: 'POST',
|
|
|
|
failure: function(response) {
|
|
|
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
2019-04-11 09:16:30 +00:00
|
|
|
},
|
|
|
|
success: function(response, options) {
|
|
|
|
var upid = response.result.data;
|
|
|
|
|
|
|
|
var win = Ext.create('Proxmox.window.TaskViewer', {
|
|
|
|
upid: upid
|
|
|
|
});
|
|
|
|
win.show();
|
2019-04-01 06:08:34 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var tbar = [
|
2019-01-25 12:04:10 +00:00
|
|
|
{
|
|
|
|
text: gettext('Create'),
|
|
|
|
handler: function() {
|
2019-12-18 20:32:00 +00:00
|
|
|
let win = Ext.create('PBS.DataStoreEdit', {});
|
|
|
|
win.on('destroy', reload);
|
|
|
|
win.show();
|
2019-01-25 12:04:10 +00:00
|
|
|
}
|
2019-04-01 06:08:34 +00:00
|
|
|
},
|
2019-12-19 16:44:20 +00:00
|
|
|
'-',
|
2019-04-01 06:08:34 +00:00
|
|
|
gc_btn
|
2019-01-25 12:04:10 +00:00
|
|
|
//edit_btn, remove_btn
|
|
|
|
];
|
|
|
|
|
|
|
|
Proxmox.Utils.monStoreErrors(me, store);
|
|
|
|
|
2019-12-19 16:44:20 +00:00
|
|
|
Ext.apply(me, {
|
|
|
|
store: store,
|
|
|
|
selModel: sm,
|
2019-01-25 12:04:10 +00:00
|
|
|
tbar: tbar,
|
2019-12-19 16:44:20 +00:00
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
header: gettext('Name'),
|
2019-01-25 12:04:10 +00:00
|
|
|
sortable: true,
|
|
|
|
dataIndex: 'name',
|
|
|
|
flex: 1
|
|
|
|
},
|
|
|
|
{
|
2019-12-19 16:44:20 +00:00
|
|
|
header: gettext('Path'),
|
2019-01-25 12:04:10 +00:00
|
|
|
sortable: true,
|
|
|
|
dataIndex: 'path',
|
2019-12-19 16:44:20 +00:00
|
|
|
flex: 1
|
2019-01-25 12:04:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
header: gettext('Comment'),
|
|
|
|
sortable: false,
|
|
|
|
dataIndex: 'comment',
|
|
|
|
renderer: Ext.String.htmlEncode,
|
|
|
|
flex: 2
|
|
|
|
}
|
|
|
|
],
|
|
|
|
listeners: {
|
|
|
|
activate: reload
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
me.callParent();
|
|
|
|
|
|
|
|
store.load();
|
|
|
|
}
|
|
|
|
});
|
2019-12-18 20:32:00 +00:00
|
|
|
|
|
|
|
Ext.define('PBS.DataStoreInputPanel', {
|
|
|
|
extend: 'Proxmox.panel.InputPanel',
|
|
|
|
alias: 'widget.pbsDataStoreInputPanel',
|
|
|
|
|
|
|
|
onGetValues: function(values) {
|
|
|
|
var me = this;
|
|
|
|
|
|
|
|
return values;
|
|
|
|
},
|
|
|
|
|
|
|
|
column1: [
|
|
|
|
{
|
|
|
|
xtype: 'textfield',
|
|
|
|
name: 'name',
|
2019-12-19 16:44:20 +00:00
|
|
|
allowBlank: false,
|
2019-12-18 20:32:00 +00:00
|
|
|
fieldLabel: gettext('Name'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
column2: [
|
|
|
|
{
|
|
|
|
xtype: 'textfield',
|
|
|
|
name: 'path',
|
2019-12-19 16:44:20 +00:00
|
|
|
allowBlank: false,
|
|
|
|
fieldLabel: gettext('Backing Path'),
|
|
|
|
emptyText: gettext('An absolute path'),
|
2019-12-18 20:32:00 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
columnB: [
|
|
|
|
{
|
|
|
|
xtype: 'textfield',
|
|
|
|
name: 'comment',
|
2019-12-19 16:46:39 +00:00
|
|
|
fieldLabel: gettext('Comment'),
|
2019-12-18 20:32:00 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.DataStoreEdit', {
|
|
|
|
extend: 'Proxmox.window.Edit',
|
|
|
|
|
|
|
|
url: '/api2/extjs/config/datastore',
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
subject: gettext('Datastore'),
|
|
|
|
isAdd: true,
|
|
|
|
items: [{
|
|
|
|
xtype: 'pbsDataStoreInputPanel',
|
|
|
|
}],
|
|
|
|
});
|