diff --git a/src/jobservice/job/impl/gc/garbage_collection.go b/src/jobservice/job/impl/gc/garbage_collection.go index de955ab73..61cacdeec 100644 --- a/src/jobservice/job/impl/gc/garbage_collection.go +++ b/src/jobservice/job/impl/gc/garbage_collection.go @@ -230,6 +230,9 @@ func (gc *GarbageCollector) mark(ctx job.Context) error { blobs = append(blobs, orphanBlobs...) } if len(blobs) == 0 { + if err := saveGCRes(ctx, int64(0), int64(0), int64(0)); err != nil { + gc.logger.Errorf("failed to save the garbage collection results, errMsg=%v", err) + } gc.logger.Info("no need to execute GC as there is no non referenced artifacts.") return nil } @@ -269,6 +272,12 @@ func (gc *GarbageCollector) mark(ctx job.Context) error { } gc.logger.Infof("%d blobs and %d manifests eligible for deletion", blobCt, mfCt) gc.logger.Infof("The GC could free up %d MB space, the size is a rough estimation.", makeSize/1024/1024) + + if gc.dryRun { + if err := saveGCRes(ctx, makeSize, int64(blobCt), int64(mfCt)); err != nil { + gc.logger.Errorf("failed to save the garbage collection results, errMsg=%v", err) + } + } return nil } diff --git a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.html b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.html index 211d44bed..736126bcf 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.html +++ b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.html @@ -52,54 +52,26 @@ job.job_status.toUpperCase() | translate }} -
- {{ - 'GC.DELETE_BLOB_AND_MANIFEST' - | translate - : { - blob: getBlobs(job?.job_parameters), - manifest: getManifest(job?.job_parameters) - } - }} - {{ - 'GC.DELETE_BLOB' - | translate - : { - blob: getBlobs(job?.job_parameters), - } - }} - {{ - 'GC.DELETE_MANIFEST' - | translate - : { - manifest: getManifest(job?.job_parameters) - } - }} -
-
- {{ - 'GC.FREE_UP_SIZE' - | translate : { size: getSize(job?.job_parameters) } - }} -
+ + {{ + 'GC.DELETE_DETAIL' + | translate + : { + blob: getBlobs(job?.job_parameters), + manifest: getManifest(job?.job_parameters), + size: getSize(job?.job_parameters) + } + }} + {{ + 'GC.DELETE_DETAIL_DRY_RUN' + | translate + : { + blob: getBlobs(job?.job_parameters), + manifest: getManifest(job?.job_parameters), + size: getSize(job?.job_parameters) + } + }} +
{{ job.creation_time | harborDatetime : 'medium' diff --git a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.ts b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.ts index efbd0936d..b591bfa47 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.ts +++ b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.ts @@ -46,6 +46,8 @@ export class GcHistoryComponent implements OnInit, OnDestroy { selectedRow: GCHistory[] = []; isStopOnGoing: boolean = false; subscription: Subscription; + protected readonly NO = NO; + protected readonly YES = YES; constructor( private gcService: GcService, private errorHandler: ErrorHandler, @@ -154,6 +156,8 @@ export class GcHistoryComponent implements OnInit, OnDestroy { item2.job_status = item.job_status; item2.update_time = item.update_time; + item2.job_parameters = + item.job_parameters; } }); }); @@ -230,7 +234,7 @@ export class GcHistoryComponent implements OnInit, OnDestroy { return formatSize(paramObj.freed_space); } } - return null; + return '0'; } getLogLink(id): string { @@ -265,4 +269,8 @@ export class GcHistoryComponent implements OnInit, OnDestroy { ); this.confirmationDialogService.openComfirmDialog(StopExecutionsMessage); } + + shouldShowDetails(status: string): boolean { + return status !== JOB_STATUS.PENDING && status !== JOB_STATUS.RUNNING; + } } diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index d2d8e7922..2e22ecc8b 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -1233,10 +1233,8 @@ "EXPLAIN": "Speicherbereinigung (Garbage Collection / GC) ist eine rechenintensive Operation, die die Registry-Leistung beeinflussen kann", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "Probelauf erfolgreich gestartet", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up", "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index 736c25a9f..db69c6120 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -1234,10 +1234,8 @@ "EXPLAIN": "GC is a compute intensive operation that may impact registry performance", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "Triggered dry run successfully", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up", "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index 0a3ae0576..45560d455 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -1230,10 +1230,8 @@ "EXPLAIN": "GC is a compute intensive operation that may impact registry performance", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "Triggered dry run successfully", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up",, "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index e0a3c0894..d0c3c00a1 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -1200,10 +1200,8 @@ "EXPLAIN": "GC est une opération gourmande en puissance de calcul qui peut impacter les performances du registre", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "Exécution à blanc déclenchée avec succès", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up", "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index c168266fc..08231df3a 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -1230,10 +1230,8 @@ "EXPLAIN": "A limpeza exige recursos computacionais e pode impactar performance.", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "Teste executado com sucesso", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up", "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index c3f9da65b..d85854fd1 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -1233,10 +1233,8 @@ "EXPLAIN": "GC is a compute intensive operation that may impact registry performance", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "Triggered dry run successfully", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up", "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index 38bfcb7e2..288ddd4fa 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -1230,10 +1230,8 @@ "EXPLAIN": "垃圾回收是一个计算密集型操作,可能会影响仓库性能", "EXPLAIN_TIME_WINDOW": "在最近的两小时(默认窗口期)内被推送的 Artifacts 不会被当做垃圾回收的目标", "DRY_RUN_SUCCESS": "触发模拟运行成功", - "DELETE_BLOB_AND_MANIFEST": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 已删除", - "DELETE_BLOB": "{{blob}}个 blob(s) 已删除", - "DELETE_MANIFEST": "{{manifest}}个 manifest(s) 已删除", - "FREE_UP_SIZE": "{{size}}的空间已清理", + "DELETE_DETAIL": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 已删除,{{size}}的空间已清理", + "DELETE_DETAIL_DRY_RUN": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 将被删除,{{size}}的空间将被清理", "WORKERS_TOOLTIP": "设置可并行执行垃圾回收任务的工作者数量,默认值为1。" }, "RETAG": { diff --git a/src/portal/src/i18n/lang/zh-tw-lang.json b/src/portal/src/i18n/lang/zh-tw-lang.json index a32383740..b915fa4b7 100644 --- a/src/portal/src/i18n/lang/zh-tw-lang.json +++ b/src/portal/src/i18n/lang/zh-tw-lang.json @@ -1222,10 +1222,8 @@ "EXPLAIN": "清理垃圾是一個計算密集的操作,可能影響註冊表的效能", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", "DRY_RUN_SUCCESS": "成功觸發測試執行", - "DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted", - "DELETE_BLOB": "{{blob}} blob(s) deleted", - "DELETE_MANIFEST": "{{manifest}} manifest(s) deleted", - "FREE_UP_SIZE": "{{size}} space freed up", + "DELETE_DETAIL": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted, {{size}} space freed up", + "DELETE_DETAIL_DRY_RUN": "{{blob}} blob(s) and {{manifest}} manifest(s) could be deleted, {{size}} space could be freed up", "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": {