From bb0246910e31165b7d3ef7de43f4cbf54cf58ea7 Mon Sep 17 00:00:00 2001 From: kunw Date: Tue, 25 Oct 2016 18:22:29 +0800 Subject: [PATCH] Updates for hiding buttons against to user role. --- .../components/details/retrieve-projects.directive.js | 7 ++++++- .../project-member/edit-project-member.directive.html | 2 +- .../project-member/edit-project-member.directive.js | 3 ++- .../project-member/list-project-member.directive.html | 10 +++++----- .../project-member/list-project-member.directive.js | 9 +++------ .../components/project/publicity-button.directive.html | 4 ++-- .../components/project/publicity-button.directive.js | 3 ++- .../repository/list-repository.directive.html | 4 ++-- .../components/repository/list-repository.directive.js | 5 +++-- .../js/components/repository/list-tag.directive.html | 4 ++-- .../js/components/repository/list-tag.directive.js | 3 ++- src/ui/views/project.htm | 6 +++--- src/ui/views/repository.htm | 6 +++--- 13 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/ui/static/resources/js/components/details/retrieve-projects.directive.js b/src/ui/static/resources/js/components/details/retrieve-projects.directive.js index 3d5641b11..3533f2c42 100644 --- a/src/ui/static/resources/js/components/details/retrieve-projects.directive.js +++ b/src/ui/static/resources/js/components/details/retrieve-projects.directive.js @@ -29,6 +29,7 @@ vm.isOpen = false; vm.isProjectMember = false; vm.target = $location.path().substr(1) || 'repositories'; + vm.roleId = 0; vm.isPublic = Number(getParameterByName('is_public', $location.absUrl())); @@ -152,6 +153,9 @@ function getCurrentProjectMemberSuccess(data, status) { console.log('Successful get current project member:' + status); vm.isProjectMember = true; + if(data && data['roles'] && data['roles'].length > 0) { + vm.roleId = data['roles'][0]['role_id']; + } } function getCurrentProjectMemberFailed(data, status) { @@ -171,7 +175,8 @@ 'isOpen': '=', 'selectedProject': '=', 'isPublic': '=', - 'isProjectMember': '=' + 'isProjectMember': '=', + 'roleId': '=' }, link: link, controller: RetrieveProjectsController, diff --git a/src/ui/static/resources/js/components/project-member/edit-project-member.directive.html b/src/ui/static/resources/js/components/project-member/edit-project-member.directive.html index 4f83d1a13..1d1b48f47 100644 --- a/src/ui/static/resources/js/components/project-member/edit-project-member.directive.html +++ b/src/ui/static/resources/js/components/project-member/edit-project-member.directive.html @@ -14,7 +14,7 @@ --> //vm.username// - + diff --git a/src/ui/static/resources/js/components/project-member/edit-project-member.directive.js b/src/ui/static/resources/js/components/project-member/edit-project-member.directive.js index f1e73b48e..b2f7d9c49 100644 --- a/src/ui/static/resources/js/components/project-member/edit-project-member.directive.js +++ b/src/ui/static/resources/js/components/project-member/edit-project-member.directive.js @@ -87,7 +87,8 @@ 'roleName': '=', 'projectId': '=', 'delete': '&', - 'reload': '&' + 'reload': '&', + 'currentRoleId': '@' }, 'controller': EditProjectMemberController, 'controllerAs': 'vm', diff --git a/src/ui/static/resources/js/components/project-member/list-project-member.directive.html b/src/ui/static/resources/js/components/project-member/list-project-member.directive.html index befef1d01..31a5af950 100644 --- a/src/ui/static/resources/js/components/project-member/list-project-member.directive.html +++ b/src/ui/static/resources/js/components/project-member/list-project-member.directive.html @@ -21,23 +21,23 @@ - - + + - +
- +
// 'username' | tr //// 'role' | tr //// 'operation' | tr //// 'username' | tr //// 'role' | tr //// 'operation' | tr //
- +
diff --git a/src/ui/static/resources/js/components/project-member/list-project-member.directive.js b/src/ui/static/resources/js/components/project-member/list-project-member.directive.js index 992b1d598..6fa330532 100644 --- a/src/ui/static/resources/js/components/project-member/list-project-member.directive.js +++ b/src/ui/static/resources/js/components/project-member/list-project-member.directive.js @@ -56,11 +56,7 @@ } function addProjectMember() { - if(vm.isOpen) { - vm.isOpen = false; - }else{ - vm.isOpen = true; - } + vm.isOpen = !vm.isOpen; } function deleteProjectMember(e) { @@ -105,7 +101,8 @@ 'restrict': 'E', 'templateUrl': '/static/resources/js/components/project-member/list-project-member.directive.html', 'scope': { - 'sectionHeight': '=' + 'sectionHeight': '=', + 'roleId': '@' }, 'link': link, 'controller': ListProjectMemberController, diff --git a/src/ui/static/resources/js/components/project/publicity-button.directive.html b/src/ui/static/resources/js/components/project/publicity-button.directive.html index 05a4688b0..68a66cca2 100644 --- a/src/ui/static/resources/js/components/project/publicity-button.directive.html +++ b/src/ui/static/resources/js/components/project/publicity-button.directive.html @@ -12,5 +12,5 @@ See the License for the specific language governing permissions and limitations under the License. --> - - \ No newline at end of file + + \ No newline at end of file diff --git a/src/ui/static/resources/js/components/project/publicity-button.directive.js b/src/ui/static/resources/js/components/project/publicity-button.directive.js index 7f108b880..1af415ecc 100644 --- a/src/ui/static/resources/js/components/project/publicity-button.directive.js +++ b/src/ui/static/resources/js/components/project/publicity-button.directive.js @@ -60,7 +60,8 @@ 'templateUrl': '/static/resources/js/components/project/publicity-button.directive.html', 'scope': { 'isPublic': '=', - 'projectId': '=' + 'projectId': '=', + 'roleId': '@' }, 'link': link, 'controller': PublicityButtonController, diff --git a/src/ui/static/resources/js/components/repository/list-repository.directive.html b/src/ui/static/resources/js/components/repository/list-repository.directive.html index 42b02744c..c8f666306 100644 --- a/src/ui/static/resources/js/components/repository/list-repository.directive.html +++ b/src/ui/static/resources/js/components/repository/list-repository.directive.html @@ -23,10 +23,10 @@  //repo//   //vm.tagCount[repo]// - +
- +
diff --git a/src/ui/static/resources/js/components/repository/list-repository.directive.js b/src/ui/static/resources/js/components/repository/list-repository.directive.js index 655ac6764..b26228763 100644 --- a/src/ui/static/resources/js/components/repository/list-repository.directive.js +++ b/src/ui/static/resources/js/components/repository/list-repository.directive.js @@ -26,7 +26,7 @@ $scope.subsTabPane = 30; var vm = this; - + vm.sectionHeight = {'min-height': '579px'}; vm.filterInput = ''; @@ -180,7 +180,8 @@ 'restrict': 'E', 'templateUrl': '/static/resources/js/components/repository/list-repository.directive.html', 'scope': { - 'sectionHeight': '=' + 'sectionHeight': '=', + 'roleId': '@' }, 'link': link, 'controller': ListRepositoryController, diff --git a/src/ui/static/resources/js/components/repository/list-tag.directive.html b/src/ui/static/resources/js/components/repository/list-tag.directive.html index 94fc5dab0..029b02a2d 100644 --- a/src/ui/static/resources/js/components/repository/list-tag.directive.html +++ b/src/ui/static/resources/js/components/repository/list-tag.directive.html @@ -5,7 +5,7 @@ // 'tag' | tr // // 'image_details' | tr // // 'pull_command' | tr // - // 'operation' | tr // + // 'operation' | tr // @@ -14,7 +14,7 @@ - + diff --git a/src/ui/static/resources/js/components/repository/list-tag.directive.js b/src/ui/static/resources/js/components/repository/list-tag.directive.js index f47b0b917..279446500 100644 --- a/src/ui/static/resources/js/components/repository/list-tag.directive.js +++ b/src/ui/static/resources/js/components/repository/list-tag.directive.js @@ -85,7 +85,8 @@ 'associateId': '=', 'repoName': '=', 'toggleInProgress': '=', - 'deleteByTag': '&' + 'deleteByTag': '&', + 'roleId': '@' }, 'replace': true, 'controller': ListTagController, diff --git a/src/ui/views/project.htm b/src/ui/views/project.htm index 7d7d32480..e1b884a82 100644 --- a/src/ui/views/project.htm +++ b/src/ui/views/project.htm @@ -48,7 +48,7 @@ // 'role' | tr // // 'creation_time' | tr // // 'publicity' | tr // - // 'operation' | tr // + // 'operation' | tr // @@ -63,8 +63,8 @@ //p.repo_count// //vm.getProjectRole(p.current_user_role_id) | tr// //p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'// - - + +    diff --git a/src/ui/views/repository.htm b/src/ui/views/repository.htm index 0ee168ccc..7a9f94d45 100644 --- a/src/ui/views/repository.htm +++ b/src/ui/views/repository.htm @@ -30,13 +30,13 @@ - +
- + - +