Job Service Dashboard Component
Relevant source files
The following files were used as context for generating this wiki page:
- src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.component.ts
- src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.module.ts
- src/jobservice/README.md
- src/portal/src/i18n/lang/en-us-lang.json
- src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.component.spec.ts
The Job Service Dashboard Component is a centralized management interface within the Harbor portal dedicated to monitoring and controlling asynchronous background jobs. It provides administrators with high-level visibility into the health and status of the Job Service, including pending job queues, scheduled tasks, and the state of worker pools.
The dashboard serves as the UI frontend for the Job Service, which handles various background operations such as replication, vulnerability scanning, and garbage collection. It allows for administrative actions like pausing, resuming, or stopping job queues and workers to maintain system stability.
Sources: src/jobservice/README.md, src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.module.ts:27-52
Architecture and Module Structure
The dashboard is implemented as an Angular module that organizes several sub-components into a tabbed layout. The main container is the JobServiceDashboardComponent, which utilizes child routes to display specific views for different job-related entities.
Dashboard Routing Structure
The module defines a nested routing structure to navigate between different monitoring perspectives:
The dashboard defaults to the pending-jobs view upon activation.
Sources: src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.module.ts:27-52
Component Hierarchy and Functional Roles
The dashboard is composed of various specialized components that handle data display and user interaction for the Job Service API.
| Component | Description |
|---|---|
JobServiceDashboardComponent | The primary entry point and container for the dashboard views. |
PendingCardComponent / PendingListComponent | Displays jobs currently in the queue waiting for execution. |
ScheduleCardComponent / ScheduleListComponent | Manages cron-like periodic jobs and their upcoming execution times. |
WorkerCardComponent / WorkerListComponent | Monitors the health, PID, and concurrency of individual worker pools. |
DonutChartComponent | Visualizes worker utilization and job distribution within the WorkerCardComponent. |
Sources: src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.module.ts:54-63, src/portal/src/i18n/lang/en-us-lang.json:1152-1240
Job Service Backend Integration
The dashboard interacts with the Job Service backend, which is built on the gocraft/work framework. The dashboard reflects the state of the following core backend components:
- API Server: Serves the RESTful requests initiated by the dashboard UI.
- Stats Manager: Maintains the real-time status and statistics displayed on the dashboard cards.
- Worker Pool: The compute nodes where jobs are executed; the dashboard tracks their heartbeat and concurrency.
- Persistent Driver: Typically Redis, used as the message broker between the controller and workers.
Data Flow Overview
The dashboard facilitates the flow of control commands from the user to the backend workers.
Administrative Operations
The dashboard provides several critical buttons and controls to manage the job execution lifecycle. These operations directly correspond to the Job Service REST API endpoints (e.g., POST /api/v1/jobs/{job_id}).
Management Actions
- Stop All: Stops and removes all jobs in a selected queue.
- Pause/Resume Queue: Temporarily halts job execution for a specific type of job while still allowing new jobs to be enqueued.
- Pause/Resume Schedule: Controls the execution of periodic job templates.
- Free Worker: Manually stops a running job to release a worker node.
Status Definitions
The dashboard tracks jobs through multiple states defined in the backend:
pending: Job is in the queue.running: Job is currently being processed.success/error: Terminal states for job execution.stopped/cancelled: Result of administrative intervention.scheduled: Future-dated jobs or periodic templates.
Sources: src/jobservice/README.md, src/portal/src/i18n/lang/en-us-lang.json:1152-1234
Dashboard Monitoring Fields
The dashboard displays specific technical metrics retrieved from the Job Service GET /api/v1/stats and GET /api/v1/jobs/{job_id} endpoints.
| Metric | Source Context | Description |
|---|---|---|
| Latency | Pending Jobs | The time jobs have spent waiting in the queue. |
| Concurrency | Worker Pools | The maximum number of parallel jobs a pool can handle. |
| Heartbeat At | Worker Pools | The last time the worker pool communicated its health status. |
| Check-in At | Workers | Progress reporting from a job currently in progress (e.g., "30%"). |
| Cron | Schedules | The cron-style specification for periodic tasks. |
Sources: src/jobservice/README.md, src/portal/src/i18n/lang/en-us-lang.json:1200-1230
Conclusion
The Job Service Dashboard Component is a vital administrative tool in Harbor for managing asynchronous task execution. By providing granular control over worker pools, job queues, and schedules, it ensures that background processes—essential for security and maintenance—remain observable and manageable.
Sources: src/jobservice/README.md, src/portal/src/app/base/left-side-nav/job-service-dashboard/job-service-dashboard.module.ts