From 891ef80e4664ed075048d84708ac648fd6be591d Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Mon, 16 Mar 2020 18:59:21 +0800 Subject: [PATCH] [OCI] changes some show words 1. search result show artifact count 2. replication shows changes both to all 3. fix delete bug when delete some artifact Signed-off-by: Yogi_Wang --- .../artifact-list-tab.component.ts | 33 +++++++++++++++---- .../artifact-vulnerabilities.component.html | 2 +- .../repository-gridview.component.spec.ts | 2 +- .../repository-gridview.component.ts | 15 ++++++--- .../add-rule/add-rule.component.html | 2 +- .../list-repository-ro.component.html | 2 +- .../create-edit-rule.component.html | 2 +- 7 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts b/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts index 14a505208..e6c85b902 100644 --- a/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts +++ b/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts @@ -685,7 +685,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { } retag() { - if (this.selectedRow && this.selectedRow.length) { + if (this.selectedRow && this.selectedRow.length && !this.depth) { this.retagDialogOpened = true; this.retagSrcImage = this.repoName + ":" + this.selectedRow[0].digest; } @@ -712,7 +712,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { } deleteArtifact() { - if (this.selectedRow && this.selectedRow.length) { + if (this.selectedRow && this.selectedRow.length && !this.depth) { let artifactNames: string[] = []; this.selectedRow.forEach(artifact => { artifactNames.push(artifact.digest.slice(0, 15)); @@ -744,9 +744,30 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { this.deleteArtifactobservableLists.push(this.delOperate(artifact)); }); this.loading = true; - forkJoin(...this.deleteArtifactobservableLists).subscribe((items) => { - // if delete one success refresh list - if (items.some(item => !item)) { + forkJoin(...this.deleteArtifactobservableLists).subscribe((deleteResult) => { + let deleteSuccessList = []; + let deleteErrorList = []; + deleteResult.forEach(result => { + if (!result) { + // delete success + deleteSuccessList.push(result); + } else { + deleteErrorList.push(result); + } + }); + if (deleteSuccessList.length === deleteResult.length) { + // all is success + this.selectedRow = []; + let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} }; + this.clrLoad(st); + } else if (deleteErrorList.length === deleteResult.length) { + // all is error + this.loading = false; + this.errorHandlerService.error(deleteResult[deleteResult.length - 1].error); + } else { + // some artifact delete success but it has error delete things + this.errorHandlerService.error(deleteErrorList[deleteErrorList.length - 1].error); + // if delete one success refresh list this.selectedRow = []; let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} }; this.clrLoad(st); @@ -799,7 +820,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { } showDigestId() { - if (this.selectedRow && (this.selectedRow.length === 1)) { + if (this.selectedRow && (this.selectedRow.length === 1) && !this.depth) { this.manifestInfoTitle = "REPOSITORY.COPY_DIGEST_ID"; this.digestId = this.selectedRow[0].digest; this.showTagManifestOpened = true; diff --git a/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.html b/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.html index fdeb4ae33..b0aec1130 100644 --- a/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.html +++ b/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.html @@ -69,7 +69,7 @@ {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'VULNERABILITY.GRID.FOOT_OF' | translate}} {{pagination.totalItems}} {{'VULNERABILITY.GRID.FOOT_ITEMS' | translate}} - + diff --git a/src/portal/src/app/project/repository/repository-gridview.component.spec.ts b/src/portal/src/app/project/repository/repository-gridview.component.spec.ts index a02ed9c22..9b56fccf0 100644 --- a/src/portal/src/app/project/repository/repository-gridview.component.spec.ts +++ b/src/portal/src/app/project/repository/repository-gridview.component.spec.ts @@ -90,7 +90,7 @@ describe('RepositoryComponentGridview (inline template)', () => { }; const fakedRepositoryService = { listRepositoriesResponse(params: NewRepositoryService.ListRepositoriesParams) { - if (params.name === 'nginx') { + if (params.q === encodeURIComponent(`name=~nginx`)) { return of({headers: new Map(), body: mockNginxRepo}); } return of({headers: new Map(), body: mockRepo}).pipe(delay(0)); diff --git a/src/portal/src/app/project/repository/repository-gridview.component.ts b/src/portal/src/app/project/repository/repository-gridview.component.ts index 87106a431..2e6d41e26 100644 --- a/src/portal/src/app/project/repository/repository-gridview.component.ts +++ b/src/portal/src/app/project/repository/repository-gridview.component.ts @@ -75,7 +75,8 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy cardHover = false; listHover = false; - pageSize: number = DEFAULT_PAGE_SIZE; + // pageSize: number = DEFAULT_PAGE_SIZE; + pageSize: number = 3; currentPage = 1; totalCount = 0; currentState: ClrDatagridStateInterface; @@ -315,9 +316,11 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy let params: NewRepositoryService.ListRepositoriesParams = { projectName: this.projectName, page: this.currentPage, - pageSize: this.pageSize, - name: this.lastFilteredRepoName + pageSize: this.pageSize }; + if (this.lastFilteredRepoName) { + params.q = encodeURIComponent(`name=~${this.lastFilteredRepoName}`); + } this.loading = true; this.newRepoService.listRepositoriesResponse( @@ -351,9 +354,11 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy let params: NewRepositoryService.ListRepositoriesParams = { projectName: this.projectName, page: pageNumber, - pageSize: this.pageSize, - name: this.lastFilteredRepoName + pageSize: this.pageSize }; + if (this.lastFilteredRepoName) { + params.q = encodeURIComponent(`name=~${this.lastFilteredRepoName}`); + } if (state.filters && state.filters.length) { state.filters.forEach(item => { params[item.property] = item.value; diff --git a/src/portal/src/app/project/tag-feature-integration/tag-retention/add-rule/add-rule.component.html b/src/portal/src/app/project/tag-feature-integration/tag-retention/add-rule/add-rule.component.html index 88e830266..dd2f9d5ff 100644 --- a/src/portal/src/app/project/tag-feature-integration/tag-retention/add-rule/add-rule.component.html +++ b/src/portal/src/app/project/tag-feature-integration/tag-retention/add-rule/add-rule.component.html @@ -75,7 +75,7 @@ -
+
diff --git a/src/portal/src/app/shared/list-repository-ro/list-repository-ro.component.html b/src/portal/src/app/shared/list-repository-ro/list-repository-ro.component.html index 3be971bc5..45c9b97e2 100644 --- a/src/portal/src/app/shared/list-repository-ro/list-repository-ro.component.html +++ b/src/portal/src/app/shared/list-repository-ro/list-repository-ro.component.html @@ -4,7 +4,7 @@ {{'REPOSITORY.PULL_COUNT' | translate}} {{r.name || r.repository_name}} - {{r.tags_count}} + {{r.artifact_count}} {{r.pull_count}} diff --git a/src/portal/src/lib/components/create-edit-rule/create-edit-rule.component.html b/src/portal/src/lib/components/create-edit-rule/create-edit-rule.component.html index 5d2755805..c96287773 100644 --- a/src/portal/src/lib/components/create-edit-rule/create-edit-rule.component.html +++ b/src/portal/src/lib/components/create-edit-rule/create-edit-rule.component.html @@ -82,7 +82,7 @@