diff --git a/src/portal/lib/src/tag/tag.component.html b/src/portal/lib/src/tag/tag.component.html index add76442e..88449dae5 100644 --- a/src/portal/lib/src/tag/tag.component.html +++ b/src/portal/lib/src/tag/tag.component.html @@ -55,10 +55,10 @@
- - + + - +
@@ -75,8 +75,8 @@ - - + + {{'REPOSITORY.TAG' | translate}} {{'REPOSITORY.SIZE' | translate}} @@ -109,7 +109,7 @@
- +
diff --git a/src/portal/lib/src/tag/tag.component.ts b/src/portal/lib/src/tag/tag.component.ts index 6b161914f..970f525c6 100644 --- a/src/portal/lib/src/tag/tag.component.ts +++ b/src/portal/lib/src/tag/tag.component.ts @@ -153,6 +153,7 @@ export class TagComponent implements OnInit, AfterViewInit { hasScanImagePermission: boolean; hasEnabledScanner: boolean; scanBtnState: ClrLoadingState = ClrLoadingState.DEFAULT; + onSendingScanCommand: boolean; constructor( private errorHandler: ErrorHandler, private tagService: TagService, @@ -318,11 +319,11 @@ export class TagComponent implements OnInit, AfterViewInit { } } - addLabels(tag: Tag[]): void { + addLabels(): void { this.labelListOpen = true; - this.selectedTag = tag; + this.selectedTag = this.selectedRow; this.stickName = ''; - this.labelSelectedChange(tag); + this.labelSelectedChange(this.selectedRow); } stickLabel(labelInfo: LabelState): void { @@ -558,10 +559,10 @@ export class TagComponent implements OnInit, AfterViewInit { } } - retag(tags: Tag[]) { - if (tags && tags.length) { + retag() { + if (this.selectedRow && this.selectedRow.length) { this.retagDialogOpened = true; - this.retagSrcImage = this.repoName + ":" + tags[0].digest; + this.retagSrcImage = this.repoName + ":" + this.selectedRow[0].digest; } else { this.errorHandler.error("One tag should be selected before retag."); } @@ -588,10 +589,10 @@ export class TagComponent implements OnInit, AfterViewInit { }); } - deleteTags(tags: Tag[]) { - if (tags && tags.length) { + deleteTags() { + if (this.selectedRow && this.selectedRow.length) { let tagNames: string[] = []; - tags.forEach(tag => { + this.selectedRow.forEach(tag => { tagNames.push(tag.name); }); @@ -604,7 +605,7 @@ export class TagComponent implements OnInit, AfterViewInit { titleKey, summaryKey, content, - tags, + this.selectedRow, ConfirmationTargets.TAG, buttons); this.confirmationDialog.open(message); @@ -670,10 +671,10 @@ export class TagComponent implements OnInit, AfterViewInit { } } - showDigestId(tag: Tag[]) { - if (tag && (tag.length === 1)) { + showDigestId() { + if (this.selectedRow && (this.selectedRow.length === 1)) { this.manifestInfoTitle = "REPOSITORY.COPY_DIGEST_ID"; - this.digestId = tag[0].digest; + this.digestId = this.selectedRow[0].digest; this.showTagManifestOpened = true; this.copyFailed = false; } @@ -716,9 +717,10 @@ export class TagComponent implements OnInit, AfterViewInit { return VULNERABILITY_SCAN_STATUS.NOT_SCANNED; } // Whether show the 'scan now' menu - canScanNow(t: Tag[]): boolean { + canScanNow(): boolean { if (!this.hasScanImagePermission) { return false; } - let st: string = this.scanStatus(t[0]); + if (this.onSendingScanCommand) { return false; } + let st: string = this.scanStatus(this.selectedRow[0]); return st !== VULNERABILITY_SCAN_STATUS.RUNNING; } getImagePermissionRule(projectId: number): void { @@ -742,15 +744,18 @@ export class TagComponent implements OnInit, AfterViewInit { }, error => this.errorHandler.error(error)); } // Trigger scan - scanNow(t: Tag[]): void { - if (t && t.length) { - t.forEach((data: any) => { + scanNow(): void { + if (this.selectedRow && this.selectedRow.length) { + this.selectedRow.forEach((data: any) => { let tagId = data.name; + this.onSendingScanCommand = true; this.channel.publishScanEvent(this.repoName + "/" + tagId); }); } } - + submitFinish(e: boolean) { + this.onSendingScanCommand = e; + } // pull command onCpError($event: any): void { this.copyInput.setPullCommendShow(); diff --git a/src/portal/lib/src/vulnerability-scanning/result-bar-chart.component.ts b/src/portal/lib/src/vulnerability-scanning/result-bar-chart.component.ts index 53b0f9fac..8cdbe470e 100644 --- a/src/portal/lib/src/vulnerability-scanning/result-bar-chart.component.ts +++ b/src/portal/lib/src/vulnerability-scanning/result-bar-chart.component.ts @@ -3,7 +3,7 @@ import { Input, OnInit, OnDestroy, - ChangeDetectorRef, + ChangeDetectorRef, Output, EventEmitter, } from '@angular/core'; import { Subscription , timer} from "rxjs"; @@ -17,6 +17,7 @@ import { import { ErrorHandler } from '../error-handler/index'; import { ChannelService } from '../channel/index'; import { JobLogService } from "../service/index"; +import { finalize } from "rxjs/operators"; const STATE_CHECK_INTERVAL: number = 3000; // 3s const RETRY_TIMES: number = 3; @@ -35,6 +36,8 @@ export class ResultBarChartComponent implements OnInit, OnDestroy { stateCheckTimer: Subscription; scanSubscription: Subscription; timerHandler: any; + @Output() + submitFinish: EventEmitter = new EventEmitter(); constructor( private tagService: TagService, @@ -114,6 +117,7 @@ export class ResultBarChartComponent implements OnInit, OnDestroy { this.onSubmitting = true; this.scanningService.startVulnerabilityScanning(this.repoName, this.tagId) + .pipe(finalize(() => this.submitFinish.emit(false))) .subscribe(() => { this.onSubmitting = false; diff --git a/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html b/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html index 919c0f6b9..ba23c043a 100644 --- a/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html +++ b/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.html @@ -26,7 +26,7 @@ {{fixableCount}} {{'SCANNER.FIXABLE' | translate}}
-
{{'VULNERABILITY.NO_VULNERABILITY' | translate }}
+
{{'VULNERABILITY.NO_VULNERABILITY' | translate }}
diff --git a/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss b/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss index 338a18c9d..a22e514ed 100644 --- a/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss +++ b/src/portal/lib/src/vulnerability-scanning/result-tip-histogram/result-tip-histogram.component.scss @@ -288,8 +288,6 @@ hr { color: green; } .tip-block { - height: $thirty-pixel; - line-height: $thirty-pixel; position: relative; } .font-size-14 { diff --git a/src/portal/lib/src/vulnerability-scanning/scanning.scss b/src/portal/lib/src/vulnerability-scanning/scanning.scss index d462d8cae..aee468bf7 100644 --- a/src/portal/lib/src/vulnerability-scanning/scanning.scss +++ b/src/portal/lib/src/vulnerability-scanning/scanning.scss @@ -1,6 +1,5 @@ .bar-wrapper { width: 210px; - height: 15px; } .bar-state { text-align: center !important; @@ -10,7 +9,6 @@ } .bar-state-chart { - margin-top: 2px; .loop-height { height: 2px; } @@ -18,7 +16,6 @@ .bar-state-error { position: relative; - top: -4px; } .error-text {