From 690d177000cd65b7ba0f3da48568d5d3727deca7 Mon Sep 17 00:00:00 2001 From: AllForNothing Date: Thu, 8 Jun 2023 15:35:29 +0800 Subject: [PATCH] Add Details column for gc history 1. Related #18779 2. Show how many blobs and manifest have been deleted and how much space has been freed up Signed-off-by: AllForNothing --- .../gc/gc-history/gc-history.component.html | 55 +++++++++++++++++++ .../gc/gc-history/gc-history.component.scss | 4 ++ .../gc/gc-history/gc-history.component.ts | 30 ++++++++++ src/portal/src/i18n/lang/de-de-lang.json | 6 +- src/portal/src/i18n/lang/en-us-lang.json | 6 +- src/portal/src/i18n/lang/es-es-lang.json | 6 +- src/portal/src/i18n/lang/fr-fr-lang.json | 6 +- src/portal/src/i18n/lang/pt-br-lang.json | 6 +- src/portal/src/i18n/lang/tr-tr-lang.json | 6 +- src/portal/src/i18n/lang/zh-cn-lang.json | 6 +- src/portal/src/i18n/lang/zh-tw-lang.json | 6 +- 11 files changed, 129 insertions(+), 8 deletions(-) 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 344faaa1444..f9a68dee1c2 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 @@ -26,6 +26,9 @@
{{ 'GC.TRIGGER_TYPE' | translate }} {{ 'TAG_RETENTION.DRY_RUN' | translate }} {{ 'STATUS' | translate }} + {{ + 'TAG_RETENTION.DETAILS' | translate + }} {{ 'CREATION_TIME' | translate }} {{ 'UPDATE_TIME' | translate @@ -48,6 +51,58 @@
{{ 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 + : { + blobs: getBlobs(job?.job_parameters), + manifest: getManifest(job?.job_parameters) + } + }} + {{ + 'GC.DELETE_MANIFEST' + | translate + : { + blob: getBlobs(job?.job_parameters), + manifest: getManifest(job?.job_parameters) + } + }} +
+
+ {{ + 'GC.FREE_UP_SIZE' + | translate : { 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.scss b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.scss index 6f63db9c9d8..219bcc08aec 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.scss +++ b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc-history/gc-history.component.scss @@ -18,3 +18,7 @@ color: #007CBB; } } + +.detail { + min-width: 12rem; +} 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 1bef783ff93..efbd0936d6e 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 @@ -9,6 +9,7 @@ import { import { GcService } from '../../../../../../../../ng-swagger-gen/services/gc.service'; import { CURRENT_BASE_HREF, + formatSize, getPageSizeFromLocalStorage, getSortingString, PageSizeMapKeys, @@ -202,6 +203,35 @@ export class GcHistoryComponent implements OnInit, OnDestroy { } return NO; } + getBlobs(param: string): number { + if (param) { + const paramObj: any = JSON.parse(param); + if (paramObj && paramObj.purged_blobs) { + return paramObj.purged_blobs; + } + } + return 0; + } + + getManifest(param: string): number { + if (param) { + const paramObj: any = JSON.parse(param); + if (paramObj && paramObj.purged_manifests) { + return paramObj.purged_manifests; + } + } + return 0; + } + + getSize(param: string): string { + if (param) { + const paramObj: any = JSON.parse(param); + if (paramObj && paramObj.freed_space) { + return formatSize(paramObj.freed_space); + } + } + return null; + } getLogLink(id): string { return `${CURRENT_BASE_HREF}/system/gc/${id}/log`; diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index 4d39db0ee89..8838a1e40a9 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -1230,7 +1230,11 @@ "DELETE_UNTAGGED": "Erlaube Speicherbereinigung auf Artefakte ohne Tag", "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" + "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" }, "RETAG": { "MSG_SUCCESS": "Artefakt erfolgreich kopiert", diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index fa1974c0c72..23d4caa33ef 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -1231,7 +1231,11 @@ "DELETE_UNTAGGED": "Allow garbage collection on untagged artifacts", "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" + "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" }, "RETAG": { "MSG_SUCCESS": "Copy artifact successfully", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index 25ef7708dc1..2710a8d1f29 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -1227,7 +1227,11 @@ "DELETE_UNTAGGED": "Allow garbage collection on untagged artifacts", "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" + "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" }, "RETAG": { "MSG_SUCCESS": "Copy artifact successfully", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index c3d9a256d21..7a11d89146d 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -1197,7 +1197,11 @@ "DELETE_UNTAGGED": "Supprimer les artefacts non tagués", "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" + "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" }, "RETAG": { "MSG_SUCCESS": "Artefact copié", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index 2e585f59998..9ff98904ffa 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -1227,7 +1227,11 @@ "DELETE_UNTAGGED": "Permitir coleta de artefatos sem tags", "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" + "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" }, "RETAG": { "MSG_SUCCESS": "Artefato copiado com sucesso", diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index fdbf095dc47..195cb958a90 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -1230,7 +1230,11 @@ "DELETE_UNTAGGED": "Allow garbage collection on untagged artifacts", "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" + "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" }, "RETAG": { "MSG_SUCCESS": "Copy artifact successfully", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index 26e50d0fb29..c8b8a6422f5 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -1227,7 +1227,11 @@ "DELETE_UNTAGGED": "允许回收无 tag 的 artifacts", "EXPLAIN": "垃圾回收是一个计算密集型操作,可能会影响仓库性能", "EXPLAIN_TIME_WINDOW": "在最近的两小时(默认窗口期)内被推送的 Artifacts 不会被当做垃圾回收的目标", - "DRY_RUN_SUCCESS": "触发模拟运行成功" + "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}}的空间已清理" }, "RETAG": { "MSG_SUCCESS": "Artifact 拷贝成功", diff --git a/src/portal/src/i18n/lang/zh-tw-lang.json b/src/portal/src/i18n/lang/zh-tw-lang.json index c31f3d5472f..2f651545a03 100644 --- a/src/portal/src/i18n/lang/zh-tw-lang.json +++ b/src/portal/src/i18n/lang/zh-tw-lang.json @@ -1219,7 +1219,11 @@ "DELETE_UNTAGGED": "允許對未標籤檔案進行垃圾收集", "EXPLAIN": "清理垃圾是一個計算密集的操作,可能影響註冊表的效能", "EXPLAIN_TIME_WINDOW": "Artifacts uploaded in the past 2 hours(the default window) are excluded from garbage collection", - "DRY_RUN_SUCCESS": "成功觸發測試執行" + "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" }, "RETAG": { "MSG_SUCCESS": "Artifact 複製成功",