mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Merge pull request #4768 from ninjadq/fix_bug_search_result
Fix bug on search result ui
This commit is contained in:
commit
ac8e5d6e25
@ -11,8 +11,8 @@
|
||||
// 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 } from '@angular/core';
|
||||
import { Router, NavigationExtras } from '@angular/router';
|
||||
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, OnInit } from '@angular/core';
|
||||
import { Router, NavigationExtras, NavigationEnd } from '@angular/router';
|
||||
import { Repository } from 'harbor-ui';
|
||||
import { State } from 'clarity-angular';
|
||||
|
||||
@ -23,19 +23,33 @@ import { SearchTriggerService } from '../../base/global-search/search-trigger.se
|
||||
templateUrl: 'list-repository-ro.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class ListRepositoryROComponent {
|
||||
export class ListRepositoryROComponent implements OnInit {
|
||||
|
||||
@Input() projectId: number;
|
||||
@Input() repositories: Repository[];
|
||||
|
||||
@Output() paginate = new EventEmitter<State>();
|
||||
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private searchTrigger: SearchTriggerService,
|
||||
private ref: ChangeDetectorRef) {
|
||||
let hnd = setInterval(()=>ref.markForCheck(), 100);
|
||||
setTimeout(()=>clearInterval(hnd), 1000);
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = function(){
|
||||
return false;
|
||||
};
|
||||
this.router.events.subscribe((evt) => {
|
||||
if (evt instanceof NavigationEnd) {
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
||||
setTimeout(() => clearInterval(hnd), 1000);
|
||||
}
|
||||
|
||||
refresh(state: State) {
|
||||
|
Loading…
Reference in New Issue
Block a user