mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-05-04 11:00:00 +03:00
fix(multi-arch): wrong history order when we use multi-arch tabs many times
no arch when the landing page is not tag history reorder history elements
This commit is contained in:
parent
656914f0d7
commit
c9ede6fe61
3 changed files with 38 additions and 40 deletions
|
@ -497,6 +497,7 @@ tag-history-element {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
|
min-height: 3em;
|
||||||
width: 420px;
|
width: 420px;
|
||||||
float: left;
|
float: left;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
|
|
@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this.on('mount', function() {
|
this.on('mount', function() {
|
||||||
const self = this;
|
const self = this;
|
||||||
this.refs.button.root.onclick = function() {
|
this.refs.button.root.onclick = function() {
|
||||||
registryUI.taghistory._image = self.opts.image;
|
|
||||||
registryUI.taghistory.go(self.opts.image.name, self.opts.image.tag);
|
registryUI.taghistory.go(self.opts.image.name, self.opts.image.tag);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<material-spinner />
|
<material-spinner />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<material-tabs if="{ this.archs }" useLine="true" tabs="{ this.archs }" tabchanged="{ this.tabchanged }"></material-tabs>
|
<material-tabs if="{ this.archs }" useLine="true" tabs="{ this.archs }" tabchanged="{ this.tabchanged }" />
|
||||||
|
|
||||||
<material-card each="{ guiElement in this.elements }" class="tag-history-element">
|
<material-card each="{ guiElement in this.elements }" class="tag-history-element">
|
||||||
<tag-history-element each="{ entry in guiElement }" if="{ entry.value && entry.value.length > 0}" />
|
<tag-history-element each="{ entry in guiElement }" if="{ entry.value && entry.value.length > 0}" />
|
||||||
|
@ -38,12 +38,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
const self = this;
|
const self = this;
|
||||||
const eltIdx = function (e) {
|
const eltIdx = function (e) {
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case 'id': return 1;
|
case 'created': return 1;
|
||||||
case 'created': return 2;
|
case 'created_by': return 2;
|
||||||
case 'created_by': return 3;
|
case 'size': return 3;
|
||||||
case 'size': return 4;
|
case 'os': return 4;
|
||||||
case 'os': return 5;
|
case 'architecture': return 5;
|
||||||
case 'architecture': return 6;
|
case 'id': return 6;
|
||||||
case 'linux': return 7;
|
case 'linux': return 7;
|
||||||
case 'docker_version': return 8;
|
case 'docker_version': return 8;
|
||||||
default: return 10;
|
default: return 10;
|
||||||
|
@ -78,9 +78,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConfig = function (blobs) {
|
const getConfig = function (blobs) {
|
||||||
const res = ['architecture', 'User', 'created', 'docker_version', 'os', 'Cmd', 'Entrypoint', 'Env', 'Labels', 'User', 'Volumes', 'WorkingDir', 'author', 'id', 'ExposedPorts'].reduce(function(acc, e) {
|
const res = ['architecture', 'User', 'created', 'docker_version', 'os', 'Cmd', 'Entrypoint', 'Env', 'Labels', 'User', 'Volumes', 'WorkingDir', 'author', 'id', 'ExposedPorts']
|
||||||
|
.reduce(function (acc, e) {
|
||||||
const value = blobs[e] || blobs.config[e];
|
const value = blobs[e] || blobs.config[e];
|
||||||
if (value) {
|
if (value && e === 'architecture' && blobs.variant) {
|
||||||
|
acc[e] = value + blobs.variant;
|
||||||
|
} else if (value) {
|
||||||
acc[e] = value;
|
acc[e] = value;
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
|
@ -109,9 +112,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
return guiElements.sort(eltSort);
|
return guiElements.sort(eltSort);
|
||||||
}
|
}
|
||||||
|
self.elements = new Array(blobs.history.length + 1);
|
||||||
self.elements.push(exec(getConfig(blobs)));
|
self.elements[0] = exec(getConfig(blobs));
|
||||||
blobs.history.reverse().forEach(function(elt) { self.elements.push(exec(elt)) });
|
blobs.history.forEach(function (elt, i) { self.elements[blobs.history.length - i] = exec(elt) });
|
||||||
registryUI.taghistory.loadend = true;
|
registryUI.taghistory.loadend = true;
|
||||||
self.update();
|
self.update();
|
||||||
};
|
};
|
||||||
|
@ -125,7 +128,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.update();
|
self.update();
|
||||||
}
|
};
|
||||||
|
|
||||||
self.tabchanged = function (arch, idx) {
|
self.tabchanged = function (arch, idx) {
|
||||||
self.elements = []
|
self.elements = []
|
||||||
|
@ -135,15 +138,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
self.image.variants[idx].fillInfo();
|
self.image.variants[idx].fillInfo();
|
||||||
self.image.variants[idx].on('blobs', processBlobs);
|
self.image.variants[idx].on('blobs', processBlobs);
|
||||||
}
|
};
|
||||||
|
|
||||||
registryUI.taghistory.display = function () {
|
registryUI.taghistory.display = function () {
|
||||||
self.elements = []
|
self.elements = []
|
||||||
const blobs = registryUI.taghistory._image && registryUI.taghistory._image.blobs;
|
|
||||||
if (blobs) {
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
return processBlobs(blobs);
|
|
||||||
}
|
|
||||||
self.image = new registryUI.DockerImage(registryUI.taghistory.image, registryUI.taghistory.tag, true);
|
self.image = new registryUI.DockerImage(registryUI.taghistory.image, registryUI.taghistory.tag, true);
|
||||||
self.image.fillInfo()
|
self.image.fillInfo()
|
||||||
self.image.on('blobs', processBlobs);
|
self.image.on('blobs', processBlobs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue