1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(schedules): add schedules UI (#2414)

* feat(schedules): add schedules UI mockups

* feat(schedules): update controller pattern

* feat(schedules): leverages API

* feat(schedules): add the ability create/edit a script execution job schedule

* feat(schedules): add form validation and details about cron expression
This commit is contained in:
Anthony Lapenna 2018-11-07 11:59:21 +13:00 committed by GitHub
parent 7d32a6619d
commit 4740375ba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 826 additions and 7 deletions

View file

@ -32,32 +32,32 @@ type scheduleFromFileContentPayload struct {
func (payload *scheduleFromFilePayload) Validate(r *http.Request) error {
name, err := request.RetrieveMultiPartFormValue(r, "Name", false)
if err != nil {
return err
return errors.New("Invalid name")
}
payload.Name = name
image, err := request.RetrieveMultiPartFormValue(r, "Image", false)
if err != nil {
return err
return errors.New("Invalid image")
}
payload.Image = image
cronExpression, err := request.RetrieveMultiPartFormValue(r, "Schedule", false)
cronExpression, err := request.RetrieveMultiPartFormValue(r, "CronExpression", false)
if err != nil {
return err
return errors.New("Invalid cron expression")
}
payload.CronExpression = cronExpression
var endpoints []portainer.EndpointID
err = request.RetrieveMultiPartFormJSONValue(r, "Endpoints", &endpoints, false)
if err != nil {
return err
return errors.New("Invalid endpoints")
}
payload.Endpoints = endpoints
file, _, err := request.RetrieveMultiPartFormFile(r, "File")
file, _, err := request.RetrieveMultiPartFormFile(r, "file")
if err != nil {
return portainer.Error("Invalid Script file. Ensure that the file is uploaded correctly")
return portainer.Error("Invalid script file. Ensure that the file is uploaded correctly")
}
payload.File = file