mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-08 07:51:25 +01:00
Updates for interactions of retrieving project list in repositories.
Updates for interactions of retrieving project list in repositories.
This commit is contained in:
commit
c3540be065
@ -27,12 +27,12 @@
|
||||
|
||||
vm.projectName = '';
|
||||
vm.isOpen = false;
|
||||
vm.isProjectMember = false;
|
||||
vm.target = 'repositories';
|
||||
|
||||
vm.isPublic = Number(getParameterByName('is_public', $location.absUrl()));
|
||||
vm.publicity = (vm.isPublic === 1) ? true : false;
|
||||
|
||||
if(getParameterByName('is_public', $location.absUrl())) {
|
||||
vm.isPublic = getParameterByName('is_public', $location.absUrl()) === 'true' ? 1 : 0;
|
||||
vm.publicity = (vm.isPublic === 1) ? true : false;
|
||||
}
|
||||
|
||||
vm.retrieve = retrieve;
|
||||
vm.filterInput = '';
|
||||
vm.selectItem = selectItem;
|
||||
@ -58,20 +58,20 @@
|
||||
}
|
||||
|
||||
function getProjectSuccess(data, status) {
|
||||
vm.projects = data;
|
||||
|
||||
if(vm.projects == null) {
|
||||
vm.isPublic = 1;
|
||||
vm.publicity = true;
|
||||
vm.projectType = 'public_projects';
|
||||
console.log('vm.projects is null, load public projects.');
|
||||
return;
|
||||
vm.projects = data || [];
|
||||
|
||||
if(vm.projects.length == 0){
|
||||
if(vm.isPublic === 0) {
|
||||
$window.location.href = '/project';
|
||||
}else{
|
||||
vm.publicity = true;
|
||||
vm.projectType = 'public_projects';
|
||||
vm.target = 'repositories';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(angular.isArray(vm.projects) && vm.projects.length > 0) {
|
||||
vm.selectedProject = vm.projects[0];
|
||||
}else{
|
||||
$window.location.href = '/project';
|
||||
}
|
||||
|
||||
if(getParameterByName('project_id', $location.absUrl())){
|
||||
@ -81,10 +81,10 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$location.search('project_id', vm.selectedProject.project_id);
|
||||
|
||||
vm.checkProjectMember(vm.selectedProject.project_id);
|
||||
vm.checkProjectMember(vm.selectedProject.project_id);
|
||||
|
||||
vm.resultCount = vm.projects.length;
|
||||
|
||||
$scope.$watch('vm.filterInput', function(current, origin) {
|
||||
@ -102,11 +102,12 @@
|
||||
function selectItem(item) {
|
||||
vm.selectedProject = item;
|
||||
$location.search('project_id', vm.selectedProject.project_id);
|
||||
vm.checkProjectMember(vm.selectedProject.project_id);
|
||||
}
|
||||
|
||||
$scope.$on('$locationChangeSuccess', function(e) {
|
||||
var projectId = getParameterByName('project_id', $location.absUrl());
|
||||
vm.isOpen = false;
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
vm.isOpen = false;
|
||||
});
|
||||
|
||||
function checkProjectMember(projectId) {
|
||||
@ -121,7 +122,7 @@
|
||||
}
|
||||
|
||||
function getCurrentProjectMemberFailed(data, status) {
|
||||
vm.isProjectMember = false;
|
||||
vm.isProjectMember = false;
|
||||
console.log('Current user has no member for the project:' + status + ', location.url:' + $location.url());
|
||||
}
|
||||
|
||||
@ -132,6 +133,7 @@
|
||||
restrict: 'E',
|
||||
templateUrl: '/static/resources/js/components/details/retrieve-projects.directive.html',
|
||||
scope: {
|
||||
'target': '=',
|
||||
'isOpen': '=',
|
||||
'selectedProject': '=',
|
||||
'publicity': '=',
|
||||
@ -147,7 +149,7 @@
|
||||
|
||||
function link(scope, element, attrs, ctrl) {
|
||||
$(document).on('click', clickHandler);
|
||||
|
||||
|
||||
function clickHandler(e) {
|
||||
$('[data-toggle="popover"]').each(function () {
|
||||
if (!$(this).is(e.target) &&
|
||||
|
@ -65,11 +65,7 @@
|
||||
retrieve(vm.queryParams, vm.page, vm.pageSize);
|
||||
|
||||
$scope.$on('$locationChangeSuccess', function() {
|
||||
|
||||
if(vm.publicity) {
|
||||
vm.target = 'repositories';
|
||||
}
|
||||
|
||||
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
vm.queryParams = {
|
||||
'beginTimestamp' : vm.beginTimestamp,
|
||||
|
@ -24,13 +24,14 @@
|
||||
|
||||
function NavigationDetailsController($window, $location, $scope, getParameterByName) {
|
||||
var vm = this;
|
||||
|
||||
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
|
||||
$scope.$on('$locationChangeSuccess', function() {
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
});
|
||||
|
||||
|
||||
vm.path = $location.path();
|
||||
}
|
||||
|
||||
@ -51,19 +52,23 @@
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs, ctrl) {
|
||||
|
||||
|
||||
var visited = ctrl.path.substring(1);
|
||||
if(visited.indexOf('?') >= 0) {
|
||||
visited = ctrl.url.substring(1, ctrl.url.indexOf('?'));
|
||||
}
|
||||
|
||||
if(visited) {
|
||||
element.find('a[tag="' + visited + '"]').addClass('active');
|
||||
}else{
|
||||
element.find('a:first').addClass('active');
|
||||
}
|
||||
|
||||
ctrl.target = visited;
|
||||
|
||||
scope.$watch('vm.target', function(current) {
|
||||
if(current) {
|
||||
ctrl.target = current;
|
||||
element.find('a').removeClass('active');
|
||||
element.find('a[tag="' + ctrl.target + '"]').addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
element.find('a').on('click', click);
|
||||
|
||||
function click(event) {
|
||||
|
@ -30,7 +30,7 @@
|
||||
<navigation-details target="vm.target" ng-show="vm.isProjectMember"></navigation-details>
|
||||
</span>
|
||||
</div>
|
||||
<retrieve-projects is-open="vm.isOpen" selected-project="vm.selectedProject" is-project-member="vm.isProjectMember" publicity="vm.publicity"></retrieve-projects>
|
||||
<retrieve-projects target="vm.target" is-open="vm.isOpen" selected-project="vm.selectedProject" is-project-member="vm.isProjectMember" publicity="vm.publicity"></retrieve-projects>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content" ng-click="vm.closeRetrievePane()">
|
||||
<input type="hidden" id="HarborRegUrl" value="{{.HarborRegUrl}}">
|
||||
|
Loading…
Reference in New Issue
Block a user