-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Route refactoring and UI tweaks (#3)
* Remove external resource call in Aim UI Material Icons are not even actually used. * Reduce UI built size and memory needed to build * Refactor routes - stop using fiber mounts as they were problematic - make the MLFlow API available directly on / to ease user onboarding - move health and version to / as well - fix loading of Aim UI with embedded credentials URL - use fetch directly to get the version in both UIs
- Loading branch information
1 parent
06db0fa
commit 14d0de9
Showing
24 changed files
with
423 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
fasttrack | ||
fasttrack.db* | ||
pkg/ui/*/build* | ||
!pkg/ui/*/build.sh | ||
pkg/ui/*/embed/build* | ||
!pkg/ui/*/embed/build.sh | ||
tests/*/*.src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package aim | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/gofiber/fiber/v2" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
func ErrorHandler(c *fiber.Ctx, err error) error { | ||
var e *ErrorResponse | ||
var f *fiber.Error | ||
var d DetailedError | ||
|
||
switch { | ||
case errors.As(err, &e): | ||
case errors.As(err, &f): | ||
e = &ErrorResponse{ | ||
Code: f.Code, | ||
Message: f.Message, | ||
Detail: "", | ||
} | ||
case errors.As(err, &d): | ||
e = &ErrorResponse{ | ||
Code: d.Code(), | ||
Message: d.Message(), | ||
Detail: d.Detail(), | ||
} | ||
default: | ||
e = &ErrorResponse{ | ||
Code: fiber.StatusInternalServerError, | ||
Message: err.Error(), | ||
Detail: "", | ||
} | ||
} | ||
|
||
fn := log.Errorf | ||
|
||
switch e.Code { | ||
case fiber.StatusNotFound: | ||
fn = log.Debugf | ||
case fiber.StatusInternalServerError: | ||
default: | ||
fn = log.Warnf | ||
} | ||
|
||
fn("Error encountered in %s %s: %s", c.Method(), c.Path(), err) | ||
|
||
return c.Status(e.Code).JSON(e) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package aim | ||
|
||
import ( | ||
"github.com/gofiber/fiber/v2" | ||
) | ||
|
||
func AddRoutes(r fiber.Router) { | ||
apps := r.Group("apps") | ||
apps.Get("/", GetApps) | ||
apps.Post("/", CreateApp) | ||
apps.Get("/:id/", GetApp) | ||
apps.Put("/:id/", UpdateApp) | ||
apps.Delete("/:id/", DeleteApp) | ||
|
||
dashboards := r.Group("/dashboards") | ||
dashboards.Get("/", GetDashboards) | ||
dashboards.Post("/", CreateDashboard) | ||
dashboards.Get("/:id/", GetDashboard) | ||
dashboards.Put("/:id/", UpdateDashboard) | ||
dashboards.Delete("/:id/", DeleteDashboard) | ||
|
||
experiments := r.Group("experiments") | ||
experiments.Get("/", GetExperiments) | ||
experiments.Get("/:id/", GetExperiment) | ||
experiments.Get("/:id/activity/", GetExperimentActivity) | ||
experiments.Get("/:id/runs/", GetExperimentRuns) | ||
|
||
projects := r.Group("/projects") | ||
projects.Get("/", GetProject) | ||
projects.Get("/activity/", GetProjectActivity) | ||
projects.Get("/pinned-sequences/", GetProjectPinnedSequences) | ||
projects.Post("/pinned-sequences/", UpdateProjectPinnedSequences) | ||
projects.Get("/params/", GetProjectParams) | ||
projects.Get("/status/", GetProjectStatus) | ||
|
||
runs := r.Group("/runs") | ||
runs.Get("/active/", GetRunsActive) | ||
runs.Get("/search/run/", GetRunsSearch) | ||
runs.Get("/search/metric/", GetRunsMetricsSearch) | ||
runs.Get("/:id/info/", GetRunInfo) | ||
runs.Post("/:id/metric/get-batch/", GetRunMetricBatch) | ||
|
||
tags := r.Group("/tags") | ||
tags.Get("/", GetTags) | ||
|
||
r.Use(func(c *fiber.Ctx) error { | ||
return fiber.ErrNotFound | ||
}) | ||
} |
Oops, something went wrong.