Skip to content

Commit

Permalink
Add Details column for gc history
Browse files Browse the repository at this point in the 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 <[email protected]>
  • Loading branch information
AllForNothing authored and AllForNothing committed Jun 8, 2023
1 parent c08c7c5 commit 690d177
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ <h5 class="history-header mt-3 font-style" id="history-header">
<clr-dg-column>{{ 'GC.TRIGGER_TYPE' | translate }}</clr-dg-column>
<clr-dg-column>{{ 'TAG_RETENTION.DRY_RUN' | translate }}</clr-dg-column>
<clr-dg-column>{{ 'STATUS' | translate }}</clr-dg-column>
<clr-dg-column class="detail">{{
'TAG_RETENTION.DETAILS' | translate
}}</clr-dg-column>
<clr-dg-column>{{ 'CREATION_TIME' | translate }}</clr-dg-column>
<clr-dg-column [clrDgSortBy]="'update_time'">{{
'UPDATE_TIME' | translate
Expand All @@ -48,6 +51,58 @@ <h5 class="history-header mt-3 font-style" id="history-header">
<clr-dg-cell>{{
job.job_status.toUpperCase() | translate
}}</clr-dg-cell>
<clr-dg-cell>
<div>
<span
*ngIf="
getBlobs(job?.job_parameters) &&
getManifest(job?.job_parameters)
"
>{{
'GC.DELETE_BLOB_AND_MANIFEST'
| translate
: {
blob: getBlobs(job?.job_parameters),
manifest: getManifest(job?.job_parameters)
}
}}</span
>
<span
*ngIf="
getBlobs(job?.job_parameters) &&
!getManifest(job?.job_parameters)
"
>{{
'GC.DELETE_BLOB'
| translate
: {
blobs: getBlobs(job?.job_parameters),
manifest: getManifest(job?.job_parameters)
}
}}</span
>
<span
*ngIf="
!getBlobs(job?.job_parameters) &&
getManifest(job?.job_parameters)
"
>{{
'GC.DELETE_MANIFEST'
| translate
: {
blob: getBlobs(job?.job_parameters),
manifest: getManifest(job?.job_parameters)
}
}}</span
>
</div>
<div *ngIf="getSize(job?.job_parameters)">
{{
'GC.FREE_UP_SIZE'
| translate : { size: getSize(job?.job_parameters) }
}}
</div>
</clr-dg-cell>
<clr-dg-cell>{{
job.creation_time | harborDatetime : 'medium'
}}</clr-dg-cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
color: #007CBB;
}
}

.detail {
min-width: 12rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { GcService } from '../../../../../../../../ng-swagger-gen/services/gc.service';
import {
CURRENT_BASE_HREF,
formatSize,
getPageSizeFromLocalStorage,
getSortingString,
PageSizeMapKeys,
Expand Down Expand Up @@ -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`;
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/de-de-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/en-us-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/es-es-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/fr-fr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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é",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/pt-br-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/tr-tr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/zh-cn-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 拷贝成功",
Expand Down
6 changes: 5 additions & 1 deletion src/portal/src/i18n/lang/zh-tw-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 複製成功",
Expand Down

0 comments on commit 690d177

Please sign in to comment.