Get the remainder of the repo settings panel working
This commit is contained in:
parent
32956b6713
commit
31480de8c1
12 changed files with 480 additions and 30 deletions
|
@ -11,7 +11,72 @@ angular.module('quay').directive('repoPanelSettings', function () {
|
|||
scope: {
|
||||
'repository': '=repository'
|
||||
},
|
||||
controller: function($scope, $element, ApiService) {
|
||||
controller: function($scope, $element, ApiService, Config) {
|
||||
$scope.getBadgeFormat = function(format, repository) {
|
||||
if (!repository) { return ''; }
|
||||
|
||||
var imageUrl = Config.getUrl('/repository/' + repository.namespace + '/' + repository.name + '/status');
|
||||
if (!$scope.repository.is_public) {
|
||||
imageUrl += '?token=' + repository.status_token;
|
||||
}
|
||||
|
||||
var linkUrl = Config.getUrl('/repository/' + repository.namespace + '/' + repository.name);
|
||||
|
||||
switch (format) {
|
||||
case 'svg':
|
||||
return imageUrl;
|
||||
|
||||
case 'md':
|
||||
return '[](' + linkUrl + ')';
|
||||
|
||||
case 'asciidoc':
|
||||
return 'image:' + imageUrl + '["Docker Repository on ' + Config.REGISTRY_TITLE_SHORT + '", link="' + linkUrl + '"]';
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
$scope.askDelete = function() {
|
||||
bootbox.confirm('Are you sure you want delete this repository?', function(r) {
|
||||
if (!r) { return; }
|
||||
$scope.deleteRepo();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteRepo = function() {
|
||||
var params = {
|
||||
'repository': $scope.repository.namespace + '/' + $scope.repository.name
|
||||
};
|
||||
|
||||
ApiService.deleteRepository(null, params).then(function() {
|
||||
setTimeout(function() {
|
||||
document.location = '/repository/';
|
||||
}, 100);
|
||||
}, ApiService.errorDisplay('Could not delete repository'));
|
||||
};
|
||||
|
||||
|
||||
$scope.askChangeAccess = function(newAccess) {
|
||||
bootbox.confirm('Are you sure you want to make this repository ' + newAccess + '?', function(r) {
|
||||
if (!r) { return; }
|
||||
$scope.changeAccess(newAccess);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.changeAccess = function(newAccess) {
|
||||
var visibility = {
|
||||
'visibility': newAccess
|
||||
};
|
||||
|
||||
var params = {
|
||||
'repository': $scope.repository.namespace + '/' + $scope.repository.name
|
||||
};
|
||||
|
||||
ApiService.changeRepoVisibility(visibility, params).then(function() {
|
||||
$scope.repository.is_public = newAccess == 'public';
|
||||
}, ApiService.errorDisplay('Could not change repository visibility'));
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
|
|
Reference in a new issue