mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-10-13 01:28:17 +02:00
feat: Implement calendar view for scheduled jobs
- Added a new calendar view to display scheduled jobs for the next two months. - Introduced components for generating calendar events from job data. - Integrated FullCalendar for enhanced calendar functionality. - Updated routing to include a new endpoint for the calendar view. - Enhanced layout to include a link to the calendar in the navigation. - Added necessary CSS for FullCalendar styling and functionality. - Included tooltips for event details and filtering options for job visibility.
This commit is contained in:
1 parent
88d0ac815a
commit
37d507ade6
9 files changed
+1045
-2
No files matched your search
@@ -42,6 +42,23 @@ func (h *Handlers) HandleJobs(c *gin.Context) {
|
||||
components.Jobs(c, data).Render(c, c.Writer)
|
||||
}
|
||||
|
||||
// HandleCalendarView handles the GET /calendar route
|
||||
func (h *Handlers) HandleCalendarView(c *gin.Context) {
|
||||
userID := c.GetUint("userID")
|
||||
|
||||
// Get all jobs with Next Run time for this user
|
||||
var jobs []db.Job
|
||||
h.DB.Where("created_by = ?", userID).Preload("Config").Find(&jobs)
|
||||
|
||||
// Prepare data for the calendar view
|
||||
data := components.JobCalendarData{
|
||||
Jobs: jobs,
|
||||
}
|
||||
|
||||
// Render the calendar view
|
||||
components.JobCalendar(c, data).Render(c, c.Writer)
|
||||
}
|
||||
|
||||
// HandleJobRunDetails handles the GET /job/:id route
|
||||
func (h *Handlers) HandleJobRunDetails(c *gin.Context) {
|
||||
userID := c.GetUint("userID")
|
||||
|
||||
@@ -84,6 +84,10 @@ func (h *Handlers) RegisterRoutes(router *gin.Engine) {
|
||||
authorized.POST("/jobs/:id/run", h.HandleRunJob)
|
||||
authorized.GET("/history", h.HandleHistory)
|
||||
authorized.GET("/job-runs/:id", h.HandleJobRunDetails)
|
||||
|
||||
// Calendar view route
|
||||
authorized.GET("/calendar", h.HandleCalendarView)
|
||||
|
||||
authorized.GET("/profile", h.HandleProfile)
|
||||
authorized.POST("/profile/theme", h.HandleUpdateTheme)
|
||||
authorized.POST("/logout", h.HandleLogout)
|
||||
|
||||
Reference in new issue
Block a user