fix(delete): alt+click every time with better messages when no digest

fixes #120
This commit is contained in:
Joxit 2020-01-28 22:14:34 +01:00
parent 2e915a82b1
commit 241ee0fd13
No known key found for this signature in database
GPG key ID: F526592B8E012263
8 changed files with 23 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/style.css vendored

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "docker-registry-ui", "name": "docker-registry-ui",
"version": "1.4.5", "version": "1.4.6",
"scripts": { "scripts": {
"build": "./node_modules/gulp/bin/gulp.js build" "build": "./node_modules/gulp/bin/gulp.js build"
}, },

View file

@ -282,6 +282,11 @@ material-button .content i.material-icons,
color: #777; color: #777;
} }
material-button[disabled] .content i.material-icons,
material-checkbox[disabled] .content i.material-icons {
color: #bbb;
}
material-snackbar .toast { material-snackbar .toast {
height: auto; height: auto;
} }

View file

@ -202,6 +202,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
oReq.getContentDigest(function (digest) { oReq.getContentDigest(function (digest) {
self.digest = digest; self.digest = digest;
self.trigger('content-digest', digest); self.trigger('content-digest', digest);
if (!digest) {
registryUI.showErrorCanNotReadContentDigest();
}
}); });
self.getBlobs(response.config.digest) self.getBlobs(response.config.digest)
} else if (this.status == 404) { } else if (this.status == 404) {

View file

@ -15,10 +15,10 @@ 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/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<remove-image> <remove-image>
<material-button waves-center="true" rounded="true" waves-color="#ddd" title="This will delete the image." if="{ !opts.multiDelete }"> <material-button waves-center="true" rounded="true" waves-color="#ddd" title="This will delete the image." if="{ !opts.multiDelete }" disabled="{ !this.digest }">
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</material-button> </material-button>
<material-checkbox if="{ opts.multiDelete }" title="Select this tag to delete it."></material-checkbox> <material-checkbox if="{ opts.multiDelete }" title="Select this tag to delete it." disabled="{ !this.digest }"></material-checkbox>
<script type="text/javascript"> <script type="text/javascript">
const self = this; const self = this;
@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const tag = self.opts.image.tag; const tag = self.opts.image.tag;
registryUI.taglist.go(name); registryUI.taglist.go(name);
if (!self.digest) { if (!self.digest) {
registryUI.showErrorCanNotReadContentDigest(); registryUI.snackbar('Information for ' + name + ':' + tag + ' are not yet loaded.');
return; return;
} }
const oReq = new Http(); const oReq = new Http();
@ -74,6 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
opts.image.one('content-digest', function(digest) { opts.image.one('content-digest', function(digest) {
self.digest = digest; self.digest = digest;
self.update();
}); });
opts.image.trigger('get-content-digest'); opts.image.trigger('get-content-digest');
</script> </script>

View file

@ -153,8 +153,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
return images; return images;
}; };
registryUI.taglist.bulkDelete = function() { registryUI.taglist.bulkDelete = function(e) {
if (self.multiDelete && self.toDelete > 0) { if (self.multiDelete && self.toDelete > 0) {
if (e.altKey) {
self._getRemoveImageTags()
.filter(function(img) { return img.tags['material-checkbox'].checked; })
.forEach(function(img) { img.tags['material-checkbox'].toggle() });
}
self._getRemoveImageTags().filter(function(img) { self._getRemoveImageTags().filter(function(img) {
return img.tags['material-checkbox'].checked; return img.tags['material-checkbox'].checked;
}).forEach(function(img) { }).forEach(function(img) {
@ -170,6 +175,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
checkbox._toggle = checkbox.toggle; checkbox._toggle = checkbox.toggle;
checkbox.toggle = function(e) { checkbox.toggle = function(e) {
if (e.altKey) { if (e.altKey) {
if (!this.checked) { this._toggle(); }
self._getRemoveImageTags() self._getRemoveImageTags()
.filter(function(img) { return !img.tags['material-checkbox'].checked; }) .filter(function(img) { return !img.tags['material-checkbox'].checked; })
.forEach(function(img) { img.tags['material-checkbox'].toggle() }); .forEach(function(img) { img.tags['material-checkbox'].toggle() });