From 97acf44fbce5995d03c7c892ed56aa439e7786f8 Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Wed, 8 May 2019 11:30:27 +0800 Subject: [PATCH] Fix always show loading indicator when call API failed;Z-Index issue in repository detail page when event popup widget open;Wrong robot token expiration in system settings when call API failed Signed-off-by: Yogi_Wang --- src/portal/lib/src/config/config.ts | 2 +- src/portal/lib/src/endpoint/endpoint.component.ts | 10 +++++----- src/portal/lib/src/label/label.component.ts | 10 +++++----- src/portal/lib/src/tag/tag.component.scss | 6 +----- .../app/project/project-routing-resolver.service.ts | 4 ++-- src/portal/src/app/user/user.component.ts | 5 ++--- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/portal/lib/src/config/config.ts b/src/portal/lib/src/config/config.ts index cd2193bb1..75f36669d 100644 --- a/src/portal/lib/src/config/config.ts +++ b/src/portal/lib/src/config/config.ts @@ -129,7 +129,7 @@ export class Configuration { this.email_password = new StringValueItem("", true); this.email_insecure = new BoolValueItem(false, true); this.token_expiration = new NumberValueItem(30, true); - this.robot_token_duration = new NumberValueItem(30, true); + this.robot_token_duration = new NumberValueItem(30 * (60 * 24), true); this.cfg_expiration = new NumberValueItem(30, true); this.verify_remote_cert = new BoolValueItem(false, true); this.scan_all_policy = new ComplexValueItem({ diff --git a/src/portal/lib/src/endpoint/endpoint.component.ts b/src/portal/lib/src/endpoint/endpoint.component.ts index a8feb0a9e..4915b5cf2 100644 --- a/src/portal/lib/src/endpoint/endpoint.component.ts +++ b/src/portal/lib/src/endpoint/endpoint.component.ts @@ -27,7 +27,7 @@ import { Endpoint } from "../service/interface"; import { EndpointService } from "../service/endpoint.service"; import { ErrorHandler } from "../error-handler/index"; -import { map, catchError } from "rxjs/operators"; +import { map, catchError, finalize } from "rxjs/operators"; import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message"; import { ConfirmationAcknowledgement } from "../confirmation-dialog/confirmation-state-message"; import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component"; @@ -115,14 +115,14 @@ export class EndpointComponent implements OnInit, OnDestroy { retrieve(): void { this.loading = true; this.selectedRow = []; - this.endpointService.getEndpoints(this.targetName) + this.endpointService.getEndpoints(this.targetName).pipe(finalize(() => { + this.loading = false; + this.forceRefreshView(1000); + })) .subscribe(targets => { this.targets = targets || []; - this.loading = false; - this.forceRefreshView(1000); }, error => { this.errorHandler.error(error); - this.loading = false; }); } diff --git a/src/portal/lib/src/label/label.component.ts b/src/portal/lib/src/label/label.component.ts index 406028561..8ae088fd8 100644 --- a/src/portal/lib/src/label/label.component.ts +++ b/src/portal/lib/src/label/label.component.ts @@ -34,7 +34,7 @@ import { TranslateService } from "@ngx-translate/core"; import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component"; import { operateChanges, OperateInfo, OperationState } from "../operation/operate"; import { OperationService } from "../operation/operation.service"; -import { map, catchError } from "rxjs/operators"; +import { map, catchError, finalize } from "rxjs/operators"; import { errorHandler as errorHandFn } from "../shared/shared.utils"; import { Observable, throwError as observableThrowError, forkJoin } from "rxjs"; @Component({ @@ -76,14 +76,14 @@ export class LabelComponent implements OnInit { this.loading = true; this.selectedRow = []; this.targetName = ""; - this.labelService.getLabels(scope, this.projectId, name) + this.labelService.getLabels(scope, this.projectId, name).pipe(finalize(() => { + this.loading = false; + this.forceRefreshView(2000); + })) .subscribe(targets => { this.targets = targets || []; - this.loading = false; - this.forceRefreshView(2000); }, error => { this.errorHandler.error(error); - this.loading = false; }); } diff --git a/src/portal/lib/src/tag/tag.component.scss b/src/portal/lib/src/tag/tag.component.scss index 5ace8c8cd..d3430dd59 100644 --- a/src/portal/lib/src/tag/tag.component.scss +++ b/src/portal/lib/src/tag/tag.component.scss @@ -51,7 +51,7 @@ .rightPos { position: absolute; - z-index: 600; + z-index: 1; right: 35px; margin-top: 20px; display: flex; @@ -108,10 +108,6 @@ top: 5px; } -.datagrid-action-bar { - z-index: 10; -} - .trigger-item hbr-label-piece { display: flex !important; margin: 6px 0; diff --git a/src/portal/src/app/project/project-routing-resolver.service.ts b/src/portal/src/app/project/project-routing-resolver.service.ts index e15b865cb..4b3cf5570 100644 --- a/src/portal/src/app/project/project-routing-resolver.service.ts +++ b/src/portal/src/app/project/project-routing-resolver.service.ts @@ -59,10 +59,10 @@ export class ProjectRoutingResolver implements Resolve { this.router.navigate(['/harbor', 'projects']); return null; } - }, catchError (error => { + }), catchError (error => { this.router.navigate(['/harbor', 'projects']); return null; - }))); + })); } } diff --git a/src/portal/src/app/user/user.component.ts b/src/portal/src/app/user/user.component.ts index 3e413146a..adab41fed 100644 --- a/src/portal/src/app/user/user.component.ts +++ b/src/portal/src/app/user/user.component.ts @@ -291,18 +291,17 @@ export class UserComponent implements OnInit, OnDestroy { })); } - return this.userService.deleteUser(user.user_id).pipe(map(() => { this.translate.get('BATCH.DELETED_SUCCESS').subscribe(res => { operateChanges(operMessage, OperationState.success); }); - }, catchError(error => { + }), catchError(error => { const message = errorHandFn(error); this.translate.get(message).subscribe(res => operateChanges(operMessage, OperationState.failure, res) ); return observableThrowError(message); - }))); + })); } // Refresh the user list