worker stats dashboard, fixed logs page, mobile support for navbar & project dashboard

This commit is contained in:
simon987
2019-02-09 16:34:15 -05:00
parent 4ef4752c14
commit a6802c7109
19 changed files with 259 additions and 58 deletions

View File

@@ -78,6 +78,7 @@ func New() *WebAPI {
api.router.POST("/worker/create", LogRequestMiddleware(api.WorkerCreate))
api.router.POST("/worker/update", LogRequestMiddleware(api.WorkerUpdate))
api.router.GET("/worker/get/:id", LogRequestMiddleware(api.WorkerGet))
api.router.GET("/worker/stats", LogRequestMiddleware(api.GetAllWorkerStats))
api.router.POST("/access/grant", LogRequestMiddleware(api.WorkerGrantAccess))
api.router.POST("/access/remove", LogRequestMiddleware(api.WorkerRemoveAccess))

View File

@@ -44,6 +44,12 @@ type WorkerAccessResponse struct {
Message string `json:"message"`
}
type GetAllWorkerStatsResponse struct {
Ok bool `json:"ok"`
Message string `json:"message,omitempty"`
Stats *[]storage.WorkerStats `json:"stats"`
}
func (api *WebAPI) WorkerCreate(r *Request) {
workerReq := &CreateWorkerRequest{}
@@ -208,6 +214,16 @@ func (api *WebAPI) WorkerUpdate(r *Request) {
}
}
func (api *WebAPI) GetAllWorkerStats(r *Request) {
stats := api.Database.GetAllWorkerStats()
r.OkJson(GetAllWorkerStatsResponse{
Ok: true,
Stats: stats,
})
}
func (api *WebAPI) workerCreate(request *CreateWorkerRequest, identity *storage.Identity) (*storage.Worker, error) {
if request.Alias == "" {