mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-13 19:21:56 +01:00
Updates for hiding buttons against to user role.
This commit is contained in:
parent
ce7b556e84
commit
bb0246910e
src/ui
static/resources/js/components
details
project-member
edit-project-member.directive.htmledit-project-member.directive.jslist-project-member.directive.htmllist-project-member.directive.js
project
repository
views
@ -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,
|
||||
|
@ -14,7 +14,7 @@
|
||||
-->
|
||||
<td width="30%">//vm.username//</td>
|
||||
<td width="45%"><switch-role roles="vm.roles" edit-mode="vm.editMode" user-id="vm.userId" role-name="vm.roleName"></switch-role></td>
|
||||
<td width="25%">
|
||||
<td width="25%" ng-if="vm.currentRoleId == 1">
|
||||
<a ng-show="vm.userId != vm.currentUserId" href="javascript:void(0);" ng-click="vm.updateProjectMember({projectId: vm.projectId, userId: vm.userId, roleId: vm.roleId})">
|
||||
<span ng-if="!vm.editMode" class="glyphicon glyphicon-pencil" title="// 'edit' | tr //"></span><span ng-if="vm.editMode" class="glyphicon glyphicon-ok" title="// 'confirm' | tr //">
|
||||
</a>
|
||||
|
@ -87,7 +87,8 @@
|
||||
'roleName': '=',
|
||||
'projectId': '=',
|
||||
'delete': '&',
|
||||
'reload': '&'
|
||||
'reload': '&',
|
||||
'currentRoleId': '@'
|
||||
},
|
||||
'controller': EditProjectMemberController,
|
||||
'controllerAs': 'vm',
|
||||
|
@ -21,23 +21,23 @@
|
||||
<button class="btn btn-primary" type="button" ng-click="vm.search({projectId: vm.projectId, username: vm.username})"><span class="glyphicon glyphicon-search"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addProjectMember()"><span class="glyphicon glyphicon-plus"></span>// 'add_member' | tr //</button>
|
||||
<button ng-if="vm.isOpen" class="btn btn-default" disabled="disabled" type="button"><span class="glyphicon glyphicon-plus"></span>// 'add_member' | tr //</button>
|
||||
<button ng-if="vm.roleId == 1 && !vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addProjectMember()"><span class="glyphicon glyphicon-plus"></span>// 'add_member' | tr //</button>
|
||||
<button ng-if="vm.roleId == 1 && vm.isOpen" class="btn btn-default" disabled="disabled" type="button"><span class="glyphicon glyphicon-plus"></span>// 'add_member' | tr //</button>
|
||||
</div>
|
||||
<add-project-member ng-show="vm.isOpen" is-open="vm.isOpen" project-id="//vm.projectId//" reload='vm.search({projectId: vm.projectId, username: vm.username})'></add-project-member>
|
||||
<add-project-member ng-if="vm.isOpen" is-open="vm.isOpen" project-id="//vm.projectId//" reload='vm.search({projectId: vm.projectId, username: vm.username})'></add-project-member>
|
||||
<div class="search-pane">
|
||||
<div class="sub-pane">
|
||||
<div class="table-head-container">
|
||||
<table class="table table-pane table-header">
|
||||
<thead>
|
||||
<th width="30%">// 'username' | tr //</th><th width="45%">// 'role' | tr //</th><th width="25%">// 'operation' | tr //</th>
|
||||
<th width="30%">// 'username' | tr //</th><th width="45%">// 'role' | tr //</th><th width="25%" ng-if="vm.roleId == 1">// 'operation' | tr //</th>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="table-body-container">
|
||||
<table class="table table-pane">
|
||||
<tbody>
|
||||
<tr ng-repeat="pr in vm.projectMembers" edit-project-member username="pr.username" project-id="vm.projectId" user-id="pr.user_id" delete="vm.deleteProjectMember({projectId: vm.projectId, userId: pr.user_id})" current-user-id="vm.user.user_id" role-name="pr.role_name" reload='vm.search({projectId: vm.projectId, username: vm.username})'></tr>
|
||||
<tr ng-repeat="pr in vm.projectMembers" edit-project-member username="pr.username" project-id="vm.projectId" user-id="pr.user_id" delete="vm.deleteProjectMember({projectId: vm.projectId, userId: pr.user_id})" current-user-id="vm.user.user_id" role-name="pr.role_name" reload='vm.search({projectId: vm.projectId, username: vm.username})' current-role-id="//vm.roleId//"></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -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,
|
||||
|
@ -12,5 +12,5 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<button ng-if="vm.isPublic" class="btn btn-success" ng-click="vm.toggle()">// 'button_on' | tr //</button>
|
||||
<button ng-if="!vm.isPublic" class="btn btn-danger" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
||||
<button ng-if="vm.isPublic" class="btn btn-success" ng-disabled="vm.roleId == 0" ng-click="vm.toggle()">// 'button_on' | tr //</button>
|
||||
<button ng-if="!vm.isPublic" class="btn btn-danger" ng-disabled="vm.roleId == 0" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
@ -60,7 +60,8 @@
|
||||
'templateUrl': '/static/resources/js/components/project/publicity-button.directive.html',
|
||||
'scope': {
|
||||
'isPublic': '=',
|
||||
'projectId': '='
|
||||
'projectId': '=',
|
||||
'roleId': '@'
|
||||
},
|
||||
'link': link,
|
||||
'controller': PublicityButtonController,
|
||||
|
@ -23,10 +23,10 @@
|
||||
<a ng-if="vm.tagCount[repo] === 0" role="button" style="text-decoration: none;" data-toggle="collapse" data-parent="" aria-expanded="true" aria-controls="collapse//$index+1//">
|
||||
<span class="glyphicon glyphicon-book"></span> //repo// <span class="badge">//vm.tagCount[repo]//</span>
|
||||
</a>
|
||||
<a ng-show="vm.tagCount[repo] > 0" class="pull-right" style="margin-right: 75px;" href="javascript:void(0)" ng-click="vm.deleteByRepo(repo)" title="// 'delete_repo' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[repo + '|']"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a ng-show="vm.tagCount[repo] > 0 && vm.roleId == 1" class="pull-right" style="margin-right: 75px;" href="javascript:void(0)" ng-click="vm.deleteByRepo(repo)" title="// 'delete_repo' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[repo + '|']"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<list-tag ng-show="vm.tagCount[repo] > 0" associate-id="$index + 1" repo-name="repo" tag-count="vm.tagCount" toggle-in-progress="vm.toggleInProgress" delete-by-tag="vm.deleteByTag()"></list-tag>
|
||||
<list-tag ng-show="vm.tagCount[repo] > 0" associate-id="$index + 1" repo-name="repo" tag-count="vm.tagCount" toggle-in-progress="vm.toggleInProgress" delete-by-tag="vm.deleteByTag()" role-id="//vm.roleId//"></list-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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,
|
||||
|
@ -5,7 +5,7 @@
|
||||
<th width="20%"><span class="glyphicon glyphicon-tags"></span> // 'tag' | tr //</th>
|
||||
<th width="15%" style="text-align: center;">// 'image_details' | tr //</th>
|
||||
<th width="40%">// 'pull_command' | tr //</th>
|
||||
<th width="15%" style="text-align: center;">// 'operation' | tr //</th>
|
||||
<th width="15%" ng-if="vm.roleId == 1" style="text-align: center;">// 'operation' | tr //</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="tag in vm.tags">
|
||||
@ -14,7 +14,7 @@
|
||||
<td>
|
||||
<pull-command repo-name="//vm.repoName//" tag="//tag//"></pull-command>
|
||||
</td>
|
||||
<td style="text-align: center;"><a href="javascript:void(0);" ng-click="vm.deleteTag({repoName: vm.repoName, tag: tag})" title="// 'delete_tag' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[vm.repoName +'|'+ tag]"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
<td style="text-align: center;"><a ng-if="vm.roleId == 1" href="javascript:void(0);" ng-click="vm.deleteTag({repoName: vm.repoName, tag: tag})" title="// 'delete_tag' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[vm.repoName +'|'+ tag]"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -85,7 +85,8 @@
|
||||
'associateId': '=',
|
||||
'repoName': '=',
|
||||
'toggleInProgress': '=',
|
||||
'deleteByTag': '&'
|
||||
'deleteByTag': '&',
|
||||
'roleId': '@'
|
||||
},
|
||||
'replace': true,
|
||||
'controller': ListTagController,
|
||||
|
@ -48,7 +48,7 @@
|
||||
<th width="15%" ng-if="!vm.isPublic">// 'role' | tr //</th>
|
||||
<th width="20%">// 'creation_time' | tr //</th>
|
||||
<th width="15%">// 'publicity' | tr //</th>
|
||||
<th width="10%">// 'operation' | tr //</th>
|
||||
<th width="10%" ng-if="p.current_user_role_id == 1">// 'operation' | tr //</th>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
@ -63,8 +63,8 @@
|
||||
<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="20%">//p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||
<td width="15%"><publicity-button is-public="p.public" project-id="p.project_id"></publicity-button></td>
|
||||
<td width="10%">
|
||||
<td width="15%"><publicity-button is-public="p.public" project-id="p.project_id" role-id="//p.current_user_role_id//"></publicity-button></td>
|
||||
<td width="10%" ng-if="p.current_user_role_id == 1">
|
||||
<a href="javascript:void(0)" ng-click="vm.confirmToDelete(p.project_id, p.name)"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -30,13 +30,13 @@
|
||||
<navigation-details target="vm.target" ng-show="vm.isProjectMember"></navigation-details>
|
||||
</span>
|
||||
</div>
|
||||
<retrieve-projects target="vm.target" is-open="vm.isOpen" selected-project="vm.selectedProject" is-project-member="vm.isProjectMember" is-public="vm.isPublic"></retrieve-projects>
|
||||
<retrieve-projects target="vm.target" is-open="vm.isOpen" selected-project="vm.selectedProject" role-id="vm.roleId" is-project-member="vm.isProjectMember" is-public="vm.isPublic"></retrieve-projects>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content" ng-click="vm.closeRetrievePane()">
|
||||
<input type="hidden" id="HarborRegUrl" value="{{.HarborRegUrl}}">
|
||||
<list-repository ng-if="vm.target === 'repositories'" section-height="vm.sectionHeight"></list-repository>
|
||||
<list-repository ng-if="vm.target === 'repositories'" section-height="vm.sectionHeight" role-id="//vm.roleId//"></list-repository>
|
||||
<list-replication ng-if="vm.target === 'replication'" section-height="vm.sectionHeight"></list-replication>
|
||||
<list-project-member ng-if="vm.target === 'users'" section-height="vm.sectionHeight"></list-project-member>
|
||||
<list-project-member ng-if="vm.target === 'users'" section-height="vm.sectionHeight" role-id="//vm.roleId//"></list-project-member>
|
||||
<list-log ng-if="vm.target === 'logs'" section-height="vm.sectionHeight" target="vm.target"></list-log>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user