Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 582bdb5

Browse files
author
Alex Collins
committed
Merge pull request #95 from atc-/0.9.5
Version 0.9.5
2 parents fbb010d + 7353951 commit 582bdb5

File tree

9 files changed

+732
-245
lines changed

9 files changed

+732
-245
lines changed

LICENSE

Lines changed: 674 additions & 201 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ You could also use the data-container pattern using `--volumes-from`:
5959
docker run -p 8080:8080 --volumes-from=registry_web_data atcol/docker-registry-ui
6060

6161
Now all data will be kept in the `registry_web_data` container.
62+
63+
# License
64+
65+
As of release 0.9.5, this project is licenced under GPL v3.0. See the LICENSE file.

grails-app/conf/DataSource.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ environments {
1818
development {
1919
dataSource {
2020
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
21-
url = "jdbc:h2:file:/var/lib/h2/devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
21+
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
2222
}
2323
}
2424
test {

grails-app/domain/docker/registry/web/Registry.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Registry {
6666
", port=" + port +
6767
", apiVersion='" + apiVersion + '\'' +
6868
", username='" + username + '\'' +
69-
", password='" + password + '\'' +
69+
", password='" + password?.replaceAll("(?s).", "*") + '\'' +
7070
", repositoryService=" + repositoryService +
7171
", version=" + version +
7272
'}';

grails-app/services/docker/registry/web/RepositoryService.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ class RepositoryService {
123123
def http = new HTTPBuilder(url)
124124
def result = true
125125
try {
126+
127+
http.getClient().getParams().setParameter("http.connection.timeout", new Integer(10000))
128+
http.getClient().getParams().setParameter("http.socket.timeout", new Integer(10000))
129+
126130
http.request(Method.GET, groovyx.net.http.ContentType.JSON) {
127131
response.success = { resp, json ->
128132
log.info("Ping of $registry succeeded")
@@ -136,6 +140,8 @@ class RepositoryService {
136140
} catch (final ConnectException|IOException e) {
137141
log.info("Ping failed: $e")
138142
result = false
143+
} finally {
144+
http.shutdown()
139145
}
140146
result
141147
}

grails-app/views/registry/index.gsp

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,30 @@
1818
<div class="message" role="status">${flash.message}</div>
1919
</g:if>
2020
<table class="table table-striped table-hover">
21-
<thead>
22-
<tr>
23-
<th>${message(code: 'registry.apiVersion.label', default: 'Api Version')}</th>
24-
<th>${message(code: 'registry.protocol.label', default: 'Protocol')}</th>
25-
<th>${message(code: 'registry.host.label', default: 'Hostname')}</th>
26-
<th>${message(code: 'registry.port.label', default: 'Port')}</th>
27-
<th>${message(code: 'registry.username.label', default: 'Username')}</th>
28-
<th>${message(code: 'registry.password.label', default: 'Password')}</th>
29-
</tr>
30-
</thead>
31-
<tbody>
32-
<g:each in="${registryInstanceList}" status="i" var="registryInstance">
33-
<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
34-
35-
<td><g:link action="show" id="${registryInstance.id}">${fieldValue(bean: registryInstance, field: "apiVersion")}</g:link></td>
36-
37-
<td>${fieldValue(bean: registryInstance, field: "protocol")}</td>
38-
39-
<td>${fieldValue(bean: registryInstance, field: "host")}</td>
40-
41-
<td>${fieldValue(bean: registryInstance, field: "port")}</td>
42-
43-
<td>${fieldValue(bean: registryInstance, field: "username")}</td>
44-
45-
<td>${fieldValue(bean: registryInstance, field: "password")?.replaceAll(".", "*")}</td>
46-
</tr>
47-
</g:each>
48-
</tbody>
49-
</table>
50-
<div class="pagination">
51-
<g:paginate total="${registryInstanceCount ?: 0}" />
52-
</div>
53-
</div>
54-
</body>
21+
<thead>
22+
<tr>
23+
<th>${message(code: 'registry.host.label', default: 'Hostname')}</th>
24+
<th>${message(code: 'registry.port.label', default: 'Port')}</th>
25+
<th>${message(code: 'registry.username.label', default: 'Username')}</th>
26+
<th>${message(code: 'registry.password.label', default: 'Password')}</th>
27+
<th>${message(code: 'registry.apiVersion.label', default: 'Api Version')}</th>
28+
</tr>
29+
</thead>
30+
<tbody>
31+
<g:each in="${registryInstanceList}" status="i" var="registryInstance">
32+
<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
33+
<td><g:link action="show" id="${registryInstance.id}">${fieldValue(bean: registryInstance, field: "host")}</g:link></td>
34+
<td>${fieldValue(bean: registryInstance, field: "port")}</td>
35+
<td>${fieldValue(bean: registryInstance, field: "username")}</td>
36+
<td>${fieldValue(bean: registryInstance, field: "password")?.replaceAll(".", "*")}</td>
37+
<td>${fieldValue(bean: registryInstance, field: "apiVersion")}</td>
38+
</tr>
39+
</g:each>
40+
</tbody>
41+
</table>
42+
<div class="pagination">
43+
<g:paginate total="${registryInstanceCount ?: 0}" />
44+
</div>
45+
</div>
46+
</body>
5547
</html>

grails-app/views/repository/image-prompts.js.gsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
val = $(val);
1616
val.click(function () {
1717
var dialog = $('#dialog-confirm-pull');
18-
var pre = $('#dialog-confirm-pull > pre');
18+
var pre = $('#dialog-confirm-pull').find('> pre');
1919
var pullName = val.attr("data-pullName");
2020
pre.text("docker pull " + pullName);
2121
$("#dialog-confirm-pull").dialog({
@@ -48,6 +48,7 @@
4848
type: "DELETE"
4949
}).done(function () {
5050
showSuccess('<g:message code="image.delete.success" />');
51+
location.reload(true)
5152
}).fail(function () {
5253
showFail('<g:message code="image.delete.failure" />');
5354
});

grails-app/views/repository/index.gsp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,5 @@
5555
</g:each>
5656
<jqDT:resources/>
5757
<g:include view="repository/image-prompts.js.gsp"/>
58-
<g:javascript>
59-
$(document).ready(function() {
60-
$('.accordion').accordion({
61-
collapsible: true
62-
});
63-
});
64-
</g:javascript>
6558
</body>
6659
</html>

test/unit/docker/registry/web/RegistrySpec.groovy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,22 @@ class RegistrySpec extends Specification {
149149
"username".equals(registry.username)
150150
registry.password == null
151151
}
152+
153+
void "test toString doesn't NPE on null password :)"() {
154+
when:
155+
def registry = Registry.fromUrl("http://admin@172.17.42.1:5000/v1/")
156+
registry.password = null
157+
then:
158+
"Registry{id=null, protocol='http', host='172.17.42.1', port=5000, apiVersion='v1', username='admin', password='null', repositoryService=null, version=null}"
159+
.equals(registry.toString())
160+
}
161+
162+
void "test toString doesn't contain password :)"() {
163+
when:
164+
def registryStr = Registry.fromUrl("http://admin:abc123@172.17.42.1:5000/v1/").toString()
165+
then:
166+
registryStr != null
167+
!registryStr.contains("abc123")
168+
registryStr.contains("******") // * replaces abc123
169+
}
152170
}

0 commit comments

Comments
 (0)