mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
Fixed retrieving projects more than one page in repo, reduce userinfo in cookie.
This commit is contained in:
parent
917e75e7bd
commit
ce9ba33ccd
@ -31,14 +31,20 @@
|
|||||||
vm.target = $location.path().substr(1) || 'repositories';
|
vm.target = $location.path().substr(1) || 'repositories';
|
||||||
|
|
||||||
vm.isPublic = Number(getParameterByName('is_public', $location.absUrl()));
|
vm.isPublic = Number(getParameterByName('is_public', $location.absUrl()));
|
||||||
|
|
||||||
|
var DEFAULT_PAGE = 1;
|
||||||
|
var DEFAULT_PAGE_SIZE = 15;
|
||||||
|
|
||||||
|
vm.page = Number(getParameterByName('page', $location.absUrl()) || DEFAULT_PAGE);
|
||||||
|
vm.pageSize = Number(getParameterByName('page_size', $location.absUrl()) || DEFAULT_PAGE_SIZE);
|
||||||
|
|
||||||
vm.retrieve = retrieve;
|
vm.retrieve = retrieve;
|
||||||
vm.filterInput = '';
|
vm.filterInput = '';
|
||||||
vm.selectItem = selectItem;
|
vm.selectItem = selectItem;
|
||||||
vm.checkProjectMember = checkProjectMember;
|
vm.checkProjectMember = checkProjectMember;
|
||||||
|
|
||||||
function retrieve() {
|
function retrieve() {
|
||||||
ListProjectService(vm.projectName, vm.isPublic)
|
ListProjectService(vm.projectName, vm.isPublic, vm.page, vm.pageSize)
|
||||||
.success(getProjectSuccess)
|
.success(getProjectSuccess)
|
||||||
.error(getProjectFailed);
|
.error(getProjectFailed);
|
||||||
}
|
}
|
||||||
@ -58,7 +64,6 @@
|
|||||||
|
|
||||||
function getProjectSuccess(data, status) {
|
function getProjectSuccess(data, status) {
|
||||||
vm.projects = data || [];
|
vm.projects = data || [];
|
||||||
|
|
||||||
if(vm.projects.length == 0 && vm.isPublic === 0){
|
if(vm.projects.length == 0 && vm.isPublic === 0){
|
||||||
$window.location.href = '/project';
|
$window.location.href = '/project';
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,6 @@
|
|||||||
|
|
||||||
var hideTarget = convertToBoolean(scope.hideTarget);
|
var hideTarget = convertToBoolean(scope.hideTarget);
|
||||||
|
|
||||||
console.log('loading-progress, toggleInProgress:' + scope.toggleInProgress + ', hideTarget:' + hideTarget);
|
|
||||||
|
|
||||||
var pristine = element.html();
|
var pristine = element.html();
|
||||||
|
|
||||||
scope.$watch('toggleInProgress', function(current) {
|
scope.$watch('toggleInProgress', function(current) {
|
||||||
|
@ -154,7 +154,7 @@
|
|||||||
|
|
||||||
function deleteRepositorySuccess(data, status) {
|
function deleteRepositorySuccess(data, status) {
|
||||||
vm.toggleInProgress[vm.repoName + '|' + vm.tag] = false;
|
vm.toggleInProgress[vm.repoName + '|' + vm.tag] = false;
|
||||||
vm.retrieve();
|
$scope.$broadcast('refreshTags', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteRepositoryFailed(data, status) {
|
function deleteRepositoryFailed(data, status) {
|
||||||
|
@ -32,7 +32,14 @@
|
|||||||
|
|
||||||
function getCurrentUserComplete(response) {
|
function getCurrentUserComplete(response) {
|
||||||
if(angular.isDefined(response)) {
|
if(angular.isDefined(response)) {
|
||||||
currentUser.set(response.data);
|
var user = response.data;
|
||||||
|
currentUser.set({
|
||||||
|
'user_id': user.user_id,
|
||||||
|
'username': user.username,
|
||||||
|
'role_name': user.role_name,
|
||||||
|
'email': user.email,
|
||||||
|
'realname': user.realname,
|
||||||
|
'comment': user.comment});
|
||||||
if(location.pathname === '/') {
|
if(location.pathname === '/') {
|
||||||
$window.location.href = '/dashboard';
|
$window.location.href = '/dashboard';
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
<td colspan="5" height="320px" class="empty-hint" ng-if="vm.projects.length === 0"><h4 class="text-muted">// 'no_projects_add_new_project' | tr //</h4></td>
|
<td colspan="5" height="320px" class="empty-hint" ng-if="vm.projects.length === 0"><h4 class="text-muted">// 'no_projects_add_new_project' | tr //</h4></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-if="vm.projects.length > 0" ng-repeat="p in vm.projects">
|
<tr ng-if="vm.projects.length > 0" ng-repeat="p in vm.projects">
|
||||||
<td width="20%"><a href="/repository#/repositories?project_id=//p.project_id//&is_public=//p.public//">//p.name//</a></td>
|
<td width="20%"><a href="/repository#/repositories?page=//vm.page//&page_size=//vm.pageSize//&project_id=//p.project_id//&is_public=//p.public//">//p.name//</a></td>
|
||||||
<td width="15%">//p.repo_count//</td>
|
<td width="15%">//p.repo_count//</td>
|
||||||
<td width="15%" ng-if="vm.isPublic === 0">//vm.getProjectRole(p.current_user_role_id) | tr//</td>
|
<td width="15%" ng-if="vm.isPublic === 0">//vm.getProjectRole(p.current_user_role_id) | tr//</td>
|
||||||
<td width="20%">//p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
<td width="20%">//p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user