From f5a24d5ced10d998182bd759127ede0751e0d56f Mon Sep 17 00:00:00 2001 From: AllForNothing <sshijun@vmware.com> Date: Fri, 30 Jun 2023 17:26:54 +0800 Subject: [PATCH] Add worker parameter for GC 1. Related back-end PR #18855 Signed-off-by: AllForNothing <sshijun@vmware.com> --- .../clearing-job/clearing-job-interfact.ts | 2 ++ .../clearing-job/gc-page/gc/gc.component.html | 31 +++++++++++++++++++ .../clearing-job/gc-page/gc/gc.component.scss | 4 +++ .../clearing-job/gc-page/gc/gc.component.ts | 10 ++++++ src/portal/src/i18n/lang/de-de-lang.json | 3 +- src/portal/src/i18n/lang/en-us-lang.json | 3 +- src/portal/src/i18n/lang/es-es-lang.json | 3 +- src/portal/src/i18n/lang/fr-fr-lang.json | 3 +- src/portal/src/i18n/lang/pt-br-lang.json | 3 +- src/portal/src/i18n/lang/tr-tr-lang.json | 3 +- src/portal/src/i18n/lang/zh-cn-lang.json | 3 +- src/portal/src/i18n/lang/zh-tw-lang.json | 3 +- 12 files changed, 63 insertions(+), 8 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/clearing-job/clearing-job-interfact.ts b/src/portal/src/app/base/left-side-nav/clearing-job/clearing-job-interfact.ts index 262e4bb66db..c6de076307a 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/clearing-job-interfact.ts +++ b/src/portal/src/app/base/left-side-nav/clearing-job/clearing-job-interfact.ts @@ -20,3 +20,5 @@ export const YES: string = 'TAG_RETENTION.YES'; export const NO: string = 'TAG_RETENTION.NO'; export const REFRESH_STATUS_TIME_DIFFERENCE: number = 5000; + +export const WORKER_OPTIONS: number[] = [1, 2, 3, 4, 5]; diff --git a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.html b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.html index 2b63b0ad366..5878f296bae 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.html +++ b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.html @@ -50,6 +50,37 @@ [originCron]="originCron" (inputvalue)="saveGcSchedule($event)"></cron-selection> </div> + <div class="clr-row mb-1"> + <div class="clr-col-2 flex-200 font-style"> + {{ 'JOB_SERVICE_DASHBOARD.WORKERS' | translate + }}<clr-tooltip> + <clr-icon + clrTooltipTrigger + shape="info-circle" + size="24"></clr-icon> + <clr-tooltip-content + clrPosition="top-right" + clrSize="lg" + *clrIfOpen> + <span>{{ 'GC.WORKERS_TOOLTIP' | translate }}</span> + </clr-tooltip-content> + </clr-tooltip> + </div> + <div class="clr-col"> + <div class="clr-select-wrapper"> + <select + id="workers" + class="clr-select worker-select" + [(ngModel)]="workerNum"> + <option + *ngFor="let item of workerOptions" + value="{{ item }}"> + {{ item }} + </option> + </select> + </div> + </div> + </div> <div class="clr-row"> <div class="clr-col-2 flex-200"></div> <div class="clr-col"> diff --git a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.scss b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.scss index 88f4a102b09..4d0cf4bc715 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.scss +++ b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.scss @@ -35,3 +35,7 @@ padding-left: .6rem; padding-right: .6rem; } + +.worker-select { + width: 4.5rem; +} diff --git a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.ts b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.ts index 13879de85d4..b48855fa26d 100644 --- a/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.ts +++ b/src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.ts @@ -10,7 +10,9 @@ import { GcHistoryComponent } from './gc-history/gc-history.component'; import { JOB_STATUS, REFRESH_STATUS_TIME_DIFFERENCE, + WORKER_OPTIONS, } from '../../clearing-job-interfact'; +import { clone } from '../../../../../shared/units/utils'; const ONE_MINUTE = 60000; @@ -27,6 +29,8 @@ export class GcComponent implements OnInit, OnDestroy { @ViewChild(CronScheduleComponent) cronScheduleComponent: CronScheduleComponent; shouldDeleteUntagged: boolean; + workerNum: number = 1; + workerOptions: number[] = clone(WORKER_OPTIONS); dryRunOnGoing: boolean = false; lastCompletedTime: string; @@ -116,8 +120,10 @@ export class GcComponent implements OnInit, OnDestroy { this.shouldDeleteUntagged = JSON.parse( gcHistory.job_parameters ).delete_untagged; + this.workerNum = +JSON.parse(gcHistory.job_parameters).workers; } else { this.shouldDeleteUntagged = false; + this.workerNum = 1; } } @@ -132,6 +138,7 @@ export class GcComponent implements OnInit, OnDestroy { schedule: { parameters: { delete_untagged: this.shouldDeleteUntagged, + workers: +this.workerNum, dry_run: false, }, schedule: { @@ -157,6 +164,7 @@ export class GcComponent implements OnInit, OnDestroy { schedule: { parameters: { delete_untagged: this.shouldDeleteUntagged, + workers: +this.workerNum, dry_run: true, }, schedule: { @@ -188,6 +196,7 @@ export class GcComponent implements OnInit, OnDestroy { schedule: { parameters: { delete_untagged: this.shouldDeleteUntagged, + workers: +this.workerNum, dry_run: false, }, schedule: { @@ -212,6 +221,7 @@ export class GcComponent implements OnInit, OnDestroy { schedule: { parameters: { delete_untagged: this.shouldDeleteUntagged, + workers: +this.workerNum, dry_run: false, }, schedule: { diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index c38ae7b27a1..a55ee0b90cb 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -1236,7 +1236,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "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 1c6e09533bf..2aa6a5217e2 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -1237,7 +1237,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "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 9e40ca8a7ab..22fb70c0f43 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -1233,7 +1233,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "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 24f5feb9bce..6e02fc0f705 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -1203,7 +1203,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "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 5f4ad235862..997bcaa381a 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -1233,7 +1233,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "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 19277aac646..cd5f5681388 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -1236,7 +1236,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "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 f828778dfc8..15b97d35a04 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -1233,7 +1233,8 @@ "DELETE_BLOB_AND_MANIFEST": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 已删除", "DELETE_BLOB": "{{blob}}个 blob(s) 已删除", "DELETE_MANIFEST": "{{manifest}}个 manifest(s) 已删除", - "FREE_UP_SIZE": "{{size}}的空间已清理" + "FREE_UP_SIZE": "{{size}}的空间已清理", + "WORKERS_TOOLTIP": "设置可并行执行垃圾回收任务的工作者数量,默认值为1。" }, "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 080d89d337b..0a3af0cd62c 100644 --- a/src/portal/src/i18n/lang/zh-tw-lang.json +++ b/src/portal/src/i18n/lang/zh-tw-lang.json @@ -1225,7 +1225,8 @@ "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" + "FREE_UP_SIZE": "{{size}} space freed up", + "WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1." }, "RETAG": { "MSG_SUCCESS": "Artifact 複製成功",