Remove notary UI (#18666)

1. Remove notary from the UI
2. Remove notary-related unit test cases

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-05-11 19:23:51 +08:00 committed by GitHub
parent 79d1aa05fd
commit f2fc0f6a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 7 additions and 130 deletions

View File

@ -288,7 +288,7 @@
</div> </div>
<div <div
class="clr-form-control margin-top-06" class="clr-form-control margin-top-06"
*ngIf="withNotary() && enableContentTrust"> *ngIf="enableContentTrust">
<label class="clr-control-label width-6rem"> <label class="clr-control-label width-6rem">
<span>{{ <span>{{
'P2P_PROVIDER.CRITERIA' | translate 'P2P_PROVIDER.CRITERIA' | translate
@ -330,12 +330,10 @@
</div> </div>
</div> </div>
<div <div
class="clr-form-control margin-top-06" class="clr-form-control margin-top-06 mt-1"
*ngIf="preventVul" *ngIf="preventVul">
[ngClass]="{ 'mt-1': !withNotary() }">
<label for="repo" class="clr-control-label width-6rem"> <label for="repo" class="clr-control-label width-6rem">
<ng-container <ng-container *ngIf="!enableContentTrust">
*ngIf="!(withNotary() && enableContentTrust)">
<span>{{ <span>{{
'P2P_PROVIDER.CRITERIA' | translate 'P2P_PROVIDER.CRITERIA' | translate
}}</span> }}</span>

View File

@ -173,7 +173,7 @@ export class AddP2pPolicyComponent implements OnInit, OnDestroy {
this.preventVul = project.metadata.prevent_vul === TRUE; this.preventVul = project.metadata.prevent_vul === TRUE;
this.projectSeverity = project.metadata.severity; this.projectSeverity = project.metadata.severity;
this.enableContentTrust = this.enableContentTrust =
project.metadata.enable_content_trust === TRUE; project.metadata.enable_content_trust_cosign === TRUE;
this.severity = this.severity =
PROJECT_SEVERITY_LEVEL_MAP[this.projectSeverity]; PROJECT_SEVERITY_LEVEL_MAP[this.projectSeverity];
} }
@ -423,9 +423,6 @@ export class AddP2pPolicyComponent implements OnInit, OnDestroy {
} }
return false; return false;
} }
withNotary(): boolean {
return this.appConfigService.getConfig().with_notary;
}
showExplainForEventBased(): boolean { showExplainForEventBased(): boolean {
return this.triggerType === TRIGGER.EVENT_BASED; return this.triggerType === TRIGGER.EVENT_BASED;
} }

View File

@ -32,18 +32,6 @@
'ACCESSORY.CO_SIGN' | translate 'ACCESSORY.CO_SIGN' | translate
}}</label> }}</label>
</clr-checkbox-wrapper> </clr-checkbox-wrapper>
<clr-checkbox-wrapper *ngIf="withNotary">
<input
id="content-trust"
type="checkbox"
clrCheckbox
[(ngModel)]="projectPolicy.ContentTrust"
name="content-trust"
[disabled]="!hasChangeConfigRole" />
<label for="content-trust">{{
'ACCESSORY.NOTARY' | translate
}}</label>
</clr-checkbox-wrapper>
<clr-control-helper class="config-subtext"> <clr-control-helper class="config-subtext">
{{ 'PROJECT_CONFIG.CONTENT_TRUST_POLCIY' | translate }} {{ 'PROJECT_CONFIG.CONTENT_TRUST_POLCIY' | translate }}
</clr-control-helper> </clr-control-helper>

View File

@ -15,7 +15,6 @@ import { Component, ViewChild } from '@angular/core';
const mockSystemInfo: SystemInfo[] = [ const mockSystemInfo: SystemInfo[] = [
{ {
with_trivy: true, with_trivy: true,
with_notary: true,
with_admiral: false, with_admiral: false,
admiral_endpoint: 'NA', admiral_endpoint: 'NA',
auth_mode: 'db_auth', auth_mode: 'db_auth',
@ -27,7 +26,6 @@ const mockSystemInfo: SystemInfo[] = [
}, },
{ {
with_trivy: false, with_trivy: false,
with_notary: false,
with_admiral: false, with_admiral: false,
admiral_endpoint: 'NA', admiral_endpoint: 'NA',
auth_mode: 'db_auth', auth_mode: 'db_auth',

View File

@ -44,7 +44,6 @@ export class ProjectPolicy {
initByProject(pro: Project) { initByProject(pro: Project) {
this.Public = pro.metadata.public === 'true'; this.Public = pro.metadata.public === 'true';
this.ContentTrust = pro.metadata.enable_content_trust === 'true';
this.ContentTrustCosign = this.ContentTrustCosign =
pro.metadata.enable_content_trust_cosign === 'true'; pro.metadata.enable_content_trust_cosign === 'true';
this.PreventVulImg = pro.metadata.prevent_vul === '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 { retrieve(state?: State): any {
this.projectService.getProject(this.projectId).subscribe( this.projectService.getProject(this.projectId).subscribe(
response => { response => {

View File

@ -14,7 +14,6 @@ export class Project {
role_name?: string; role_name?: string;
metadata?: { metadata?: {
public: string | boolean; public: string | boolean;
enable_content_trust: string | boolean;
enable_content_trust_cosign?: string | boolean; enable_content_trust_cosign?: string | boolean;
prevent_vul: string | boolean; prevent_vul: string | boolean;
severity: string; severity: string;
@ -24,7 +23,6 @@ export class Project {
cve_allowlist?: object; cve_allowlist?: object;
constructor() { constructor() {
this.metadata.public = false; this.metadata.public = false;
this.metadata.enable_content_trust = false;
this.metadata.enable_content_trust_cosign = false; this.metadata.enable_content_trust_cosign = false;
this.metadata.prevent_vul = false; this.metadata.prevent_vul = false;
this.metadata.severity = 'low'; this.metadata.severity = 'low';

View File

@ -299,15 +299,6 @@
| uppercase | uppercase
}} }}
</th> </th>
<th
*ngIf="withNotary"
class="left tag-header-color">
{{
'ACCESSORY.NOTARY_SIGNED'
| translate
| uppercase
}}
</th>
<th class="left tag-header-color"> <th class="left tag-header-color">
{{ {{
'REPOSITORY.PULL_TIME' 'REPOSITORY.PULL_TIME'
@ -332,41 +323,6 @@
<td class="left tag-body-color"> <td class="left tag-body-color">
{{ tag.name }} {{ tag.name }}
</td> </td>
<td
*ngIf="withNotary"
class="left tag-body-color"
[ngSwitch]="tag.signed">
<div class="cell">
<clr-icon
shape="check-circle"
*ngSwitchCase="true"
size="20"
class="color-green"></clr-icon>
<clr-icon
shape="times-circle"
*ngSwitchCase="false"
size="16"
class="color-red"></clr-icon>
<a
href="javascript:void(0)"
*ngSwitchDefault
role="tooltip"
aria-haspopup="true"
class="tooltip tooltip-top-right">
<clr-icon
shape="help"
class="color-gray"
size="16"></clr-icon>
<span
class="tooltip-content"
>{{
'REPOSITORY.NOTARY_IS_UNDETERMINED'
| translate
}}</span
>
</a>
</div>
</td>
<td class="left tag-body-color"> <td class="left tag-body-color">
{{ {{
tag.pull_time === tag.pull_time ===

View File

@ -281,9 +281,6 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.hiddenArray this.hiddenArray
); );
} }
get withNotary(): boolean {
return this.appConfigService.getConfig()?.with_notary;
}
clrDgRefresh(state: ClrDatagridStateInterface) { clrDgRefresh(state: ClrDatagridStateInterface) {
setTimeout(() => { setTimeout(() => {

View File

@ -105,9 +105,6 @@
<clr-dg-column *ngIf="hasPullCommand()">{{ <clr-dg-column *ngIf="hasPullCommand()">{{
'REPOSITORY.PULL_COMMAND' | translate 'REPOSITORY.PULL_COMMAND' | translate
}}</clr-dg-column> }}</clr-dg-column>
<clr-dg-column *ngIf="withNotary">{{
'ACCESSORY.NOTARY_SIGNED' | translate
}}</clr-dg-column>
<clr-dg-column [clrDgSortBy]="'pull_time'">{{ <clr-dg-column [clrDgSortBy]="'pull_time'">{{
'TAG.PULL_TIME' | translate 'TAG.PULL_TIME' | translate
}}</clr-dg-column> }}</clr-dg-column>
@ -138,34 +135,6 @@
[iconMode]="true" [iconMode]="true"
[defaultValue]="getPullCommand(tag)"></hbr-copy-input> [defaultValue]="getPullCommand(tag)"></hbr-copy-input>
</clr-dg-cell> </clr-dg-cell>
<clr-dg-cell *ngIf="withNotary" [ngSwitch]="tag.signed">
<div class="cell">
<clr-icon
shape="check-circle"
*ngSwitchCase="true"
size="20"
class="color-green"></clr-icon>
<clr-icon
shape="times-circle"
*ngSwitchCase="false"
size="16"
class="color-red"></clr-icon>
<a
href="javascript:void(0)"
*ngSwitchDefault
role="tooltip"
aria-haspopup="true"
class="tooltip tooltip-top-right">
<clr-icon
shape="help"
class="color-gray"
size="16"></clr-icon>
<span class="tooltip-content">{{
'REPOSITORY.NOTARY_IS_UNDETERMINED' | translate
}}</span>
</a>
</div>
</clr-dg-cell>
<clr-dg-cell>{{ <clr-dg-cell>{{
tag.pull_time !== availableTime tag.pull_time !== availableTime
? (tag.pull_time | harborDatetime : 'short') ? (tag.pull_time | harborDatetime : 'short')

View File

@ -12,7 +12,6 @@ import {
USERSTATICPERMISSION, USERSTATICPERMISSION,
} from '../../../../../shared/services'; } from '../../../../../shared/services';
import { delay } from 'rxjs/operators'; import { delay } from 'rxjs/operators';
import { AppConfigService } from '../../../../../services/app-config.service';
import { SharedTestingModule } from '../../../../../shared/shared.module'; import { SharedTestingModule } from '../../../../../shared/shared.module';
describe('ArtifactTagComponent', () => { describe('ArtifactTagComponent', () => {
@ -29,18 +28,7 @@ describe('ArtifactTagComponent', () => {
const mockSystemInfoService = { const mockSystemInfoService = {
getSystemInfo: () => of(false), getSystemInfo: () => of(false),
}; };
const mockAppConfigService = {
getConfig: () => {
return {
project_creation_restriction: '',
with_chartmuseum: '',
with_notary: '',
with_trivy: '',
with_admiral: '',
registry_url: '',
};
},
};
let userPermissionService; let userPermissionService;
const permissions = [ const permissions = [
{ {
@ -61,7 +49,6 @@ describe('ArtifactTagComponent', () => {
providers: [ providers: [
{ provide: ErrorHandler, useValue: mockErrorHandler }, { provide: ErrorHandler, useValue: mockErrorHandler },
{ provide: ArtifactService, useValue: mockArtifactService }, { provide: ArtifactService, useValue: mockArtifactService },
{ provide: AppConfigService, useValue: mockAppConfigService },
{ provide: SystemInfoService, useValue: mockSystemInfoService }, { provide: SystemInfoService, useValue: mockSystemInfoService },
{ {
provide: UserPermissionService, provide: UserPermissionService,

View File

@ -104,7 +104,6 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
private translateService: TranslateService, private translateService: TranslateService,
private userPermissionService: UserPermissionService, private userPermissionService: UserPermissionService,
private systemInfoService: SystemInfoService, private systemInfoService: SystemInfoService,
private appConfigService: AppConfigService,
private errorHandlerService: ErrorHandler, private errorHandlerService: ErrorHandler,
private activatedRoute: ActivatedRoute private activatedRoute: ActivatedRoute
) { ) {
@ -434,9 +433,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
ngOnDestroy(): void { ngOnDestroy(): void {
this.tagNameCheckSub.unsubscribe(); this.tagNameCheckSub.unsubscribe();
} }
get withNotary(): boolean {
return this.appConfigService.getConfig().with_notary;
}
public get registryUrl(): string { public get registryUrl(): string {
if (this.systemInfo && this.systemInfo.registry_url) { if (this.systemInfo && this.systemInfo.registry_url) {
return this.systemInfo.registry_url; return this.systemInfo.registry_url;

View File

@ -20,7 +20,6 @@ describe('RepositoryComponentGridview (inline template)', () => {
let compRepo: RepositoryGridviewComponent; let compRepo: RepositoryGridviewComponent;
let fixtureRepo: ComponentFixture<RepositoryGridviewComponent>; let fixtureRepo: ComponentFixture<RepositoryGridviewComponent>;
let mockSystemInfo: SystemInfo = { let mockSystemInfo: SystemInfo = {
with_notary: true,
with_admiral: false, with_admiral: false,
admiral_endpoint: 'NA', admiral_endpoint: 'NA',
auth_mode: 'db_auth', auth_mode: 'db_auth',

View File

@ -15,7 +15,6 @@
import { ClairDBStatus } from '../shared/services'; import { ClairDBStatus } from '../shared/services';
export class AppConfig { export class AppConfig {
with_notary: boolean;
with_trivy: boolean; with_trivy: boolean;
admiral_endpoint: string; admiral_endpoint: string;
auth_mode: string; auth_mode: string;
@ -33,7 +32,6 @@ export class AppConfig {
constructor() { constructor() {
// Set default value // Set default value
this.with_notary = false;
this.with_trivy = false; this.with_trivy = false;
this.admiral_endpoint = ''; this.admiral_endpoint = '';
this.auth_mode = 'db_auth'; this.auth_mode = 'db_auth';

View File

@ -141,7 +141,6 @@ export interface AccessLogItem {
*/ */
export interface SystemInfo { export interface SystemInfo {
with_trivy?: boolean; with_trivy?: boolean;
with_notary?: boolean;
with_admiral?: boolean; with_admiral?: boolean;
with_chartmuseum?: boolean; with_chartmuseum?: boolean;
admiral_endpoint?: string; admiral_endpoint?: string;