From 289f2230d72189be9de219c1c2bdfb2b0d383797 Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Tue, 30 Apr 2019 01:10:07 +0800 Subject: [PATCH] Add OIDC Redirect url on configration and fix delete repository bug and fix operation refresh bug 1. add OIDC Redirect url on configration. 2. fix delete repository bug. 3. fix operation refresh bug when user Appears when the refresh button is clicked on replicate. Signed-off-by: Yogi_Wang --- src/portal/lib/src/operation/operate.ts | 2 +- .../repository-gridview.component.ts | 106 +++++++++--------- src/portal/lib/src/service/interface.ts | 1 + .../config/auth/config-auth.component.html | 1 + .../config/auth/config-auth.component.scss | 7 +- .../app/config/auth/config-auth.component.ts | 20 +++- src/portal/src/i18n/lang/en-us-lang.json | 1 + src/portal/src/i18n/lang/es-es-lang.json | 1 + src/portal/src/i18n/lang/fr-fr-lang.json | 1 + src/portal/src/i18n/lang/pt-br-lang.json | 1 + src/portal/src/i18n/lang/zh-cn-lang.json | 1 + 11 files changed, 84 insertions(+), 58 deletions(-) diff --git a/src/portal/lib/src/operation/operate.ts b/src/portal/lib/src/operation/operate.ts index 8bb17e01a..38881ba26 100644 --- a/src/portal/lib/src/operation/operate.ts +++ b/src/portal/lib/src/operation/operate.ts @@ -8,7 +8,7 @@ export class OperateInfo { this.name = ''; this.state = ''; this.data = {id: -1, name: '', errorInf: ''}; - this.timeStamp = 0; + this.timeStamp = new Date().getTime(); this.timeDiff = 'less 1 minute'; } } diff --git a/src/portal/lib/src/repository-gridview/repository-gridview.component.ts b/src/portal/lib/src/repository-gridview/repository-gridview.component.ts index 09e85ab44..60a0b2103 100644 --- a/src/portal/lib/src/repository-gridview/repository-gridview.component.ts +++ b/src/portal/lib/src/repository-gridview/repository-gridview.component.ts @@ -138,7 +138,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { // Get system info for tag views this.systemInfoService.getSystemInfo() .subscribe(systemInfo => (this.systemInfo = systemInfo) - , error => this.errorHandler.error(error)); + , error => this.errorHandler.error(error)); if (this.mode === "admiral") { this.isCardView = true; @@ -151,29 +151,42 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { } confirmDeletion(message: ConfirmationAcknowledgement) { - if (message && - message.source === ConfirmationTargets.REPOSITORY && - message.state === ConfirmationState.CONFIRMED) { - - let repoLists = message.data; - if (repoLists && repoLists.length) { - let observableLists: any[] = []; - repoLists.forEach(repo => { - observableLists.push(this.delOperate(repo)); - }); - - forkJoin(observableLists).subscribe((item) => { - this.selectedRow = []; - this.refresh(); - let st: State = this.getStateAfterDeletion(); - if (!st) { - this.refresh(); - } else { - this.clrLoad(st); - } - }); + let repArr: any[] = []; + message.data.forEach(repo => { + if (!this.signedCon[repo.name]) { + repArr.push(this.getTagInfo(repo.name)); } - } + }); + this.loading = true; + forkJoin(...repArr).subscribe(() => { + if (message && + message.source === ConfirmationTargets.REPOSITORY && + message.state === ConfirmationState.CONFIRMED) { + let repoLists = message.data; + if (repoLists && repoLists.length) { + let observableLists: any[] = []; + repoLists.forEach(repo => { + observableLists.push(this.delOperate(repo)); + }); + forkJoin(observableLists).subscribe((item) => { + this.selectedRow = []; + this.refresh(); + let st: State = this.getStateAfterDeletion(); + if (!st) { + this.refresh(); + } else { + this.clrLoad(st); + } + }, error => { + this.errorHandler.error(error); + this.loading = false; + }); + } + } + }, error => { + this.errorHandler.error(error); + this.loading = false; + }); } delOperate(repo: RepositoryItem): Observable { @@ -238,25 +251,16 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { deleteRepos(repoLists: RepositoryItem[]) { if (repoLists && repoLists.length) { let repoNames: string[] = []; - let repArr: any[] = []; - repoLists.forEach(repo => { repoNames.push(repo.name); - - if (!this.signedCon[repo.name]) { - repArr.push(this.getTagInfo(repo.name)); - } }); - - forkJoin(...repArr).subscribe(() => { - this.confirmationDialogSet( - 'REPOSITORY.DELETION_TITLE_REPO', - '', - repoNames.join(','), - repoLists, - 'REPOSITORY.DELETION_SUMMARY_REPO', - ConfirmationButtons.DELETE_CANCEL); - }, error => this.errorHandler.error(error)); + this.confirmationDialogSet( + 'REPOSITORY.DELETION_TITLE_REPO', + '', + repoNames.join(','), + repoLists, + 'REPOSITORY.DELETION_SUMMARY_REPO', + ConfirmationButtons.DELETE_CANCEL); } } @@ -270,7 +274,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { } }); }) - , catchError(error => observableThrowError(error))); + , catchError(error => observableThrowError(error))); } confirmationDialogSet(summaryTitle: string, signature: string, @@ -311,7 +315,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { } }) - , catchError(error => observableThrowError(false))); + , catchError(error => observableThrowError(false))); } provisionItemEvent(evt: any, repo: RepositoryItem): void { @@ -358,11 +362,11 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { params.set("page_size", "" + this.pageSize); this.loading = true; - this.repositoryService.getRepositories( - this.projectId, - this.lastFilteredRepoName, - params - ) + this.repositoryService.getRepositories( + this.projectId, + this.lastFilteredRepoName, + params + ) .subscribe((repo: Repository) => { this.totalCount = repo.metadata.xTotalCount; this.repositoriesCopy = repo.data; @@ -406,11 +410,11 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { this.loading = true; - this.repositoryService.getRepositories( - this.projectId, - this.lastFilteredRepoName, - params - ) + this.repositoryService.getRepositories( + this.projectId, + this.lastFilteredRepoName, + params + ) .subscribe((repo: Repository) => { this.totalCount = repo.metadata.xTotalCount; diff --git a/src/portal/lib/src/service/interface.ts b/src/portal/lib/src/service/interface.ts index 4eeaa0dbb..2b9417abd 100644 --- a/src/portal/lib/src/service/interface.ts +++ b/src/portal/lib/src/service/interface.ts @@ -257,6 +257,7 @@ export interface SystemInfo { harbor_version?: string; clair_vulnerability_status?: ClairDBStatus; next_scan_all?: number; + external_url?: string; } /** diff --git a/src/portal/src/app/config/auth/config-auth.component.html b/src/portal/src/app/config/auth/config-auth.component.html index a835415f2..0b08a15f2 100644 --- a/src/portal/src/app/config/auth/config-auth.component.html +++ b/src/portal/src/app/config/auth/config-auth.component.html @@ -322,6 +322,7 @@
+
{{ 'CONFIG.OIDC.OIDC_REDIREC_URL' | translate}} {{redirectUrl}}/c/oidc/callback