mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-02 21:11:37 +01:00
Merge pull request #5022 from pengpengshui/hightlights
Modify leftnav and tab have no hightLight about #4996
This commit is contained in:
commit
9989a67d09
@ -11,25 +11,29 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, OnInit } from '@angular/core';
|
import { Component, Input, Output, OnDestroy, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, OnInit } from '@angular/core';
|
||||||
import { Router, NavigationEnd } from '@angular/router';
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
import { State } from 'clarity-angular';
|
import { State } from 'clarity-angular';
|
||||||
import { Repository } from 'harbor-ui';
|
import { Repository } from 'harbor-ui';
|
||||||
|
import 'rxjs/add/operator/filter';
|
||||||
|
|
||||||
import { SearchTriggerService } from '../../base/global-search/search-trigger.service';
|
import { SearchTriggerService } from '../../base/global-search/search-trigger.service';
|
||||||
|
import {Subscription} from "rxjs/Subscription";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'list-repository-ro',
|
selector: 'list-repository-ro',
|
||||||
templateUrl: 'list-repository-ro.component.html',
|
templateUrl: 'list-repository-ro.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class ListRepositoryROComponent implements OnInit {
|
export class ListRepositoryROComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
@Input() projectId: number;
|
@Input() projectId: number;
|
||||||
@Input() repositories: Repository[];
|
@Input() repositories: Repository[];
|
||||||
|
|
||||||
@Output() paginate = new EventEmitter<State>();
|
@Output() paginate = new EventEmitter<State>();
|
||||||
|
|
||||||
|
routerSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private searchTrigger: SearchTriggerService,
|
private searchTrigger: SearchTriggerService,
|
||||||
@ -37,13 +41,12 @@ export class ListRepositoryROComponent implements OnInit {
|
|||||||
this.router.routeReuseStrategy.shouldReuseRoute = function() {
|
this.router.routeReuseStrategy.shouldReuseRoute = function() {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
this.router.events.subscribe((evt) => {
|
this.routerSubscription = this.router.events.filter(event => event instanceof NavigationEnd)
|
||||||
if (evt instanceof NavigationEnd) {
|
.subscribe((event) => {
|
||||||
// trick the Router into believing it's last link wasn't previously loaded
|
// trick the Router into believing it's last link wasn't previously loaded
|
||||||
this.router.navigated = false;
|
this.router.navigated = false;
|
||||||
// if you need to scroll back to top, here is the right place
|
// if you need to scroll back to top, here is the right place
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +55,10 @@ export class ListRepositoryROComponent implements OnInit {
|
|||||||
setTimeout(() => clearInterval(hnd), 1000);
|
setTimeout(() => clearInterval(hnd), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.routerSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
refresh(state: State) {
|
refresh(state: State) {
|
||||||
if (this.repositories) {
|
if (this.repositories) {
|
||||||
this.paginate.emit(state);
|
this.paginate.emit(state);
|
||||||
|
Loading…
Reference in New Issue
Block a user