|
|
|
@ -52,13 +52,22 @@ func generateMockStepsLog(logCur actions.LogCursor) (stepsLog []*actions.ViewSte |
|
|
|
|
return stepsLog |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func MockActionsView(ctx *context.Context) { |
|
|
|
|
ctx.Data["RunID"] = ctx.PathParam("run") |
|
|
|
|
ctx.Data["JobID"] = ctx.PathParam("job") |
|
|
|
|
ctx.HTML(http.StatusOK, "devtest/repo-action-view") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func MockActionsRunsJobs(ctx *context.Context) { |
|
|
|
|
req := web.GetForm(ctx).(*actions.ViewRequest) |
|
|
|
|
runID := ctx.PathParamInt64("run") |
|
|
|
|
|
|
|
|
|
req := web.GetForm(ctx).(*actions.ViewRequest) |
|
|
|
|
resp := &actions.ViewResponse{} |
|
|
|
|
resp.State.Run.TitleHTML = `mock run title <a href="/">link</a>` |
|
|
|
|
resp.State.Run.Status = actions_model.StatusRunning.String() |
|
|
|
|
resp.State.Run.CanCancel = true |
|
|
|
|
resp.State.Run.CanCancel = runID == 10 |
|
|
|
|
resp.State.Run.CanApprove = runID == 20 |
|
|
|
|
resp.State.Run.CanRerun = runID == 30 |
|
|
|
|
resp.State.Run.CanDeleteArtifact = true |
|
|
|
|
resp.State.Run.WorkflowID = "workflow-id" |
|
|
|
|
resp.State.Run.WorkflowLink = "./workflow-link" |
|
|
|
@ -85,6 +94,29 @@ func MockActionsRunsJobs(ctx *context.Context) { |
|
|
|
|
Size: 1024 * 1024, |
|
|
|
|
Status: "completed", |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{ |
|
|
|
|
ID: runID * 10, |
|
|
|
|
Name: "job 100", |
|
|
|
|
Status: actions_model.StatusRunning.String(), |
|
|
|
|
CanRerun: true, |
|
|
|
|
Duration: "1h", |
|
|
|
|
}) |
|
|
|
|
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{ |
|
|
|
|
ID: runID*10 + 1, |
|
|
|
|
Name: "job 101", |
|
|
|
|
Status: actions_model.StatusWaiting.String(), |
|
|
|
|
CanRerun: false, |
|
|
|
|
Duration: "2h", |
|
|
|
|
}) |
|
|
|
|
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{ |
|
|
|
|
ID: runID*10 + 2, |
|
|
|
|
Name: "job 102", |
|
|
|
|
Status: actions_model.StatusFailure.String(), |
|
|
|
|
CanRerun: false, |
|
|
|
|
Duration: "3h", |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
resp.State.CurrentJob.Steps = append(resp.State.CurrentJob.Steps, &actions.ViewJobStep{ |
|
|
|
|
Summary: "step 0 (mock slow)", |
|
|
|
|
Duration: time.Hour.String(), |
|
|
|
|