[fix-image-history] Sort elements attributes (os, id, created...)

This commit is contained in:
Joxit 2018-12-13 20:05:28 +01:00
parent 5aaedfb0aa
commit cb50dd42d8
2 changed files with 20 additions and 2 deletions

View file

@ -208,7 +208,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
return !e.empty_layer;
}).forEach(function(e, i) {
e.size = self.layers[i].size;
e.id = self.layers[i].digest;
e.id = self.layers[i].digest.replace('sha256:', '');
});
self.trigger('creation-date', self.creationDate);
self.trigger('blobs', self.blobs);

View file

@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
<material-card each="{ guiElement in registryUI.taghistory.elements }" class="tag-history-element">
<div each="{ entry in guiElement }" class="{ entry.key }">
<div each="{ entry in guiElement.sort(registryUI.taghistory.eltSort) }" class="{ entry.key }">
<div class="headline"><i class="material-icons"></i>
<p>{ entry.key.replace('_', ' ') }</p>
</div>
@ -40,6 +40,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</material-card>
<script type="text/javascript">
registryUI.taghistory.instance = this;
registryUI.taghistory.eltIdx = function(e) {
switch (e) {
case 'id': return 1;
case 'created': return 2;
case 'created_by': return 3;
case 'size': return 4;
case 'os': return 5;
case 'architecture': return 6;
case 'linux': return 7;
case 'docker_version': return 8;
case 'config': return 9;
case 'container_config': return 10;
default: return 10;
}
};
registryUI.taghistory.eltSort = function(e1, e2) {
return registryUI.taghistory.eltIdx(e1.key) - registryUI.taghistory.eltIdx(e2.key);
};
registryUI.taghistory.display = function() {
registryUI.taghistory.elements = []
let oReq = new Http();