From 38d7eda1ad0befb0a8d6db303aa15b23ebe737d3 Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Tue, 7 Mar 2023 18:12:08 +0800 Subject: [PATCH] Update UI for the deprecation of Artifact Hub (#18303) 1. Update edit-registry page to enable the edition for Artifact Hub 2. Update edit-replication-rule page to enable the edition for rules contain Artifact Hub Signed-off-by: AllForNothing --- .../create-edit-endpoint.component.html | 20 +++++-- .../create-edit-endpoint.component.scss | 4 -- .../create-edit-endpoint.component.ts | 20 +------ .../registries/endpoint.component.html | 20 ++----- .../registries/endpoint.component.ts | 8 +-- .../create-edit-rule.component.ts | 57 ++++++++----------- .../list-replication-rule.component.html | 14 ----- .../list-replication-rule.component.ts | 6 -- .../app/shared/services/endpoint.service.ts | 2 - 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 +- 17 files changed, 54 insertions(+), 121 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.html b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.html index 44bf53895..abed60fb9 100644 --- a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.html +++ b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.html @@ -27,12 +27,20 @@ (change)="adapterChange($event)" [(ngModel)]="target.type" [disabled]="testOngoing || editDisabled"> - + + + + + + diff --git a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.scss b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.scss index 9c0206436..e7b649c29 100644 --- a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.scss +++ b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.scss @@ -74,7 +74,3 @@ display: flex; align-items: center; } - - .hidden{ - display:none; - } diff --git a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts index f3cda0eb0..79e28c402 100644 --- a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts +++ b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts @@ -25,7 +25,7 @@ import { Subscription, throwError as observableThrowError } from 'rxjs'; import { TranslateService } from '@ngx-translate/core'; import { ErrorHandler } from '../../../../shared/units/error-handler'; import { InlineAlertComponent } from '../../../../shared/components/inline-alert/inline-alert.component'; -import { Endpoint, PingEndpoint } from '../../../../shared/services/interface'; +import { Endpoint, PingEndpoint } from '../../../../shared/services'; import { clone, compareValue, @@ -35,10 +35,7 @@ import { import { HttpClient } from '@angular/common/http'; import { catchError } from 'rxjs/operators'; import { AppConfigService } from '../../../../services/app-config.service'; -import { - EndpointService, - HELM_HUB, -} from '../../../../shared/services/endpoint.service'; +import { EndpointService } from '../../../../shared/services/endpoint.service'; import { ClrLoadingState } from '@clr/angular'; const FAKE_PASSWORD = 'rjGcfuRu'; @@ -56,7 +53,6 @@ export class CreateEditEndpointComponent modalTitle: string; urlDisabled: boolean = false; editDisabled: boolean = false; - controlEnabled: boolean = false; createEditDestinationOpened: boolean; staticBackdrop: boolean = true; closable: boolean = false; @@ -64,11 +60,9 @@ export class CreateEditEndpointComponent adapterList: string[]; endpointList: any[] = []; target: Endpoint = this.initEndpoint(); - selectedType: string; initVal: Endpoint; targetForm: NgForm; @ViewChild('targetForm') currentForm: NgForm; - targetEndpoint; testOngoing: boolean; onGoing: boolean; endpointId: number | string; @@ -101,12 +95,6 @@ export class CreateEditEndpointComponent this.endpointService.getAdapters().subscribe( adapters => { this.adapterList = adapters || []; - // disable helm-hub - for (let i = 0; i < this.adapterList.length; i++) { - if (this.adapterList[i] === HELM_HUB) { - this.adapterList.splice(i, 1); - } - } }, error => { this.errorHandler.error(error); @@ -521,8 +509,4 @@ export class CreateEditEndpointComponent getAdapterText(adapter: string): string { return this.endpointService.getAdapterText(adapter); } - // hide helm hub option when creating registry - shouldHide(adapter: string) { - return adapter === HELM_HUB && !this.endpointId; - } } diff --git a/src/portal/src/app/base/left-side-nav/registries/endpoint.component.html b/src/portal/src/app/base/left-side-nav/registries/endpoint.component.html index e0b616174..e705df91c 100644 --- a/src/portal/src/app/base/left-side-nav/registries/endpoint.component.html +++ b/src/portal/src/app/base/left-side-nav/registries/endpoint.component.html @@ -74,6 +74,9 @@ {{ 'DESTINATION.CREATION_TIME' | translate }} + {{ + 'REPLICATION.DESCRIPTION' | translate + }} {{ 'DESTINATION.PLACEHOLDER' | translate }} @@ -100,22 +103,6 @@ {{ getAdapterText(t.type) }} - - - - {{ - 'DESTINATION.DEPRECATED' | translate - }} - - {{ !t.insecure }} @@ -124,6 +111,7 @@ {{ t.creation_time | harborDatetime: 'short' }} + {{ t.description }} { - let srcRegistryId = ruleInfo.src_registry.id; - this.repService - .getRegistryInfo(srcRegistryId) - .pipe(finalize(() => (this.onGoing = false))) - .subscribe( - adapter => { - this.setFilterAndTrigger(adapter); - this.updateRuleFormAndCopyUpdateForm(ruleInfo); - }, - (error: any) => { - this.translateService - .get( - 'REPLICATION.UNREACHABLE_SOURCE_REGISTRY', - { - error: errorHandlerFn(error), - } - ) - .subscribe(translatedResponse => { - this.inlineAlert.showInlineError( - translatedResponse - ); - }); - } - ); - }, - (error: any) => { - this.onGoing = false; - this.inlineAlert.showInlineError(error); - } - ); + this.repService + .getRegistryInfo(rule.src_registry.id) + .pipe(finalize(() => (this.onGoing = false))) + .subscribe({ + next: adapter => { + this.setFilterAndTrigger(adapter); + this.updateRuleFormAndCopyUpdateForm(rule); + }, + error: (error: any) => { + // if error, use default(set registry id to 0) filters and triggers + this.repService.getRegistryInfo(0).subscribe(res => { + this.setFilterAndTrigger(res); + this.updateRuleFormAndCopyUpdateForm(rule); + }); + this.translateService + .get('REPLICATION.UNREACHABLE_SOURCE_REGISTRY', { + error: errorHandlerFn(error), + }) + .subscribe(translatedResponse => { + this.inlineAlert.showInlineError( + translatedResponse + ); + }); + }, + }); } else { this.onGoing = true; let registryObs = this.repService.getRegistryInfo(0); diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html index 8b3c23ebc..3131746fd 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html +++ b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html @@ -142,20 +142,6 @@ {{ p.src_registry ? p.src_registry.name : '' }} - - - - {{ 'DESTINATION.DEPRECATED' | translate }} - - {{ diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts index 7ccb7577c..e5df9852c 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts +++ b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts @@ -47,12 +47,10 @@ import { ClrDatagridStateInterface } from '@clr/angular'; import { errorHandler } from '../../../../../shared/units/shared.utils'; import { ConfirmationAcknowledgement } from '../../../../global-confirmation-dialog/confirmation-state-message'; import { ConfirmationMessage } from '../../../../global-confirmation-dialog/confirmation-message'; -import { HELM_HUB } from '../../../../../shared/services/endpoint.service'; import { BandwidthUnit, Flatten_I18n_MAP } from '../../replication'; import { KB_TO_MB } from '../create-edit-rule/create-edit-rule.component'; import { ReplicationService } from 'ng-swagger-gen/services/replication.service'; import { ReplicationPolicy } from '../../../../../../../ng-swagger-gen/models/replication-policy'; -import { JobserviceService } from '../../../../../../../ng-swagger-gen/services/jobservice.service'; import { ReplicationTrigger } from '../../../../../../../ng-swagger-gen/models/replication-trigger'; import { TRIGGER, @@ -369,10 +367,6 @@ export class ListReplicationRuleComponent implements OnInit { this.clrLoad(); } - isHelmHub(srcRegistry: any): boolean { - return srcRegistry && srcRegistry.type === HELM_HUB; - } - getFlattenLevelString(level: number) { if (level !== null && Flatten_I18n_MAP[level]) { return Flatten_I18n_MAP[level]; diff --git a/src/portal/src/app/shared/services/endpoint.service.ts b/src/portal/src/app/shared/services/endpoint.service.ts index b863671ad..2ecf3a12c 100644 --- a/src/portal/src/app/shared/services/endpoint.service.ts +++ b/src/portal/src/app/shared/services/endpoint.service.ts @@ -31,8 +31,6 @@ export const ADAPTERS_MAP = { 'github-ghcr': 'Github GHCR', }; -export const HELM_HUB: string = 'helm-hub'; - /** * Define the service methods to handle the endpoint related things. * diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index dc550db4c..74d4654e0 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -696,8 +696,7 @@ "DELETED_FAILED": "Löschen des Endpunktes fehlgeschlagen.", "CANNOT_EDIT": "Endpunkt kann nicht geändert werden, während die Replikationsregel aktiviert ist.", "FAILED_TO_DELETE_TARGET_IN_USED": "Genutzter Endpunkt konnte nicht gelöscht werden.", - "PLACEHOLDER": "Wir konnten keine Endpunkt finden.", - "DEPRECATED": "Helm Hub wird nach Artifact Hub migriert" + "PLACEHOLDER": "Wir konnten keine Endpunkt finden." }, "REPOSITORY": { "COPY_DIGEST_ID": "Kopiere Digest", diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index be7bb5999..86eb3426c 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -696,8 +696,7 @@ "DELETED_FAILED": "Deleted endpoints failed.", "CANNOT_EDIT": "Endpoint cannot be changed while the replication rule is enabled.", "FAILED_TO_DELETE_TARGET_IN_USED": "Failed to delete the endpoint in use.", - "PLACEHOLDER": "We couldn't find any endpoints!", - "DEPRECATED": "Helm Hub is moving to Artifact Hub" + "PLACEHOLDER": "We couldn't find any endpoints!" }, "REPOSITORY": { "COPY_DIGEST_ID": "Copy Digest", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index 8086c1160..e7d24a1b3 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -698,8 +698,7 @@ "DELETED_FAILED": "Ha fallado la eliminación del endpoint.", "CANNOT_EDIT": "El endpoint no puede ser cambiado mientras la regla de replicación está activa.", "FAILED_TO_DELETE_TARGET_IN_USED": "Fallo al eliminar el endpoint en uso.", - "PLACEHOLDER": "We couldn't find any endpoints!", - "DEPRECATED": "Helm Hub is moving to Artifact Hub" + "PLACEHOLDER": "We couldn't find any endpoints!" }, "REPOSITORY": { "COPY_DIGEST_ID": "Copy Digest", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index db6ea451a..39cd57d62 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -685,8 +685,7 @@ "DELETED_FAILED": "Echec de la suppression du Endpoint", "CANNOT_EDIT": "Le Endpoint ne peut pas être modifié tant que la règle de réplication est activée.", "FAILED_TO_DELETE_TARGET_IN_USED": "Echec de la suppression du Endpoint en cours d'utilisation", - "PLACEHOLDER": "Nous n'avons trouvé aucun Endpoint !", - "DEPRECATED": "Helm Hub migre vers Artifact Hub" + "PLACEHOLDER": "Nous n'avons trouvé aucun Endpoint !" }, "REPOSITORY": { "COPY_DIGEST_ID": "Copier le Résumé", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index 2c6aca221..e41c7606d 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -696,8 +696,7 @@ "DELETED_FAILED": "Falha ao remover endereço.", "CANNOT_EDIT": "Endereço não pode ser alterado enquando a regra de replicação estiver ativa.", "FAILED_TO_DELETE_TARGET_IN_USED": "Falha ao remover endereço em uso.", - "PLACEHOLDER": "Não há endereços cadastrados", - "DEPRECATED": "Helm Hub está sendo movido para Artifact Hub" + "PLACEHOLDER": "Não há endereços cadastrados" }, "REPOSITORY": { "COPY_DIGEST_ID": "Copiar Digest", diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index 0c8d7a0f1..6b7b45836 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -696,8 +696,7 @@ "DELETED_FAILED": "Silinen uç noktalar başarısız oldu.", "CANNOT_EDIT": "Çoğaltma kuralı etkinken uç noktası değiştirilemez.", "FAILED_TO_DELETE_TARGET_IN_USED": "Kullanılan uç nokta silinemedi.", - "PLACEHOLDER": "Uç noktaları bulamadık!", - "DEPRECATED": "Helm Hub is moving to Artifact Hub" + "PLACEHOLDER": "Uç noktaları bulamadık!" }, "REPOSITORY": { "COPY_DIGEST_ID": "Özet Kopyala", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index 1b721691b..37c53003a 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -698,8 +698,7 @@ "DELETED_FAILED": "删除目标失败。", "CANNOT_EDIT": "当复制规则启用时目标无法修改。", "FAILED_TO_DELETE_TARGET_IN_USED": "无法删除正在使用的目标。", - "PLACEHOLDER": "未发现任何复制目标!", - "DEPRECATED": "Helm Hub 正被移至 Artifact Hub" + "PLACEHOLDER": "未发现任何复制目标!" }, "REPOSITORY": { "COPY_DIGEST_ID": "复制摘要", diff --git a/src/portal/src/i18n/lang/zh-tw-lang.json b/src/portal/src/i18n/lang/zh-tw-lang.json index 8057389b8..2d2af93e8 100644 --- a/src/portal/src/i18n/lang/zh-tw-lang.json +++ b/src/portal/src/i18n/lang/zh-tw-lang.json @@ -693,8 +693,7 @@ "DELETED_FAILED": "刪除目標失敗。", "CANNOT_EDIT": "當複制規則啟用時目標無法修改。", "FAILED_TO_DELETE_TARGET_IN_USED": "無法刪除正在使用的目標。", - "PLACEHOLDER": "未發現任何復制目標!", - "DEPRECATED": "Helm Hub is moving to Artifact Hub" + "PLACEHOLDER": "未發現任何復制目標!" }, "REPOSITORY":{ "COPY_DIGEST_ID": "複製摘要",