From 9e0e8e066b578c5d06b2453e5a8ca77cceceb6d2 Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Tue, 28 Mar 2023 20:37:44 +0800 Subject: [PATCH] Add copy digest button for accessories (#18433) 1.Fixes #18406 Signed-off-by: AllForNothing --- .../artifact-list-tab.component.ts | 13 +++++++++++++ .../sub-accessories/sub-accessories.component.html | 5 ++++- .../sub-accessories/sub-accessories.component.scss | 14 ++++++++++++++ .../sub-accessories/sub-accessories.component.ts | 4 ++++ .../app/services/event-service/event.service.ts | 1 + src/portal/src/css/common.scss | 9 +++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts index a0ac89edb..e727e4983 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts @@ -180,6 +180,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { ] ); deleteAccessorySub: Subscription; + copyDigestSub: Subscription; @ViewChild('datagrid') datagrid; constructor( @@ -241,6 +242,14 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { } ); } + if (!this.copyDigestSub) { + this.copyDigestSub = this.eventService.subscribe( + HarborEvent.COPY_DIGEST, + (a: Accessory) => { + this.copyDigestComponent.showDigestId(a.digest); + } + ); + } } ngOnDestroy() { @@ -252,6 +261,10 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { this.deleteAccessorySub.unsubscribe(); this.deleteAccessorySub = null; } + if (this.copyDigestSub) { + this.copyDigestSub.unsubscribe(); + this.copyDigestSub = null; + } this.datagrid['columnsService']?.columns?.forEach((item, index) => { if (this.depth) { this.hiddenArray[index] = !!item?._value?.hidden; diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/sub-accessories/sub-accessories.component.html b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/sub-accessories/sub-accessories.component.html index f4f993329..5f8071f2d 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/sub-accessories/sub-accessories.component.html +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/sub-accessories/sub-accessories.component.html @@ -11,9 +11,12 @@ *ngFor="let a of displayedAccessories; let i = index" [clrDgItem]="a"> - +