diff --git a/static/js/directives/ui/fetch-tag-dialog.js b/static/js/directives/ui/fetch-tag-dialog.js index 163418cc9..57186f4d9 100644 --- a/static/js/directives/ui/fetch-tag-dialog.js +++ b/static/js/directives/ui/fetch-tag-dialog.js @@ -17,20 +17,28 @@ angular.module('quay').directive('fetchTagDialog', function () { $scope.currentFormat = null; $scope.currentEntity = null; $scope.currentRobot = null; + $scope.formats = []; - $scope.formats = [ - { - 'title': 'Squashed Docker Image', - 'icon': 'ci-squashed', - 'command': 'curl -L -f {http}://{pull_user}:{pull_password}@{hostname}/c1/squash/{namespace}/{name}/{tag} | docker load', - 'require_creds': true - }, + UserService.updateUserIn($scope, updateFormats); - { + var updateFormats = function() { + $scope.formats = []; + + if ($scope.repository && UserService.isNamespaceAdmin($scope.repository.namespace)) { + $scope.formats.push({ + 'title': 'Squashed Docker Image', + 'icon': 'ci-squashed', + 'command': 'curl -L -f {http}://{pull_user}:{pull_password}@{hostname}/c1/squash/{namespace}/{name}/{tag} | docker load', + 'require_creds': true + }); + } + + $scope.formats.push({ 'title': 'Basic Docker Pull', 'icon': 'docker-icon', 'command': 'docker pull {hostname}/{namespace}/{name}:{tag}' - }]; + }); + }; $scope.$watch('currentEntity', function(entity) { if (!entity) { @@ -94,6 +102,8 @@ angular.module('quay').directive('fetchTagDialog', function () { $scope.clearCounter++; + updateFormats(); + $element.find('#copyClipboard').clipboardCopy(); $element.find('#fetchTagDialog').modal({}); }