From a6e986df62277a3ad74a53a932e934f78e50f54f Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Tue, 31 Mar 2020 14:23:49 +0800 Subject: [PATCH] [OCI] Refact artifact tag 1.get artifact tag from another api 2.add refresh button in artifact tag 3.fix permission change 4.some ui style Signed-off-by: Yogi_Wang --- .../artifact-list-tab.component.html | 2 +- .../artifact-list-tab.component.spec.ts | 4 +- .../artifact-list-tab.component.ts | 4 +- .../artifact/artifact-summary.component.html | 2 +- .../artifact/artifact-summary.component.ts | 8 +- .../artifact-tag/artifact-tag.component.html | 16 ++- .../artifact-tag/artifact-tag.component.scss | 6 + .../artifact-tag.component.spec.ts | 9 ++ .../artifact-tag/artifact-tag.component.ts | 116 +++++++++++++++--- src/portal/src/global.scss | 6 + .../src/lib/services/permission-static.ts | 66 +++++++--- 11 files changed, 187 insertions(+), 52 deletions(-) diff --git a/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html b/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html index f00cb114d..caea736cc 100644 --- a/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html +++ b/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html @@ -95,7 +95,7 @@  {{'VULNERABILITY.SCAN_NOW' | translate}} - + {{'BUTTON.ACTIONS' | translate}} diff --git a/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts b/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts index 5e4b64688..1a5c118a4 100644 --- a/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts +++ b/src/portal/src/app/project/repository/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts @@ -247,9 +247,9 @@ describe("ArtifactListTabComponent (inline template)", () => { error: () => { } }; const permissions = [ - { resource: USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.VALUE.CREATE }, + { resource: USERSTATICPERMISSION.REPOSITORY_ARTIFACT_LABEL.KEY, action: USERSTATICPERMISSION.REPOSITORY_ARTIFACT_LABEL.VALUE.CREATE }, { resource: USERSTATICPERMISSION.REPOSITORY.KEY, action: USERSTATICPERMISSION.REPOSITORY.VALUE.PULL }, - { resource: USERSTATICPERMISSION.REPOSITORY_TAG.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG.VALUE.DELETE }, + { resource: USERSTATICPERMISSION.ARTIFACT.KEY, action: USERSTATICPERMISSION.ARTIFACT.VALUE.DELETE }, { resource: USERSTATICPERMISSION.REPOSITORY_TAG_SCAN_JOB.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG_SCAN_JOB.VALUE.CREATE }, ]; const mockRouter = { 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 21a37ecc3..6738e9741 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 @@ -855,9 +855,9 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { } getImagePermissionRule(projectId: number): void { const permissions = [ - { resource: USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.VALUE.CREATE }, + { resource: USERSTATICPERMISSION.REPOSITORY_ARTIFACT_LABEL.KEY, action: USERSTATICPERMISSION.REPOSITORY_ARTIFACT_LABEL.VALUE.CREATE }, { resource: USERSTATICPERMISSION.REPOSITORY.KEY, action: USERSTATICPERMISSION.REPOSITORY.VALUE.PULL }, - { resource: USERSTATICPERMISSION.REPOSITORY_TAG.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG.VALUE.DELETE }, + { resource: USERSTATICPERMISSION.ARTIFACT.KEY, action: USERSTATICPERMISSION.ARTIFACT.VALUE.DELETE }, { resource: USERSTATICPERMISSION.REPOSITORY_TAG_SCAN_JOB.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG_SCAN_JOB.VALUE.CREATE }, ]; this.userPermissionService.hasProjectPermissions(this.projectId, permissions).subscribe((results: Array) => { diff --git a/src/portal/src/app/project/repository/artifact/artifact-summary.component.html b/src/portal/src/app/project/repository/artifact/artifact-summary.component.html index f8f90fedc..39d4085c5 100644 --- a/src/portal/src/app/project/repository/artifact/artifact-summary.component.html +++ b/src/portal/src/app/project/repository/artifact/artifact-summary.component.html @@ -23,7 +23,7 @@ + > this.loading = false)) .subscribe(response => { this.artifact = response; @@ -105,8 +103,4 @@ export class ArtifactSummaryComponent implements OnInit { onBack(): void { this.backEvt.emit(this.repositoryName); } - - refreshArtifact() { - this.getArtifactDetails(); - } } diff --git a/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html b/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html index 1f044e366..8a1eb2b6c 100644 --- a/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html +++ b/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html @@ -1,12 +1,16 @@

{{'REPOSITORY.TAGS_COUNT' | translate}}

- + + - + + +