From 4d60119c51b4c12ca6b93dd9dce5553c37200973 Mon Sep 17 00:00:00 2001 From: AllForNothing 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 --- .../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 262e4bb66db6..c6de076307a1 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 2b63b0ad366e..5878f296bae3 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)"> +
+
+ {{ 'JOB_SERVICE_DASHBOARD.WORKERS' | translate + }} + + + {{ 'GC.WORKERS_TOOLTIP' | translate }} + + +
+
+
+ +
+
+
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 88f4a102b09b..4d0cf4bc715d 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 13879de85d46..b48855fa26da 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 f425cc341bc8..1fe1f93bf81f 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 e68f0ae1e9f3..f7b675868612 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 fdf1b50eaf41..5c250f80da7e 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 9ffa50706599..4888c3b32df2 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 aea1bdaf4314..460578ed9d6a 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 07246c927aa0..ce89603b4562 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 982b7ce29eda..5c5726033621 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 9c81b58e7846..0f14711916df 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 複製成功",