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