detached 59e0fc0

Shorten container creation URL, update logs, and clean up code

commit
59e0fc0577808bd2f3ddfadc6d68a63cd3a4da21
author
bamen · · 2024-09-19 05:31 UTC
parent
745953a
signature
unsigned
3 files · +3 -5
M internal/cli/cmd/push.go +1 -1
@@ -88,7 +88,7 @@ func pushImage(a *cli.App, imageName string) error {
8888 log.Info("Image pushed successfully", "image", imageName)
8989
9090 if pushResponse.CreateContainerURL != "" {
91- log.Info("Create a container for this image at:", "url", pushResponse.CreateContainerURL)
91+ log.Info("Container creation URL:", "url", pushResponse.CreateContainerURL)
9292 }
9393
9494 return nil
@@ -88,7 +88,7 @@ func pushImage(a *cli.App, imageName string) error {
88 log.Info("Image pushed successfully", "image", imageName)88 log.Info("Image pushed successfully", "image", imageName)
89 89
90 if pushResponse.CreateContainerURL != "" {90 if pushResponse.CreateContainerURL != "" {
91- log.Info("Create a container for this image at:", "url", pushResponse.CreateContainerURL)91+ log.Info("Container creation URL:", "url", pushResponse.CreateContainerURL)
92 }92 }
93 93
94 return nil94 return nil
M internal/httpserve/handler/cli-endpoints.go +1 -3
@@ -4,7 +4,6 @@ import (
44 "encoding/json"
55 "errors"
66 "fmt"
7- "log"
87 "net/http"
98 "regexp"
109
@@ -153,13 +152,12 @@ func generateShortID(imageID string) string {
153152
154153 // storeIDMapping saves the mapping between short ID and full ID
155154 func storeIDMapping(shortID, fullID string) {
156- log.Printf("Storing mapping: %s -> %s", shortID, fullID)
157155 safelyInteractWithIDMap(Update, shortID, fullID)
158156 }
159157
160158 // generateCreateContainerURL creates the URL for the container creation page
161159 func generateCreateContainerURL(a *server.App, shortID string) string {
162- return fmt.Sprintf("%s://%s%s/create-container/%s",
160+ return fmt.Sprintf("%s://%s%s/cc/%s",
163161 a.Config.Http.Protocol(),
164162 a.Config.Http.FullDomain(),
165163 a.Config.Admin.Path,
@@ -4,7 +4,6 @@ import (
4 "encoding/json"4 "encoding/json"
5 "errors"5 "errors"
6 "fmt"6 "fmt"
7- "log"
8 "net/http"7 "net/http"
9 "regexp"8 "regexp"
10 9
@@ -153,13 +152,12 @@ func generateShortID(imageID string) string {
153 152
154 // storeIDMapping saves the mapping between short ID and full ID153 // storeIDMapping saves the mapping between short ID and full ID
155 func storeIDMapping(shortID, fullID string) {154 func storeIDMapping(shortID, fullID string) {
156- log.Printf("Storing mapping: %s -> %s", shortID, fullID)
157 safelyInteractWithIDMap(Update, shortID, fullID)155 safelyInteractWithIDMap(Update, shortID, fullID)
158 }156 }
159 157
160 // generateCreateContainerURL creates the URL for the container creation page158 // generateCreateContainerURL creates the URL for the container creation page
161 func generateCreateContainerURL(a *server.App, shortID string) string {159 func generateCreateContainerURL(a *server.App, shortID string) string {
162- return fmt.Sprintf("%s://%s%s/create-container/%s",160+ return fmt.Sprintf("%s://%s%s/cc/%s",
163 a.Config.Http.Protocol(),161 a.Config.Http.Protocol(),
164 a.Config.Http.FullDomain(),162 a.Config.Http.FullDomain(),
165 a.Config.Admin.Path,163 a.Config.Admin.Path,
M internal/httpserve/router.go +1 -1
@@ -106,7 +106,7 @@ func bindAdminRoute(e *echo.Echo, a *server.App, adminPath string) {
106106 adminGroup.GET("/manager", func(c echo.Context) error {
107107 return handler.AdminManagerRoute(c, a)
108108 }, middleware.RequireLogin(a))
109- adminGroup.GET("/create-container/:ID", func(c echo.Context) error {
109+ adminGroup.GET("/cc/:ID", func(c echo.Context) error {
110110 return handler.CreateContainerFullGET(c, a)
111111 }, middleware.RequireLogin(a))
112112 }
@@ -106,7 +106,7 @@ func bindAdminRoute(e *echo.Echo, a *server.App, adminPath string) {
106 adminGroup.GET("/manager", func(c echo.Context) error {106 adminGroup.GET("/manager", func(c echo.Context) error {
107 return handler.AdminManagerRoute(c, a)107 return handler.AdminManagerRoute(c, a)
108 }, middleware.RequireLogin(a))108 }, middleware.RequireLogin(a))
109- adminGroup.GET("/create-container/:ID", func(c echo.Context) error {109+ adminGroup.GET("/cc/:ID", func(c echo.Context) error {
110 return handler.CreateContainerFullGET(c, a)110 return handler.CreateContainerFullGET(c, a)
111 }, middleware.RequireLogin(a))111 }, middleware.RequireLogin(a))
112 }112 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close