mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 17:06:16 +00:00
ui: dc/Backup: add schedule simulator button
so that a user can simply simulate the schedule Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
e190bc2cc8
commit
4d6215bcf5
@ -112,6 +112,7 @@ JSSRC= \
|
|||||||
window/StartupEdit.js \
|
window/StartupEdit.js \
|
||||||
window/DownloadUrlToStorage.js \
|
window/DownloadUrlToStorage.js \
|
||||||
window/UploadToStorage.js \
|
window/UploadToStorage.js \
|
||||||
|
window/ScheduleSimulator.js \
|
||||||
window/Wizard.js \
|
window/Wizard.js \
|
||||||
ha/Fencing.js \
|
ha/Fencing.js \
|
||||||
ha/GroupEdit.js \
|
ha/GroupEdit.js \
|
||||||
|
@ -701,6 +701,21 @@ Ext.define('PVE.dc.BackupView', {
|
|||||||
edit_btn,
|
edit_btn,
|
||||||
detail_btn,
|
detail_btn,
|
||||||
'-',
|
'-',
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxButton',
|
||||||
|
selModel: null,
|
||||||
|
text: gettext('Simulate Schedule'),
|
||||||
|
handler: () => {
|
||||||
|
let record = sm.getSelection()[0];
|
||||||
|
let schedule;
|
||||||
|
if (record) {
|
||||||
|
schedule = record.data.schedule;
|
||||||
|
}
|
||||||
|
Ext.create('PVE.window.ScheduleSimulator', {
|
||||||
|
schedule,
|
||||||
|
}).show();
|
||||||
|
},
|
||||||
|
},
|
||||||
run_btn,
|
run_btn,
|
||||||
'->',
|
'->',
|
||||||
noBackupJobWarning,
|
noBackupJobWarning,
|
||||||
|
118
www/manager6/window/ScheduleSimulator.js
Normal file
118
www/manager6/window/ScheduleSimulator.js
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
Ext.define('PVE.window.ScheduleSimulator', {
|
||||||
|
extend: 'Ext.window.Window',
|
||||||
|
|
||||||
|
title: gettext('Simulate Schedule'),
|
||||||
|
|
||||||
|
controller: {
|
||||||
|
xclass: 'Ext.app.ViewController',
|
||||||
|
close: function() { this.getView().close(); },
|
||||||
|
simulate: function() {
|
||||||
|
let me = this;
|
||||||
|
let schedule = me.lookup('schedule').getValue();
|
||||||
|
if (!schedule) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let number = me.lookup('number').getValue() || 10;
|
||||||
|
Proxmox.Utils.API2Request({
|
||||||
|
url: '/cluster/jobs/schedule-analyze',
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
schedule,
|
||||||
|
number,
|
||||||
|
},
|
||||||
|
failure: function(response, opts) {
|
||||||
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
let schedules = response.result.data;
|
||||||
|
me.lookup('grid').getStore().setData(schedules);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
scheduleChanged: function(field, value) {
|
||||||
|
this.lookup('simulateBtn').setDisabled(!value);
|
||||||
|
},
|
||||||
|
|
||||||
|
renderTimestamp: function(value) {
|
||||||
|
let date = new Date(value*1000);
|
||||||
|
return date.toLocaleString();
|
||||||
|
},
|
||||||
|
|
||||||
|
init: function(view) {
|
||||||
|
let me = this;
|
||||||
|
if (view.schedule) {
|
||||||
|
me.lookup('schedule').setValue(view.schedule);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
bodyPadding: 10,
|
||||||
|
modal: true,
|
||||||
|
resizable: false,
|
||||||
|
width: 600,
|
||||||
|
|
||||||
|
layout: 'fit',
|
||||||
|
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
xtype: 'inputpanel',
|
||||||
|
column1: [
|
||||||
|
{
|
||||||
|
xtype: 'pveCalendarEvent',
|
||||||
|
reference: 'schedule',
|
||||||
|
fieldLabel: gettext('Schedule'),
|
||||||
|
listeners: {
|
||||||
|
change: 'scheduleChanged',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxintegerfield',
|
||||||
|
minValue: 1,
|
||||||
|
maxValue: 100,
|
||||||
|
value: 10,
|
||||||
|
reference: 'number',
|
||||||
|
fieldLabel: gettext('Number'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'button',
|
||||||
|
reference: 'simulateBtn',
|
||||||
|
text: gettext('Simulate'),
|
||||||
|
handler: 'simulate',
|
||||||
|
align: 'right',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
column2: [
|
||||||
|
{
|
||||||
|
xtype: 'grid',
|
||||||
|
reference: 'grid',
|
||||||
|
emptyText: Proxmox.Utils.NoneText,
|
||||||
|
scrollable: true,
|
||||||
|
height: 300,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
text: gettext('Local Time'),
|
||||||
|
renderer: 'renderTimestamp',
|
||||||
|
dataIndex: 'timestamp',
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
store: {
|
||||||
|
fields: ['timestamp'],
|
||||||
|
data: [],
|
||||||
|
sorter: 'timestamp',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: gettext('OK'),
|
||||||
|
handler: 'close',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user