1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-08 15:25:22 +02:00

feat(schedules): add retry policy to script schedules (#2445)

This commit is contained in:
Anthony Lapenna 2018-11-09 15:22:08 +13:00 committed by GitHub
parent e7ab057c81
commit a2d9f591a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 160 additions and 44 deletions

View file

@ -42,8 +42,8 @@
</div>
<!-- image-input -->
<div class="form-group">
<label for="schedule_image" class="col-sm-1 control-label text-left">Image</label>
<div class="col-sm-11">
<label for="schedule_image" class="col-sm-2 control-label text-left">Image</label>
<div class="col-sm-10">
<input type="text" class="form-control" ng-model="$ctrl.model.Job.Image" id="schedule_image" name="schedule_image" placeholder="e.g. ubuntu:latest" required>
</div>
</div>
@ -55,12 +55,24 @@
</div>
</div>
<!-- !image-input -->
<!-- retry-policy -->
<div class="form-group">
<span class="col-sm-12 text-muted small">
This schedule will be executed via a privileged container on the target hosts. You can access the host filesystem under the
<code>/host</code> folder.
</span>
<label for="retrycount" class="col-sm-2 control-label text-left">
Retry count
<portainer-tooltip position="bottom" message="Number of retries when it's not possible to reach the endpoint."></portainer-tooltip>
</label>
<div class="col-sm-10 col-md-4">
<input type="number" class="form-control" ng-model="$ctrl.model.Job.RetryCount" id="retrycount" name="retrycount" placeholder="3">
</div>
<label for="retryinterval" class="col-sm-2 control-label text-left">
Retry interval
<portainer-tooltip position="bottom" message="Retry interval in seconds."></portainer-tooltip>
</label>
<div class="col-sm-10 col-md-4">
<input type="number" class="form-control" ng-model="$ctrl.model.Job.RetryInterval" id="retryinterval" name="retryinterval" placeholder="30">
</div>
</div>
<!-- !retry-policy -->
<!-- execution-method -->
<div ng-if="!$ctrl.model.Id">
<div class="col-sm-12 form-section-title">
@ -98,6 +110,12 @@
<div class="col-sm-12 form-section-title">
Web editor
</div>
<div class="form-group">
<span class="col-sm-12 text-muted small">
This schedule will be executed via a privileged container on the target hosts. You can access the host filesystem under the
<code>/host</code> folder.
</span>
</div>
<div class="form-group">
<div class="col-sm-12">
<code-editor

View file

@ -29,6 +29,8 @@ function ScriptExecutionJobModel(data) {
this.Endpoints = data.Endpoints;
this.FileContent = '';
this.Method = 'editor';
this.RetryCount = data.RetryCount;
this.RetryInterval = data.RetryInterval;
}
function ScheduleCreateRequest(model) {
@ -37,6 +39,8 @@ function ScheduleCreateRequest(model) {
this.Image = model.Job.Image;
this.Endpoints = model.Job.Endpoints;
this.FileContent = model.Job.FileContent;
this.RetryCount = model.Job.RetryCount;
this.RetryInterval = model.Job.RetryInterval;
this.File = model.Job.File;
}
@ -47,4 +51,6 @@ function ScheduleUpdateRequest(model) {
this.Image = model.Job.Image;
this.Endpoints = model.Job.Endpoints;
this.FileContent = model.Job.FileContent;
this.RetryCount = model.Job.RetryCount;
this.RetryInterval = model.Job.RetryInterval;
}

View file

@ -47,7 +47,9 @@ angular.module('portainer.app')
Name: payload.Name,
CronExpression: payload.CronExpression,
Image: payload.Image,
Endpoints: Upload.json(payload.Endpoints)
Endpoints: Upload.json(payload.Endpoints),
RetryCount: payload.RetryCount,
RetryInterval: payload.RetryInterval
}
});
};