Merge pull request #4756 from ninjadq/fix_multiple_scan_after_add_label

Fix bug sent multiple scan request
This commit is contained in:
Steven Zou 2018-04-20 21:01:08 +08:00 committed by GitHub
commit fcf4807583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "harbor-ui", "name": "harbor-ui",
"version": "0.7.2", "version": "0.7.5",
"description": "Harbor shared UI components based on Clarity and Angular4", "description": "Harbor shared UI components based on Clarity and Angular4",
"scripts": { "scripts": {
"start": "ng serve --host 0.0.0.0 --port 4500 --proxy-config proxy.config.json", "start": "ng serve --host 0.0.0.0 --port 4500 --proxy-config proxy.config.json",
@ -29,9 +29,9 @@
"@ngx-translate/core": "^6.0.0", "@ngx-translate/core": "^6.0.0",
"@ngx-translate/http-loader": "0.0.3", "@ngx-translate/http-loader": "0.0.3",
"@webcomponents/custom-elements": "^1.0.0", "@webcomponents/custom-elements": "^1.0.0",
"clarity-angular": "^0.10.17", "clarity-angular": "^0.10.27",
"clarity-icons": "^0.10.17", "clarity-icons": "^0.10.27",
"clarity-ui": "^0.10.17", "clarity-ui": "^0.10.27",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"intl": "^1.2.5", "intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2", "mutationobserver-shim": "^0.3.2",
@ -70,4 +70,4 @@
"uglify-js": "^2.8.22", "uglify-js": "^2.8.22",
"webdriver-manager": "10.2.5" "webdriver-manager": "10.2.5"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "harbor-ui", "name": "harbor-ui",
"version": "0.7.2", "version": "0.7.5",
"description": "Harbor shared UI components based on Clarity and Angular4", "description": "Harbor shared UI components based on Clarity and Angular4",
"author": "VMware", "author": "VMware",
"module": "index.js", "module": "index.js",

View File

@ -39,7 +39,7 @@ export const TAG_TEMPLATE = `
</div> </div>
</div> </div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<clr-datagrid [clrDgLoading]="loading" [class.embeded-datagrid]="isEmbedded" [(clrDgSelected)]="selectedRow" (clrDgSelectedChange)="selectedChange()"> <clr-datagrid [clrDgLoading]="loading" [class.embeded-datagrid]="isEmbedded" [(clrDgSelected)]="selectedRow">
<clr-dg-action-bar> <clr-dg-action-bar>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!(canScanNow(selectedRow) && selectedRow.length==1)" (click)="scanNow(selectedRow)"><clr-icon shape="shield-check" size="16"></clr-icon>&nbsp;{{'VULNERABILITY.SCAN_NOW' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" [disabled]="!(canScanNow(selectedRow) && selectedRow.length==1)" (click)="scanNow(selectedRow)"><clr-icon shape="shield-check" size="16"></clr-icon>&nbsp;{{'VULNERABILITY.SCAN_NOW' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!(selectedRow.length==1)" (click)="showDigestId(selectedRow)" ><clr-icon shape="copy" size="16"></clr-icon>&nbsp;{{'REPOSITORY.COPY_DIGEST_ID' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" [disabled]="!(selectedRow.length==1)" (click)="showDigestId(selectedRow)" ><clr-icon shape="copy" size="16"></clr-icon>&nbsp;{{'REPOSITORY.COPY_DIGEST_ID' | translate}}</button>

View File

@ -292,7 +292,7 @@ export class TagComponent implements OnInit, AfterViewInit {
}); });
} }
selectedChange(tag?: Tag[]): void { labelSelectedChange(tag?: Tag[]): void {
if (tag && tag[0].labels && tag[0].labels.length) { if (tag && tag[0].labels && tag[0].labels.length) {
this.imageStickLabels.forEach(data => { this.imageStickLabels.forEach(data => {
data.iconsShow = false; data.iconsShow = false;
@ -307,7 +307,7 @@ export class TagComponent implements OnInit, AfterViewInit {
this.labelListOpen = true; this.labelListOpen = true;
this.selectedTag = tag; this.selectedTag = tag;
this.selectedChange(tag); this.labelSelectedChange(tag);
} }
stickLabel(labelInfo: {[key: string]: any | string[]}): void { stickLabel(labelInfo: {[key: string]: any | string[]}): void {

View File

@ -39,6 +39,7 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
onSubmitting: boolean = false; onSubmitting: boolean = false;
retryCounter: number = 0; retryCounter: number = 0;
stateCheckTimer: Subscription; stateCheckTimer: Subscription;
scanSubscription: Subscription;
timerHandler: any; timerHandler: any;
@ViewChild("scanningLogViewer") @ViewChild("scanningLogViewer")
@ -53,7 +54,7 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.channel.scanCommand$.subscribe((tagId: string) => { this.scanSubscription = this.channel.scanCommand$.subscribe((tagId: string) => {
let myFullTag: string = this.repoName + "/" + this.tagId; let myFullTag: string = this.repoName + "/" + this.tagId;
if (myFullTag === tagId) { if (myFullTag === tagId) {
this.scanNow(); this.scanNow();
@ -66,6 +67,9 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
this.stateCheckTimer.unsubscribe(); this.stateCheckTimer.unsubscribe();
this.stateCheckTimer = null; this.stateCheckTimer = null;
} }
if (this.scanSubscription) {
this.scanSubscription.unsubscribe()
};
} }
//Get vulnerability scanning status //Get vulnerability scanning status

View File

@ -26,11 +26,11 @@
"@ngx-translate/http-loader": "0.0.3", "@ngx-translate/http-loader": "0.0.3",
"@types/jquery": "^2.0.41", "@types/jquery": "^2.0.41",
"@webcomponents/custom-elements": "^1.0.0", "@webcomponents/custom-elements": "^1.0.0",
"clarity-angular": "0.10.24", "clarity-angular": "^0.10.27",
"clarity-icons": "0.10.24", "clarity-icons": "^0.10.27",
"clarity-ui": "0.10.24", "clarity-ui": "^0.10.27",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"harbor-ui": "0.7.4", "harbor-ui": "0.7.5",
"intl": "^1.2.5", "intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2", "mutationobserver-shim": "^0.3.2",
"ngx-cookie": "^1.0.0", "ngx-cookie": "^1.0.0",