diff --git a/static/resources/js/components/details/retrieve-projects.directive.js b/static/resources/js/components/details/retrieve-projects.directive.js index 4b36c63f3..41b57ec79 100644 --- a/static/resources/js/components/details/retrieve-projects.directive.js +++ b/static/resources/js/components/details/retrieve-projects.directive.js @@ -28,58 +28,49 @@ vm.projectName = ''; vm.isOpen = false; vm.isProjectMember = false; - vm.target = 'repositories'; + vm.target = $location.path().substr(1) || 'repositories'; vm.isPublic = Number(getParameterByName('is_public', $location.absUrl())); - vm.publicity = (vm.isPublic === 1) ? true : false; - + vm.retrieve = retrieve; vm.filterInput = ''; vm.selectItem = selectItem; vm.checkProjectMember = checkProjectMember; - - $scope.$watch('vm.selectedProject', function(current, origin) { - if(current) { - vm.selectedId = current.project_id; - } - }); - - $scope.$watch('vm.publicity', function(current, origin) { - vm.publicity = current ? true : false; - vm.isPublic = vm.publicity ? 1 : 0; - vm.projectType = (vm.isPublic === 1) ? 'public_projects' : 'my_projects'; - vm.retrieve(); - }); - + function retrieve() { ListProjectService(vm.projectName, vm.isPublic) .success(getProjectSuccess) .error(getProjectFailed); } + + vm.retrieve(); + + $scope.$watch('vm.isPublic', function(current) { + vm.projectType = vm.isPublic === 0 ? 'my_project_count' : 'public_project_count'; + }); + + $scope.$watch('vm.selectedProject', function(current) { + if(current) { + vm.selectedId = current.project_id; + } + }); + function getProjectSuccess(data, status) { vm.projects = data || []; - if(vm.projects.length == 0){ - if(vm.isPublic === 0) { - $window.location.href = '/project'; - }else{ - vm.publicity = true; - vm.projectType = 'public_projects'; - vm.target = 'repositories'; - } + if(vm.projects.length == 0 && vm.isPublic === 0){ + $window.location.href = '/project'; } - - if(angular.isArray(vm.projects) && vm.projects.length > 0) { - vm.selectedProject = vm.projects[0]; - } - + if(getParameterByName('project_id', $location.absUrl())){ - angular.forEach(vm.projects, function(value, index) { - if(value['project_id'] === Number(getParameterByName('project_id', $location.absUrl()))) { - vm.selectedProject = value; + for(var i in vm.projects) { + var project = vm.projects[i]; + if(project['project_id'] == getParameterByName('project_id', $location.absUrl())) { + vm.selectedProject = project; + break; } - }); + } } $location.search('project_id', vm.selectedProject.project_id); @@ -125,6 +116,7 @@ function getCurrentProjectMemberFailed(data, status) { vm.isProjectMember = false; console.log('Current user has no member for the project:' + status + ', location.url:' + $location.url()); + vm.target = 'repositories'; } } @@ -137,7 +129,7 @@ 'target': '=', 'isOpen': '=', 'selectedProject': '=', - 'publicity': '=', + 'isPublic': '=', 'isProjectMember': '=' }, link: link, diff --git a/static/resources/js/components/log/list-log.directive.js b/static/resources/js/components/log/list-log.directive.js index 2faac6af1..ae0f60fce 100644 --- a/static/resources/js/components/log/list-log.directive.js +++ b/static/resources/js/components/log/list-log.directive.js @@ -35,7 +35,8 @@ vm.beginTimestamp = 0; vm.endTimestamp = 0; vm.keywords = ''; - vm.username = ''; + + vm.username = $location.hash() || ''; vm.op = []; vm.opOthers = true; @@ -118,18 +119,6 @@ console.log('Total Count in logs:' + vm.totalCount + ', page:' + vm.page); -// vm.queryParams = { -// 'beginTimestamp' : 0, -// 'endTimestamp' : 0, -// 'keywords' : '', -// 'projectId': vm.projectId, -// 'username' : '' -// }; -// vm.op = ['all']; -// vm.fromDate = ''; -// vm.toDate = ''; -// vm.others = ''; -// vm.opOthers = true; vm.isOpen = false; } function listLogFailed(response){ @@ -159,9 +148,7 @@ 'restrict': 'E', 'templateUrl': '/static/resources/js/components/log/list-log.directive.html', 'scope': { - 'sectionHeight': '=', - 'target': '=', - 'publicity': '=' + 'sectionHeight': '=' }, 'link': link, 'controller': ListLogController, diff --git a/static/resources/js/components/project-member/list-project-member.directive.js b/static/resources/js/components/project-member/list-project-member.directive.js index b9ee3fccd..992b1d598 100644 --- a/static/resources/js/components/project-member/list-project-member.directive.js +++ b/static/resources/js/components/project-member/list-project-member.directive.js @@ -94,8 +94,7 @@ function getProjectMemberFailed(response) { console.log('Failed to get project members:' + response); - vm.projectMembers = []; - vm.target = 'repositories'; + vm.projectMembers = []; $location.url('repositories').search('project_id', vm.projectId); } @@ -106,8 +105,7 @@ 'restrict': 'E', 'templateUrl': '/static/resources/js/components/project-member/list-project-member.directive.html', 'scope': { - 'sectionHeight': '=', - 'target': '=' + 'sectionHeight': '=' }, 'link': link, 'controller': ListProjectMemberController, diff --git a/static/resources/js/components/repository/list-repository.directive.js b/static/resources/js/components/repository/list-repository.directive.js index 3ad1108b9..655ac6764 100644 --- a/static/resources/js/components/repository/list-repository.directive.js +++ b/static/resources/js/components/repository/list-repository.directive.js @@ -31,7 +31,7 @@ vm.filterInput = ''; vm.toggleInProgress = []; - + var hashValue = $location.hash(); if(hashValue) { var slashIndex = hashValue.indexOf('/'); @@ -54,10 +54,10 @@ if(val) { vm.projectId = getParameterByName('project_id', $location.absUrl()); vm.filterInput = ''; - vm.retrieve(); + vm.retrieve(); } }); - + $scope.$watch('vm.repositories', function(current) { if(current) { @@ -93,6 +93,7 @@ vm.deleteImage = deleteImage; function retrieve(){ + console.log('retrieve repositories, project_id:' + vm.projectId); ListRepositoryService(vm.projectId, vm.filterInput, vm.page, vm.pageSize) .then(getRepositoryComplete, getRepositoryFailed); } diff --git a/static/resources/js/components/repository/list-tag.directive.js b/static/resources/js/components/repository/list-tag.directive.js index fde155265..f47b0b917 100644 --- a/static/resources/js/components/repository/list-tag.directive.js +++ b/static/resources/js/components/repository/list-tag.directive.js @@ -30,7 +30,6 @@ $scope.$watch('vm.repoName', function(current, origin) { if(current) { - console.log('vm.repoName in tags:' + current); vm.retrieve(); } }); diff --git a/static/resources/js/components/top-repository/top-repository.directive.html b/static/resources/js/components/top-repository/top-repository.directive.html index a44c1dc93..e6567e7f6 100644 --- a/static/resources/js/components/top-repository/top-repository.directive.html +++ b/static/resources/js/components/top-repository/top-repository.directive.html @@ -29,7 +29,8 @@

// 'no_top_repositories' | tr //

- //t.name////t.count// + //t.name// + //t.count// diff --git a/static/resources/js/components/top-repository/top-repository.directive.js b/static/resources/js/components/top-repository/top-repository.directive.js index 800f7e767..bb02890b4 100644 --- a/static/resources/js/components/top-repository/top-repository.directive.js +++ b/static/resources/js/components/top-repository/top-repository.directive.js @@ -28,7 +28,7 @@ ListTopRepositoryService(5) .success(listTopRepositorySuccess) .error(listTopRepositoryFailed); - + function listTopRepositorySuccess(data) { vm.top10Repositories = data || []; } @@ -39,6 +39,7 @@ $scope.$emit('raiseError', true); console.log('Failed to get top repo:' + data); } + } function topRepository() { diff --git a/static/resources/js/components/user-log/user-log.directive.html b/static/resources/js/components/user-log/user-log.directive.html index 5500b0ffd..4fd762d5e 100644 --- a/static/resources/js/components/user-log/user-log.directive.html +++ b/static/resources/js/components/user-log/user-log.directive.html @@ -16,10 +16,11 @@
- - - - + + + + +
// 'operation' | tr //// 'details' | tr //// 'user' | tr //// 'creation_time' | tr //// 'username' | tr //// 'repository_name' | tr //// 'tag' | tr //// 'operation' | tr //// 'timestamp' | tr //
@@ -30,7 +31,11 @@

// 'no_user_logs' | tr //

- //t.operation////t.repo_name////t.username////t.op_time | dateL : 'YYYY-MM-DD HH:mm:ss'// + //t.username// + //t.repo_name// + //t.repo_tag// + //t.operation// + //t.op_time | dateL : 'YYYY-MM-DD HH:mm:ss'// diff --git a/static/resources/js/components/user-log/user-log.directive.js b/static/resources/js/components/user-log/user-log.directive.js index 8869c7854..ceb86a778 100644 --- a/static/resources/js/components/user-log/user-log.directive.js +++ b/static/resources/js/components/user-log/user-log.directive.js @@ -20,15 +20,17 @@ .module('harbor.user.log') .directive('userLog', userLog); - UserLogController.$inject = ['$scope', 'ListIntegratedLogService', '$filter', 'trFilter']; + UserLogController.$inject = ['$scope', 'ListIntegratedLogService', '$filter', 'trFilter', '$window']; - function UserLogController($scope, ListIntegratedLogService, $filter, trFilter) { + function UserLogController($scope, ListIntegratedLogService, $filter, trFilter, $window) { var vm = this; ListIntegratedLogService() .success(listIntegratedLogSuccess) .error(listIntegratedLogFailed); - + + vm.gotoLog = gotoLog; + function listIntegratedLogSuccess(data) { vm.integratedLogs = data || []; } @@ -39,6 +41,11 @@ $scope.$emit('raiseError', true); console.log('Failed to get user logs:' + data); } + + function gotoLog(projectId, username) { + $window.location.href = '/repository#/logs?project_id=' + projectId + '#' + encodeURIComponent(username); + } + } function userLog() { diff --git a/static/resources/js/layout/details/details.controller.js b/static/resources/js/layout/details/details.controller.js index d07679cbc..777f627a7 100644 --- a/static/resources/js/layout/details/details.controller.js +++ b/static/resources/js/layout/details/details.controller.js @@ -20,17 +20,17 @@ .module('harbor.details') .controller('DetailsController', DetailsController); - DetailsController.$inject = ['$scope', '$timeout']; + DetailsController.$inject = ['$scope', '$timeout', '$window']; - function DetailsController($scope, $timeout) { + function DetailsController($scope, $timeout, $window) { var vm = this; - vm.publicity = false; + vm.isPublic = 0; vm.isProjectMember = false; vm.togglePublicity = togglePublicity; - vm.sectionDefaultHeight = {'min-height': '579px'}; + vm.sectionHeight = {'min-height': '579px'}; //Message dialog handler for details. $scope.$on('modalTitle', function(e, val) { @@ -75,8 +75,9 @@ }); function togglePublicity(e) { - vm.publicity = e.publicity; - vm.target = 'repositories'; + vm.isPublic = e.isPublic; + $window.location='/project?is_public=' + vm.isPublic; + return; } } diff --git a/static/resources/js/layout/project/project.controller.js b/static/resources/js/layout/project/project.controller.js index 51f401432..674c360b1 100644 --- a/static/resources/js/layout/project/project.controller.js +++ b/static/resources/js/layout/project/project.controller.js @@ -20,18 +20,20 @@ .module('harbor.layout.project') .controller('ProjectController', ProjectController); - ProjectController.$inject = ['$scope', 'ListProjectService', 'DeleteProjectService', '$timeout', 'currentUser', 'getRole', '$filter', 'trFilter']; + ProjectController.$inject = ['$scope', 'ListProjectService', 'DeleteProjectService', '$timeout', 'currentUser', 'getRole', '$filter', 'trFilter', 'getParameterByName', '$location']; - function ProjectController($scope, ListProjectService, DeleteProjectService, $timeout, currentUser, getRole, $filter, trFilter) { + function ProjectController($scope, ListProjectService, DeleteProjectService, $timeout, currentUser, getRole, $filter, trFilter, getParameterByName, $location) { var vm = this; vm.isOpen = false; vm.projectName = ''; - vm.publicity = 0; + vm.isPublic = Number(getParameterByName('is_public', $location.absUrl())) || 0; vm.page = 1; vm.pageSize = 15; + vm.sectionHeight = {'min-height': '579px'}; + vm.retrieve = retrieve; vm.showAddProject = showAddProject; vm.searchProject = searchProject; @@ -44,6 +46,7 @@ vm.confirmToDelete = confirmToDelete; vm.deleteProject = deleteProject; + //Error message dialog handler for project. $scope.$on('modalTitle', function(e, val) { @@ -89,7 +92,7 @@ }); function retrieve() { - ListProjectService(vm.projectName, vm.publicity, vm.page, vm.pageSize) + ListProjectService(vm.projectName, vm.isPublic, vm.page, vm.pageSize) .then(listProjectSuccess) .catch(listProjectFailed); } @@ -127,15 +130,14 @@ } function showAddButton() { - return (vm.publicity === 0); + return (vm.isPublic === 0); } function togglePublicity(e) { - vm.publicity = e.publicity; + vm.isPublic = e.isPublic; vm.isOpen = false; vm.page = 1; vm.retrieve(); - console.log('vm.publicity:' + vm.publicity); } function searchProjectByKeyPress($event) { diff --git a/views/project.htm b/views/project.htm index aa002e020..f56c5b0fd 100644 --- a/views/project.htm +++ b/views/project.htm @@ -19,13 +19,13 @@
-
+ // 'my_projects' | tr // + // 'my_projects' | tr // + | + // 'public_projects' | tr // + // 'public_projects' | tr // + +
@@ -33,50 +33,48 @@
- - + +
-
- - -
-
-
- - - - - - - - - -
// 'project_name' | tr //// 'repositories' | tr //// 'role' | tr //// 'creation_time' | tr //// 'publicity' | tr //// 'operation' | tr //
-
-
- - - - - - - - - - - - - - -

// 'no_projects_add_new_project' | tr //

//p.name////p.repo_count////vm.getProjectRole(p.current_user_role_id) | tr////p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'// -    -
-
+
+ +
+
+
+ + + + + + + + + +
// 'project_name' | tr //// 'repositories' | tr //// 'role' | tr //// 'creation_time' | tr //// 'publicity' | tr //// 'operation' | tr //
+
+
+ + + + + + + + + + + + + + +

// 'no_projects_add_new_project' | tr //

//p.name////p.repo_count////vm.getProjectRole(p.current_user_role_id) | tr////p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'// +    +
- +
+
-
diff --git a/views/repository.htm b/views/repository.htm index 5c543b53c..0ee168ccc 100644 --- a/views/repository.htm +++ b/views/repository.htm @@ -16,29 +16,28 @@
-
+
+ // 'my_projects' | tr // + // 'my_projects' | tr // + | + // 'public_projects' | tr // + // 'public_projects' | tr //
- - - - + + + +
- - + +
- - - - - -
+ + + + +