fieldDefaults: {
labelWidth: 150,
},
- items: [
- {
- xtype: 'proxmoxcheckbox',
- name: 'config',
- fieldLabel: gettext('System Configuration'),
- },
- {
- xtype: 'proxmoxcheckbox',
- name: 'database',
- value: 1,
- uncheckedValue: 0,
- fieldLabel: gettext('Rule Database'),
- listeners: {
- change: function(field, value) {
- field.nextSibling('field[name=statistic]').setDisabled(!value);
- },
- },
- },
- {
- xtype: 'proxmoxcheckbox',
- name: 'statistic',
- fieldLabel: gettext('Statistic'),
- },
- ],
initComponent: function() {
let me = this;
- if (!me.filename) {
- throw "no filename given";
+ me.items = [
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'config',
+ fieldLabel: gettext('System Configuration'),
+ },
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'database',
+ value: 1,
+ uncheckedValue: 0,
+ fieldLabel: gettext('Rule Database'),
+ listeners: {
+ change: function(field, value) {
+ field.nextSibling('field[name=statistic]').setDisabled(!value);
+ },
+ },
+ },
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'statistic',
+ fieldLabel: gettext('Statistic'),
+ },
+ ];
+
+ let restorePath;
+ if (me.filename) {
+ restorePath = `backup/${encodeURIComponent(me.filename)}`;
+ } else if (me.backup_time) {
+ restorePath = `pbs/${me.remote}/snapshot/${me.backup_id}/${me.backup_time}`;
+ } else {
+ throw "neither filename nor snapshot given";
}
-
- me.url = `/nodes/${Proxmox.NodeName}/backup/${encodeURIComponent(me.filename)}`;
+ me.url = `/nodes/${Proxmox.NodeName}/${restorePath}`;
me.callParent();
},
});
+Ext.define('PMG.BackupWindow', {
+ extend: 'Proxmox.window.Edit',
+ xtype: 'pmgBackupWindow',
+ onlineHelp: 'chapter_pmgbackup',
+
+ showProgress: true,
+ title: gettext('Backup'),
+ isCreate: true,
+ method: 'POST',
+ submitText: gettext('Backup'),
+ fieldDefaults: {
+ labelWidth: 150,
+ },
+ showTaskViewer: true,
+ items: [
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'statistic',
+ value: 1,
+ uncheckedValue: 0,
+ fieldLabel: gettext('Include Statistics'),
+ },
+ ],
+
+});
+
Ext.define('PMG.BackupRestore', {
extend: 'Ext.grid.GridPanel',
xtype: 'pmgBackupRestore',
createBackup: function() {
let view = this.getView();
- Proxmox.Utils.API2Request({
+ Ext.create('PMG.BackupWindow', {
url: "/nodes/" + Proxmox.NodeName + "/backup",
- method: 'POST',
- waitMsgTarget: view,
- failure: function(response, opts) {
- Ext.Msg.alert(gettext('Error'), response.htmlStatus);
- },
- success: function(response, opts) {
- let upid = response.result.data;
-
- let win = Ext.create('Proxmox.window.TaskViewer', {
- upid: upid,
- autoShow: true,
- });
- view.mon(win, 'close', () => view.store.load());
- },
- });
+ taskDone: () => view.store.load(),
+ }).show();
},
onRestore: function() {
tbar: [
{
- text: gettext('Backup'),
+ text: gettext('Backup Now'),
handler: 'createBackup',
},
'-',
header: gettext('Size'),
width: 100,
sortable: true,
- renderer: Proxmox.Utils.format_size,
+ renderer: Proxmox.Utils.render_size,
dataIndex: 'size',
},
{