mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-08 00:04:14 +00:00
calendar event simulator: rename number parameter to iterations
in sync with the same option of `systemd-analyze calendar` and number is so generic. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
f493f5685d
commit
584a57ea3c
@ -47,7 +47,7 @@ __PACKAGE__->register_method({
|
|||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
schedule => {
|
schedule => {
|
||||||
description => "Backup schedule. The format is a subset of `systemd` calendar events.",
|
description => "Job schedule. The format is a subset of `systemd` calendar events.",
|
||||||
type => 'string', format => 'pve-calendar-event',
|
type => 'string', format => 'pve-calendar-event',
|
||||||
maxLength => 128,
|
maxLength => 128,
|
||||||
},
|
},
|
||||||
@ -56,8 +56,8 @@ __PACKAGE__->register_method({
|
|||||||
optional => 1,
|
optional => 1,
|
||||||
type => 'integer',
|
type => 'integer',
|
||||||
},
|
},
|
||||||
number => {
|
iterations => {
|
||||||
description => "Number of timestamps to return.",
|
description => "Number of event-iteration to simulate and return.",
|
||||||
optional => 1,
|
optional => 1,
|
||||||
type => 'integer',
|
type => 'integer',
|
||||||
minimum => 1,
|
minimum => 1,
|
||||||
@ -68,7 +68,7 @@ __PACKAGE__->register_method({
|
|||||||
},
|
},
|
||||||
returns => {
|
returns => {
|
||||||
type => 'array',
|
type => 'array',
|
||||||
description => 'Contains the guest objects.',
|
description => 'An array of the next <iterations> events since <starttime>.',
|
||||||
items => {
|
items => {
|
||||||
type => 'object',
|
type => 'object',
|
||||||
properties => {
|
properties => {
|
||||||
@ -87,14 +87,14 @@ __PACKAGE__->register_method({
|
|||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
my $starttime = $param->{starttime} // time();
|
my $starttime = $param->{starttime} // time();
|
||||||
my $number = $param->{number} // 10;
|
my $iterations = $param->{iterations} // 10;
|
||||||
my $schedule = $param->{schedule};
|
my $schedule = $param->{schedule};
|
||||||
|
|
||||||
my $result = [];
|
my $result = [];
|
||||||
|
|
||||||
my $event = PVE::CalendarEvent::parse_calendar_event($schedule);
|
my $event = PVE::CalendarEvent::parse_calendar_event($schedule);
|
||||||
|
|
||||||
for (my $count = 0; $count < $number; $count++) {
|
for (my $count = 0; $count < $iterations; $count++) {
|
||||||
my $next = PVE::CalendarEvent::compute_next_event($event, $starttime);
|
my $next = PVE::CalendarEvent::compute_next_event($event, $starttime);
|
||||||
push @$result, {
|
push @$result, {
|
||||||
timestamp => $next,
|
timestamp => $next,
|
||||||
|
@ -12,13 +12,13 @@ Ext.define('PVE.window.ScheduleSimulator', {
|
|||||||
if (!schedule) {
|
if (!schedule) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let number = me.lookup('number').getValue() || 10;
|
let iterations = me.lookup('iterations').getValue() || 10;
|
||||||
Proxmox.Utils.API2Request({
|
Proxmox.Utils.API2Request({
|
||||||
url: '/cluster/jobs/schedule-analyze',
|
url: '/cluster/jobs/schedule-analyze',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
params: {
|
||||||
schedule,
|
schedule,
|
||||||
number,
|
iterations,
|
||||||
},
|
},
|
||||||
failure: function(response, opts) {
|
failure: function(response, opts) {
|
||||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||||
@ -71,8 +71,8 @@ Ext.define('PVE.window.ScheduleSimulator', {
|
|||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 100,
|
maxValue: 100,
|
||||||
value: 10,
|
value: 10,
|
||||||
reference: 'number',
|
reference: 'iterations',
|
||||||
fieldLabel: gettext('Number'),
|
fieldLabel: gettext('Iterations'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'button',
|
xtype: 'button',
|
||||||
|
Loading…
Reference in New Issue
Block a user