From f2fc0f6a99194fcd7abd65ec675e77019482dc06 Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Thu, 11 May 2023 19:23:51 +0800 Subject: [PATCH] Remove notary UI (#18666) 1. Remove notary from the UI 2. Remove notary-related unit test cases Signed-off-by: AllForNothing --- .../add-p2p-policy.component.html | 10 ++--- .../add-p2p-policy.component.ts | 5 +-- .../project-policy-config.component.html | 12 ----- .../project-policy-config.component.spec.ts | 2 - .../project-policy-config.component.ts | 4 -- .../project-policy-config/project.ts | 2 - .../artifact-list-tab.component.html | 44 ------------------- .../artifact-list-tab.component.ts | 3 -- .../artifact-tag/artifact-tag.component.html | 31 ------------- .../artifact-tag.component.spec.ts | 15 +------ .../artifact-tag/artifact-tag.component.ts | 5 +-- .../repository-gridview.component.spec.ts | 1 - src/portal/src/app/services/app-config.ts | 2 - .../src/app/shared/services/interface.ts | 1 - 14 files changed, 7 insertions(+), 130 deletions(-) diff --git a/src/portal/src/app/base/project/p2p-provider/add-p2p-policy/add-p2p-policy.component.html b/src/portal/src/app/base/project/p2p-provider/add-p2p-policy/add-p2p-policy.component.html index 5da0f389f..ebc3d50f0 100644 --- a/src/portal/src/app/base/project/p2p-provider/add-p2p-policy/add-p2p-policy.component.html +++ b/src/portal/src/app/base/project/p2p-provider/add-p2p-policy/add-p2p-policy.component.html @@ -288,7 +288,7 @@
+ *ngIf="enableContentTrust">
+ class="clr-form-control margin-top-06 mt-1" + *ngIf="preventVul"> - - - - {{ 'PROJECT_CONFIG.CONTENT_TRUST_POLCIY' | translate }} diff --git a/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.spec.ts b/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.spec.ts index 27c9e2a99..1be3a8609 100644 --- a/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.spec.ts +++ b/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.spec.ts @@ -15,7 +15,6 @@ import { Component, ViewChild } from '@angular/core'; const mockSystemInfo: SystemInfo[] = [ { with_trivy: true, - with_notary: true, with_admiral: false, admiral_endpoint: 'NA', auth_mode: 'db_auth', @@ -27,7 +26,6 @@ const mockSystemInfo: SystemInfo[] = [ }, { with_trivy: false, - with_notary: false, with_admiral: false, admiral_endpoint: 'NA', auth_mode: 'db_auth', diff --git a/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.ts b/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.ts index 03c205a95..c46c4e998 100644 --- a/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.ts +++ b/src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.ts @@ -44,7 +44,6 @@ export class ProjectPolicy { initByProject(pro: Project) { this.Public = pro.metadata.public === 'true'; - this.ContentTrust = pro.metadata.enable_content_trust === 'true'; this.ContentTrustCosign = pro.metadata.enable_content_trust_cosign === 'true'; this.PreventVulImg = pro.metadata.prevent_vul === 'true'; @@ -168,9 +167,6 @@ export class ProjectPolicyConfigComponent implements OnInit { }); } - public get withNotary(): boolean { - return this.systemInfo ? this.systemInfo.with_notary : false; - } retrieve(state?: State): any { this.projectService.getProject(this.projectId).subscribe( response => { diff --git a/src/portal/src/app/base/project/project-config/project-policy-config/project.ts b/src/portal/src/app/base/project/project-config/project-policy-config/project.ts index e822b7212..b26f353f7 100644 --- a/src/portal/src/app/base/project/project-config/project-policy-config/project.ts +++ b/src/portal/src/app/base/project/project-config/project-policy-config/project.ts @@ -14,7 +14,6 @@ export class Project { role_name?: string; metadata?: { public: string | boolean; - enable_content_trust: string | boolean; enable_content_trust_cosign?: string | boolean; prevent_vul: string | boolean; severity: string; @@ -24,7 +23,6 @@ export class Project { cve_allowlist?: object; constructor() { this.metadata.public = false; - this.metadata.enable_content_trust = false; this.metadata.enable_content_trust_cosign = false; this.metadata.prevent_vul = false; this.metadata.severity = 'low'; diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html index ef58788e5..508d490f1 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html @@ -299,15 +299,6 @@ | uppercase }} - - {{ - 'ACCESSORY.NOTARY_SIGNED' - | translate - | uppercase - }} - {{ 'REPOSITORY.PULL_TIME' @@ -332,41 +323,6 @@ {{ tag.name }} - - - {{ tag.pull_time === diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts index e727e4983..6c289db0f 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts @@ -281,9 +281,6 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { this.hiddenArray ); } - get withNotary(): boolean { - return this.appConfigService.getConfig()?.with_notary; - } clrDgRefresh(state: ClrDatagridStateInterface) { setTimeout(() => { diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.html b/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.html index 4102a6886..3b3bf7a55 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.html +++ b/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.html @@ -105,9 +105,6 @@ {{ 'REPOSITORY.PULL_COMMAND' | translate }} - {{ - 'ACCESSORY.NOTARY_SIGNED' | translate - }} {{ 'TAG.PULL_TIME' | translate }} @@ -138,34 +135,6 @@ [iconMode]="true" [defaultValue]="getPullCommand(tag)"> - - - {{ tag.pull_time !== availableTime ? (tag.pull_time | harborDatetime : 'short') diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.spec.ts b/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.spec.ts index 73e476b2a..aced8495c 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.spec.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.spec.ts @@ -12,7 +12,6 @@ import { USERSTATICPERMISSION, } from '../../../../../shared/services'; import { delay } from 'rxjs/operators'; -import { AppConfigService } from '../../../../../services/app-config.service'; import { SharedTestingModule } from '../../../../../shared/shared.module'; describe('ArtifactTagComponent', () => { @@ -29,18 +28,7 @@ describe('ArtifactTagComponent', () => { const mockSystemInfoService = { getSystemInfo: () => of(false), }; - const mockAppConfigService = { - getConfig: () => { - return { - project_creation_restriction: '', - with_chartmuseum: '', - with_notary: '', - with_trivy: '', - with_admiral: '', - registry_url: '', - }; - }, - }; + let userPermissionService; const permissions = [ { @@ -61,7 +49,6 @@ describe('ArtifactTagComponent', () => { providers: [ { provide: ErrorHandler, useValue: mockErrorHandler }, { provide: ArtifactService, useValue: mockArtifactService }, - { provide: AppConfigService, useValue: mockAppConfigService }, { provide: SystemInfoService, useValue: mockSystemInfoService }, { provide: UserPermissionService, diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.ts b/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.ts index 8fca4053e..87812ce15 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-tag/artifact-tag.component.ts @@ -104,7 +104,6 @@ export class ArtifactTagComponent implements OnInit, OnDestroy { private translateService: TranslateService, private userPermissionService: UserPermissionService, private systemInfoService: SystemInfoService, - private appConfigService: AppConfigService, private errorHandlerService: ErrorHandler, private activatedRoute: ActivatedRoute ) { @@ -434,9 +433,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy { ngOnDestroy(): void { this.tagNameCheckSub.unsubscribe(); } - get withNotary(): boolean { - return this.appConfigService.getConfig().with_notary; - } + public get registryUrl(): string { if (this.systemInfo && this.systemInfo.registry_url) { return this.systemInfo.registry_url; diff --git a/src/portal/src/app/base/project/repository/repository-gridview.component.spec.ts b/src/portal/src/app/base/project/repository/repository-gridview.component.spec.ts index 0a30abfbe..8f94afb16 100644 --- a/src/portal/src/app/base/project/repository/repository-gridview.component.spec.ts +++ b/src/portal/src/app/base/project/repository/repository-gridview.component.spec.ts @@ -20,7 +20,6 @@ describe('RepositoryComponentGridview (inline template)', () => { let compRepo: RepositoryGridviewComponent; let fixtureRepo: ComponentFixture; let mockSystemInfo: SystemInfo = { - with_notary: true, with_admiral: false, admiral_endpoint: 'NA', auth_mode: 'db_auth', diff --git a/src/portal/src/app/services/app-config.ts b/src/portal/src/app/services/app-config.ts index 9841baeec..2e5c1cad2 100644 --- a/src/portal/src/app/services/app-config.ts +++ b/src/portal/src/app/services/app-config.ts @@ -15,7 +15,6 @@ import { ClairDBStatus } from '../shared/services'; export class AppConfig { - with_notary: boolean; with_trivy: boolean; admiral_endpoint: string; auth_mode: string; @@ -33,7 +32,6 @@ export class AppConfig { constructor() { // Set default value - this.with_notary = false; this.with_trivy = false; this.admiral_endpoint = ''; this.auth_mode = 'db_auth'; diff --git a/src/portal/src/app/shared/services/interface.ts b/src/portal/src/app/shared/services/interface.ts index d02f91f60..5d641c99a 100644 --- a/src/portal/src/app/shared/services/interface.ts +++ b/src/portal/src/app/shared/services/interface.ts @@ -141,7 +141,6 @@ export interface AccessLogItem { */ export interface SystemInfo { with_trivy?: boolean; - with_notary?: boolean; with_admiral?: boolean; with_chartmuseum?: boolean; admiral_endpoint?: string;