mirror of https://github.com/portainer/portainer
fix(edge-jobs): HTTP 404 on file upload (#6671)
* fix(edge-jobs): HTTP 404 on file upload * fix(edge-jobs): state 'edge job' in message on edge job removal instead of 'stack' * fix(api/edge-jobs): save changes on edge-jobs updatepull/6771/head
parent
355674cf22
commit
030b3d7c4d
|
@ -119,7 +119,7 @@ func (payload *edgeJobCreateFromFilePayload) Validate(r *http.Request) error {
|
||||||
payload.CronExpression = cronExpression
|
payload.CronExpression = cronExpression
|
||||||
|
|
||||||
var endpoints []portainer.EndpointID
|
var endpoints []portainer.EndpointID
|
||||||
err = request.RetrieveMultiPartFormJSONValue(r, "Environments", &endpoints, false)
|
err = request.RetrieveMultiPartFormJSONValue(r, "Endpoints", &endpoints, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("Invalid environments")
|
return errors.New("Invalid environments")
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ func (handler *Handler) updateEdgeSchedule(edgeJob *portainer.EdgeJob, payload *
|
||||||
}
|
}
|
||||||
|
|
||||||
if payload.FileContent != nil && *payload.FileContent != string(fileContent) {
|
if payload.FileContent != nil && *payload.FileContent != string(fileContent) {
|
||||||
|
fileContent = []byte(*payload.FileContent)
|
||||||
_, err := handler.FileService.StoreEdgeJobFileFromBytes(strconv.Itoa(int(edgeJob.ID)), fileContent)
|
_, err := handler.FileService.StoreEdgeJobFileFromBytes(strconv.Itoa(int(edgeJob.ID)), fileContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -31,7 +31,7 @@ export class EdgeJobsViewController {
|
||||||
for (let edgeJob of edgeJobs) {
|
for (let edgeJob of edgeJobs) {
|
||||||
try {
|
try {
|
||||||
await this.EdgeJobService.remove(edgeJob.Id);
|
await this.EdgeJobService.remove(edgeJob.Id);
|
||||||
this.Notifications.success('Stack successfully removed', edgeJob.Name);
|
this.Notifications.success('Edge job successfully removed', edgeJob.Name);
|
||||||
_.remove(this.edgeJobs, edgeJob);
|
_.remove(this.edgeJobs, edgeJob);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to remove Edge job ' + edgeJob.Name);
|
this.Notifications.error('Failure', err, 'Unable to remove Edge job ' + edgeJob.Name);
|
||||||
|
|
|
@ -48,7 +48,7 @@ angular.module('portainer.app').factory('FileUploadService', [
|
||||||
|
|
||||||
service.createSchedule = function (payload) {
|
service.createSchedule = function (payload) {
|
||||||
return Upload.upload({
|
return Upload.upload({
|
||||||
url: 'api/schedules?method=file',
|
url: 'api/edge_jobs?method=file',
|
||||||
data: {
|
data: {
|
||||||
file: payload.File,
|
file: payload.File,
|
||||||
Name: payload.Name,
|
Name: payload.Name,
|
||||||
|
|
Loading…
Reference in New Issue