From e4f7e25d27de461d10fd9d5ded407e1dad1f9e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borna=20Rajkovi=C4=87?= Date: Sun, 6 Aug 2023 15:10:36 +0200 Subject: [PATCH] WIP: display jobs --- assets/images/invoice.svg | 7 +++++ assets/images/play.svg | 4 +++ main.go | 5 ++++ templates/jobs.gohtml | 59 +++++++++++++++++++++++++++++++++++++++ templates/webhooks.gohtml | 1 + 5 files changed, 76 insertions(+) create mode 100644 assets/images/invoice.svg create mode 100644 assets/images/play.svg create mode 100644 templates/jobs.gohtml diff --git a/assets/images/invoice.svg b/assets/images/invoice.svg new file mode 100644 index 0000000..ed8e5e5 --- /dev/null +++ b/assets/images/invoice.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/assets/images/play.svg b/assets/images/play.svg new file mode 100644 index 0000000..36ec614 --- /dev/null +++ b/assets/images/play.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/main.go b/main.go index 5b62d5f..b830fcc 100644 --- a/main.go +++ b/main.go @@ -128,6 +128,7 @@ func loadTemplates(g *gin.Engine) { "templates/admin_dashboard.gohtml", "templates/countries.gohtml", "templates/webhooks.gohtml", + "templates/jobs.gohtml", "templates/dialogs/add-holiday.gohtml", "templates/dialogs/edit-holiday.gohtml", @@ -267,6 +268,10 @@ func setupAdminDashboard(adminDashboard *gin.RouterGroup, service holiday.Holida webhooks, _ := webhookService.Find() c.HTML(http.StatusOK, "webhooks.gohtml", gin.H{"Webhooks": webhooks}) }) + adminDashboard.GET("/jobs", func(c *gin.Context) { + jobs, _ := webhookService.FindAllJobs() + c.HTML(http.StatusOK, "jobs.gohtml", gin.H{"Jobs": jobs}) + }) adminDashboard.POST("/webhooks", func(c *gin.Context) { request := struct { Id *string `form:"id"` diff --git a/templates/jobs.gohtml b/templates/jobs.gohtml new file mode 100644 index 0000000..8aa2d2c --- /dev/null +++ b/templates/jobs.gohtml @@ -0,0 +1,59 @@ + + + + + + Holiday-api | Admin dashboard + + + + +
+
+
+

Holiday-api | Jobs

+
+
+ +
+
+ + + + + + + + + + + + + {{range $entry := .Jobs}} + + + + + + + + {{end}} + +
WebhookCreatedSuccessRetries remaining
{{$entry.WebhookId}}{{$entry.Created.Format "2006-01-02 15:04:05"}} + + {{$entry.RetryCount}} + + +
+
+
+ + \ No newline at end of file diff --git a/templates/webhooks.gohtml b/templates/webhooks.gohtml index 93abac1..634c8b7 100644 --- a/templates/webhooks.gohtml +++ b/templates/webhooks.gohtml @@ -50,6 +50,7 @@ +