mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 17:17:46 +01:00
Fix scan is repeatedly triggered and refresh Logs failed/ init time not available
Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
parent
679bab9f80
commit
3086a3eeb6
@ -203,7 +203,7 @@ describe('RecentLogComponent (inline template)', () => {
|
||||
fixture.detectChanges();
|
||||
expect(component.recentLogs).toBeTruthy();
|
||||
expect(component.logsCache).toBeTruthy();
|
||||
expect(component.recentLogs.length).toEqual(3);
|
||||
expect(component.recentLogs.length).toEqual(15);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -67,7 +67,8 @@ export class RecentLogComponent implements OnInit {
|
||||
}
|
||||
|
||||
public doFilter(terms: string): void {
|
||||
if (!terms) {
|
||||
// allow search by null characters
|
||||
if (terms === undefined || terms === null) {
|
||||
return;
|
||||
}
|
||||
this.currentTerm = terms.trim();
|
||||
|
@ -66,6 +66,8 @@ export interface Tag extends Base {
|
||||
signature?: string;
|
||||
scan_overview?: VulnerabilitySummary;
|
||||
labels: Label[];
|
||||
push_time?: string;
|
||||
pull_time?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,8 @@
|
||||
<clr-dg-column [clrDgSortBy]="createdComparator">{{'REPOSITORY.CREATED' | translate}}</clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'docker_version'" *ngIf="!withClair">{{'REPOSITORY.DOCKER_VERSION' | translate}}</clr-dg-column>
|
||||
<clr-dg-column *ngIf="!withAdmiral">{{'REPOSITORY.LABELS' | translate}}</clr-dg-column>
|
||||
<clr-dg-column>{{'REPOSITORY.PULL_TIME' | translate}}</clr-dg-column>
|
||||
<clr-dg-column>{{'REPOSITORY.PUSH_TIME' | translate}}</clr-dg-column>
|
||||
<clr-dg-column>{{'REPOSITORY.PULL_TIME' | translate}}</clr-dg-column>
|
||||
<clr-dg-placeholder>{{'TAG.PLACEHOLDER' | translate }}</clr-dg-placeholder>
|
||||
<clr-dg-row *clrDgItems="let t of tags" [clrDgItem]='t'>
|
||||
<clr-dg-cell class="truncated flex-max-width">
|
||||
@ -125,8 +125,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell>{{t.pull_time | date: 'short'}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{t.push_time | date: 'short'}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{t.pull_time | date: 'short'}}</clr-dg-cell>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<span *ngIf="pagination.totalItems">{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'REPOSITORY.OF' | translate}}</span> {{pagination.totalItems}} {{'REPOSITORY.ITEMS' | translate}}
|
||||
|
@ -66,7 +66,7 @@ export interface LabelState {
|
||||
label: Label;
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
export const AVAILABLE_TIME = '0001-01-01T00:00:00Z';
|
||||
@Component({
|
||||
selector: 'hbr-tag',
|
||||
templateUrl: './tag.component.html',
|
||||
@ -271,7 +271,10 @@ export class TagComponent implements OnInit, AfterViewInit {
|
||||
// Do filtering and sorting
|
||||
this.tags = doFiltering<Tag>(tags, state);
|
||||
this.tags = doSorting<Tag>(this.tags, state);
|
||||
|
||||
this.tags = this.tags.map(tag => {
|
||||
tag.push_time = tag.push_time === AVAILABLE_TIME ? '' : tag.push_time;
|
||||
return tag;
|
||||
});
|
||||
this.loading = false;
|
||||
}, error => {
|
||||
this.loading = false;
|
||||
@ -539,7 +542,10 @@ export class TagComponent implements OnInit, AfterViewInit {
|
||||
signatures.push(t.name);
|
||||
}
|
||||
});
|
||||
this.tags = items;
|
||||
this.tags = items.map(tag => {
|
||||
tag.push_time = tag.push_time === AVAILABLE_TIME ? '' : tag.push_time;
|
||||
return tag;
|
||||
});
|
||||
let signedName: { [key: string]: string[] } = {};
|
||||
signedName[this.repoName] = signatures;
|
||||
this.signatureOutput.emit(signedName);
|
||||
|
@ -48,8 +48,12 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.tagStatus === "running") {
|
||||
this.scanNow();
|
||||
if ((this.tagStatus === VULNERABILITY_SCAN_STATUS.running || this.tagStatus === VULNERABILITY_SCAN_STATUS.pending)
|
||||
&& !this.stateCheckTimer) {
|
||||
// Avoid duplicated subscribing
|
||||
this.stateCheckTimer = timer(0, STATE_CHECK_INTERVAL).subscribe(() => {
|
||||
this.getSummary();
|
||||
});
|
||||
}
|
||||
this.scanSubscription = this.channel.scanCommand$.subscribe((tagId: string) => {
|
||||
let myFullTag: string = this.repoName + "/" + this.tagId;
|
||||
|
Loading…
Reference in New Issue
Block a user