Show manifest digests in place of V1 ids in the tag view when possible

This commit is contained in:
Joseph Schorr 2017-03-01 18:22:40 -05:00
parent 814bbb4a96
commit af743b156b
8 changed files with 88 additions and 11 deletions

View file

@ -1,4 +1,28 @@
.image-link {
display: inline-block;
white-space: nowrap;
width: 130px;
}
.image-link a {
font-family: Consolas, "Lucida Console", Monaco, monospace;
font-size: 12px;
text-decoration: none;
}
.image-link .id-label {
font-size: 10px;
cursor: pointer;
padding: 2px;
background-color: #eee;
border-radius: 5px;
padding-left: 4px;
padding-right: 4px;
width: 40px;
text-align: center;
color: black !important;
}
.image-link .id-label.cas {
background-color: #e8f1f6;
}

View file

@ -1,2 +1,17 @@
<a bo-href-i="/repository/{{ repository.namespace }}/{{ repository.name }}/image/{{ imageId }}"
class="image-link-element" bindonce>{{ imageId.substr(0, 12) }}</a>
<span>
<a bo-href-i="/repository/{{ repository.namespace }}/{{ repository.name }}/image/{{ imageId }}"
class="image-link-element" bindonce>
<span class="id-label" ng-if="!hasSHA256(manifestDigest)"
data-title="The Docker V1 ID for this image. This ID is not content addressable nor is it stable across pulls."
data-container="body"
bs-tooltip>V1ID</span>
<span class="id-label cas" ng-if="hasSHA256(manifestDigest)"
data-title="The content-addressable SHA256 hash of this layer."
data-container="body"
bs-tooltip>SHA256</span>
<span ng-if="!hasSHA256(manifestDigest)">{{ imageId.substr(0, 12) }}</span>
<span ng-if="hasSHA256(manifestDigest)">{{ getShortDigest(manifestDigest) }}</span>
</a>
</span>

View file

@ -101,7 +101,7 @@
</td>
<td class="hidden-xs hidden-sm"
ng-class="tablePredicateClass('image_id', options.predicate, options.reverse)"
style="width: 120px;">
style="width: 140px;">
<a ng-click="orderBy('image_id')">Image</a>
</td>
<td class="hidden-xs hidden-sm image-track" ng-repeat="it in imageTracks"
@ -200,7 +200,7 @@
</td>
<td class="hidden-sm hidden-xs" bo-text="tag.size | bytes"></td>
<td class="hidden-xs hidden-sm image-id-col">
<span class="image-link" repository="repository" image-id="tag.image_id"></span>
<span class="image-link" repository="repository" image-id="tag.image_id" manifest-digest="tag.manifest_digest"></span>
</td>
<td class="hidden-xs hidden-sm image-track"
ng-if="imageTracks.length > maxTrackCount" bindonce>

View file

@ -10,9 +10,17 @@ angular.module('quay').directive('imageLink', function () {
restrict: 'C',
scope: {
'repository': '=repository',
'imageId': '=imageId'
'imageId': '=imageId',
'manifestDigest': '=?manifestDigest'
},
controller: function($scope, $element) {
$scope.hasSHA256 = function(digest) {
return digest && digest.indexOf('sha256:') == 0;
};
$scope.getShortDigest = function(digest) {
return digest.substr('sha256:'.length).substr(0, 12);
};
}
};
return directiveDefinitionObject;