mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 09:08:26 +01:00
Fix bug on search result ui
Fix issue #3852, After global search result returned if you research another item, the content will not refresh.
This commit is contained in:
parent
5089b26cf8
commit
456b0c40cb
@ -11,8 +11,8 @@
|
|||||||
// 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 } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, OnInit } from '@angular/core';
|
||||||
import { Router, NavigationExtras } from '@angular/router';
|
import { Router, NavigationExtras, NavigationEnd } from '@angular/router';
|
||||||
import { Repository } from 'harbor-ui';
|
import { Repository } from 'harbor-ui';
|
||||||
import { State } from 'clarity-angular';
|
import { State } from 'clarity-angular';
|
||||||
|
|
||||||
@ -23,19 +23,33 @@ import { SearchTriggerService } from '../../base/global-search/search-trigger.se
|
|||||||
templateUrl: 'list-repository-ro.component.html',
|
templateUrl: 'list-repository-ro.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class ListRepositoryROComponent {
|
export class ListRepositoryROComponent implements OnInit {
|
||||||
|
|
||||||
@Input() projectId: number;
|
@Input() projectId: number;
|
||||||
@Input() repositories: Repository[];
|
@Input() repositories: Repository[];
|
||||||
|
|
||||||
@Output() paginate = new EventEmitter<State>();
|
@Output() paginate = new EventEmitter<State>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private searchTrigger: SearchTriggerService,
|
private searchTrigger: SearchTriggerService,
|
||||||
private ref: ChangeDetectorRef) {
|
private ref: ChangeDetectorRef) {
|
||||||
let hnd = setInterval(()=>ref.markForCheck(), 100);
|
this.router.routeReuseStrategy.shouldReuseRoute = function(){
|
||||||
setTimeout(()=>clearInterval(hnd), 1000);
|
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) {
|
refresh(state: State) {
|
||||||
|
Loading…
Reference in New Issue
Block a user