diff --git a/main.go b/main.go
index 5699246..bba617a 100644
--- a/main.go
+++ b/main.go
@@ -185,6 +185,7 @@ func (a *apiClient) viewTags(c echo.Context) error {
data.Set("repo", repo)
data.Set("tags", tags)
data.Set("deleteAllowed", deleteAllowed)
+ data.Set("events", registry.GetEvents(repo))
return c.Render(http.StatusOK, "tags.html", data)
}
@@ -279,9 +280,8 @@ func (a *apiClient) checkDeletePermission(user string) bool {
// viewLog view events from sqlite.
func (a *apiClient) viewLog(c echo.Context) error {
- events := registry.GetEvents()
data := jet.VarMap{}
- data.Set("events", events)
+ data.Set("events", registry.GetEvents(""))
return c.Render(http.StatusOK, "event_log.html", data)
}
diff --git a/registry/event_listener.go b/registry/event_listener.go
index 7627039..20c59ba 100644
--- a/registry/event_listener.go
+++ b/registry/event_listener.go
@@ -103,7 +103,7 @@ func ProcessEvents(request *http.Request, retention int) {
}
// GetEvents retrieve events from sqlite db
-func GetEvents() []EventRow {
+func GetEvents(repository string) []EventRow {
var events []EventRow
db, err := sql.Open("sqlite3", dbFile)
if err != nil {
@@ -112,7 +112,11 @@ func GetEvents() []EventRow {
}
defer db.Close()
- rows, err := db.Query("SELECT * FROM events ORDER BY id DESC LIMIT 1000")
+ query := "SELECT * FROM events ORDER BY id DESC LIMIT 1000"
+ if repository != "" {
+ query = fmt.Sprintf("SELECT * FROM events WHERE repository='%s' ORDER BY id DESC LIMIT 5", repository)
+ }
+ rows, err := db.Query(query)
if err != nil {
logger.Error("Error selecting from table: ", err)
return events
diff --git a/registry/tasks.go b/registry/tasks.go
index 0656e02..378f278 100644
--- a/registry/tasks.go
+++ b/registry/tasks.go
@@ -64,7 +64,7 @@ func PurgeOldTags(client *Client, purgeDryRun bool, purgeTagsKeepDays, purgeTags
for _, tag := range tags {
_, infoV1, _ := client.TagInfo(repo, tag, true)
if infoV1 == "" {
- logger.Errorf("[%s] manifest missed for tag %s", repo, tag)
+ logger.Errorf("[%s] missing manifest v1 for tag %s", repo, tag)
continue
}
created := gjson.Get(gjson.Get(infoV1, "history.0.v1Compatibility").String(), "created").Time()
diff --git a/templates/event_log.html b/templates/event_log.html
index c01d9bd..82da955 100644
--- a/templates/event_log.html
+++ b/templates/event_log.html
@@ -33,7 +33,7 @@
{{ e.Action }} |
{{if hasPrefix(e.Tag,"sha256") }}
- {{ e.Repository }}@{{ e.Tag[:12] }}.....{{ e.Tag[66:] }} |
+ {{ e.Repository }}@{{ e.Tag[:19] }}... |
{{else}}
{{ e.Repository }}:{{ e.Tag }} |
{{end}}
diff --git a/templates/tag_info.html b/templates/tag_info.html
index 299c111..e9b7cfa 100644
--- a/templates/tag_info.html
+++ b/templates/tag_info.html
@@ -11,7 +11,7 @@
{{ repo }}
{{ tag }}
-
+
Image Details |
diff --git a/templates/tags.html b/templates/tags.html
index 6cc628f..dbeb8a7 100644
--- a/templates/tags.html
+++ b/templates/tags.html
@@ -2,12 +2,16 @@
{{block head()}}
+
{{end}}
@@ -49,4 +55,33 @@
{{end}}
+
+Latest events on this repo
+
+
+
+ Action |
+ Image |
+ IP Address |
+ User |
+ Time |
+
+
+
+ {{range e := events}}
+
+ {{ e.Action }} |
+ {{if hasPrefix(e.Tag,"sha256") }}
+ {{ e.Repository }}@{{ e.Tag[:19] }}... |
+ {{else}}
+ {{ e.Repository }}:{{ e.Tag }} |
+ {{end}}
+ {{ e.IP }} |
+ {{ e.User }} |
+ {{ e.Created }} |
+
+ {{end}}
+
+
+
{{end}}