mirror of
https://github.com/Quiq/docker-registry-ui.git
synced 2025-07-19 00:27:07 +00:00
Show the root namespace "library" in the dropdown even when there are no repos in it
This commit is contained in:
parent
7a752d3f8d
commit
7a3bc551b3
@ -1,8 +1,11 @@
|
||||
## Changelog
|
||||
|
||||
### Unreleased
|
||||
### 0.7.3 (2018-08-14)
|
||||
|
||||
* Add `registry_password_file` option to the config file.
|
||||
* Improve no data message on empty tables on UI.
|
||||
* Show the root namespace "library" in the dropdown even when there are no repos in it.
|
||||
* Switch alpine Docker image to 3.8.
|
||||
|
||||
### 0.7.2 (2018-07-30)
|
||||
|
||||
|
@ -148,6 +148,9 @@ func (c *Client) Namespaces() []string {
|
||||
for k := range c.repos {
|
||||
namespaces = append(namespaces, k)
|
||||
}
|
||||
if !ItemInSlice("library", namespaces) {
|
||||
namespaces = append(namespaces, "library")
|
||||
}
|
||||
sort.Strings(namespaces)
|
||||
return namespaces
|
||||
}
|
||||
|
@ -42,3 +42,13 @@ func PrettySize(size float64) string {
|
||||
}
|
||||
return fmt.Sprintf("%.*f %s", 0, size, units[i])
|
||||
}
|
||||
|
||||
// ItemInSlice check if item is an element of slice
|
||||
func ItemInSlice(item string, slice []string) bool {
|
||||
for _, i := range slice {
|
||||
if i == item {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -45,3 +45,13 @@ func TestPrettySize(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestItemInSlice(t *testing.T) {
|
||||
a := []string{"abc", "def", "ghi"}
|
||||
convey.Convey("Check whether element is in slice", t, func() {
|
||||
convey.So(ItemInSlice("abc", a), convey.ShouldBeTrue)
|
||||
convey.So(ItemInSlice("ghi", a), convey.ShouldBeTrue)
|
||||
convey.So(ItemInSlice("abc1", a), convey.ShouldBeFalse)
|
||||
convey.So(ItemInSlice("gh", a), convey.ShouldBeFalse)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user