fix issue about back to public project #1918

This commit is contained in:
pengpengshui 2017-08-17 14:29:23 +08:00
parent 613dfc597d
commit 04929c98f7
5 changed files with 32 additions and 4 deletions

View File

@ -16,4 +16,6 @@
font-size: 14px;
font-style: italic;
letter-spacing: 0.01em;
}
}
.cursor{
cursor: pointer;}

View File

@ -1,4 +1,4 @@
<a *ngIf="hasSignedIn" [routerLink]="['/harbor', 'projects']">&lt; {{'PROJECT_DETAIL.PROJECTS' | translate}}</a>
<a *ngIf="hasSignedIn" (click)="backToProject()" class="cursor">&lt; {{'PROJECT_DETAIL.PROJECTS' | translate}}</a>
<a *ngIf="!hasSignedIn" [routerLink]="['/harbor', 'sign-in']">&lt; {{'SEARCH.BACK' | translate}}</a>
<h1 class="sub-header-title">{{currentProject.name}} <span class="role-label" *ngIf="isMember">{{roleName | translate}}</span></h1>

View File

@ -57,4 +57,11 @@ export class ProjectDetailComponent {
return this.sessionService.getCurrentUser() != null;
}
}
backToProject(): void {
if (window.sessionStorage) {
window.sessionStorage.setItem('fromDetails', 'true');
}
this.router.navigate(['/harbor', 'projects']);
}
}

View File

@ -13,7 +13,7 @@
</div>
<div class="option-right">
<div class="select" style="float: left; left:-6px; top:8px;">
<select (change)="doFilterProjects($event)">
<select (change)="doFilterProjects($event)" [(ngModel)]="selecteType">
<option value="0" [selected]="currentFilteredType === 0">{{projectTypes[0] | translate}}</option>
<option value="1">{{projectTypes[1] | translate}}</option>
<option value="2">{{projectTypes[2] | translate}}</option>

View File

@ -47,6 +47,7 @@ import { StatisticHandler } from '../shared/statictics/statistic-handler.service
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ProjectComponent implements OnInit, OnDestroy {
selecteType:number = 0;
changedProjects: Project[];
projectTypes = ProjectTypes;
@ -121,6 +122,16 @@ export class ProjectComponent implements OnInit, OnDestroy {
retrieve(state?: State): void {
this.projectName = "";
if (window.sessionStorage && window.sessionStorage['projectTypeValue'] && window.sessionStorage['fromDetails']) {
this.currentFilteredType = +window.sessionStorage['projectTypeValue'];
this.selecteType = this.currentFilteredType;
window.sessionStorage.removeItem('fromDetails');
}
if (this.currentFilteredType !== 0) {
this.getProjects('', this.currentFilteredType - 1);
return;
}
this.getProjects();
}
@ -175,6 +186,9 @@ export class ProjectComponent implements OnInit, OnDestroy {
} else {
this.getProjects("", this.currentFilteredType - 1);
}
if (window.sessionStorage) {
window.sessionStorage['projectTypeValue'] = this.currentFilteredType;
}
}
}
@ -192,6 +206,11 @@ export class ProjectComponent implements OnInit, OnDestroy {
} else {
this.getProjects("", this.currentFilteredType - 1);
}
this.selecteType = this.currentFilteredType;
if (window.sessionStorage) {
window.sessionStorage['projectTypeValue'] = this.currentFilteredType;
}
},
error => this.messageHandlerService.handleError(error)
);