Add ability to change the visibility of a repo, and show whether the repo is private in the repo-view screen
This commit is contained in:
parent
ce7620673b
commit
4382ebfd20
6 changed files with 214 additions and 11 deletions
|
@ -86,6 +86,33 @@ p.editable:hover i {
|
|||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.repo .header .icon-container {
|
||||
position: relative;
|
||||
background: #eee;
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
text-align: center;
|
||||
line-height: 38px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.repo .header .icon-container .icon-lock {
|
||||
font-size: 50%;
|
||||
position: absolute;
|
||||
bottom: -6px;
|
||||
right: 0px;
|
||||
background: rgb(253, 191, 191);
|
||||
width: 20px;
|
||||
display: inline-block;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
height: 20px;
|
||||
line-height: 21px;
|
||||
}
|
||||
|
||||
.repo .description {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
@ -272,6 +299,56 @@ p.editable:hover i {
|
|||
width: 54px;
|
||||
}
|
||||
|
||||
.repo-admin .repo-access-state .state-icon {
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.repo-admin .repo-access-state .state-icon i {
|
||||
font-size: 46px;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.repo-admin .repo-access-state {
|
||||
text-align: center;
|
||||
width: 520px;
|
||||
}
|
||||
|
||||
.repo-admin .repo-access-state .state-icon i.icon-lock {
|
||||
background: rgb(253, 191, 191);
|
||||
}
|
||||
|
||||
.repo-admin .repo-access-state .state-icon i.icon-unlock-alt {
|
||||
background: rgb(170, 236, 170);
|
||||
}
|
||||
|
||||
.repo-admin .change-access {
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #eee;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.repo-admin .change-access .alert {
|
||||
color: black;
|
||||
background: white;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.repo-admin .change-access .alert .alert-content {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.repo-admin .change-access:hover .alert {
|
||||
background: inherit;
|
||||
border: inherit;
|
||||
}
|
||||
|
||||
|
||||
/* Overrides for typeahead to work with bootstrap 3. */
|
||||
|
||||
.twitter-typeahead .tt-query,
|
||||
|
|
|
@ -212,17 +212,36 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.askChangeAccess = function(newAccess) {
|
||||
$('#make' + newAccess + 'Modal').modal({});
|
||||
};
|
||||
|
||||
$scope.changeAccess = function(newAccess) {
|
||||
$('#make' + newAccess + 'Modal').modal('hide');
|
||||
|
||||
var visibility = {
|
||||
'visibility': newAccess
|
||||
};
|
||||
var visibilityPost = Restangular.one('repository/' + namespace + '/' + name + '/changevisibility');
|
||||
visibilityPost.customPOST(visibility).then(function() {
|
||||
$scope.repo.is_public = newAccess == 'public';
|
||||
}, function() {
|
||||
$('#cannotchangeModal').modal({});
|
||||
});
|
||||
};
|
||||
|
||||
// Fetch the repository information.
|
||||
var repositoryFetch = Restangular.one('repository/' + namespace + '/' + name);
|
||||
repositoryFetch.get().then(function(repo) {
|
||||
$scope.repo = repo;
|
||||
});
|
||||
|
||||
// Fetch the permissions.
|
||||
var permissionsFetch = Restangular.one('repository/' + namespace + '/' + name + '/permissions');
|
||||
permissionsFetch.get().then(function(resp) {
|
||||
$rootScope.title = 'Settings - ' + namespace + '/' + name;
|
||||
$scope.repo = {
|
||||
'namespace': namespace,
|
||||
'name': name
|
||||
};
|
||||
|
||||
$scope.permissions = resp.permissions;
|
||||
}, function() {
|
||||
$scope.repo = null;
|
||||
$scope.permissions = null;
|
||||
$rootScope.title = 'Unknown Repository';
|
||||
});
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
<i class="icon-hdd icon-large"></i> <span style="color: #aaa;"> {{repo.namespace}}</span> <span style="color: #ccc">/</span> {{repo.name}}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- User Access Permissions -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Access Permissions</div>
|
||||
<div class="panel-heading">User Access Permissions</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<table class="permissions">
|
||||
|
@ -51,6 +52,33 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- Public/Private -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Repository Settings</div>
|
||||
<div class="panel-body">
|
||||
<div class="repo-access-state" ng-show="!repo.is_public">
|
||||
<div class="state-icon"><i class="icon-lock"></i></div>
|
||||
|
||||
This repository is currently <b>private</b>. Only users on the above access list may interact with it.
|
||||
|
||||
<div class="change-access">
|
||||
<button class="btn btn-danger" ng-click="askChangeAccess('public')">Make Public</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="repo-access-state" ng-show="repo.is_public">
|
||||
<div class="state-icon"><i class="icon-unlock-alt"></i></div>
|
||||
|
||||
This repository is currently <b>public</b> and visible to all users.
|
||||
|
||||
<div class="change-access">
|
||||
<button class="btn btn-success" ng-click="askChangeAccess('private')">Make Private</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal message dialog -->
|
||||
<div class="modal fade" id="cannotchangeModal">
|
||||
|
@ -71,6 +99,52 @@
|
|||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<!-- Modal message dialog -->
|
||||
<div class="modal fade" id="makepublicModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Make Repository Public</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-warning">
|
||||
Warning: This will allow <b>anyone</b> to pull from this repository
|
||||
</div>
|
||||
Are you sure you want to make this repository public?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" ng-click="changeAccess('public')">Make Public</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<!-- Modal message dialog -->
|
||||
<div class="modal fade" id="makeprivateModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Make Repository Private</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-warning">
|
||||
Warning: Only users on the permissions list will be able to access this repository.
|
||||
</div>
|
||||
Are you sure you want to make this repository private?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success" ng-click="changeAccess('private')">Make Private</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<!-- Modal message dialog -->
|
||||
<div class="modal fade" id="onlyadminModal">
|
||||
<div class="modal-dialog">
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
<!-- Repo Header -->
|
||||
<div class="header">
|
||||
<h3>
|
||||
<i class="icon-hdd icon-large"></i> <span style="color: #aaa;"> {{repo.namespace}}</span> <span style="color: #ccc">/</span> {{repo.name}}
|
||||
<span class="icon-container">
|
||||
<i class="icon-lock icon-large" ng-show="!repo.is_public" title="Private Repository"></i>
|
||||
<i class="icon-hdd icon-large"></i>
|
||||
</span>
|
||||
|
||||
<span style="color: #aaa;"> {{repo.namespace}}</span> <span style="color: #ccc">/</span> {{repo.name}}
|
||||
|
||||
<span class="settings-cog" ng-show="repo.can_admin" title="Repository Settings">
|
||||
<a href="{{ '#/repository/' + repo.namespace + '/' + repo.name + '/admin' }}">
|
||||
|
|
Reference in a new issue