diff --git a/gulpfile.js b/gulpfile.js
index f3b9ce1..35a579b 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -49,7 +49,7 @@ gulp.task('riot-tag', ['html'], function() {
});
gulp.task('riot-static-tag', ['html'], function() {
- return gulp.src(['src/tags/catalog.tag', 'src/tags/app.tag', 'src/tags/taglist.tag'])
+ return gulp.src(['src/tags/catalog.tag', 'src/tags/app.tag', 'src/tags/taglist.tag', 'src/tags/remove-image.tag'])
.pipe(concat('tags-static.js'))
.pipe(riot())
.pipe(minifier({}, uglify))
diff --git a/src/index.html b/src/index.html
index 1d2d724..4c3808b 100644
--- a/src/index.html
+++ b/src/index.html
@@ -68,6 +68,7 @@
+
diff --git a/src/scripts/script.js b/src/scripts/script.js
index 2e6c873..7bef7a1 100644
--- a/src/scripts/script.js
+++ b/src/scripts/script.js
@@ -60,6 +60,7 @@ registryUI.removeServer = function(url) {
registryServer.splice(index, 1);
localStorage.setItem('registryServer', JSON.stringify(registryServer));
}
+registryUI.isImageRemoveActivated = true;
registryUI.catalog = {};
registryUI.taglist = {};
diff --git a/src/scripts/static.js b/src/scripts/static.js
index cb9c0af..62ac604 100644
--- a/src/scripts/static.js
+++ b/src/scripts/static.js
@@ -17,7 +17,8 @@
var registryUI = {}
registryUI.url = function() {
return '${URL}';
-}
+};
+registryUI.isImageRemoveActivated = true;
registryUI.catalog = {};
registryUI.taglist = {};
diff --git a/src/tags/remove-image.tag b/src/tags/remove-image.tag
new file mode 100644
index 0000000..c326277
--- /dev/null
+++ b/src/tags/remove-image.tag
@@ -0,0 +1,63 @@
+
+
+
+ delete
+
+
+
diff --git a/src/tags/taglist.tag b/src/tags/taglist.tag
index 5473a96..0a3513a 100644
--- a/src/tags/taglist.tag
+++ b/src/tags/taglist.tag
@@ -30,16 +30,15 @@
| Repository |
+ |
| { registryUI.taglist.name } |
{ item } |
-
-
- delete
-
+ |
+
|
@@ -117,42 +116,6 @@
};
registryUI.taglist.refresh = function () {
rg.router.go(rg.router.current.name, rg.router.current.params);
- }
- registryUI.taglist.remove = function (name, tag) {
- var oReq = new Http();
- oReq.addEventListener('load', function () {
- registryUI.taglist.refresh();
- if (this.status == 200) {
- if (!this.getAllResponseHeaders().includes('Docker-Content-Digest')) {
- registryUI.taglist.createSnackbar('You need tu add Access-Control-Expose-Headers: [\'Docker-Content-Digest\'] in your server configuration.');
- return;
- }
- var digest = this.getResponseHeader('Docker-Content-Digest');
- var oReq = new Http();
- oReq.addEventListener('load', function () {
- if (this.status == 200 || this.status == 202) {
- registryUI.taglist.createSnackbar('Deleting ' + name + ':' + tag + ' image. Run `registry garbage-collect config.yml` on your registry');
- } else if (this.status == 404) {
- registryUI.taglist.createSnackbar('Digest not found');
- } else {
- registryUI.taglist.createSnackbar(this.responseText);
- }
- });
- oReq.open('DELETE', registryUI.url() + '/v2/' + name + '/manifests/' + digest);
- oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json');
- oReq.addEventListener('error', function () {
- registryUI.taglist.createSnackbar('An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: [\'DELETE\'].');
- });
- oReq.send();
- } else if (this.status == 404) {
- registryUI.taglist.createSnackbar('Manifest for' + name + ':' + tag + 'not found');
- } else {
- registryUI.taglist.createSnackbar(this.responseText);
- }
- });
- oReq.open('HEAD', registryUI.url() + '/v2/' + name + '/manifests/' + tag);
- oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json');
- oReq.send();
};