diff --git a/static/directives/image-link.html b/static/directives/image-link.html index 71af47bca..88d66add0 100644 --- a/static/directives/image-link.html +++ b/static/directives/image-link.html @@ -1,17 +1,37 @@ - - V1ID + V1ID - SHA256 + SHA256 - {{ imageId.substr(0, 12) }} - {{ getShortDigest(manifestDigest) }} - + + {{ imageId.substr(0, 12) }} + {{ getShortDigest(manifestDigest) }} + + + diff --git a/static/js/directives/ui/image-link.js b/static/js/directives/ui/image-link.js index 7a3bcf2c4..9f8d9fb53 100644 --- a/static/js/directives/ui/image-link.js +++ b/static/js/directives/ui/image-link.js @@ -13,7 +13,9 @@ angular.module('quay').directive('imageLink', function () { 'imageId': '=imageId', 'manifestDigest': '=?manifestDigest' }, - controller: function($scope, $element) { + controller: function($scope, $element, $timeout) { + $scope.showingCopyBox = false; + $scope.hasSHA256 = function(digest) { return digest && digest.indexOf('sha256:') == 0; }; @@ -21,6 +23,24 @@ angular.module('quay').directive('imageLink', function () { $scope.getShortDigest = function(digest) { return digest.substr('sha256:'.length).substr(0, 12); }; + + $scope.showCopyBox = function() { + $scope.showingCopyBox = true; + + // Necessary to wait for digest cycle to complete. + $timeout(function() { + $element.find('.modal').modal('show'); + }, 10); + }; + + $scope.hideCopyBox = function() { + $element.find('.modal').modal('hide'); + + // Wait for the modal to hide before removing from the DOM. + $timeout(function() { + $scope.showingCopyBox = false; + }, 10); + }; } }; return directiveDefinitionObject;