comparison scid/http.c @ 41:00b9af607524

scid: implement /jobresults/id page
author David Demelier <markand@malikania.fr>
date Tue, 09 Aug 2022 14:52:34 +0200
parents 96008a1953ba
children 576f4b1ec79f
comparison
equal deleted inserted replaced
40:752bb1cd2dd8 41:00b9af607524
32 #include "page-api-jobs.h" 32 #include "page-api-jobs.h"
33 #include "page-api-projects.h" 33 #include "page-api-projects.h"
34 #include "page-api-todo.h" 34 #include "page-api-todo.h"
35 #include "page-api-workers.h" 35 #include "page-api-workers.h"
36 #include "page-index.h" 36 #include "page-index.h"
37 #include "page-jobresults.h"
37 #include "page-static.h" 38 #include "page-static.h"
38 #include "pageutil.h" 39 #include "pageutil.h"
39 40
40 enum page { 41 enum page {
41 PAGE_INDEX, /* Job results at index. */ 42 PAGE_INDEX, /* Job results at index. */
43 PAGE_JOBRESULTS, /* List of jobresult for one job. */
42 PAGE_API, 44 PAGE_API,
43 PAGE_STATIC, 45 PAGE_STATIC,
44 PAGE_LAST /* Not used. */ 46 PAGE_LAST /* Not used. */
45 }; 47 };
46 48
47 static void 49 static void
48 dispatch_api(struct kreq *req) 50 dispatch_api(struct kreq *req)
49 { 51 {
66 pageutil_status(req, KHTTP_404); 68 pageutil_status(req, KHTTP_404);
67 } 69 }
68 70
69 static const char *pages[] = { 71 static const char *pages[] = {
70 [PAGE_INDEX] = "", 72 [PAGE_INDEX] = "",
73 [PAGE_JOBRESULTS] = "jobresults",
71 [PAGE_API] = "api", 74 [PAGE_API] = "api",
72 [PAGE_STATIC] = "static" 75 [PAGE_STATIC] = "static"
73 }; 76 };
74 77
75 static void (*handlers[])(struct kreq *req) = { 78 static void (*handlers[])(struct kreq *req) = {
76 [PAGE_INDEX] = page_index, 79 [PAGE_INDEX] = page_index,
80 [PAGE_JOBRESULTS] = page_jobresults,
77 [PAGE_API] = dispatch_api, 81 [PAGE_API] = dispatch_api,
78 [PAGE_STATIC] = page_static 82 [PAGE_STATIC] = page_static
79 }; 83 };
80 84
81 static void 85 static void