mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-20 07:37:38 +01:00
fixed redirecting to project with public or private of UI.
This commit is contained in:
parent
a69f5725a6
commit
4d7bc7a7e6
@ -6,17 +6,19 @@
|
|||||||
.module('harbor.details')
|
.module('harbor.details')
|
||||||
.directive('retrieveProjects', retrieveProjects);
|
.directive('retrieveProjects', retrieveProjects);
|
||||||
|
|
||||||
RetrieveProjectsController.$inject = ['$scope', 'nameFilter', '$filter', 'CurrentProjectMemberService', 'ListProjectService', '$routeParams', '$location'];
|
RetrieveProjectsController.$inject = ['$scope', 'nameFilter', '$filter', 'CurrentProjectMemberService', 'ListProjectService', '$routeParams', '$route', '$location'];
|
||||||
|
|
||||||
function RetrieveProjectsController($scope, nameFilter, $filter, CurrentProjectMemberService, ListProjectService, $routeParams, $location) {
|
function RetrieveProjectsController($scope, nameFilter, $filter, CurrentProjectMemberService, ListProjectService, $routeParams, $route, $location) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.projectName = '';
|
vm.projectName = '';
|
||||||
vm.isPublic = 0;
|
|
||||||
vm.publicity = false;
|
if($route.current.params.is_public) {
|
||||||
|
vm.isPublic = $route.current.params.is_public === 'true' ? 1 : 0;
|
||||||
|
vm.publicity = (vm.isPublic === 1) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
vm.retrieve = retrieve;
|
vm.retrieve = retrieve;
|
||||||
|
|
||||||
vm.retrieve();
|
vm.retrieve();
|
||||||
|
|
||||||
vm.checkProjectMember = checkProjectMember;
|
vm.checkProjectMember = checkProjectMember;
|
||||||
@ -31,8 +33,9 @@
|
|||||||
vm.selectItem = selectItem;
|
vm.selectItem = selectItem;
|
||||||
|
|
||||||
$scope.$watch('vm.publicity', function(current, origin) {
|
$scope.$watch('vm.publicity', function(current, origin) {
|
||||||
vm.isPublic = current ? 1 : 0;
|
vm.publicity = current ? 1 : 0;
|
||||||
vm.projectType = (vm.isPublic == 1) ? 'public_projects' : 'my_projects';
|
vm.isPublic = vm.publicity ? 1 : 0;
|
||||||
|
vm.projectType = (vm.isPublic === 1) ? 'public_projects' : 'my_projects';
|
||||||
vm.retrieve();
|
vm.retrieve();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -44,9 +47,12 @@
|
|||||||
|
|
||||||
function getProjectSuccess(data, status) {
|
function getProjectSuccess(data, status) {
|
||||||
vm.projects = data;
|
vm.projects = data;
|
||||||
if(vm.projects == null) {
|
|
||||||
|
if(!angular.isDefined(vm.projects)) {
|
||||||
|
vm.isPublic = 1;
|
||||||
vm.publicity = 1;
|
vm.publicity = 1;
|
||||||
console.log('vm.projects is null, load public projects.');
|
vm.projectType = 'public_projects';
|
||||||
|
console.log('vm.projects is undefined, load public projects.');
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.selectedProject = vm.projects[0];
|
vm.selectedProject = vm.projects[0];
|
||||||
@ -109,7 +115,6 @@
|
|||||||
'publicity': '=',
|
'publicity': '=',
|
||||||
'isProjectMember': '='
|
'isProjectMember': '='
|
||||||
},
|
},
|
||||||
link: link,
|
|
||||||
replace: true,
|
replace: true,
|
||||||
controller: RetrieveProjectsController,
|
controller: RetrieveProjectsController,
|
||||||
bindToController: true,
|
bindToController: true,
|
||||||
@ -118,9 +123,6 @@
|
|||||||
|
|
||||||
return directive;
|
return directive;
|
||||||
|
|
||||||
function link(scope, element, attrs, ctrl) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
@ -12,7 +12,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="checkbox" ng-model="vm.isPublic"> // 'public_projects' | tr //
|
<input type="checkbox" ng-model="vm.isPublic"> // 'public' | tr //
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -200,6 +200,10 @@ var global_messages = {
|
|||||||
'zh-CN': '项目'
|
'zh-CN': '项目'
|
||||||
},
|
},
|
||||||
'public_projects': {
|
'public_projects': {
|
||||||
|
'en-US': 'Public Projects',
|
||||||
|
'zh-CN': '公开项目'
|
||||||
|
},
|
||||||
|
'public': {
|
||||||
'en-US': 'Public',
|
'en-US': 'Public',
|
||||||
'zh-CN': '公开'
|
'zh-CN': '公开'
|
||||||
},
|
},
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('harbor.services.project')
|
||||||
|
.factory('GetProjectById', GetProjectById);
|
||||||
|
|
||||||
|
GetProjectById.$inject = ['$http'];
|
||||||
|
|
||||||
|
function GetProjectById($http) {
|
||||||
|
|
||||||
|
return getProject;
|
||||||
|
|
||||||
|
function getProject(id) {
|
||||||
|
return $http
|
||||||
|
.get('/api/projects/' + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -30,7 +30,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="p in vm.projects">
|
<tr ng-repeat="p in vm.projects">
|
||||||
<td><a href="/ng/repository#/repositories?project_id=//p.ProjectId//">//p.Name//</a></td>
|
<td><a href="/ng/repository#/repositories?project_id=//p.ProjectId//&is_public=//p.Public//">//p.Name//</a></td>
|
||||||
<td>N/A</td>
|
<td>N/A</td>
|
||||||
<td>N/A</td>
|
<td>N/A</td>
|
||||||
<td>//p.CreationTime | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
<td>//p.CreationTime | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user