mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2026-07-10 08:29:17 +00:00
Remove space in front of function brackets
This commit is contained in:
@@ -49,7 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
registryUI.appTag = this;
|
||||
route.base('#!');
|
||||
route('', function () {
|
||||
route('', function() {
|
||||
route.routeName = 'home';
|
||||
if (registryUI.catalog.display) {
|
||||
registryUI.catalog.loadend = false;
|
||||
@@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
registryUI.appTag.update();
|
||||
});
|
||||
route('/taglist/*', function (image) {
|
||||
route('/taglist/*', function(image) {
|
||||
route.routeName = 'taglist';
|
||||
registryUI.taglist.name = image;
|
||||
if (registryUI.taglist.display) {
|
||||
@@ -66,7 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
registryUI.appTag.update();
|
||||
});
|
||||
route('/taghistory/image/*/tag/*', function (image, tag) {
|
||||
route('/taghistory/image/*/tag/*', function(image, tag) {
|
||||
route.routeName = 'taghistory';
|
||||
|
||||
registryUI.taghistory.image = image;
|
||||
@@ -78,27 +78,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
registryUI.appTag.update();
|
||||
});
|
||||
registryUI.home = function () {
|
||||
registryUI.home = function() {
|
||||
if (route.routeName == 'home') {
|
||||
registryUI.catalog.display;
|
||||
} else {
|
||||
route('');
|
||||
}
|
||||
};
|
||||
registryUI.snackbar = function (message, isError) {
|
||||
registryUI.snackbar = function(message, isError) {
|
||||
registryUI.appTag.tags['material-snackbar'].addToast({'message': message, 'isError': isError}, 15000);
|
||||
};
|
||||
registryUI.errorSnackbar = function (message) {
|
||||
registryUI.errorSnackbar = function(message) {
|
||||
return registryUI.snackbar(message, true);
|
||||
}
|
||||
registryUI.cleanName = function () {
|
||||
registryUI.cleanName = function() {
|
||||
const url = (registryUI.url() && registryUI.url().length > 0 && registryUI.url()) || window.location.host;
|
||||
if (url) {
|
||||
return url.startsWith('http') ? url.replace(/https?:\/\//, '') : url;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
route.parser(null, function (path, filter) {
|
||||
route.parser(null, function(path, filter) {
|
||||
const f = filter
|
||||
.replace(/\?/g, '\\?')
|
||||
.replace(/\*/g, '([^?#]+?)')
|
||||
@@ -108,27 +108,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
if (args) return args.slice(1)
|
||||
});
|
||||
|
||||
registryUI.isDigit = function (char) {
|
||||
registryUI.isDigit = function(char) {
|
||||
return char >= '0' && char <= '9';
|
||||
}
|
||||
|
||||
registryUI.DockerImage = function (name, tag) {
|
||||
registryUI.DockerImage = function(name, tag) {
|
||||
this.name = name;
|
||||
this.tag = tag;
|
||||
riot.observable(this);
|
||||
this.on('get-size', function () {
|
||||
this.on('get-size', function() {
|
||||
if (this.size !== undefined) {
|
||||
return this.trigger('size', this.size);
|
||||
}
|
||||
return this.fillInfo();
|
||||
});
|
||||
this.on('get-sha256', function () {
|
||||
this.on('get-sha256', function() {
|
||||
if (this.size !== undefined) {
|
||||
return this.trigger('sha256', this.sha256);
|
||||
}
|
||||
return this.fillInfo();
|
||||
});
|
||||
this.on('get-date', function () {
|
||||
this.on('get-date', function() {
|
||||
if (this.date !== undefined) {
|
||||
return this.trigger('date', this.date);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
});
|
||||
};
|
||||
|
||||
registryUI.DockerImage._tagReduce = function (acc, e) {
|
||||
registryUI.DockerImage._tagReduce = function(acc, e) {
|
||||
if (acc.length > 0 && registryUI.isDigit(acc[acc.length - 1].charAt(0)) == registryUI.isDigit(e)) {
|
||||
acc[acc.length - 1] += e;
|
||||
} else {
|
||||
@@ -145,7 +145,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
return acc;
|
||||
}
|
||||
|
||||
registryUI.DockerImage.compare = function (e1, e2) {
|
||||
registryUI.DockerImage.compare = function(e1, e2) {
|
||||
const tag1 = e1.tag.match(/./g).reduce(registryUI.DockerImage._tagReduce, []);
|
||||
const tag2 = e2.tag.match(/./g).reduce(registryUI.DockerImage._tagReduce, []);
|
||||
|
||||
@@ -163,17 +163,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
return e1.tag.length - e2.tag.length;
|
||||
};
|
||||
|
||||
registryUI.DockerImage.prototype.fillInfo = function () {
|
||||
registryUI.DockerImage.prototype.fillInfo = function() {
|
||||
if (this._fillInfoWaiting) {
|
||||
return;
|
||||
}
|
||||
this._fillInfoWaiting = true;
|
||||
const oReq = new Http();
|
||||
const self = this;
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
if (this.status == 200 || this.status == 202) {
|
||||
const response = JSON.parse(this.responseText);
|
||||
self.size = response.layers.reduce(function (acc, e) {
|
||||
self.size = response.layers.reduce(function(acc, e) {
|
||||
return acc + e.size;
|
||||
}, 0);
|
||||
self.sha256 = response.config.digest;
|
||||
@@ -191,10 +191,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
registryUI.DockerImage.prototype.getBlobs = function (blob) {
|
||||
registryUI.DockerImage.prototype.getBlobs = function(blob) {
|
||||
const oReq = new Http();
|
||||
const self = this;
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
if (this.status == 200 || this.status == 202) {
|
||||
const response = JSON.parse(this.responseText);
|
||||
self.creationDate = new Date(response.created);
|
||||
|
||||
@@ -35,10 +35,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<script>
|
||||
registryUI.catalog.instance = this;
|
||||
registryUI.catalog.display = function () {
|
||||
registryUI.catalog.display = function() {
|
||||
registryUI.catalog.repositories = [];
|
||||
var oReq = new Http();
|
||||
oReq.addEventListener('load', function () {
|
||||
oReq.addEventListener('load', function() {
|
||||
registryUI.catalog.repositories = [];
|
||||
if (this.status == 200) {
|
||||
registryUI.catalog.repositories = JSON.parse(this.responseText).repositories || [];
|
||||
@@ -49,18 +49,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
registryUI.snackbar(this.responseText);
|
||||
}
|
||||
});
|
||||
oReq.addEventListener('error', function () {
|
||||
oReq.addEventListener('error', function() {
|
||||
registryUI.snackbar(this.getErrorMessage(), true);
|
||||
registryUI.catalog.repositories = [];
|
||||
});
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
registryUI.catalog.loadend = true;
|
||||
registryUI.catalog.instance.update();
|
||||
});
|
||||
oReq.open('GET', registryUI.url() + '/v2/_catalog?n=100000');
|
||||
oReq.send();
|
||||
};
|
||||
registryUI.catalog.go = function (image) {
|
||||
registryUI.catalog.go = function(image) {
|
||||
route('taglist/' + image);
|
||||
};
|
||||
registryUI.catalog.display();
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
<!--
|
||||
Copyright (C) 2016 Jones Magloire @Joxit
|
||||
Copyright (C) 2016 Jones Magloire @Joxit
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<remove-image>
|
||||
<a href="#" title="This will delete the image." onclick="registryUI.removeImage.remove('{ opts.image.name }', '{ opts.image.tag }')">
|
||||
<a href="#" title="This will delete the image."
|
||||
onclick="registryUI.removeImage.remove('{ opts.image.name }', '{ opts.image.tag }')">
|
||||
<i class="material-icons">delete</i>
|
||||
</a>
|
||||
<script type="text/javascript">
|
||||
registryUI.removeImage = registryUI.removeImage || {};
|
||||
|
||||
registryUI.removeImage.remove = function (name, tag) {
|
||||
registryUI.removeImage.remove = function(name, tag) {
|
||||
var oReq = new Http();
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
registryUI.taglist.refresh();
|
||||
if (this.status == 200) {
|
||||
if (!this.hasHeader('Docker-Content-Digest')) {
|
||||
@@ -32,7 +33,7 @@
|
||||
}
|
||||
var digest = this.getResponseHeader('Docker-Content-Digest');
|
||||
var oReq = new Http();
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
if (this.status == 200 || this.status == 202) {
|
||||
registryUI.taglist.refresh();
|
||||
registryUI.snackbar('Deleting ' + name + ':' + tag + ' image. Run `registry garbage-collect config.yml` on your registry');
|
||||
@@ -44,7 +45,7 @@
|
||||
});
|
||||
oReq.open('DELETE', registryUI.url() + '/v2/' + name + '/manifests/' + digest);
|
||||
oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json');
|
||||
oReq.addEventListener('error', function () {
|
||||
oReq.addEventListener('error', function() {
|
||||
registryUI.errorSnackbar('An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: [\'DELETE\'].');
|
||||
});
|
||||
oReq.send();
|
||||
|
||||
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</a>
|
||||
|
||||
<script type="text/javascript">
|
||||
go = function (image, tag) {
|
||||
go = function(image, tag) {
|
||||
route('/taghistory/image/' + image + '/tag/' + tag);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -48,10 +48,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
registryUI.taghistory.instance = this;
|
||||
registryUI.taghistory.display = function () {
|
||||
registryUI.taghistory.display = function() {
|
||||
let oReq = new Http();
|
||||
registryUI.taghistory.instance.update();
|
||||
oReq.addEventListener('load', function () {
|
||||
oReq.addEventListener('load', function() {
|
||||
registryUI.taghistory.elements = [];
|
||||
|
||||
function modifySpecificAttributeTypes(value) {
|
||||
@@ -113,11 +113,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
registryUI.snackbar(this.responseText);
|
||||
}
|
||||
});
|
||||
oReq.addEventListener('error', function () {
|
||||
oReq.addEventListener('error', function() {
|
||||
registryUI.snackbar(this.getErrorMessage(), true);
|
||||
registryUI.taghistory.elements = [];
|
||||
});
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
registryUI.taghistory.loadend = true;
|
||||
registryUI.taghistory.instance.update();
|
||||
});
|
||||
|
||||
@@ -69,16 +69,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</material-card>
|
||||
<script>
|
||||
registryUI.taglist.instance = this;
|
||||
registryUI.taglist.display = function () {
|
||||
registryUI.taglist.display = function() {
|
||||
registryUI.taglist.tags = [];
|
||||
if (route.routeName == 'taglist') {
|
||||
var oReq = new Http();
|
||||
registryUI.taglist.instance.update();
|
||||
oReq.addEventListener('load', function () {
|
||||
oReq.addEventListener('load', function() {
|
||||
registryUI.taglist.tags = [];
|
||||
if (this.status == 200) {
|
||||
registryUI.taglist.tags = JSON.parse(this.responseText).tags || [];
|
||||
registryUI.taglist.tags = registryUI.taglist.tags.map(function (tag) {
|
||||
registryUI.taglist.tags = registryUI.taglist.tags.map(function(tag) {
|
||||
return new registryUI.DockerImage(registryUI.taglist.name, tag);
|
||||
}).sort(registryUI.DockerImage.compare);
|
||||
} else if (this.status == 404) {
|
||||
@@ -87,11 +87,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
registryUI.snackbar(this.responseText, true);
|
||||
}
|
||||
});
|
||||
oReq.addEventListener('error', function () {
|
||||
oReq.addEventListener('error', function() {
|
||||
registryUI.snackbar(this.getErrorMessage(), true);
|
||||
registryUI.taglist.tags = [];
|
||||
});
|
||||
oReq.addEventListener('loadend', function () {
|
||||
oReq.addEventListener('loadend', function() {
|
||||
registryUI.taglist.loadend = true;
|
||||
registryUI.taglist.instance.update();
|
||||
});
|
||||
@@ -103,7 +103,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
registryUI.taglist.display();
|
||||
registryUI.taglist.instance.update();
|
||||
|
||||
registryUI.taglist.reverse = function () {
|
||||
registryUI.taglist.reverse = function() {
|
||||
if (registryUI.taglist.asc) {
|
||||
registryUI.taglist.tags.reverse();
|
||||
registryUI.taglist.asc = false;
|
||||
@@ -113,7 +113,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
registryUI.taglist.instance.update();
|
||||
};
|
||||
registryUI.taglist.refresh = function () {
|
||||
registryUI.taglist.refresh = function() {
|
||||
route(registryUI.taglist.name);
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user