Class JobsController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjobLogsByCourse(Long courseId, Long jobId) Returns the full log of one job that belongs to the given course.jobLogTailByCourse(Long courseId, Long jobId, Long afterId) Returns the log lines of one job that belong to the given course that were written after the line with idafterId, together with the job's status: one poll of a "tail -f" style view.Iterable<edu.ucsb.cs156.jobs.entities.Job> jobsByCourse(Long courseId) edu.ucsb.cs156.jobs.entities.JoblaunchAddTeamMemberToGithubJob(String memberGithubLogin, Integer githubTeamId, Long teamMemberId, Long courseId) edu.ucsb.cs156.jobs.entities.JoblaunchAddTeamToGithubJob(String teamName, Long courseId) edu.ucsb.cs156.jobs.entities.Jobedu.ucsb.cs156.jobs.entities.JoblaunchDeleteTeamFromGithubJob(Integer githubTeamId, Long courseId) edu.ucsb.cs156.jobs.entities.JoblaunchDeleteTeamMemberFromGithubJob(String memberGithubLogin, Integer githubTeamId, Long courseId) edu.ucsb.cs156.jobs.entities.JoblaunchPullTeamsFromGithubJob(Long courseId) edu.ucsb.cs156.jobs.entities.JoblaunchPushTeamsToGithubJob(Long courseId) edu.ucsb.cs156.jobs.entities.Job
-
Constructor Details
-
JobsController
public JobsController()
-
-
Method Details
-
launchUpdateAllJob
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/launch/updateAll") public edu.ucsb.cs156.jobs.entities.Job launchUpdateAllJob() -
launchAuditAllCoursesJob
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/launch/auditAllCourses") public edu.ucsb.cs156.jobs.entities.Job launchAuditAllCoursesJob() -
launchPushTeamsToGithubJob
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/launch/pushTeamsToGithub") public edu.ucsb.cs156.jobs.entities.Job launchPushTeamsToGithubJob(@RequestParam Long courseId) -
launchPullTeamsFromGithubJob
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/launch/pullTeamsFromGithub") public edu.ucsb.cs156.jobs.entities.Job launchPullTeamsFromGithubJob(@RequestParam Long courseId) -
launchDeleteTeamMemberFromGithubJob
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping("/launch/deleteTeamMemberFromGithub") public edu.ucsb.cs156.jobs.entities.Job launchDeleteTeamMemberFromGithubJob(@RequestParam String memberGithubLogin, @RequestParam Integer githubTeamId, @RequestParam Long courseId) -
launchAddTeamMemberToGithubJob
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping("/launch/addTeamMemberToGithub") public edu.ucsb.cs156.jobs.entities.Job launchAddTeamMemberToGithubJob(@RequestParam String memberGithubLogin, @RequestParam Integer githubTeamId, @RequestParam Long teamMemberId, @RequestParam Long courseId) -
launchDeleteTeamFromGithubJob
-
launchAddTeamToGithubJob
-
jobsByCourse
-
jobLogsByCourse
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("/course/logs") public String jobLogsByCourse(@RequestParam Long courseId, @RequestParam Long jobId) Returns the full log of one job that belongs to the given course.Why this app-owned endpoint exists: the library's own
GET /api/jobs/logs/{id}returns the full log but is restricted toROLE_ADMIN. The per-course jobs tab is used by course instructors and staff who are not necessarily admins, and the course-scoped listing above only populatesJob.logwith a short tail preview (JobService.getJobLogPreview). This endpoint gives those users the same full log, guarded by the same course-permission rule as the listing.A job that exists but is not scoped to the given course is deliberately reported as not found (404) rather than forbidden (403), so that job ids do not leak across courses.
- Parameters:
courseId- the id of the course the job must belong tojobId- the id of the job- Returns:
- the full job log, oldest line first
-
jobLogTailByCourse
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("/course/logs/tail") public JobLogTail jobLogTailByCourse(@RequestParam Long courseId, @RequestParam Long jobId, @RequestParam(defaultValue="0") Long afterId) Returns the log lines of one job that belong to the given course that were written after the line with idafterId, together with the job's status: one poll of a "tail -f" style view. The client keeps the id of the last line it has received and passes it asafterIdon its next poll, and stops polling once the status is one of a job that has finished.This is the course-scoped counterpart of the library's admin-only
GET /api/jobs/logs/{id}/tail, for the same reason asjobLogsByCourse(Long, Long). Like that endpoint it reports a job of another course as not found.The status is read before the lines. If the job has already finished when its status is read, all of its lines have been written by the time they are read, so a client that stops polling on a finished status has not missed any. Reading them the other way round could miss the last lines of a job that finishes in between.
- Parameters:
courseId- the id of the course the job must belong tojobId- the id of the jobafterId- only lines with an id greater than this are returned; 0 for the whole log- Returns:
- the status of the job and its new log lines, oldest first
-