mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-27 19:17:47 +01:00
continuous updates for UI
This commit is contained in:
parent
2ab653c642
commit
44a8e5d578
@ -26,7 +26,7 @@
|
||||
})
|
||||
.otherwise({
|
||||
redirectTo: '/'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function nameFilter() {
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -32,7 +32,7 @@
|
||||
<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>
|
||||
<button type="button" class="btn btn-primary" ng-click="vm.search({op: vm.op})">Search</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -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',
|
||||
|
@ -2,9 +2,9 @@
|
||||
<div class="col-xs-12 col-md-12 each-tab-pane">
|
||||
<div class="form-inline">
|
||||
<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">
|
||||
<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 class="input-group-btn">
|
||||
<button class="btn btn-link" type="button" ng-click="vm.advancedSearch()">Advanced Search</button>
|
||||
@ -12,22 +12,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pane">
|
||||
<advanced-search ng-show="vm.isOpen" is-open="vm.isOpen"></advanced-search>
|
||||
<advanced-search ng-show="vm.isOpen" is-open="vm.isOpen" op="vm.op" others="vm.others" search='vm.aSearch({op: vm.op, others: vm.others})'></advanced-search>
|
||||
<div class="sub-pane">
|
||||
<table class="table table-pane">
|
||||
<thead>
|
||||
<th>Username</th><th>Repository Name</th><th>Operation</th><th>Timestamp</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Haox</td><td>myrepo/Ubuntu</td><td>Create</td><td>2016-03-22 12:35:00</td>
|
||||
<tr ng-repeat="log in vm.logs">
|
||||
<td>//log.Username//</td><td>//log.RepoName//</td><td>//log.Operation//</td><td>//log.OpTime//</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Haox</td><td>myrepo/MySQL</td><td>Push</td><td>2016-03-22 12:35:00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Daniel</td><td>myproject/Golang</td><td>Create</td><td>2016-03-12 12:35:00</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="" ng-model="vm.username" size="30">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="button" ng-click="vm.search({username: vm.username})"><span class="glyphicon glyphicon-search"></span></button>
|
||||
<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 class="btn btn-success" type="button" ng-click="vm.addProjectMember()"><span class="glyphicon glyphicon-plus"></span>Add Member</button>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
<ul class="switch-pane-tabs" role="tablist">
|
||||
<li><a tag="repositories" ng-click="vm.clickTab()" href="/ng/repository#/repositories">Repositories</a><span class="gutter">|</span></li>
|
||||
<li><a tag="users" ng-click="vm.clickTab()" href="/ng/repository#/users">Users</a><span class="gutter">|</span></li>
|
||||
<li><a tag="logs" ng-click="vm.clickTab()" href="/ng/repository#/logs">Logs</a></li>
|
||||
<li><a tag="repositories" ng-click="vm.clickTab()" href="/ng/repository#/repositories?project_id=//vm.selectedProject.ProjectId//">Repositories</a><span class="gutter">|</span></li>
|
||||
<li><a tag="users" ng-click="vm.clickTab()" href="/ng/repository#/users?project_id=//vm.selectedProject.ProjectId//">Users</a><span class="gutter">|</span></li>
|
||||
<li><a tag="logs" ng-click="vm.clickTab()" href="/ng/repository#/logs?project_id=//vm.selectedProject.ProjectId//">Logs</a></li>
|
||||
</ul>
|
@ -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,
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
@ -1 +1 @@
|
||||
<list-repository info="vm.info"></list-repository>
|
||||
<list-repository></list-repository>
|
@ -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;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,16 +5,15 @@
|
||||
<div class="section">
|
||||
<h4 class="page-header">My Projects<span class="gutter">|</span><a href="#" class="title-color">Public Projects</a></h4>
|
||||
<div class="switch-pane">
|
||||
<switch-pane-projects is-open="vm.open" selected-project="vm.selectedProject"></switch-pane-projects>
|
||||
<span>
|
||||
<navigation-details is-open="vm.open"></navigation-details>
|
||||
</span>
|
||||
<switch-pane-projects is-open="vm.open" selected-project="vm.selectedProject"></switch-pane-projects>
|
||||
<span>
|
||||
<navigation-details is-open="vm.open" selected-project="vm.selectedProject"></navigation-details>
|
||||
</span>
|
||||
</div>
|
||||
<retrieve-projects is-open="vm.open" projects="vm.projects" selected-project="vm.selectedProject"></retrieve-projects>
|
||||
<!-- Tab panes -->
|
||||
<retrieve-projects is-open="vm.open" projects="vm.projects" selected-project="vm.selectedProject"></retrieve-projects>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content" ng-click="vm.closeRetrievePane()">
|
||||
<ng-view></ng-view>
|
||||
</div>
|
||||
<ng-view></ng-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user