mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 14:47:38 +01:00
continuous updates for repository logs.
This commit is contained in:
parent
224fb808eb
commit
f83c94f414
@ -1,28 +0,0 @@
|
|||||||
(function() {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular
|
|
||||||
.module('harbor.details')
|
|
||||||
.directive('addMember', addMember);
|
|
||||||
|
|
||||||
function AddMemberController() {
|
|
||||||
var vm = this;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function addMember() {
|
|
||||||
var directive = {
|
|
||||||
'restrict': 'E',
|
|
||||||
'templateUrl': '/static/ng/resources/js/components/details/add-member.directive.html',
|
|
||||||
'scope': {
|
|
||||||
|
|
||||||
},
|
|
||||||
'controller': AddMemberController,
|
|
||||||
'controllerAs': 'vm',
|
|
||||||
'bindToController': true
|
|
||||||
}
|
|
||||||
return directive;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
@ -1,55 +0,0 @@
|
|||||||
(function() {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular
|
|
||||||
.module('harbor.details')
|
|
||||||
.directive('switchRoles', switchRoles);
|
|
||||||
|
|
||||||
|
|
||||||
SwitchRolesController.$inject = ['$scope'];
|
|
||||||
|
|
||||||
function SwitchRolesController($scope) {
|
|
||||||
var vm = this;
|
|
||||||
|
|
||||||
vm.currentRole = getRoleById(vm.roleId);
|
|
||||||
vm.selectRole = selectRole;
|
|
||||||
|
|
||||||
function selectRole(role) {
|
|
||||||
vm.currentRole = getRoleById(role.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRoleById(roleId) {
|
|
||||||
for(var i = 0; i < vm.roles.length; i++) {
|
|
||||||
var role = vm.roles[i];
|
|
||||||
if(role.id == roleId) {
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchRoles() {
|
|
||||||
var directive = {
|
|
||||||
'restrict': 'E',
|
|
||||||
'templateUrl': '/static/ng/resources/js/components/details/switch-roles.directive.html',
|
|
||||||
'scope': {
|
|
||||||
'roles': '=',
|
|
||||||
'editMode': '=',
|
|
||||||
'userId': '=',
|
|
||||||
'roleId': '='
|
|
||||||
},
|
|
||||||
'link' : link,
|
|
||||||
'controller' : SwitchRolesController,
|
|
||||||
'controllerAs': 'vm',
|
|
||||||
'bindToController': true
|
|
||||||
};
|
|
||||||
return directive;
|
|
||||||
|
|
||||||
function link(scope, element, attrs, ctrl) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<div class="well panel-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-10 col-md-10">
|
||||||
|
<form class="form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="">Operation:</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="checkbox" ng-model="vm.opAll" ng-checked="vm.opCreate && vm.opPull && vm.opPush && vm.opDelete && vm.opOthers" ng-click="vm.checkOperation({checked: 'all'})"> All
|
||||||
|
<input type="checkbox" ng-checked="vm.opCreate" ng-model="vm.opCreate" ng-click="vm.checkOperation({checked: 'create'})"> Create
|
||||||
|
<input type="checkbox" ng-checked="vm.opPull" ng-model="vm.opPull" ng-click="vm.checkOperation({checked: 'pull'})"> Pull
|
||||||
|
<input type="checkbox" ng-checked="vm.opPush" ng-model="vm.opPush" ng-click="vm.checkOperation({checked: 'push'})"> Push
|
||||||
|
<input type="checkbox" ng-checked="vm.opDelete" ng-model="vm.opDelete" ng-click="vm.checkOperation({checked: 'delete'})"> Delete
|
||||||
|
<input type="checkbox" ng-checked="vm.opOthers" ng-model="vm.opOthers" ng-click="vm.checkOperation({checked: 'others'})"> Others
|
||||||
|
<input type="text" ng-model="vm.others" size="10">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="">Duration:</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
From:
|
||||||
|
<input type="text" id="fromdatepicker" readonly="readonly">
|
||||||
|
<span class="glyphicon glyphicon-calendar"></span>
|
||||||
|
|
||||||
|
To:
|
||||||
|
<input type="text" id="todatepicker" readonly="readonly">
|
||||||
|
<span class="glyphicon glyphicon-calendar"></span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2 col-md-2">
|
||||||
|
<form>
|
||||||
|
<div class="form-group" style="margin-top: 40%;">
|
||||||
|
<button type="button" class="btn btn-primary" ng-click="vm.search()">Search</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,53 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('harbor.log')
|
||||||
|
.directive('advancedSearch', advancedSearch);
|
||||||
|
|
||||||
|
AdvancedSearchController.$inject = ['ListLogService'];
|
||||||
|
|
||||||
|
function AdvancedSearchController(ListLogService) {
|
||||||
|
var vm = this;
|
||||||
|
|
||||||
|
vm.checkOperation = checkOperation;
|
||||||
|
vm.search = search;
|
||||||
|
|
||||||
|
vm.opAll = true;
|
||||||
|
vm.opCreate = true;
|
||||||
|
vm.opPull = true;
|
||||||
|
vm.opPush = true;
|
||||||
|
vm.opDelete = true;
|
||||||
|
vm.opOthers = true;
|
||||||
|
|
||||||
|
function checkOperation(e) {
|
||||||
|
if(e.checked == 'all') {
|
||||||
|
vm.opCreate = vm.opAll;
|
||||||
|
vm.opPull = vm.opAll;
|
||||||
|
vm.opPush = vm.opAll;
|
||||||
|
vm.opDelete = vm.opAll;
|
||||||
|
vm.opOthers = vm.opAll;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function search() {
|
||||||
|
vm.isOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function advancedSearch() {
|
||||||
|
var directive = {
|
||||||
|
'restrict': 'E',
|
||||||
|
'templateUrl': '/static/ng/resources/js/components/log/advanced-search.directive.html',
|
||||||
|
'scope': {
|
||||||
|
'isOpen': '='
|
||||||
|
},
|
||||||
|
'controller': AdvancedSearchController,
|
||||||
|
'controllerAs': 'vm',
|
||||||
|
'bindToController': true
|
||||||
|
};
|
||||||
|
return directive;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -6,8 +6,14 @@
|
|||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-primary" type="button"><span class="glyphicon glyphicon-search"></span></button>
|
<button class="btn btn-primary" type="button"><span class="glyphicon glyphicon-search"></span></button>
|
||||||
</span>
|
</span>
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button class="btn btn-link" type="button" ng-click="vm.advancedSearch()">Advanced Search</button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pane">
|
||||||
|
<advanced-search ng-show="vm.isOpen" is-open="vm.isOpen"></advanced-search>
|
||||||
|
<div class="sub-pane">
|
||||||
<table class="table table-pane">
|
<table class="table table-pane">
|
||||||
<thead>
|
<thead>
|
||||||
<th>Username</th><th>Repository Name</th><th>Operation</th><th>Timestamp</th>
|
<th>Username</th><th>Repository Name</th><th>Operation</th><th>Timestamp</th>
|
||||||
@ -25,4 +31,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
@ -6,10 +6,20 @@
|
|||||||
.module('harbor.log')
|
.module('harbor.log')
|
||||||
.directive('listLog', listLog);
|
.directive('listLog', listLog);
|
||||||
|
|
||||||
// ListLogController.$inject = ['ListLogService'];
|
ListLogController.$inject = ['ListLogService'];
|
||||||
|
|
||||||
function ListLogController() {
|
function ListLogController(ListLogService) {
|
||||||
|
var vm = this;
|
||||||
|
vm.isOpen = false;
|
||||||
|
vm.advancedSearch = advancedSearch;
|
||||||
|
|
||||||
|
function advancedSearch() {
|
||||||
|
if(vm.isOpen){
|
||||||
|
vm.isOpen = false;
|
||||||
|
}else{
|
||||||
|
vm.isOpen = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function listLog() {
|
function listLog() {
|
||||||
|
9
static/ng/resources/js/components/log/log.config.js
Normal file
9
static/ng/resources/js/components/log/log.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('harbor.log');
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
@ -1,15 +0,0 @@
|
|||||||
(function() {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular
|
|
||||||
.module('harbor.project.member')
|
|
||||||
.controller('AddProjectMemberController', AddProjectMemberController);
|
|
||||||
|
|
||||||
AddProjectMemberController.$inject = ['AddProjectMemberService'];
|
|
||||||
|
|
||||||
function AddProjectMemberController(AddProjectMemberService) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
@ -3,23 +3,23 @@
|
|||||||
<div class="col-xs-10 col-md-10">
|
<div class="col-xs-10 col-md-10">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" id="addUsername" placeholder="Username">
|
<input type="text" class="form-control" id="addUsername" placeholder="Username" ng-model="vm.username">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<form class="form-inline clearfix">
|
<form class="form-inline clearfix">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="roleIdList">Role:</label>
|
<label for="roleIdList">Role:</label>
|
||||||
<input type="radio" name="roleId" value="1"> Project Admin
|
<span ng-repeat="role in vm.roles">
|
||||||
<input type="radio" name="roleId" value="2"> Developer
|
<input type="radio" name="role" ng-model="vm.optRole" value="//role.id//"> //role.name//
|
||||||
<input type="radio" name="roleId" value="3"> Guest
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-2 col-md-2">
|
<div class="col-xs-2 col-md-2">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group" style="margin-top: 20%;">
|
<div class="form-group" style="margin-top: 20%;">
|
||||||
<button type="button" class="btn btn-default" id="btnCancel">Cancel</button>
|
<button type="button" class="btn btn-default" id="btnCancel" ng-click="vm.cancel()">Cancel</button>
|
||||||
<button type="button" class="btn btn-primary" id="btnSave">Save</button>
|
<button type="button" class="btn btn-primary" id="btnSave" ng-click="vm.save()">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
@ -0,0 +1,42 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('harbor.project.member')
|
||||||
|
.directive('addProjectMember', addProjectMember);
|
||||||
|
|
||||||
|
AddProjectMemberController.$inject = ['roles', 'AddProjectMemberService'];
|
||||||
|
|
||||||
|
function AddProjectMemberController(roles, AddProjectMemberService) {
|
||||||
|
var vm = this;
|
||||||
|
vm.roles = roles();
|
||||||
|
vm.optRole = 1;
|
||||||
|
vm.save = save;
|
||||||
|
vm.cancel = cancel;
|
||||||
|
|
||||||
|
function save() {
|
||||||
|
console.log(vm.optRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
vm.isOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function addProjectMember() {
|
||||||
|
var directive = {
|
||||||
|
'restrict': 'E',
|
||||||
|
'templateUrl': '/static/ng/resources/js/components/project-member/add-project-member.directive.html',
|
||||||
|
'scope': {
|
||||||
|
'isOpen': '='
|
||||||
|
},
|
||||||
|
'controller': AddProjectMemberController,
|
||||||
|
'controllerAs': 'vm',
|
||||||
|
'bindToController': true
|
||||||
|
}
|
||||||
|
return directive;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -1,15 +0,0 @@
|
|||||||
(function() {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular
|
|
||||||
.module('harbor.project.member')
|
|
||||||
.controller('DeleteProjectMemberController', DeleteProjectMemberController);
|
|
||||||
|
|
||||||
DeleteProjectMemberController.$inject = ['DeleteProjectMemberService'];
|
|
||||||
|
|
||||||
function DeleteProjectMemberController(DeleteProjectMemberService) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
@ -1,9 +1,9 @@
|
|||||||
<td style="padding: 15px;">//vm.username//</td>
|
<td style="padding: 15px;">//vm.username//</td>
|
||||||
<td><switch-roles roles="vm.roles" edit-mode="vm.editMode" user-id="vm.userId" role-id="vm.roleId"></switch-roles></td>
|
<td><switch-role roles="vm.roles" edit-mode="vm.editMode" user-id="vm.userId" role-id="vm.roleId"></switch-role></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="javascript:void(0);" ng-click="vm.update({roleId: vm.roleId})">
|
<a 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"></span><span ng-if="vm.editMode" class="glyphicon glyphicon-ok"></span>
|
<span ng-if="!vm.editMode" class="glyphicon glyphicon-pencil"></span><span ng-if="vm.editMode" class="glyphicon glyphicon-ok"></span>
|
||||||
</ng-switch>
|
</ng-switch>
|
||||||
</a>
|
</a>
|
||||||
<a href="#"><span class="glyphicon glyphicon-trash"></span></a>
|
<a href="javascript:void(0);" ng-click="vm.deleteProjectMember({projectId: vm.projectId, userId: vm.userId})"><span class="glyphicon glyphicon-trash"></span></a>
|
||||||
</td>
|
</td>
|
@ -4,33 +4,31 @@
|
|||||||
|
|
||||||
angular
|
angular
|
||||||
.module('harbor.project.member')
|
.module('harbor.project.member')
|
||||||
.constant('roles', roles)
|
|
||||||
.directive('editProjectMember', editProjectMember);
|
.directive('editProjectMember', editProjectMember);
|
||||||
|
|
||||||
function roles() {
|
EditProjectMemberController.$inject = ['roles', 'EditProjectMemberService', 'DeleteProjectMemberService'];
|
||||||
return [
|
|
||||||
{'id': '1', 'name': 'Project Admin'},
|
|
||||||
{'id': '2', 'name': 'Developer'},
|
|
||||||
{'id': '3', 'name': 'Guest'}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
EditProjectMemberController.$inject = ['roles', 'EditProjectMemberService', '$scope'];
|
function EditProjectMemberController(roles, EditProjectMemberService) {
|
||||||
|
|
||||||
function EditProjectMemberController(roles, EditProjectMemberService, $scope) {
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
vm.roles = roles();
|
vm.roles = roles();
|
||||||
vm.editMode = false;
|
vm.editMode = false;
|
||||||
vm.update = update;
|
vm.updateProjectMember = updateProjectMember;
|
||||||
|
vm.deleteProjectMember = deleteProjectMember;
|
||||||
|
|
||||||
|
function updateProjectMember(e) {
|
||||||
function update(e) {
|
|
||||||
if(vm.editMode) {
|
if(vm.editMode) {
|
||||||
vm.editMode = false;
|
vm.editMode = false;
|
||||||
|
|
||||||
|
console.log('project_id:' + e.projectId + ', user_id:' + e.userId + ', role_id:' + e.roleId);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
vm.editMode = true;
|
vm.editMode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteProjectMember(e) {
|
||||||
|
console.log('project_id:' + e.projectId + ', user_id:' + e.userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function editProjectMember() {
|
function editProjectMember() {
|
||||||
@ -40,18 +38,14 @@
|
|||||||
'scope': {
|
'scope': {
|
||||||
'username': '=',
|
'username': '=',
|
||||||
'userId': '=',
|
'userId': '=',
|
||||||
'roleId': '='
|
'roleId': '=',
|
||||||
|
'projectId': '='
|
||||||
},
|
},
|
||||||
'link': link,
|
|
||||||
'controller': EditProjectMemberController,
|
'controller': EditProjectMemberController,
|
||||||
'controllerAs': 'vm',
|
'controllerAs': 'vm',
|
||||||
'bindToController': true
|
'bindToController': true
|
||||||
};
|
};
|
||||||
return directive;
|
return directive;
|
||||||
|
|
||||||
function link(scope, element, attrs) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
@ -2,22 +2,22 @@
|
|||||||
<div class="col-xs-12 col-md-12 each-tab-pane">
|
<div class="col-xs-12 col-md-12 each-tab-pane">
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" placeholder="" size="30">
|
<input type="text" class="form-control" placeholder="" ng-model="vm.username" size="30">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-primary" type="button"><span class="glyphicon glyphicon-search"></span></button>
|
<button class="btn btn-primary" type="button" ng-click="vm.search({username: vm.username})"><span class="glyphicon glyphicon-search"></span></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-success" type="button" ng-click="vm.addMember()"><span class="glyphicon glyphicon-plus"></span>Add Member</button>
|
<button class="btn btn-success" type="button" ng-click="vm.addProjectMember()"><span class="glyphicon glyphicon-plus"></span>Add Member</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="pane">
|
<div class="pane">
|
||||||
<add-member ng-show="vm.isOpen"></add-member>
|
<add-project-member ng-show="vm.isOpen" is-open="vm.isOpen"></add-project-member>
|
||||||
<div class="sub-pane">
|
<div class="sub-pane">
|
||||||
<table class="table table-pane" >
|
<table class="table table-pane" >
|
||||||
<thead>
|
<thead>
|
||||||
<th width="30%">Username</th><th width="40%">Role</th><th width="30%">Operation</th>
|
<th width="30%">Username</th><th width="40%">Role</th><th width="30%">Operation</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="pr in vm.projectMembers" edit-project-member username="pr.username" user-id="pr.id" role-id="pr.roleId"></tr>
|
<tr ng-repeat="pr in vm.projectMembers" edit-project-member username="pr.username" project-id="pr.project_id" user-id="pr.id" role-id="pr.roleId"></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
function mockupProjectMembers() {
|
function mockupProjectMembers() {
|
||||||
var projectMembers = [
|
var projectMembers = [
|
||||||
{'id': '1', 'username': 'user1', 'roleId': '1'},
|
{'id': '1', 'username': 'user1', 'roleId': '1', 'project_id': '5'},
|
||||||
{'id': '2', 'username': 'user2', 'roleId': '3'},
|
{'id': '2', 'username': 'user2', 'roleId': '3', 'project_id': '5'},
|
||||||
{'id': '3', 'username': 'user3', 'roleId': '2'}
|
{'id': '3', 'username': 'user3', 'roleId': '2', 'project_id': '5'}
|
||||||
];
|
];
|
||||||
return projectMembers;
|
return projectMembers;
|
||||||
}
|
}
|
||||||
@ -22,9 +22,16 @@
|
|||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.isOpen = false;
|
vm.isOpen = false;
|
||||||
vm.addMember = addMember;
|
vm.username = "";
|
||||||
|
|
||||||
function addMember() {
|
vm.search = search;
|
||||||
|
vm.addProjectMember = addProjectMember;
|
||||||
|
|
||||||
|
function search(e) {
|
||||||
|
console.log("search for:" + e.username);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addProjectMember() {
|
||||||
if(vm.isOpen) {
|
if(vm.isOpen) {
|
||||||
vm.isOpen = false;
|
vm.isOpen = false;
|
||||||
}else{
|
}else{
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('harbor.project.member')
|
||||||
|
.constant('roles', roles)
|
||||||
|
.factory('getRoleById', getRoleById);
|
||||||
|
|
||||||
|
function roles() {
|
||||||
|
return [
|
||||||
|
{'id': '1', 'name': 'Project Admin'},
|
||||||
|
{'id': '2', 'name': 'Developer'},
|
||||||
|
{'id': '3', 'name': 'Guest'}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
getRoleById.$inject = ['roles'];
|
||||||
|
|
||||||
|
function getRoleById(roles) {
|
||||||
|
var r = roles();
|
||||||
|
return getRole;
|
||||||
|
function getRole(roleId) {
|
||||||
|
|
||||||
|
for(var i = 0; i < r.length; i++) {
|
||||||
|
var role = r[i];
|
||||||
|
if(role.id == roleId) {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,41 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('harbor.project.member')
|
||||||
|
.directive('switchRole', switchRole);
|
||||||
|
|
||||||
|
SwitchRoleController.$inject = ['getRoleById'];
|
||||||
|
|
||||||
|
function SwitchRoleController(getRoleById) {
|
||||||
|
var vm = this;
|
||||||
|
|
||||||
|
vm.currentRole = getRoleById(vm.roleId);
|
||||||
|
vm.selectRole = selectRole;
|
||||||
|
|
||||||
|
function selectRole(role) {
|
||||||
|
vm.currentRole = getRoleById(role.id);
|
||||||
|
vm.roleId = role.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchRole() {
|
||||||
|
var directive = {
|
||||||
|
'restrict': 'E',
|
||||||
|
'templateUrl': '/static/ng/resources/js/components/project-member/switch-role.directive.html',
|
||||||
|
'scope': {
|
||||||
|
'roles': '=',
|
||||||
|
'editMode': '=',
|
||||||
|
'userId': '=',
|
||||||
|
'roleId': '='
|
||||||
|
},
|
||||||
|
'controller' : SwitchRoleController,
|
||||||
|
'controllerAs': 'vm',
|
||||||
|
'bindToController': true
|
||||||
|
};
|
||||||
|
return directive;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -56,8 +56,10 @@
|
|||||||
<script src="/static/ng/resources/js/services/repository/services.list-repository.js"></script>
|
<script src="/static/ng/resources/js/services/repository/services.list-repository.js"></script>
|
||||||
|
|
||||||
<script src="/static/ng/resources/js/services/project-member/services.project-member.module.js"></script>
|
<script src="/static/ng/resources/js/services/project-member/services.project-member.module.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/services/project-member/services.add-project-member.js"></script>
|
||||||
<script src="/static/ng/resources/js/services/project-member/services.list-project-member.js"></script>
|
<script src="/static/ng/resources/js/services/project-member/services.list-project-member.js"></script>
|
||||||
<script src="/static/ng/resources/js/services/project-member/services.edit-project-member.js"></script>
|
<script src="/static/ng/resources/js/services/project-member/services.edit-project-member.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/services/project-member/services.delete-project-member.js"></script>
|
||||||
|
|
||||||
<script src="/static/ng/resources/js/services/log/services.log.module.js"></script>
|
<script src="/static/ng/resources/js/services/log/services.log.module.js"></script>
|
||||||
<script src="/static/ng/resources/js/services/log/services.list-log.js"></script>
|
<script src="/static/ng/resources/js/services/log/services.list-log.js"></script>
|
||||||
@ -73,18 +75,21 @@
|
|||||||
|
|
||||||
<script src="/static/ng/resources/js/components/details/switch-pane-projects.directive.js"></script>
|
<script src="/static/ng/resources/js/components/details/switch-pane-projects.directive.js"></script>
|
||||||
<script src="/static/ng/resources/js/components/details/retrieve-projects.directive.js"></script>
|
<script src="/static/ng/resources/js/components/details/retrieve-projects.directive.js"></script>
|
||||||
<script src="/static/ng/resources/js/components/details/add-member.directive.js"></script>
|
|
||||||
<script src="/static/ng/resources/js/components/details/switch-roles.directive.js"></script>
|
|
||||||
|
|
||||||
<script src="/static/ng/resources/js/components/repository/repository.module.js"></script>
|
<script src="/static/ng/resources/js/components/repository/repository.module.js"></script>
|
||||||
<script src="/static/ng/resources/js/components/repository/list-repository.directive.js"></script>
|
<script src="/static/ng/resources/js/components/repository/list-repository.directive.js"></script>
|
||||||
|
|
||||||
<script src="/static/ng/resources/js/components/project-member/project-member.module.js"></script>
|
<script src="/static/ng/resources/js/components/project-member/project-member.module.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/components/project-member/project-member.config.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/components/project-member/add-project-member.directive.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/components/project-member/switch-role.directive.js"></script>
|
||||||
<script src="/static/ng/resources/js/components/project-member/list-project-member.directive.js"></script>
|
<script src="/static/ng/resources/js/components/project-member/list-project-member.directive.js"></script>
|
||||||
<script src="/static/ng/resources/js/components/project-member/edit-project-member.directive.js"></script>
|
<script src="/static/ng/resources/js/components/project-member/edit-project-member.directive.js"></script>
|
||||||
|
|
||||||
<script src="/static/ng/resources/js/components/user/user.module.js"></script>
|
<script src="/static/ng/resources/js/components/user/user.module.js"></script>
|
||||||
|
|
||||||
<script src="/static/ng/resources/js/components/log/log.module.js"></script>
|
<script src="/static/ng/resources/js/components/log/log.module.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/components/log/log.config.js"></script>
|
||||||
<script src="/static/ng/resources/js/components/log/list-log.directive.js"></script>
|
<script src="/static/ng/resources/js/components/log/list-log.directive.js"></script>
|
||||||
|
<script src="/static/ng/resources/js/components/log/advanced-search.directive.js"></script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user