Hide the squashed tag fetch when the user is not an admin on the repository

This commit is contained in:
Joseph Schorr 2015-04-08 15:49:32 -04:00
parent b1cf180ab0
commit 0f49beaaa8

View file

@ -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({});
}