Hide the squashed tag fetch when the user is not an admin on the repository
This commit is contained in:
parent
b1cf180ab0
commit
0f49beaaa8
1 changed files with 19 additions and 9 deletions
|
@ -17,20 +17,28 @@ angular.module('quay').directive('fetchTagDialog', function () {
|
||||||
$scope.currentFormat = null;
|
$scope.currentFormat = null;
|
||||||
$scope.currentEntity = null;
|
$scope.currentEntity = null;
|
||||||
$scope.currentRobot = null;
|
$scope.currentRobot = null;
|
||||||
|
$scope.formats = [];
|
||||||
|
|
||||||
$scope.formats = [
|
UserService.updateUserIn($scope, updateFormats);
|
||||||
{
|
|
||||||
'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
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
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',
|
'title': 'Basic Docker Pull',
|
||||||
'icon': 'docker-icon',
|
'icon': 'docker-icon',
|
||||||
'command': 'docker pull {hostname}/{namespace}/{name}:{tag}'
|
'command': 'docker pull {hostname}/{namespace}/{name}:{tag}'
|
||||||
}];
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$watch('currentEntity', function(entity) {
|
$scope.$watch('currentEntity', function(entity) {
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
|
@ -94,6 +102,8 @@ angular.module('quay').directive('fetchTagDialog', function () {
|
||||||
|
|
||||||
$scope.clearCounter++;
|
$scope.clearCounter++;
|
||||||
|
|
||||||
|
updateFormats();
|
||||||
|
|
||||||
$element.find('#copyClipboard').clipboardCopy();
|
$element.find('#copyClipboard').clipboardCopy();
|
||||||
$element.find('#fetchTagDialog').modal({});
|
$element.find('#fetchTagDialog').modal({});
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue