18 Commits
0.6 ... 0.7

Author SHA1 Message Date
Roman Vynar
9597890b67 Prepare 0.7 release. 2018-07-04 17:57:29 +03:00
Roman Vynar
e1656debc5 Merge pull request #10 from uphy/cron
Add built-in cron feature.
2018-07-04 17:32:35 +03:00
Roman Vynar
d1ce70490c A bit refactoring. 2018-07-04 17:31:15 +03:00
Roman Vynar
e163b5af27 Merge branch 'master' of github.com:Quiq/docker-registry-ui 2018-07-04 16:47:58 +03:00
Roman Vynar
51c9a66195 Merge pull request #8 from uphy/master
Add feature to change the base path
2018-07-04 16:47:31 +03:00
Roman Vynar
4047019a3f Merge branch 'master' into master 2018-07-04 16:47:07 +03:00
Roman Vynar
0a268746c9 Merge branch 'master' of github.com:Quiq/docker-registry-ui 2018-07-04 16:38:22 +03:00
Roman Vynar
aaf65ed718 Merge pull request #11 from rmwpl/feature/nexus-compatibility
[feature/nexus-compatibility] Enable Sonatype Nexus compatibility
2018-07-04 16:38:06 +03:00
Roman Vynar
9a0674ea6b Bump go version to 1.10.3 2018-07-04 16:36:00 +03:00
Roman Vynar
34fe1742cf Show last events for repos containing / 2018-07-04 16:35:50 +03:00
Roman Vynar
0889821117 Merge pull request #12 from drExciter/url_encode_repos
URL encode repo variable in templates to support images with slash in…
2018-07-04 15:58:02 +03:00
drExciter
8aa9ac86f7 URL encode repo variable in templates to support images with slash in the name 2018-06-21 09:44:10 +02:00
Robert Wysocki
6b404abeaf [feature/nexus-compatibility] Enable Sonatype Nexus compatibility 2018-06-15 13:19:40 +01:00
Roman Vynar
16fd6d944f Last events were not shown when viewing a repo of non-default namespace. 2018-06-12 12:27:29 +03:00
Roman Vynar
4db9ceb0a6 When using MySQL for event storage, do not leak connections. 2018-06-12 12:19:13 +03:00
Yuhi Ishikura
a8d57564fa Add built-in cron feature. 2018-06-09 09:36:35 +09:00
Yuhi Ishikura
a5fc3a5d30 Add feature to change the base path. 2018-06-07 23:04:16 +09:00
Yuhi Ishikura
eabcf48494 Add example. 2018-06-07 21:46:53 +09:00
20 changed files with 362 additions and 84 deletions

View File

@@ -1,11 +1,20 @@
## Changelog
### 0.6
### 0.7 (2018-07-04)
* When using MySQL for event storage, do not leak connections.
* Last events were not shown when viewing a repo of non-default namespace.
* Support repos with slash in the name.
* Enable Sonatype Nexus compatibility.
* Add `base_path` option to the config to run UI from non-root.
* Add built-in cron feature for purging tags task.
### 0.6 (2018-05-28)
* Add MySQL along with sqlite3 support as a registry events storage.
New config settings `event_database_driver`, `event_database_location`.
* Bump Go version and dependencies.
### 0.5
### 0.5 (2018-03-06)
* Initial public version.

View File

@@ -1,4 +1,4 @@
FROM golang:1.10.2-alpine3.7 as builder
FROM golang:1.10.3-alpine as builder
ENV GOPATH /opt
@@ -12,7 +12,7 @@ RUN cd /opt/src/github.com/quiq/docker-registry-ui && \
ADD events /opt/src/github.com/quiq/docker-registry-ui/events
ADD registry /opt/src/github.com/quiq/docker-registry-ui/registry
ADD main.go /opt/src/github.com/quiq/docker-registry-ui/
ADD *.go /opt/src/github.com/quiq/docker-registry-ui/
RUN cd /opt/src/github.com/quiq/docker-registry-ui && \
go test -v ./registry && \
go build -o /opt/docker-registry-ui github.com/quiq/docker-registry-ui

View File

@@ -56,6 +56,7 @@ To receive events you need to configure Registry as follow:
- application/octet-stream
Adjust url and token as appropriate.
If you are running UI from non-root base path, e.g. /ui, the URL path for above will be `/ui/api/events`.
## Using MySQL instead of sqlite3 for event listener
@@ -85,6 +86,14 @@ You can try to run in dry-run mode first to see what is going to be purged:
docker exec -t registry-ui /opt/docker-registry-ui -purge-tags -dry-run
Alternatively, you can schedule the purging task with built-in cron feature:
purge_tags_keep_days: 90
purge_tags_keep_count: 2
purge_tags_schedule: '0 10 3 * * *'
Note, the cron schedule format includes seconds! See https://godoc.org/github.com/robfig/cron
### Debug mode
To increase http request verbosity, run container with `-e GOREQUEST_DEBUG=1`.

View File

@@ -1,5 +1,7 @@
# Listen interface.
listen_addr: 0.0.0.0:8000
# Base path of Docker Registry UI.
base_path: /
# Registry URL with schema and port.
registry_url: https://docker-registry.local
@@ -38,7 +40,11 @@ admins: []
# Debug mode. Affects only templates.
debug: true
# CLI options.
# How many days to keep tags but also keep the minimal count provided no matter how old.
purge_tags_keep_days: 90
purge_tags_keep_count: 2
# Enable built-in cron to schedule purging tags in server mode.
# Empty string disables this feature.
# Example: '25 54 17 * * *' will run it at 17:54:25 daily.
# Note, the cron schedule format includes seconds! See https://godoc.org/github.com/robfig/cron
purge_tags_schedule: ''

View File

@@ -144,13 +144,13 @@ func (e *EventListener) GetEvents(repository string) []EventRow {
e.logger.Error("Error selecting from table: ", err)
return events
}
defer rows.Close()
for rows.Next() {
var row EventRow
rows.Scan(&row.ID, &row.Action, &row.Repository, &row.Tag, &row.IP, &row.User, &row.Created)
events = append(events, row)
}
rows.Close()
return events
}
@@ -171,9 +171,11 @@ func (e *EventListener) getDababaseHandler() (*sql.DB, error) {
if e.databaseDriver == "mysql" {
schema = strings.Replace(schema, "AUTOINCREMENT", "AUTO_INCREMENT", 1)
if _, err := db.Query("SELECT * FROM events LIMIT 1"); err != nil {
rows, err := db.Query("SELECT * FROM events LIMIT 1")
if err != nil {
firstRun = true
}
rows.Close()
}
// Create table on first run.

1
example/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/data

25
example/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Docker Registry UI Example
Start the local Docker Registry and UI.
```bash
$ docker-compose up -d
```
As an example, push the docker-registry-ui image to the local Docker Registry.
```bash
$ docker tag quiq/docker-registry-ui localhost/quiq/docker-registry-ui
$ docker push localhost/quiq/docker-registry-ui
The push refers to repository [localhost:5000/quiq/docker-registry-ui]
ab414a599bf8: Pushed
a8da33adf86e: Pushed
71a0e0a972a7: Pushed
96dc74eb5456: Pushed
ac362bf380d0: Pushed
04a094fe844e: Pushed
latest: digest: sha256:d88c1ca40986a358e59795992e87e364a0b3b97833aade5abcd79dda0a0477e8 size: 1571
```
Then you will find the pushed repository 'quiq/docker-registry-ui' in the following URL.
http://localhost/ui/quiq/docker-registry-ui

79
example/config/httpd.conf Normal file
View File

@@ -0,0 +1,79 @@
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule headers_module modules/mod_headers.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule unixd_module modules/mod_unixd.so
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
ServerAdmin you@example.com
ErrorLog /proc/self/fd/2
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog /proc/self/fd/1 common
</IfModule>
ServerRoot "/usr/local/apache2"
Listen 80
<Directory />
AllowOverride none
Require all denied
</Directory>
<VirtualHost *:80>
ServerName myregistrydomain.com
Header always set "Docker-Distribution-Api-Version" "registry/2.0"
Header onsuccess set "Docker-Distribution-Api-Version" "registry/2.0"
ProxyRequests off
ProxyPreserveHost on
# no proxy for /error/ (Apache HTTPd errors messages)
ProxyPass /error/ !
ProxyPass /v2 http://registry:5000/v2
ProxyPassReverse /v2 http://registry:5000/v2
<Location /v2>
Order deny,allow
Allow from all
</Location>
ProxyPass /ui/ http://registry-ui:8000/ui/
ProxyPassReverse /ui/ http://registry-ui:8000/ui/
<Location /ui>
Order deny,allow
Allow from all
</Location>
</VirtualHost>

View File

@@ -0,0 +1,46 @@
# Listen interface.
listen_addr: 0.0.0.0:8000
# Base path of Docker Registry UI.
base_path: /ui
# Registry URL with schema and port.
registry_url: http://registry:5000
# Verify TLS certificate when using https.
verify_tls: true
# Docker registry credentials.
# They need to have a full access to the registry.
# If token authentication service is enabled, it will be auto-discovered and those credentials
# will be used to obtain access tokens.
# registry_username: user
# registry_password: pass
# Event listener token.
# The same one should be configured on Docker registry as Authorization Bearer token.
event_listener_token: token
# Retention of records to keep.
event_retention_days: 7
# Event listener storage.
event_database_driver: sqlite3
event_database_location: data/registry_events.db
# event_database_driver: mysql
# event_database_location: user:password@tcp(localhost:3306)/docker_events
# Cache refresh interval in minutes.
# How long to cache repository list and tag counts.
cache_refresh_interval: 10
# If users can delete tags. If set to False, then only admins listed below.
anyone_can_delete: false
# Users allowed to delete tags.
# This should be sent via X-WEBAUTH-USER header from your proxy.
admins: []
# Debug mode. Affects only templates.
debug: true
# CLI options.
# How many days to keep tags but also keep the minimal count provided no matter how old.
purge_tags_keep_days: 90
purge_tags_keep_count: 2

View File

@@ -0,0 +1,31 @@
version: "2.3"
services:
httpd:
image: httpd:2.4
ports:
- "80:80"
volumes:
- "./config/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro"
registry:
image: registry:2
ports:
- "5000"
volumes:
- "./data/registry:/var/lib/registry"
healthcheck:
test: ["CMD", "wget", "-s", "localhost:5000/v2/"]
interval: 5s
timeout: 10s
registry-ui:
image: quiq/docker-registry-ui:latest
ports:
- "8000"
volumes:
- "./data/registry-ui:/opt/data"
- "./config/registry-ui.yml:/opt/config.yml:ro"
depends_on:
registry:
condition: service_healthy

6
glide.lock generated
View File

@@ -1,5 +1,5 @@
hash: d156899e94e2d0d92ed200d5729bec5d0d205b5b98bbf2bd89f7f91c9ed7a518
updated: 2018-05-28T13:28:11.313447+03:00
hash: fea96c473a02b07acc1d600ee0f71c6a5143f34e5eb04a4c5e3e14378fca46f0
updated: 2018-06-09T09:03:51.972089+09:00
imports:
- name: github.com/CloudyKit/fastprinter
version: 74b38d55f37af5d6c05ca11147d616b613a3420e
@@ -36,6 +36,8 @@ imports:
version: a578a48e8d6ca8b01a3b18314c43c6716bb5f5a3
- name: github.com/pkg/errors
version: 816c9085562cd7ee03e7f8188a1cfd942858cded
- name: github.com/robfig/cron
version: b41be1df696709bb6395fe435af20370037c0b4c
- name: github.com/tidwall/gjson
version: 01f00f129617a6fe98941fb920d6c760241b54d2
- name: github.com/tidwall/match

View File

@@ -14,6 +14,8 @@ import:
- package: github.com/mattn/go-sqlite3
version: 1.7.0
- package: github.com/go-sql-driver/mysql
- package: github.com/robfig/cron
version: ~1.1.0
testImport:
- package: github.com/smartystreets/goconvey
version: 1.6.2

99
main.go
View File

@@ -3,7 +3,6 @@ package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
@@ -15,12 +14,14 @@ import (
"github.com/labstack/echo/middleware"
"github.com/quiq/docker-registry-ui/events"
"github.com/quiq/docker-registry-ui/registry"
"github.com/robfig/cron"
"github.com/tidwall/gjson"
"gopkg.in/yaml.v2"
)
type configData struct {
ListenAddr string `yaml:"listen_addr"`
BasePath string `yaml:"base_path"`
RegistryURL string `yaml:"registry_url"`
VerifyTLS bool `yaml:"verify_tls"`
Username string `yaml:"registry_username"`
@@ -35,6 +36,7 @@ type configData struct {
Debug bool `yaml:"debug"`
PurgeTagsKeepDays int `yaml:"purge_tags_keep_days"`
PurgeTagsKeepCount int `yaml:"purge_tags_keep_count"`
PurgeTagsSchedule string `yaml:"purge_tags_schedule"`
}
type template struct {
@@ -75,6 +77,15 @@ func main() {
if err != nil {
panic(err)
}
// Normalize base path.
if a.config.BasePath != "" {
if !strings.HasPrefix(a.config.BasePath, "/") {
a.config.BasePath = "/" + a.config.BasePath
}
if strings.HasSuffix(a.config.BasePath, "/") {
a.config.BasePath = a.config.BasePath[0 : len(a.config.BasePath)-1]
}
}
// Init registry API client.
a.client = registry.NewClient(a.config.RegistryURL, a.config.VerifyTLS, a.config.Username, a.config.Password)
@@ -84,9 +95,20 @@ func main() {
// Execute CLI task and exit.
if purgeTags {
registry.PurgeOldTags(a.client, purgeDryRun, a.config.PurgeTagsKeepDays, a.config.PurgeTagsKeepCount)
a.purgeOldTags(purgeDryRun)
return
}
// Schedules to purge tags.
if a.config.PurgeTagsSchedule != "" {
c := cron.New()
task := func() {
a.purgeOldTags(purgeDryRun)
}
if err := c.AddFunc(a.config.PurgeTagsSchedule, task); err != nil {
panic(fmt.Errorf("Invalid schedule format: %s", a.config.PurgeTagsSchedule))
}
c.Start()
}
// Count tags in background.
go a.client.CountTags(a.config.CacheRefreshInterval)
@@ -97,45 +119,20 @@ func main() {
a.eventListener = events.NewEventListener(a.config.EventDatabaseDriver, a.config.EventDatabaseLocation, a.config.EventRetentionDays)
// Template engine init.
view := jet.NewHTMLSet("templates")
view.SetDevelopmentMode(a.config.Debug)
view.AddGlobal("registryHost", u.Host)
view.AddGlobal("pretty_size", func(size interface{}) string {
var value float64
switch i := size.(type) {
case gjson.Result:
value = float64(i.Int())
case int64:
value = float64(i)
}
return registry.PrettySize(value)
})
view.AddGlobal("pretty_time", func(datetime interface{}) string {
d := strings.Replace(datetime.(string), "T", " ", 1)
d = strings.Replace(d, "Z", "", 1)
return strings.Split(d, ".")[0]
})
view.AddGlobal("parse_map", func(m interface{}) string {
var res string
for _, k := range registry.SortedMapKeys(m) {
res = res + fmt.Sprintf(`<tr><td style="padding: 0 10px; width: 20%%">%s</td><td style="padding: 0 10px">%v</td></tr>`, k, m.(map[string]interface{})[k])
}
return res
})
e := echo.New()
e.Renderer = &template{View: view}
e.Renderer = setupRenderer(a.config.Debug, u.Host, a.config.BasePath)
// Web routes.
e.Static("/static", "static")
e.GET("/", a.viewRepositories)
e.GET("/:namespace", a.viewRepositories)
e.GET("/:namespace/:repo", a.viewTags)
e.GET("/:namespace/:repo/:tag", a.viewTagInfo)
e.GET("/:namespace/:repo/:tag/delete", a.deleteTag)
e.GET("/events", a.viewLog)
e.Static(a.config.BasePath+"/static", "static")
e.GET(a.config.BasePath+"/", a.viewRepositories)
e.GET(a.config.BasePath+"/:namespace", a.viewRepositories)
e.GET(a.config.BasePath+"/:namespace/:repo", a.viewTags)
e.GET(a.config.BasePath+"/:namespace/:repo/:tag", a.viewTagInfo)
e.GET(a.config.BasePath+"/:namespace/:repo/:tag/delete", a.deleteTag)
e.GET(a.config.BasePath+"/events", a.viewLog)
// Protected event listener.
p := e.Group("/api")
p := e.Group(a.config.BasePath + "/api")
p.Use(middleware.KeyAuthWithConfig(middleware.KeyAuthConfig{
Validator: middleware.KeyAuthValidator(func(token string, c echo.Context) (bool, error) {
return token == a.config.EventListenerToken, nil
@@ -146,23 +143,6 @@ func main() {
e.Logger.Fatal(e.Start(a.config.ListenAddr))
}
// Render render template.
func (r *template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
t, err := r.View.GetTemplate(name)
if err != nil {
panic(fmt.Errorf("Fatal error template file: %s", err))
}
vars, ok := data.(jet.VarMap)
if !ok {
vars = jet.VarMap{}
}
err = t.Execute(w, vars, nil)
if err != nil {
panic(fmt.Errorf("Error rendering template %s: %s", name, err))
}
return nil
}
func (a *apiClient) viewRepositories(c echo.Context) error {
namespace := c.Param("namespace")
if namespace == "" {
@@ -170,7 +150,6 @@ func (a *apiClient) viewRepositories(c echo.Context) error {
}
repos, _ := a.client.Repositories(true)[namespace]
data := jet.VarMap{}
data.Set("namespace", namespace)
data.Set("namespaces", a.client.Namespaces())
@@ -196,7 +175,8 @@ func (a *apiClient) viewTags(c echo.Context) error {
data.Set("repo", repo)
data.Set("tags", tags)
data.Set("deleteAllowed", deleteAllowed)
data.Set("events", a.eventListener.GetEvents(repo))
repoPath, _ = url.PathUnescape(repoPath)
data.Set("events", a.eventListener.GetEvents(repoPath))
return c.Render(http.StatusOK, "tags.html", data)
}
@@ -212,7 +192,7 @@ func (a *apiClient) viewTagInfo(c echo.Context) error {
sha256, infoV1, infoV2 := a.client.TagInfo(repoPath, tag, false)
if infoV1 == "" || infoV2 == "" {
return c.Redirect(http.StatusSeeOther, fmt.Sprintf("/%s/%s", namespace, repo))
return c.Redirect(http.StatusSeeOther, fmt.Sprintf("%s/%s/%s", a.config.BasePath, namespace, repo))
}
var imageSize int64
@@ -272,7 +252,7 @@ func (a *apiClient) deleteTag(c echo.Context) error {
a.client.DeleteTag(repoPath, tag)
}
return c.Redirect(http.StatusSeeOther, fmt.Sprintf("/%s/%s", namespace, repo))
return c.Redirect(http.StatusSeeOther, fmt.Sprintf("%s/%s/%s", a.config.BasePath, namespace, repo))
}
// checkDeletePermission check if tag deletion is allowed whether by anyone or permitted users.
@@ -302,3 +282,8 @@ func (a *apiClient) receiveEvents(c echo.Context) error {
a.eventListener.ProcessEvents(c.Request())
return c.String(http.StatusOK, "OK")
}
// purgeOldTags purges old tags.
func (a *apiClient) purgeOldTags(dryRun bool) {
registry.PurgeOldTags(a.client, dryRun, a.config.PurgeTagsKeepDays, a.config.PurgeTagsKeepCount)
}

View File

@@ -69,7 +69,7 @@ func NewClient(url string, verifyTLS bool, username, password string) *Client {
c.logger.Warn("No token auth service discovered from ", c.url)
return nil
}
} else if strings.HasPrefix(authHeader, "Basic") {
} else if strings.HasPrefix(strings.ToLower(authHeader), "basic") {
c.request = c.request.SetBasicAuth(c.username, c.password)
c.logger.Info("It was discovered the registry is configured with HTTP basic auth.")
}

75
template.go Normal file
View File

@@ -0,0 +1,75 @@
package main
import (
"fmt"
"io"
"net/url"
"strings"
"github.com/CloudyKit/jet"
"github.com/labstack/echo"
"github.com/quiq/docker-registry-ui/registry"
"github.com/tidwall/gjson"
)
// Template Jet template.
type Template struct {
View *jet.Set
}
// Render render template.
func (r *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
t, err := r.View.GetTemplate(name)
if err != nil {
panic(fmt.Errorf("Fatal error template file: %s", err))
}
vars, ok := data.(jet.VarMap)
if !ok {
vars = jet.VarMap{}
}
err = t.Execute(w, vars, nil)
if err != nil {
panic(fmt.Errorf("Error rendering template %s: %s", name, err))
}
return nil
}
// setupRenderer template engine init.
func setupRenderer(debug bool, registryHost, basePath string) *Template {
view := jet.NewHTMLSet("templates")
view.SetDevelopmentMode(debug)
view.AddGlobal("basePath", basePath)
view.AddGlobal("registryHost", registryHost)
view.AddGlobal("pretty_size", func(size interface{}) string {
var value float64
switch i := size.(type) {
case gjson.Result:
value = float64(i.Int())
case int64:
value = float64(i)
}
return registry.PrettySize(value)
})
view.AddGlobal("pretty_time", func(datetime interface{}) string {
d := strings.Replace(datetime.(string), "T", " ", 1)
d = strings.Replace(d, "Z", "", 1)
return strings.Split(d, ".")[0]
})
view.AddGlobal("parse_map", func(m interface{}) string {
var res string
for _, k := range registry.SortedMapKeys(m) {
res = res + fmt.Sprintf(`<tr><td style="padding: 0 10px; width: 20%%">%s</td><td style="padding: 0 10px">%v</td></tr>`, k, m.(map[string]interface{})[k])
}
return res
})
view.AddGlobal("url_decode", func(m interface{}) string {
res, err := url.PathUnescape(m.(string))
if err != nil {
return m.(string)
}
return res
})
return &Template{View: view}
}

View File

@@ -15,7 +15,7 @@
<h2>Docker Registry UI</h2>
</div>
<div style="float: right">
<a href="/events">Event Log</a>
<a href="{{ basePath }}/events">Event Log</a>
</div>
<div style="clear: both"></div>

View File

@@ -14,7 +14,7 @@
{{block body()}}
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="{{ basePath }}/">Home</a></li>
<li class="active">Event Log</li>
</ol>

View File

@@ -8,12 +8,14 @@
"stateSave": true
});
$('#namespace').on('change', function (e) {
window.location = '/' + this.value;
window.location = '{{ basePath }}/' + this.value;
});
if (window.location.pathname == '/') {
namespace = window.location.pathname;
namespace = namespace.replace("{{ basePath }}", "");
if (namespace == '/') {
namespace = 'library';
} else {
namespace = window.location.pathname.split('/')[1]
namespace = namespace.split('/')[1]
}
$('#namespace').val(namespace);
});
@@ -23,15 +25,19 @@
{{block body()}}
<div style="float: right">
<select id="namespace" class="form-control input-sm" style="height: 36px">
<option value="" disabled>-- Namespace --</option>
{{range namespace := namespaces}}
<option value="{{ namespace }}">{{ namespace }}</option>
{{end}}
</select>
</div>
<div style="float: right">
<ol class="breadcrumb">
<li class="active">Namespace</li>
</ol>
</div>
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="{{ basePath }}/">Home</a></li>
</ol>
<table id="datatable" class="table table-striped table-bordered">
@@ -44,7 +50,7 @@
<tbody>
{{range repo := repos}}
<tr>
<td><a href="/{{ namespace }}/{{ repo }}">{{ repo }}</a></td>
<td><a href="{{ basePath }}/{{ namespace }}/{{ repo|url }}">{{ repo }}</a></td>
<td>{{ tagCounts[namespace+"/"+repo] }}</td>
</tr>
{{end}}

View File

@@ -4,11 +4,11 @@
{{block body()}}
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="{{ basePath }}/">Home</a></li>
{{if namespace != "library"}}
<li><a href="/{{ namespace }}">{{ namespace }}</a></li>
<li><a href="{{ basePath }}/{{ namespace }}">{{ namespace }}</a></li>
{{end}}
<li><a href="/{{ namespace }}/{{ repo }}">{{ repo }}</a></li>
<li><a href="{{ basePath }}/{{ namespace }}/{{ repo }}">{{ repo|url_decode }}</a></li>
<li class="active">{{ tag }}</li>
</ol>
<table class="table table-striped table-bordered">

View File

@@ -1,7 +1,7 @@
{{extends "base.html"}}
{{block head()}}
<script type="text/javascript" src="/static/bootstrap-confirmation.min.js"></script>
<script type="text/javascript" src="{{ basePath }}/static/bootstrap-confirmation.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/natural.js"></script>
<script type="text/javascript">
$(document).ready(function() {
@@ -29,11 +29,11 @@
{{block body()}}
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="{{ basePath }}/">Home</a></li>
{{if namespace != "library"}}
<li><a href="/{{ namespace }}">{{ namespace }}</a></li>
<li><a href="{{ basePath }}/{{ namespace }}">{{ namespace }}</a></li>
{{end}}
<li class="active">{{ repo }}</li>
<li class="active">{{ repo|url_decode }}</li>
</ol>
<table id="datatable" class="table table-striped table-bordered">
@@ -46,9 +46,9 @@
{{range tag := tags}}
<tr>
<td>
<a href="/{{ namespace }}/{{ repo }}/{{ tag }}">{{ tag }}</a>
<a href="{{ basePath }}/{{ namespace }}/{{ repo }}/{{ tag }}">{{ tag }}</a>
{{if deleteAllowed}}
<a href="/{{ namespace }}/{{ repo }}/{{ tag }}/delete" data-toggle="confirmation" class="btn btn-danger btn-xs pull-right" role="button">Delete</a>
<a href="{{ basePath }}/{{ namespace }}/{{ repo }}/{{ tag }}/delete" data-toggle="confirmation" class="btn btn-danger btn-xs pull-right" role="button">Delete</a>
{{end}}
</td>
</tr>