diff --git a/static/ng/resources/js/components/details/details.config.js b/static/ng/resources/js/components/details/details.config.js index d34e94905..0acff68ac 100644 --- a/static/ng/resources/js/components/details/details.config.js +++ b/static/ng/resources/js/components/details/details.config.js @@ -26,7 +26,7 @@ }) .otherwise({ redirectTo: '/' - }); + }); } function nameFilter() { diff --git a/static/ng/resources/js/components/details/details.controller.js b/static/ng/resources/js/components/details/details.controller.js index 92d02e277..3279c74e9 100644 --- a/static/ng/resources/js/components/details/details.controller.js +++ b/static/ng/resources/js/components/details/details.controller.js @@ -13,6 +13,10 @@ vm.isOpen = false; vm.closeRetrievePane = closeRetrievePane; + $scope.$on('selectedProjectId', function(e, val) { + $scope.$broadcast('currentProjectId',val); + }); + ListProjectService({'isPublic' : 0, 'projectName' : ''}) .then(getProjectComplete) .catch(getProjectFailed); diff --git a/static/ng/resources/js/components/details/retrieve-projects.directive.js b/static/ng/resources/js/components/details/retrieve-projects.directive.js index ea66cb295..c6eeac667 100644 --- a/static/ng/resources/js/components/details/retrieve-projects.directive.js +++ b/static/ng/resources/js/components/details/retrieve-projects.directive.js @@ -6,9 +6,9 @@ .module('harbor.details') .directive('retrieveProjects', retrieveProjects); - RetrieveProjectsController.$inject = ['$scope', 'nameFilter', '$routeParams']; + RetrieveProjectsController.$inject = ['$scope', 'nameFilter']; - function RetrieveProjectsController($scope, nameFilter, $routeParams) { + function RetrieveProjectsController($scope, nameFilter) { var vm = this; vm.selectItem = selectItem; @@ -16,18 +16,18 @@ $scope.$watch('vm.selectedProject', function(current, origin) { if(current) { - var projectId = current.ProjectId || $routeParams.project_id; - vm.selectedId = projectId; + var projectId = current.ProjectId; + vm.selectedId = projectId; } }); - function selectItem(item) { - vm.selectedId = item.ProjectId; - vm.selectedProject = item; - vm.isOpen = false; + vm.selectedId = item.ProjectId; + vm.selectedProject = item; + vm.isOpen = false; + $scope.$emit('selectedProjectId', vm.selectedId); } - + } function retrieveProjects() { diff --git a/static/ng/resources/js/components/details/switch-pane-projects.directive.js b/static/ng/resources/js/components/details/switch-pane-projects.directive.js index 7b852a975..0f9f7cd21 100644 --- a/static/ng/resources/js/components/details/switch-pane-projects.directive.js +++ b/static/ng/resources/js/components/details/switch-pane-projects.directive.js @@ -6,21 +6,21 @@ .module('harbor.details') .directive('switchPaneProjects', switchPaneProjects); - SwitchPaneProjectsController.$inject = ['$scope', '$routeParams']; + SwitchPaneProjectsController.$inject = ['$scope']; - function SwitchPaneProjectsController($scope, $routeParams) { + function SwitchPaneProjectsController($scope) { var vm = this; $scope.$on('isOpen', function(e, val){ vm.isOpen = val; }); - + $scope.$watch('vm.selectedProject', function(current, origin) { if(current){ - vm.projectName = current.Name; + vm.projectName = current.Name; } }); - + vm.switchPane = switchPane; function switchPane() { diff --git a/static/ng/resources/js/components/log/advanced-search.directive.html b/static/ng/resources/js/components/log/advanced-search.directive.html index aaf3c4580..57370f862 100644 --- a/static/ng/resources/js/components/log/advanced-search.directive.html +++ b/static/ng/resources/js/components/log/advanced-search.directive.html @@ -32,7 +32,7 @@
- +
diff --git a/static/ng/resources/js/components/log/advanced-search.directive.js b/static/ng/resources/js/components/log/advanced-search.directive.js index 5841214c4..389128718 100644 --- a/static/ng/resources/js/components/log/advanced-search.directive.js +++ b/static/ng/resources/js/components/log/advanced-search.directive.js @@ -12,7 +12,6 @@ var vm = this; vm.checkOperation = checkOperation; - vm.search = search; vm.opAll = true; vm.opCreate = true; @@ -51,15 +50,6 @@ if(vm.opOthers) { vm.op.push(vm.others); } - - } - - function search() { - if(vm.opAll) { - vm.op = []; - vm.op.push('all'); - } - console.log(vm.op.join(",")); } } @@ -68,7 +58,10 @@ 'restrict': 'E', 'templateUrl': '/static/ng/resources/js/components/log/advanced-search.directive.html', 'scope': { - 'isOpen': '=' + 'isOpen': '=', + 'op': '=', + 'others': '=', + 'search': '&' }, 'controller': AdvancedSearchController, 'controllerAs': 'vm', diff --git a/static/ng/resources/js/components/log/list-log.directive.html b/static/ng/resources/js/components/log/list-log.directive.html index cce0313d2..63927dcd9 100644 --- a/static/ng/resources/js/components/log/list-log.directive.html +++ b/static/ng/resources/js/components/log/list-log.directive.html @@ -2,9 +2,9 @@
- + - + @@ -12,22 +12,16 @@
- +
- - + + - - - - - -
UsernameRepository NameOperationTimestamp
Haoxmyrepo/UbuntuCreate2016-03-22 12:35:00
//log.Username////log.RepoName////log.Operation////log.OpTime//
Haoxmyrepo/MySQLPush2016-03-22 12:35:00
Danielmyproject/GolangCreate2016-03-12 12:35:00
diff --git a/static/ng/resources/js/components/log/list-log.directive.js b/static/ng/resources/js/components/log/list-log.directive.js index a64dca46a..acbacc886 100644 --- a/static/ng/resources/js/components/log/list-log.directive.js +++ b/static/ng/resources/js/components/log/list-log.directive.js @@ -6,12 +6,56 @@ .module('harbor.log') .directive('listLog', listLog); - ListLogController.$inject = ['ListLogService']; + ListLogController.$inject = ['ListLogService', '$routeParams']; - function ListLogController(ListLogService) { + function ListLogController(ListLogService, $routeParams) { var vm = this; vm.isOpen = false; + vm.projectId = $routeParams.project_id; + + vm.beginTimestamp = 0; + vm.endTimestamp = 0; + vm.keywords = ""; + vm.username = ""; + + vm.op = []; + vm.others = ""; + + + vm.search = search; + vm.aSearch= aSearch; + vm.advancedSearch = advancedSearch; + + + var queryParams = { + 'beginTimestamp' : vm.beginTimestamp, + 'endTimestamp' : vm.endTimestamp, + 'keywords' : vm.keywords, + 'projectId': vm.projectId, + 'username' : vm.username + }; + + retrieve(queryParams); + + function search(e) { + queryParams.username = e.username; + retrieve(queryParams); + } + + function aSearch(e) { + if(e.op == 'all') { + queryParams.keywords = ''; + }else { + queryParams.keywords = e.op.join('/') ; + } + if(e.others != "") { + queryParams.keywords += '/' + e.others; + } + queryParams.username = vm.username; + + retrieve(queryParams); + } function advancedSearch() { if(vm.isOpen){ @@ -20,6 +64,20 @@ vm.isOpen = true; } } + + function retrieve(queryParams) { + ListLogService(queryParams) + .then(listLogComplete) + .catch(listLogFailed); + } + + + function listLogComplete(response) { + vm.logs = response.data; + } + function listLogFailed(e){ + console.log('listLogFailed:' + e); + } } function listLog() { diff --git a/static/ng/resources/js/components/project-member/add-project-member.directive.js b/static/ng/resources/js/components/project-member/add-project-member.directive.js index 82e09f61e..7c769436c 100644 --- a/static/ng/resources/js/components/project-member/add-project-member.directive.js +++ b/static/ng/resources/js/components/project-member/add-project-member.directive.js @@ -10,19 +10,32 @@ function AddProjectMemberController(roles, AddProjectMemberService) { var vm = this; + vm.username = ""; vm.roles = roles(); vm.optRole = 1; vm.save = save; vm.cancel = cancel; function save() { - console.log(vm.optRole); + + AddProjectMemberService(2, vm.optRole, vm.username) + .success(addProjectMemberComplete) + .error(addProjectMemberFailed); + vm.isOpen = false; } function cancel() { vm.isOpen = false; } + function addProjectMemberComplete(data, status, header) { + console.log('addProjectMemberComplete: status:' + status + ', data:' + data); + } + + function addProjectMemberFailed(data, status, headers) { + console.log('addProjectMemberFailed: status:' + status + ', data:' + data); + } + } function addProjectMember() { diff --git a/static/ng/resources/js/components/project-member/list-project-member.directive.html b/static/ng/resources/js/components/project-member/list-project-member.directive.html index 5fb818e88..cc4f37471 100644 --- a/static/ng/resources/js/components/project-member/list-project-member.directive.html +++ b/static/ng/resources/js/components/project-member/list-project-member.directive.html @@ -4,7 +4,7 @@
- +
diff --git a/static/ng/resources/js/components/project-member/list-project-member.directive.js b/static/ng/resources/js/components/project-member/list-project-member.directive.js index 10601ee41..262250100 100644 --- a/static/ng/resources/js/components/project-member/list-project-member.directive.js +++ b/static/ng/resources/js/components/project-member/list-project-member.directive.js @@ -6,23 +6,25 @@ .module('harbor.project.member') .directive('listProjectMember', listProjectMember); - ListProjectMemberController.$inject = ['ListProjectMemberService', '$routeParams']; + ListProjectMemberController.$inject = ['$scope', 'ListProjectMemberService', '$routeParams']; - function ListProjectMemberController(ListProjectMemberService, $routeParams) { + function ListProjectMemberController($scope, ListProjectMemberService, $routeParams) { var vm = this; + + vm.projectId = $routeParams.project_id; vm.isOpen = false; vm.username = ""; - + vm.search = search; vm.addProjectMember = addProjectMember; - vm.projectId = $routeParams.project_id || 2; - - retrieve(vm.username); + retrieve(vm.projectId , vm.username); + function search(e) { - retrieve(e.username); + console.log('project_id:' + e.projectId); + retrieve(e.projectId, e.username); } function addProjectMember() { @@ -33,8 +35,8 @@ } } - function retrieve(username) { - ListProjectMemberService(vm.projectId, {'username': username}) + function retrieve(projectId, username) { + ListProjectMemberService(projectId, {'username': username}) .then(getProjectMemberComplete) .catch(getProjectMemberFailed); } diff --git a/static/ng/resources/js/components/repository/list-repository.directive.js b/static/ng/resources/js/components/repository/list-repository.directive.js index 810697df5..1c8c1142d 100644 --- a/static/ng/resources/js/components/repository/list-repository.directive.js +++ b/static/ng/resources/js/components/repository/list-repository.directive.js @@ -5,16 +5,19 @@ .module('harbor.repository') .directive('listRepository', listRepository); - ListRepositoryController.$inject = ['ListRepositoryService', 'ListTagService', 'nameFilter', '$routeParams']; + ListRepositoryController.$inject = ['$scope', 'ListRepositoryService', 'ListTagService', 'nameFilter', '$routeParams']; - function ListRepositoryController(ListRepositoryService, ListTagService, nameFilter, $routeParams) { + function ListRepositoryController($scope, ListRepositoryService, ListTagService, nameFilter, $routeParams) { var vm = this; + vm.projectId = $routeParams.project_id; vm.filterInput = ""; - - ListRepositoryService({'projectId': $routeParams.project_id, 'q': ''}) + vm.expand = expand; + + ListRepositoryService({'projectId': vm.projectId, 'q': ''}) .then(getRepositoryComplete) .catch(getRepositoryFailed); + function getRepositoryComplete(response) { vm.repositories = response.data; @@ -23,9 +26,7 @@ function getRepositoryFailed(repsonse) { } - - vm.expand = expand; - + function expand(e) { vm.tags = []; ListTagService(e.repoName) @@ -47,9 +48,6 @@ restrict: 'E', templateUrl: '/static/ng/resources/js/components/repository/list-repository.directive.html', replace: true, - scope: { - 'info': '=' - }, controller: ListRepositoryController, controllerAs: 'vm', bindToController: true diff --git a/static/ng/resources/js/layout/navigation/navigation-details.directive.html b/static/ng/resources/js/layout/navigation/navigation-details.directive.html index bf0aaceb9..fa6c55ffe 100644 --- a/static/ng/resources/js/layout/navigation/navigation-details.directive.html +++ b/static/ng/resources/js/layout/navigation/navigation-details.directive.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/static/ng/resources/js/layout/navigation/navigation-details.directive.js b/static/ng/resources/js/layout/navigation/navigation-details.directive.js index f78eec396..129fbfe71 100644 --- a/static/ng/resources/js/layout/navigation/navigation-details.directive.js +++ b/static/ng/resources/js/layout/navigation/navigation-details.directive.js @@ -30,7 +30,8 @@ templateUrl: '/static/ng/resources/js/layout/navigation/navigation-details.directive.html', link: link, scope: { - 'isOpen': "=" + 'isOpen': '=', + 'selectedProject': '=' }, replace: true, controller: NavigationDetailsController, diff --git a/static/ng/resources/js/layout/project-member/project-member.controller.js b/static/ng/resources/js/layout/project-member/project-member.controller.js index 55e747012..113ab72ea 100644 --- a/static/ng/resources/js/layout/project-member/project-member.controller.js +++ b/static/ng/resources/js/layout/project-member/project-member.controller.js @@ -6,8 +6,14 @@ .module('harbor.layout.project.member') .controller('ProjectMemberController', ProjectMemberController); - function ProjectMemberController() { + ProjectMemberController.$inject = ['$scope']; + function ProjectMemberController($scope) { + var vm = this; + $scope.$on('currentProjectId', function(e, val) { + console.log('received currentProjecjtId: ' + val + ' in ProjectMemberController'); + vm.projectId = val; + }); } })(); \ No newline at end of file diff --git a/static/ng/resources/js/layout/repository/repository.controller.html b/static/ng/resources/js/layout/repository/repository.controller.html index 8f69c080d..536aaf276 100644 --- a/static/ng/resources/js/layout/repository/repository.controller.html +++ b/static/ng/resources/js/layout/repository/repository.controller.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/static/ng/resources/js/layout/repository/repository.controller.js b/static/ng/resources/js/layout/repository/repository.controller.js index 717a7efaf..bf1b1890b 100644 --- a/static/ng/resources/js/layout/repository/repository.controller.js +++ b/static/ng/resources/js/layout/repository/repository.controller.js @@ -5,9 +5,17 @@ angular .module('harbor.layout.repository') .controller('RepositoryController', RepositoryController); + + RepositoryController.$inject = ['$scope']; - function RepositoryController() { + function RepositoryController($scope) { var vm = this; + + $scope.$on('currentProjectId', function(e, val) { + console.log('received currentProjecjtId: ' + val + ' in RepositoryController'); + vm.projectId = val; + }); + } })(); \ No newline at end of file diff --git a/static/ng/resources/js/services/log/services.list-log.js b/static/ng/resources/js/services/log/services.list-log.js index 2e5f018c2..b201595d3 100644 --- a/static/ng/resources/js/services/log/services.list-log.js +++ b/static/ng/resources/js/services/log/services.list-log.js @@ -13,7 +13,20 @@ return LogResult; function LogResult(queryParams) { - $log.info(queryParams); + var projectId = queryParams.projectId; + var username = queryParams.username; + var beginTimestamp = queryParams.beginTimestamp; + var endTimestamp = queryParams.endTimestamp; + var keywords = queryParams.keywords; + + return $http + .post('/api/projects/' + projectId + '/logs/filter', { + 'beginTimestamp' : beginTimestamp, + 'endTimestamp' : endTimestamp, + 'keywords' : keywords, + 'project_id': projectId, + 'username' : username + }); } } })(); \ No newline at end of file diff --git a/static/ng/resources/js/services/project-member/services.add-project-member.js b/static/ng/resources/js/services/project-member/services.add-project-member.js index 4759e60f6..3b3b8aedf 100644 --- a/static/ng/resources/js/services/project-member/services.add-project-member.js +++ b/static/ng/resources/js/services/project-member/services.add-project-member.js @@ -12,8 +12,12 @@ return AddProjectMember; - function AddProjectMember(projectMember) { - + function AddProjectMember(projectId, roles, username) { + return $http + .post('/api/projects/' + projectId + '/members/', { + 'roles': [ Number(roles) ], + 'user_name': username + }); } } diff --git a/views/ng/repository.htm b/views/ng/repository.htm index 2ffbecd93..ac233ad48 100644 --- a/views/ng/repository.htm +++ b/views/ng/repository.htm @@ -5,16 +5,15 @@
- - - - + + + +
- - + +
- -
+