mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-15 02:41:40 +00:00
js/BackupRestore.js - implement backup/restore panel
This commit is contained in:
parent
e92087299d
commit
7f261b55d5
112
js/BackupRestore.js
Normal file
112
js/BackupRestore.js
Normal file
@ -0,0 +1,112 @@
|
||||
/*global Proxmox*/
|
||||
Ext.define('pmg-backup-list', {
|
||||
extend: 'Ext.data.Model',
|
||||
fields: [
|
||||
'filename',
|
||||
{ type: 'integer', name: 'size' }
|
||||
],
|
||||
proxy: {
|
||||
type: 'proxmox',
|
||||
url: "/api2/json/nodes/" + Proxmox.NodeName + "/backup"
|
||||
},
|
||||
idProperty: 'filename'
|
||||
});
|
||||
|
||||
Ext.define('PMG.BackupRestore', {
|
||||
extend: 'Ext.grid.GridPanel',
|
||||
xtype: 'pmgBackupRestore',
|
||||
|
||||
title: gettext('Backup') + '/' + gettext('Restore'),
|
||||
|
||||
controller: {
|
||||
xclass: 'Ext.app.ViewController',
|
||||
|
||||
createBackup: function() {
|
||||
var me = this.getView();
|
||||
Proxmox.Utils.API2Request({
|
||||
url: "/nodes/" + Proxmox.NodeName + "/backup",
|
||||
method: 'POST',
|
||||
waitMsgTarget: me,
|
||||
failure: function (response, opts) {
|
||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||
},
|
||||
success: function(response, opts) {
|
||||
var upid = response.result.data;
|
||||
|
||||
var win = Ext.create('Proxmox.window.TaskViewer', {
|
||||
upid: upid
|
||||
});
|
||||
win.show();
|
||||
me.mon(win, 'close', function() { me.store.load(); });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onAfterRemove: function(btn, res) {
|
||||
var me = this.getView();
|
||||
me.store.load();
|
||||
},
|
||||
|
||||
onFactoryDefaults: function() {
|
||||
var me = this.getView();
|
||||
|
||||
Ext.Msg.confirm(
|
||||
gettext('Confirm'),
|
||||
gettext('Reset rule database to factory defaults?'),
|
||||
function(button) {
|
||||
if (button !== 'yes') {
|
||||
return;
|
||||
}
|
||||
var url = '/config/ruledb';
|
||||
Proxmox.Utils.API2Request({
|
||||
url: '/config/ruledb',
|
||||
method: 'POST',
|
||||
waitMsgTarget: me,
|
||||
failure: function (response, opts) {
|
||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
tbar: [
|
||||
{
|
||||
text: gettext('Backup'),
|
||||
handler: 'createBackup'
|
||||
},
|
||||
{
|
||||
xtype: 'proxmoxStdRemoveButton',
|
||||
baseurl: '/nodes/' + Proxmox.NodeName + '/backup',
|
||||
reference: 'removeBtn',
|
||||
callback: 'onAfterRemove',
|
||||
waitMsgTarget: true
|
||||
},
|
||||
{
|
||||
text: gettext('Factory Defaults'),
|
||||
handler: 'onFactoryDefaults'
|
||||
}
|
||||
],
|
||||
|
||||
store: {
|
||||
autoLoad: true,
|
||||
model: 'pmg-backup-list'
|
||||
},
|
||||
|
||||
columns: [
|
||||
{
|
||||
header: gettext('Filename'),
|
||||
width: 300,
|
||||
sortable: true,
|
||||
renderer: Ext.htmlEncode,
|
||||
dataIndex: 'filename'
|
||||
},
|
||||
{
|
||||
header: gettext('Size'),
|
||||
width: 100,
|
||||
sortable: true,
|
||||
dataIndex: 'size'
|
||||
}
|
||||
]
|
||||
});
|
@ -35,6 +35,7 @@ JSSRC= \
|
||||
RuleConfiguration.js \
|
||||
SystemOptions.js \
|
||||
Subscription.js \
|
||||
BackupRestore.js \
|
||||
SystemConfiguration.js \
|
||||
MailProxyRelaying.js \
|
||||
MailProxyPorts.js \
|
||||
|
@ -1,44 +1,4 @@
|
||||
/*global Proxmox*/
|
||||
Ext.define('PMG.RestoreSystemConfiguration', {
|
||||
extend: 'Ext.Panel',
|
||||
xtype: 'pmgRestoreSystemConfiguration',
|
||||
|
||||
title: gettext('Restore'),
|
||||
|
||||
controller: {
|
||||
xclass: 'Ext.app.ViewController',
|
||||
|
||||
onFactoryDefaults: function() {
|
||||
var me = this.getView();
|
||||
|
||||
Ext.Msg.confirm(
|
||||
gettext('Confirm'),
|
||||
gettext('Reset rule database to factory defaults?'),
|
||||
function(button) {
|
||||
if (button !== 'yes') {
|
||||
return;
|
||||
}
|
||||
var url = '/config/ruledb';
|
||||
Proxmox.Utils.API2Request({
|
||||
url: '/config/ruledb',
|
||||
method: 'POST',
|
||||
waitMsgTarget: me,
|
||||
failure: function (response, opts) {
|
||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
tbar: [
|
||||
{
|
||||
text: gettext('Factory Defaults'),
|
||||
handler: 'onFactoryDefaults'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Ext.define('PMG.SystemConfiguration', {
|
||||
extend: 'Ext.tab.Panel',
|
||||
@ -84,19 +44,14 @@ Ext.define('PMG.SystemConfiguration', {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
itemId: 'backup',
|
||||
title: gettext('Backup'),
|
||||
html: "Backup"
|
||||
},
|
||||
{
|
||||
itemId: 'restore',
|
||||
xtype: 'pmgRestoreSystemConfiguration'
|
||||
},
|
||||
{
|
||||
itemId: 'options',
|
||||
title: gettext('Options'),
|
||||
xtype: 'pmgSystemOptions'
|
||||
},
|
||||
{
|
||||
itemId: 'backup',
|
||||
xtype: 'pmgBackupRestore'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user